miggor-StreamGraph/test.gd

43 lines
1.2 KiB
GDScript3
Raw Normal View History

extends Control
var node_renderer_scene := preload("res://test_node_renderer.tscn")
@onready var nodes_container: HBoxContainer = $NodesContainer
@onready var add_button_button: Button = $AddButtonButton
@onready var add_print_button: Button = $AddPrintButton
@onready var connect_them_button: Button = $ConnectThemButton
var deck: Deck = Deck.new()
var button_node = preload("res://classes/deck/nodes/button.gd")
var print_node = preload("res://classes/deck/nodes/print.gd")
func _ready() -> void:
2023-06-11 17:39:26 +02:00
var a = [1, 2, 3]
var b = [2, 1, 3]
add_button_button.pressed.connect(
func():
var node := deck.add_node(button_node)
var node_renderer = node_renderer_scene.instantiate()
node_renderer.node = node
nodes_container.add_child(node_renderer)
add_button_button.disabled = true
)
add_print_button.pressed.connect(
func():
var node := deck.add_node(print_node)
var node_renderer = node_renderer_scene.instantiate()
node_renderer.node = node
nodes_container.add_child(node_renderer)
add_print_button.disabled = true
)
2023-06-11 17:39:26 +02:00
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)
)