fixed some ui stuff

This commit is contained in:
2023-11-09 17:56:08 +11:00
parent 0427a58635
commit e63b765753
17 changed files with 146 additions and 36 deletions

@ -8,8 +8,15 @@ var text_selected := false
var username := "default"
func _input(event: InputEvent) -> void:
if event.is_action_pressed("Open Text Chat"):
if text_selected:
if !text_selected and event.is_action_pressed("Open Text Chat"):
get_viewport().set_input_as_handled()
opened.emit()
$VBoxContainer/LineEdit.visible = true
$VBoxContainer/LineEdit.grab_focus()
text_selected = true
return
if text_selected and event is InputEventKey and event.pressed == true:
if event.keycode == KEY_ENTER:
closed.emit()
$VBoxContainer/LineEdit.deselect()
$VBoxContainer/LineEdit.visible = false
@ -20,11 +27,11 @@ func _input(event: InputEvent) -> void:
else:
rpc("append_message", username, $VBoxContainer/LineEdit.text)
$VBoxContainer/LineEdit.clear()
else:
opened.emit()
$VBoxContainer/LineEdit.visible = true
$VBoxContainer/LineEdit.grab_focus()
text_selected = true
if event.keycode == KEY_ESCAPE:
closed.emit()
$VBoxContainer/LineEdit.deselect()
$VBoxContainer/LineEdit.visible = false
text_selected = false
func change_username(old_name, new_name):