2024-02-17 13:23:07 +01:00

28 lines
703 B
GDScript

extends LineEdit
func _ready():
modulate.a = 0.0
func _unhandled_key_input(event):
if Global.interacting_with_ui:
return
if event.is_action_pressed("open_chat"):
call_deferred("grab_focus")
get_viewport().set_input_as_handled()
func _on_focus_entered():
var tween := get_tree().create_tween()
tween.tween_property(self, "modulate", Color(1, 1, 1, 1), 0.2)
Global.interacting_with_ui = true
func _on_focus_exited():
var tween := get_tree().create_tween()
tween.tween_property(self, "modulate", Color(1, 1, 1, 0), 0.2)
Global.interacting_with_ui = false
func _on_text_submitted(message: String):
(owner as UIManager).chat_message_submitted.emit(message)
text = ""
release_focus()