2023-06-27 11:51:23 +00:00
|
|
|
extends PanelContainer
|
|
|
|
|
|
2023-07-01 11:43:27 +00:00
|
|
|
var obj_dict = {}
|
|
|
|
|
@onready var dropzone = $HBoxContainer/dropzone
|
2023-06-27 11:51:23 +00:00
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func _ready():
|
2023-07-01 11:43:27 +00:00
|
|
|
|
|
|
|
|
# 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
|
2023-06-27 11:51:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
|
func _process(delta):
|
|
|
|
|
pass
|
2023-07-01 11:43:27 +00:00
|
|
|
|
|
|
|
|
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
|