wip implement #96: picking up sticky notes from the card board

This commit is contained in:
betalars 2025-05-08 21:53:53 +02:00
parent e18ae0e473
commit 8c3d7c7abb
1 changed files with 32 additions and 25 deletions

View File

@ -225,6 +225,7 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act
return return
else: else:
area.attach_sticky_note(to_handle) area.attach_sticky_note(to_handle)
to_handle.z_index = 0
if sticky_note_container.get_child_count() > 0: if sticky_note_container.get_child_count() > 0:
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty() sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
current_context = NAVIGATE current_context = NAVIGATE
@ -366,33 +367,39 @@ func _input(event):
current_context = NAVIGATE current_context = NAVIGATE
elif event.is_action_pressed("ui_accept"): # select the selected note it elif event.is_action_pressed("ui_accept"): # select the selected note it
var card:Card
if dropzone.get_child(current_dropzone_id) is Card: if dropzone.get_child(current_dropzone_id) is Card:
card = dropzone.get_child(current_dropzone_id) var card:Card = dropzone.get_child(current_dropzone_id)
if current_context == ASSIGN: # to assign it to a card if current_context == ASSIGN: # to assign it to a card
if card.has_sticky_note_attached(): if card.has_sticky_note_attached():
currently_active_node = card.exchange_sticky_note_with(currently_active_node) currently_active_node = card.exchange_sticky_note_with(currently_active_node)
current_dropzone_id = find_first_free_card() current_dropzone_id = find_first_free_card()
else:
card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note)
current_context = NAVIGATE
current_sticky_note_id += 1
current_dropzone_id = find_first_free_card()
if is_board_complete(): emit_signal("board_completed")
else: else:
card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note) if !focus_stickies and card.has_sticky_note_attached():
current_context = NAVIGATE currently_active_node = card.remove_sticky_note()
current_sticky_note_id += 1 add_sticky_note(currently_active_node)
current_dropzone_id = find_first_free_card() current_dropzone_id = -1
if is_board_complete(): emit_signal("board_completed") else: current_dropzone_id = find_first_free_card()
else:
if !focus_stickies and card.has_sticky_note_attached(): current_context = ASSIGN
currently_active_node = card.remove_sticky_note() focus_stickies = !focus_stickies
add_sticky_note(currently_active_node) if focus_stickies:
current_dropzone_id = -1 current_sticky_note_id = current_sticky_note_id
else: current_dropzone_id = find_first_free_card() else:
current_dropzone_id = current_dropzone_id
current_context = ASSIGN elif dropzone.get_child(current_dropzone_id) is StickyNote:
focus_stickies = !focus_stickies if currently_active_node is StickyNote:
if focus_stickies: currently_active_node = dropzone.get_child(current_dropzone_id)
current_sticky_note_id = current_sticky_note_id focus_stickies = false
else: current_context = ASSIGN
current_dropzone_id = current_dropzone_id current_dropzone_id += 1
currently_active_node.is_dragable = false
currently_active_node.z_index = 1
# move the note it so it floats next to the card where it should be attached # move the note it so it floats next to the card where it should be attached
func _select_card_for_assigning(sticky_note: Area2D, card: Area2D): func _select_card_for_assigning(sticky_note: Area2D, card: Area2D):