39 lines
813 B
GDScript3
Raw Normal View History

2024-02-25 19:47:13 +01:00
class_name UI
2024-02-17 19:43:47 +01:00
extends Node
2024-01-25 12:10:29 +01:00
2024-02-25 19:47:13 +01:00
static var focus: Control
2024-01-28 22:08:08 +01:00
signal chat_message_submitted(message: String)
2024-02-06 21:55:22 +01:00
@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
2024-01-25 12:10:29 +01:00
func _enter_tree():
2024-02-25 19:47:13 +01:00
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
2024-02-06 15:51:48 +01:00
func connect_fake():
2024-02-06 21:55:22 +01:00
for property in get_property_list():
if property.type != TYPE_SIGNAL:
continue
add_user_signal(property.name)
2024-02-17 19:43:47 +01:00
set(property.name, Signal(self, property.name))
2024-02-25 19:47:13 +01:00
static func unfocus():
if UI.focus:
UI.focus.release_focus()