tiger-cleanup #1
|
|
@ -27,6 +27,7 @@ var focus_stickies:bool = true:
|
|||
|
||||
var focused := false:
|
||||
set(focus):
|
||||
var was_focused := focused
|
||||
if focus:
|
||||
focused = true
|
||||
get_tree().call_group("interactables", "collapse")
|
||||
|
|
@ -44,6 +45,9 @@ var focused := false:
|
|||
if sticky is StickyNote:
|
||||
sticky.is_dragged = false
|
||||
visible = focused
|
||||
# Emit closed signal when transitioning from focused to unfocused
|
||||
if was_focused and not focused:
|
||||
closed.emit()
|
||||
|
||||
|
||||
@onready var dropzone := $HBoxContainer/dropzone
|
||||
|
|
@ -131,12 +135,13 @@ var last_save_dict: Dictionary
|
|||
var text_recovery: Dictionary
|
||||
|
||||
signal board_completed
|
||||
signal closed
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
print("Board Ready!", self, "room", State.room)
|
||||
State.room.card_board = self
|
||||
|
||||
|
||||
var size_reference := StickyNotePanel.new()
|
||||
|
||||
dropzone_size = get_viewport_rect().size - Vector2(dropzone_padding + size_reference.minimum_size.x, dropzone_padding)
|
||||
|
|
@ -576,6 +581,13 @@ func on_scene_skipped(i: int):
|
|||
func claim_focus():
|
||||
focused = true
|
||||
|
||||
|
||||
## Awaitable function to show the board and wait until user closes it
|
||||
func play() -> void:
|
||||
focused = true
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
await closed
|
||||
|
||||
func find_first_free_card() -> int:
|
||||
for i in range(dropzone.get_child_count()):
|
||||
# start searching at the current location, use modulo to avoid getting out of array bounds
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ func _move_card():
|
|||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||
|
||||
func has_sticky_note_attached() -> bool:
|
||||
return get_child_count(false) > 0
|
||||
return get_attached_sticky_note() != null
|
||||
|
||||
func get_attached_sticky_note() -> StickyNote:
|
||||
for child in get_children(false):
|
||||
|
|
|
|||
Loading…
Reference in New Issue