mirror of
https://github.com/thegatesbrowser/godot-multiplayer.git
synced 2025-08-24 21:17:10 -04:00
copy from thegates-jam repo
This commit is contained in:
parent
c1a7ad74e1
commit
1a335de566
523 changed files with 22408 additions and 0 deletions
29
ui/change_name.gd
Normal file
29
ui/change_name.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends LineEdit
|
||||
|
||||
var is_changing: bool
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
text_submitted.connect(on_text_submitted)
|
||||
focus_entered.connect(start_edit)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not event.is_action_pressed("change_name"): return
|
||||
if is_changing: return
|
||||
|
||||
start_edit.call_deferred()
|
||||
|
||||
|
||||
func start_edit() -> void:
|
||||
is_changing = true
|
||||
EditMode.set_enabled(true)
|
||||
grab_click_focus()
|
||||
grab_focus()
|
||||
caret_column = text.length()
|
||||
|
||||
|
||||
func on_text_submitted(_text: String) -> void:
|
||||
is_changing = false
|
||||
EditMode.set_enabled(false)
|
||||
release_focus()
|
Loading…
Add table
Add a link
Reference in a new issue