fixed conditions where invalid state could be reached in card board
This commit is contained in:
parent
184fb82151
commit
2cddc8284c
|
|
@ -46,13 +46,13 @@ var base_sticky_note_panel: Panel
|
|||
set(context):
|
||||
if current_context == ASSIGN and !context == ASSIGN:
|
||||
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
|
||||
match context:
|
||||
NAVIGATE:
|
||||
_return_sticky_notes_to_panels()
|
||||
DRAG:
|
||||
pass
|
||||
ASSIGN:
|
||||
pass
|
||||
#match context:
|
||||
# NAVIGATE:
|
||||
# _return_sticky_notes_to_panels()
|
||||
# DRAG:
|
||||
# pass
|
||||
# ASSIGN:
|
||||
# pass
|
||||
current_context = context
|
||||
@onready var instructions = $instructions_panel/HBoxContainer/cards_remaining
|
||||
|
||||
|
|
@ -172,6 +172,7 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
|||
if to_handle is StickyNote:
|
||||
if not to_handle.on_board:
|
||||
to_handle.reparent(dropzone)
|
||||
to_handle.on_board = true
|
||||
to_handle.owner = self
|
||||
current_context = DRAG
|
||||
|
||||
|
|
@ -187,6 +188,7 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
|||
if area.has_sticky_note_attached():
|
||||
to_handle = area.exchange_sticky_note_with(to_handle)
|
||||
to_handle.reparent(dropzone)
|
||||
to_handle.on_board = true
|
||||
sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note = to_handle
|
||||
to_handle.attached_to = sticky_note_container.get_child(current_sticky_note_id)
|
||||
to_handle.reset_drag()
|
||||
|
|
@ -235,6 +237,7 @@ func is_board_lore() -> bool:
|
|||
|
||||
# Mark area that was hovered over as currently selected
|
||||
func handle_hover(to_handle: Area2D):
|
||||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): return
|
||||
currently_active_node = to_handle
|
||||
|
||||
if is_in_dropzone(to_handle) or to_handle is Card:
|
||||
|
|
@ -252,6 +255,8 @@ func insert_area(parent: Control, node: Area2D):
|
|||
|
||||
if not node in parent.get_children():
|
||||
node.reparent(parent)
|
||||
if node is StickyNote:
|
||||
node.on_board = true
|
||||
node.owner = self
|
||||
|
||||
if children.size() > 0:
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ func attatch_sticky_note(attatchment: StickyNote, tween:bool = true):
|
|||
attatchment.transform = ancor.transform
|
||||
|
||||
func reclaim_sticky_note():
|
||||
print("meep")
|
||||
var is_emoty = is_empty()
|
||||
print("meep")
|
||||
if is_empty() and attached_sticky_note.on_board == true:
|
||||
attached_sticky_note.on_board = false
|
||||
attached_sticky_note.tween_transform_to(ancor.global_transform)
|
||||
|
|
|
|||
Loading…
Reference in New Issue