39 lines
820 B
GDScript

class_name UIManager
extends Control
signal chat_message_submitted(message: String)
var signals := [
"login",
"logout",
"ping_changed",
"download_changed",
"upload_changed",
"message_received",
]
var login: Signal
var logout: Signal
var ping_changed: Signal
var download_changed: Signal
var upload_changed: Signal
var message_received: Signal
func _enter_tree():
if get_node_or_null("/root/Main"):
connect_main_scene()
else:
connect_fake()
func connect_main_scene():
login = %Login.success
logout = %Logout.success
ping_changed = %Ping.changed
download_changed = %Client.download_changed
upload_changed = %Client.upload_changed
message_received = %Chat.message_received
func connect_fake():
for signal_name in signals:
set(signal_name, Signal(self, signal_name))
add_user_signal(signal_name)