28 lines
703 B
GDScript3
Raw Normal View History

2024-01-28 21:08:08 +00:00
extends LineEdit
2024-02-16 22:45:31 +00:00
func _ready():
modulate.a = 0.0
2024-02-17 12:23:07 +00:00
func _unhandled_key_input(event):
2024-01-28 21:08:08 +00:00
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():
2024-02-16 22:45:31 +00:00
var tween := get_tree().create_tween()
tween.tween_property(self, "modulate", Color(1, 1, 1, 1), 0.2)
2024-01-28 21:08:08 +00:00
Global.interacting_with_ui = true
func _on_focus_exited():
2024-02-16 22:45:31 +00:00
var tween := get_tree().create_tween()
tween.tween_property(self, "modulate", Color(1, 1, 1, 0), 0.2)
2024-01-28 21:08:08 +00:00
Global.interacting_with_ui = false
func _on_text_submitted(message: String):
(owner as UIManager).chat_message_submitted.emit(message)
text = ""
release_focus()