Player scoreboard name option

This commit is contained in:
Haze Weathers 2024-12-01 21:37:15 -05:00
parent b61a5122f4
commit 65053aa223
7 changed files with 95 additions and 6 deletions

View 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()