extends LineEdit func _ready(): modulate.a = 0.0 focus_entered.connect(on_focus_entered) focus_exited.connect(on_focus_exited) text_submitted.connect(on_text_submitted) func _unhandled_key_input(event): if UI.focus: 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) func on_focus_exited(): var tween := get_tree().create_tween() tween.tween_property(self, "modulate", Color(1, 1, 1, 0), 0.2) func on_text_submitted(message: String): (owner as UI).chat_message_submitted.emit(message) text = "" release_focus()