39 lines
813 B
GDScript

class_name UI
extends Node
static var focus: Control
signal chat_message_submitted(message: String)
@export var login: Signal
@export var logout: Signal
@export var ping_changed: Signal
@export var download_changed: Signal
@export var upload_changed: Signal
@export var message_received: Signal
func _enter_tree():
if get_node_or_null("/root/Main"):
return
connect_fake()
func _process(_delta):
var new_focus := get_viewport().gui_get_focus_owner()
if new_focus && new_focus.name != "Unfocus":
UI.focus = new_focus
else:
UI.focus = null
func connect_fake():
for property in get_property_list():
if property.type != TYPE_SIGNAL:
continue
add_user_signal(property.name)
set(property.name, Signal(self, property.name))
static func unfocus():
if UI.focus:
UI.focus.release_focus()