diff --git a/test.gd b/test.gd index 6d89590..fbe3c1c 100644 --- a/test.gd +++ b/test.gd @@ -6,6 +6,7 @@ var node_renderer_scene := preload("res://test_node_renderer.tscn") @onready var add_button_button: Button = $AddButtonButton @onready var add_print_button: Button = $AddPrintButton @onready var connect_them_button: Button = $ConnectThemButton +@onready var disconnect_them_button: Button = $DisconnectThemButton var deck: Deck = Deck.new() var button_node = preload("res://classes/deck/nodes/button.gd") @@ -13,8 +14,6 @@ var print_node = preload("res://classes/deck/nodes/print.gd") func _ready() -> void: - var a = [1, 2, 3] - var b = [2, 1, 3] add_button_button.pressed.connect( func(): var node := deck.add_node(button_node) @@ -40,3 +39,11 @@ func _ready() -> void: deck.connect_nodes(node_a, node_b, 0, 1) ) + + disconnect_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.disconnect_nodes(node_a, node_b, 0, 1) + ) diff --git a/test.tscn b/test.tscn index 769c9dc..c849215 100644 --- a/test.tscn +++ b/test.tscn @@ -35,6 +35,14 @@ offset_right = 379.0 offset_bottom = 607.0 text = "Connect them" +[node name="DisconnectThemButton" type="Button" parent="."] +layout_mode = 0 +offset_left = 421.0 +offset_top = 576.0 +offset_right = 538.0 +offset_bottom = 607.0 +text = "Disconnect them" + [node name="NodesContainer" type="HBoxContainer" parent="."] layout_mode = 1 anchors_preset = -1