Player scoreboard name option
This commit is contained in:
parent
b61a5122f4
commit
65053aa223
7 changed files with 95 additions and 6 deletions
29
objects/hud/player_name_input.gd
Normal file
29
objects/hud/player_name_input.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends TextEdit
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
text = Options.scoreboard_name
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
Options.entry = false
|
||||
|
||||
|
||||
func _on_text_changed() -> void:
|
||||
text = text.substr(0, 10).to_lower().strip_escapes()
|
||||
Options.scoreboard_name = text
|
||||
cursor_set_column(text.length())
|
||||
|
||||
|
||||
func _on_focus_entered() -> void:
|
||||
Options.entry = true
|
||||
cursor_set_column(text.length())
|
||||
|
||||
|
||||
func _on_focus_exited() -> void:
|
||||
Options.set_deferred("entry", false)
|
||||
|
||||
|
||||
func _on_gui_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("text_enter"):
|
||||
get_node(focus_neighbour_top).grab_focus()
|
Loading…
Add table
Add a link
Reference in a new issue