test disconnections

This commit is contained in:
Lera Elvoé 2023-06-11 19:26:21 +03:00
parent c2b04e816b
commit 0a309cf530
No known key found for this signature in database
2 changed files with 17 additions and 2 deletions

11
test.gd
View file

@ -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)
)

View file

@ -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