first init

This commit is contained in:
TotMaxim
2025-11-10 19:35:17 +03:00
commit f6649907d4
17 changed files with 297 additions and 0 deletions

24
main.gd Normal file
View File

@@ -0,0 +1,24 @@
extends Control
var dictionary_yau07: Dictionary
func _ready() -> void:
var device_yau07: Array = get_tree().get_nodes_in_group('device-addr')
for device in device_yau07:
device.connect('toggled', on_modify_device.bind(device.get_meta('device')))
func _exit_tree():
for device in dictionary_yau07:
if dictionary_yau07[device]:
dictionary_yau07[device].close_udp_unit()
func on_modify_device(toggled: bool, name_device: String) -> void:
if toggled:
var udp_broadcast := UDPBroadcast.new(name_device)
udp_broadcast.add_timer_to_scene(self)
udp_broadcast.start_broadcast()
dictionary_yau07[name_device] = udp_broadcast
else:
dictionary_yau07[name_device].close_udp_unit()