From fba99ed43275f8331f005d24865532d837287678 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 6 Feb 2024 21:55:22 +0100 Subject: [PATCH] Improved signal handling --- client/ui/UI.gd | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/client/ui/UI.gd b/client/ui/UI.gd index 9896607..580e79f 100644 --- a/client/ui/UI.gd +++ b/client/ui/UI.gd @@ -3,21 +3,12 @@ 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 +@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"): @@ -34,6 +25,9 @@ func connect_main_scene(): 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) \ No newline at end of file + for property in get_property_list(): + if property.type != TYPE_SIGNAL: + continue + + add_user_signal(property.name) + set(property.name, Signal(self, property.name)) \ No newline at end of file