frame-of-mind/src/logic-scenes/board/card-board.gd

45 lines
1.6 KiB
GDScript3
Raw Normal View History

extends PanelContainer
var obj_dict = {}
@onready var dropzone = $HBoxContainer/dropzone
# Called when the node enters the scene tree for the first time.
func _ready():
# TODO: Currently populating the dictionary with the Nodes currently in the scene
# When opening the scene we need to pass some kind of collection to the Board
# Then it can display the Card/PostIts and populate its dictionary at the same time
var cards = dropzone.get_children()
var post_it_panels = get_child(0).get_child(1).get_child(0).get_children()
var post_its = Array()
for panel in post_it_panels:
post_its.push_back(panel.get_child(0))
obj_dict["Cards"] = cards
obj_dict["Post_it_panels"] = post_it_panels
obj_dict["Post_its"] = post_its
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func populate_board():
pass
func handle_mouse_button(to_handle: Node, input: InputEvent, dragableType: int):
print_debug(input)
# TODO: We need a better way to recognize
# whether to_handle is a Card or a Post-It
# (Tried checking for a script, didn't work, because script has no name attached.
# Alternative might be to check for specific values within the script ("is_card" f.e))
match dragableType:
1: # 1 = Card
print_debug("I'm a card")
2: # 2 = PostIt
print_debug("I'm a Post-It")
to_handle.reparent(dropzone)
to_handle.set_owner(self) # needs to be here otherwise the owner disappears