first init
This commit is contained in:
24
main.gd
Normal file
24
main.gd
Normal 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()
|
||||
Reference in New Issue
Block a user