test connections

This commit is contained in:
Lera Elvoé 2023-06-11 18:39:26 +03:00
parent badd1e2450
commit 2c4a937a76
No known key found for this signature in database
3 changed files with 15 additions and 2 deletions

View file

@ -21,7 +21,7 @@ func _receive(to_port: int, data: DeckType, extra_data: Array = []) -> void:
if to_port != 1: if to_port != 1:
return return
# var data_to_print = data.get_value() var data_to_print = data.get_value()
var data_to_print = input_ports[0].value_callback.call() # var data_to_print = input_ports[0].value_callback.call()
print(data_to_print) print(data_to_print)
print("extra data: ", extra_data) print("extra data: ", extra_data)

10
test.gd
View file

@ -13,6 +13,8 @@ var print_node = preload("res://classes/deck/nodes/print.gd")
func _ready() -> void: func _ready() -> void:
var a = [1, 2, 3]
var b = [2, 1, 3]
add_button_button.pressed.connect( add_button_button.pressed.connect(
func(): func():
var node := deck.add_node(button_node) var node := deck.add_node(button_node)
@ -30,3 +32,11 @@ func _ready() -> void:
nodes_container.add_child(node_renderer) nodes_container.add_child(node_renderer)
add_print_button.disabled = true add_print_button.disabled = true
) )
connect_them_button.pressed.connect(
func():
var node_a: DeckNode = nodes_container.get_child(0).node
var node_b: DeckNode = nodes_container.get_child(1).node
deck.connect_nodes(node_a, node_b, 0, 1)
)

View file

@ -43,6 +43,9 @@ func _ready() -> void:
output_port.value_callback = port_drawer.get_text output_port.value_callback = port_drawer.get_text
"button": "button":
port_drawer.add_button(output_port.label) port_drawer.add_button(output_port.label)
port_drawer.button_pressed.connect(func():
node.send(i, DeckType.DeckTypeBool.new(true))
)
_: _:
port_drawer.add_label(output_port.label) port_drawer.add_label(output_port.label)