Improved file structure
This commit is contained in:
21
client/ui/chat/ChatInput.gd
Normal file
21
client/ui/chat/ChatInput.gd
Normal file
@ -0,0 +1,21 @@
|
||||
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")
|
||||
|
||||
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()
|
Reference in New Issue
Block a user