23 lines
505 B
GDScript3
Raw Normal View History

2024-01-28 21:08:08 +00:00
extends LineEdit
signal chat_message_submitted(message: String)
func _unhandled_input(event):
if Global.interacting_with_ui:
return
if event.is_action_pressed("open_chat"):
call_deferred("grab_focus")
2024-01-29 11:32:06 +00:00
get_viewport().set_input_as_handled()
2024-01-28 21:08:08 +00:00
func _on_focus_entered():
Global.interacting_with_ui = true
func _on_focus_exited():
Global.interacting_with_ui = false
func _on_text_submitted(message: String):
(owner as UIManager).chat_message_submitted.emit(message)
text = ""
release_focus()