wip card board refactoring
This commit is contained in:
parent
a2c5217fbf
commit
0b8ed363ee
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://dev-util/devs_board.gd" id="1_ols6o"]
|
[ext_resource type="Script" path="res://dev-util/devs_board.gd" id="1_ols6o"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="1_xrckx"]
|
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="1_xrckx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="2_ucudl"]
|
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/sticky-note.tscn" id="2_ucudl"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dp4eps03igd3w" path="res://logic-scenes/board/void_card.tscn" id="4_b7cny"]
|
[ext_resource type="PackedScene" uid="uid://dp4eps03igd3w" path="res://logic-scenes/board/void_card.tscn" id="4_b7cny"]
|
||||||
|
|
||||||
[node name="board of devs" type="Control"]
|
[node name="board of devs" type="Control"]
|
||||||
|
|
|
||||||
|
|
@ -40,70 +40,70 @@ func _ready():
|
||||||
$cards/card_2/AnimationPlayer.play("shuffle")
|
$cards/card_2/AnimationPlayer.play("shuffle")
|
||||||
await $cards/card_2/AnimationPlayer.animation_finished
|
await $cards/card_2/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
$postIts.show()
|
$sticky_notes.show()
|
||||||
|
|
||||||
for card in $postIts.get_children():
|
for card in $sticky_notes.get_children():
|
||||||
card.get_child(1).play("post")
|
card.get_child(1).play("post")
|
||||||
|
|
||||||
await $postIts/postIt_1/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_1/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
$postIts/postIt_1/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("select")
|
||||||
await $postIts/postIt_1/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_1/AnimationPlayer.animation_finished
|
||||||
$postIts/postIt_1/AnimationPlayer.play("deselect")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("deselect")
|
||||||
$postIts/postIt_2/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("select")
|
||||||
await $postIts/postIt_2/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_2/AnimationPlayer.animation_finished
|
||||||
$postIts/postIt_2/AnimationPlayer.play("deselect")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("deselect")
|
||||||
$postIts/postIt_3/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("select")
|
||||||
await $postIts/postIt_3/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_3/AnimationPlayer.animation_finished
|
||||||
$postIts/postIt_3/AnimationPlayer.play("deselect")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("deselect")
|
||||||
$postIts/postIt_4/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("select")
|
||||||
await $postIts/postIt_4/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_4/AnimationPlayer.animation_finished
|
||||||
$postIts/postIt_4/AnimationPlayer.play("deselect")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("deselect")
|
||||||
$postIts/postIt_1/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("select")
|
||||||
await get_tree().create_timer(1).timeout
|
await get_tree().create_timer(1).timeout
|
||||||
$postIts/postIt_1/AnimationPlayer.play("pick")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("pick")
|
||||||
$postIts/postIt_2/AnimationPlayer.play("shuffle")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("shuffle")
|
||||||
$postIts/postIt_3/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("unshuffle")
|
||||||
$postIts/postIt_4/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("unshuffle")
|
||||||
|
|
||||||
await $postIts/postIt_2/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_2/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
for card in $postIts.get_children():
|
for card in $sticky_notes.get_children():
|
||||||
card.get_child(1).play("post")
|
card.get_child(1).play("post")
|
||||||
|
|
||||||
await $postIts/postIt_1/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_1/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
$postIts/postIt_2/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("select")
|
||||||
await get_tree().create_timer(1).timeout
|
await get_tree().create_timer(1).timeout
|
||||||
$postIts/postIt_2/AnimationPlayer.play("pick")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("pick")
|
||||||
$postIts/postIt_3/AnimationPlayer.play("shuffle")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("shuffle")
|
||||||
$postIts/postIt_4/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("unshuffle")
|
||||||
$postIts/postIt_1/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("unshuffle")
|
||||||
|
|
||||||
await $postIts/postIt_3/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_3/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
for card in $postIts.get_children():
|
for card in $sticky_notes.get_children():
|
||||||
card.get_child(1).play("post")
|
card.get_child(1).play("post")
|
||||||
|
|
||||||
await $postIts/postIt_1/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_1/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
$postIts/postIt_3/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("select")
|
||||||
await get_tree().create_timer(1).timeout
|
await get_tree().create_timer(1).timeout
|
||||||
$postIts/postIt_3/AnimationPlayer.play("pick")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("pick")
|
||||||
$postIts/postIt_4/AnimationPlayer.play("shuffle")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("shuffle")
|
||||||
$postIts/postIt_1/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("unshuffle")
|
||||||
$postIts/postIt_2/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("unshuffle")
|
||||||
|
|
||||||
await $postIts/postIt_4/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_4/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
for card in $postIts.get_children():
|
for card in $sticky_notes.get_children():
|
||||||
card.get_child(1).play("post")
|
card.get_child(1).play("post")
|
||||||
|
|
||||||
await $postIts/postIt_1/AnimationPlayer.animation_finished
|
await $sticky_notes/sticky_note_1/AnimationPlayer.animation_finished
|
||||||
|
|
||||||
$postIts/postIt_4/AnimationPlayer.play("select")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("select")
|
||||||
await get_tree().create_timer(1).timeout
|
await get_tree().create_timer(1).timeout
|
||||||
$postIts/postIt_4/AnimationPlayer.play("pick")
|
$sticky_notes/sticky_note_4/AnimationPlayer.play("pick")
|
||||||
$postIts/postIt_1/AnimationPlayer.play("shuffle")
|
$sticky_notes/sticky_note_1/AnimationPlayer.play("shuffle")
|
||||||
$postIts/postIt_2/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_2/AnimationPlayer.play("unshuffle")
|
||||||
$postIts/postIt_3/AnimationPlayer.play("unshuffle")
|
$sticky_notes/sticky_note_3/AnimationPlayer.play("unshuffle")
|
||||||
|
|
|
||||||
|
|
@ -7,34 +7,34 @@ func get_cards_by_scene_id(id: int) -> Array:
|
||||||
|
|
||||||
for i in range(scene.get_child_count()):
|
for i in range(scene.get_child_count()):
|
||||||
output.append(scene.get_child(i))
|
output.append(scene.get_child(i))
|
||||||
for post in output[i].get_children():
|
for note in output[i].get_children():
|
||||||
if post is PostIt:
|
if note is StickyNote:
|
||||||
output[i].remove_child(post)
|
output[i].remove_child(note)
|
||||||
|
|
||||||
for card in output:
|
for card in output:
|
||||||
card.transform = Transform3D()
|
card.transform = Transform3D()
|
||||||
for postIt in card.own_postits:
|
for sticky_note in card.own_sticky_notes:
|
||||||
postIt.transform = Transform3D()
|
sticky_note.transform = Transform3D()
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
func get_cards_by_name_array(names: Array) -> Dictionary:
|
func get_cards_by_name_array(names: Array) -> Dictionary:
|
||||||
var output:Dictionary = {
|
var output:Dictionary = {
|
||||||
"cards": [],
|
"cards": [],
|
||||||
"postIts": []
|
"sticky_notes": []
|
||||||
}
|
}
|
||||||
|
|
||||||
for scene in get_children():
|
for scene in get_children():
|
||||||
for card in scene.get_children():
|
for card in scene.get_children():
|
||||||
for postIt in card.get_children():
|
for sticky_note in card.get_children():
|
||||||
if names.has(postIt.name):
|
if names.has(sticky_note.name):
|
||||||
postIt.transform = Transform3D()
|
sticky_note.transform = Transform3D()
|
||||||
output['postIts'].append(postIt)
|
output['sticky_notes'].append(sticky_note)
|
||||||
|
|
||||||
if names.has(card.name):
|
if names.has(card.name):
|
||||||
card.transform = Transform3D()
|
card.transform = Transform3D()
|
||||||
output['cards'].append(card)
|
output['cards'].append(card)
|
||||||
for child in card.get_children():
|
for child in card.get_children():
|
||||||
if child is PostIt:
|
if child is StickyNote:
|
||||||
card.remove_child(child)
|
child.reparent(self)
|
||||||
return output
|
return output
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ func _ready():
|
||||||
for item in dev_board.find_children("*"):
|
for item in dev_board.find_children("*"):
|
||||||
if item is Card:
|
if item is Card:
|
||||||
spawn_card((item as Card).duplicate())
|
spawn_card((item as Card).duplicate())
|
||||||
elif item is PostIt:
|
elif item is StickyNote:
|
||||||
spawn_postit((item as PostIt).duplicate())
|
spawn_sticky_note((item as StickyNote).duplicate())
|
||||||
|
|
||||||
func _process(delta: float):
|
func _process(delta: float):
|
||||||
pass
|
pass
|
||||||
|
|
@ -27,8 +27,8 @@ func spawn_card(card: Card):
|
||||||
|
|
||||||
populate_focus_neighbors()
|
populate_focus_neighbors()
|
||||||
|
|
||||||
func spawn_postit(postit: PostIt):
|
func spawn_sticky_note(sticky_note: StickyNote):
|
||||||
$postits.add_child(postit)
|
$sticky_notes.add_child(sticky_note)
|
||||||
|
|
||||||
populate_focus_neighbors()
|
populate_focus_neighbors()
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ func populate_focus_neighbors():
|
||||||
return
|
return
|
||||||
|
|
||||||
var first_card = $cards.get_children(false)[0]
|
var first_card = $cards.get_children(false)[0]
|
||||||
var first_postit = $postits.get_children(false)[0] if $postits.get_child_count(false) > 0 else first_card
|
var first_sticky_note = $sticky_notes.get_children(false)[0] if $sticky_notes.get_child_count(false) > 0 else first_card
|
||||||
|
|
||||||
var first_board_card = $mindmap.get_children(false)[0] if $mindmap.get_child_count(false) > 0 else first_card
|
var first_board_card = $mindmap.get_children(false)[0] if $mindmap.get_child_count(false) > 0 else first_card
|
||||||
|
|
||||||
|
|
@ -49,24 +49,24 @@ func populate_focus_neighbors():
|
||||||
if card == first_card or not (card is Card):
|
if card == first_card or not (card is Card):
|
||||||
continue
|
continue
|
||||||
card.focus_neighbor_right = first_board_card # FIXME should be a valid focusable object, but it refuses
|
card.focus_neighbor_right = first_board_card # FIXME should be a valid focusable object, but it refuses
|
||||||
card.focus_neighbor_left = first_postit
|
card.focus_neighbor_left = first_sticky_note
|
||||||
card.focus_neighbor_up = cards[(i - 1) % cards.size()]
|
card.focus_neighbor_up = cards[(i - 1) % cards.size()]
|
||||||
card.focus_neighbor_down = cards[(i + 1) % cards.size()]
|
card.focus_neighbor_down = cards[(i + 1) % cards.size()]
|
||||||
|
|
||||||
var postits = $postits.get_children(false) as Array[PostIt]
|
var sticky_notes = $sticky_notes.get_children(false) as Array[StickyNote]
|
||||||
for i in postits.size():
|
for i in sticky_notes.size():
|
||||||
var postit = postits[i]
|
var sticky_note = sticky_notes[i]
|
||||||
if not (postit is PostIt):
|
if not (sticky_note is StickyNote):
|
||||||
continue
|
continue
|
||||||
postit.focus_neighbor_right = first_card
|
sticky_note.focus_neighbor_right = first_card
|
||||||
postit.focus_neighbor_left = first_board_card
|
sticky_note.focus_neighbor_left = first_board_card
|
||||||
postit.focus_neighbor_up = postits[(i - 1) % postits.size()]
|
sticky_note.focus_neighbor_up = sticky_notes[(i - 1) % sticky_notes.size()]
|
||||||
postit.focus_neighbor_down = postits[(i + 1) % postits.size()]
|
sticky_note.focus_neighbor_down = sticky_notes[(i + 1) % sticky_notes.size()]
|
||||||
|
|
||||||
var board_items = $mindmap.get_children(false) as Array
|
var board_items = $mindmap.get_children(false) as Array
|
||||||
for i in board_items.size():
|
for i in board_items.size():
|
||||||
var board_item = board_items[i]
|
var board_item = board_items[i]
|
||||||
board_item.focus_neighbor_right = first_postit
|
board_item.focus_neighbor_right = first_sticky_note
|
||||||
board_item.focus_neighbor_left = first_card
|
board_item.focus_neighbor_left = first_card
|
||||||
board_item.focus_neighbor_up = board_items[(i - 1) % board_items.size()]
|
board_item.focus_neighbor_up = board_items[(i - 1) % board_items.size()]
|
||||||
board_item.focus_neighbor_down = board_items[(i + 1) % board_items.size()]
|
board_item.focus_neighbor_down = board_items[(i + 1) % board_items.size()]
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ anchor_bottom = 1.0
|
||||||
offset_right = 30.0
|
offset_right = 30.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="postits" type="Panel" parent="."]
|
[node name="sticky_notes" type="Panel" parent="."]
|
||||||
custom_minimum_size = Vector2(100, 0)
|
custom_minimum_size = Vector2(100, 0)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 11
|
anchors_preset = 11
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ extends PanelContainer
|
||||||
#var area_dict = {
|
#var area_dict = {
|
||||||
# "dropzone_content": [],
|
# "dropzone_content": [],
|
||||||
# "cards": [],
|
# "cards": [],
|
||||||
# "post_its_in_list": [],
|
# "sticky_notes_in_list": [],
|
||||||
# "post_it_panels": []
|
# "sticky_note_panels": []
|
||||||
#}
|
#}
|
||||||
enum {DROPZONE, POST_IT_LIST, DRAGGING, ASSIGN_POST_IT}
|
enum {DROPZONE, POST_IT_LIST, DRAGGING, ASSIGN_POST_IT}
|
||||||
|
|
||||||
|
|
@ -27,11 +27,13 @@ var has_stage = false:
|
||||||
@onready var dropzone = $HBoxContainer/dropzone
|
@onready var dropzone = $HBoxContainer/dropzone
|
||||||
var dropzone_size: Vector2
|
var dropzone_size: Vector2
|
||||||
@export var dropzone_padding = 100
|
@export var dropzone_padding = 100
|
||||||
@onready var postit_container = $HBoxContainer/ScrollContainer/VBoxContainer
|
@onready var sticky_note_container = $HBoxContainer/ScrollContainer/VBoxContainer
|
||||||
@onready var board_of_devs = $"board of devs"
|
@onready var board_of_devs = $"board of devs"
|
||||||
var base_postit_panel: Panel
|
var base_sticky_note_panel: Panel
|
||||||
@onready var current_context:int = DROPZONE:
|
@onready var current_context:int = POST_IT_LIST:
|
||||||
set(context):
|
set(context):
|
||||||
|
if current_context == ASSIGN_POST_IT and !context == ASSIGN_POST_IT:
|
||||||
|
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
|
||||||
match context:
|
match context:
|
||||||
DROPZONE:
|
DROPZONE:
|
||||||
pass
|
pass
|
||||||
|
|
@ -41,6 +43,7 @@ var base_postit_panel: Panel
|
||||||
pass
|
pass
|
||||||
ASSIGN_POST_IT:
|
ASSIGN_POST_IT:
|
||||||
pass
|
pass
|
||||||
|
current_context = context
|
||||||
@onready var instructions = $instructions_panel/HBoxContainer/cards_remaining
|
@onready var instructions = $instructions_panel/HBoxContainer/cards_remaining
|
||||||
|
|
||||||
var mementos_collected: int = 0:
|
var mementos_collected: int = 0:
|
||||||
|
|
@ -56,19 +59,29 @@ var mementos_collected: int = 0:
|
||||||
4:
|
4:
|
||||||
instructions.text = "Combine cards to order your thoughts."
|
instructions.text = "Combine cards to order your thoughts."
|
||||||
|
|
||||||
var currently_active_node: Area2D = null
|
@onready var currently_active_node: Area2D = null:
|
||||||
|
set(new_node):
|
||||||
|
if not currently_active_node == null:
|
||||||
|
currently_active_node.highlighted = false
|
||||||
|
currently_active_node = new_node
|
||||||
|
currently_active_node.highlighted = true
|
||||||
|
|
||||||
@onready var current_dropzone_id: int = 0:
|
@onready var current_dropzone_id: int = 0:
|
||||||
set(new_id):
|
set(new_id):
|
||||||
if new_id > dropzone.get_child_count() - 1: current_dropzone_id = 0
|
if new_id > dropzone.get_child_count() - 1: current_dropzone_id = 0
|
||||||
elif new_id < 0: current_dropzone_id = dropzone.get_child_count() - 1
|
elif new_id < 0: current_dropzone_id = dropzone.get_child_count() - 1
|
||||||
else: current_dropzone_id = new_id
|
else: current_dropzone_id = new_id
|
||||||
|
if current_context == ASSIGN_POST_IT:
|
||||||
|
dropzone.get_child(current_dropzone_id).preview_sticky_note(currently_active_node)
|
||||||
|
elif current_context == DROPZONE:
|
||||||
|
currently_active_node = dropzone.get_child(current_dropzone_id)
|
||||||
|
|
||||||
var current_postIt_id: int = 0:
|
@onready var current_sticky_note_id: int = 0:
|
||||||
set(new_id):
|
set(new_id):
|
||||||
if new_id > postit_container.get_child_count() - 1: current_postIt_id = 0
|
if new_id > sticky_note_container.get_child_count() - 1: current_sticky_note_id = 0
|
||||||
elif new_id < 0: current_postIt_id = postit_container.get_child_count() - 1
|
elif new_id < 0: current_sticky_note_id = sticky_note_container.get_child_count() - 1
|
||||||
else: current_postIt_id = new_id
|
else: current_sticky_note_id = new_id
|
||||||
|
currently_active_node = sticky_note_container.get_child(current_sticky_note_id).get_child(0)
|
||||||
|
|
||||||
var cache: Array = []
|
var cache: Array = []
|
||||||
|
|
||||||
|
|
@ -76,10 +89,10 @@ signal board_completed
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
base_postit_panel = $HBoxContainer/ScrollContainer/VBoxContainer/Panel
|
base_sticky_note_panel = $HBoxContainer/ScrollContainer/VBoxContainer/Panel
|
||||||
postit_container.remove_child(base_postit_panel)
|
sticky_note_container.remove_child(base_sticky_note_panel)
|
||||||
|
|
||||||
dropzone_size = get_viewport_rect().size - Vector2(dropzone_padding + base_postit_panel.custom_minimum_size.x, dropzone_padding)
|
dropzone_size = get_viewport_rect().size - Vector2(dropzone_padding + base_sticky_note_panel.custom_minimum_size.x, dropzone_padding)
|
||||||
|
|
||||||
if get_parent() == get_tree().root:
|
if get_parent() == get_tree().root:
|
||||||
populate_board(["c_void", 'c_joy', "p_wet", "p_thomas"])
|
populate_board(["c_void", 'c_joy', "p_wet", "p_thomas"])
|
||||||
|
|
@ -99,7 +112,7 @@ func populate_board(card_names: Array):
|
||||||
var all_new:Dictionary = board_of_devs.get_cards_by_name_array(card_names)
|
var all_new:Dictionary = board_of_devs.get_cards_by_name_array(card_names)
|
||||||
|
|
||||||
var new_cards:Array = all_new["cards"]
|
var new_cards:Array = all_new["cards"]
|
||||||
var new_postits:Array = all_new["postIts"]
|
var new_sticky_notes:Array = all_new["sticky_notes"]
|
||||||
|
|
||||||
# spawning the cards and adding them to the dictionary
|
# spawning the cards and adding them to the dictionary
|
||||||
for new_card in all_new["cards"]:
|
for new_card in all_new["cards"]:
|
||||||
|
|
@ -107,14 +120,11 @@ func populate_board(card_names: Array):
|
||||||
insert_area(dropzone, new_card)
|
insert_area(dropzone, new_card)
|
||||||
new_card.set_owner(self)
|
new_card.set_owner(self)
|
||||||
new_card.is_dragable = true
|
new_card.is_dragable = true
|
||||||
for new_postit in all_new["postIts"]: # spawning a post-it
|
for new_sticky_note in all_new["sticky_notes"]: # spawning a sticky note
|
||||||
var new_panel = base_postit_panel.duplicate()
|
var new_panel = base_sticky_note_panel.duplicate()
|
||||||
postit_container.add_child(new_panel)
|
sticky_note_container.add_child(new_panel)
|
||||||
new_panel.set_owner(self)
|
new_panel.set_owner(self)
|
||||||
new_panel.add_child(new_postit)
|
new_panel.attatch_sticky_note(new_sticky_note, false)
|
||||||
new_postit.set_owner(self)
|
|
||||||
new_postit.position = new_panel.get_child(0).position
|
|
||||||
new_postit.is_dragable = true
|
|
||||||
|
|
||||||
#currently_active_node = area_dict["dropzone_content"][0] # set first Card as currently selected node by default
|
#currently_active_node = area_dict["dropzone_content"][0] # set first Card as currently selected node by default
|
||||||
currently_active_node = dropzone.get_child(0)
|
currently_active_node = dropzone.get_child(0)
|
||||||
|
|
@ -143,44 +153,44 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||||
if !input.is_pressed():
|
if !input.is_pressed():
|
||||||
insert_area(dropzone, to_handle)
|
insert_area(dropzone, to_handle)
|
||||||
current_context = DROPZONE
|
current_context = DROPZONE
|
||||||
elif to_handle is PostIt:
|
elif to_handle is StickyNote:
|
||||||
if input.is_action_pressed("mouse_left"):
|
if input.is_action_pressed("mouse_left"):
|
||||||
to_handle.reparent(dropzone)
|
to_handle.reparent(dropzone)
|
||||||
to_handle.on_board = true
|
to_handle.on_board = true
|
||||||
to_handle.set_owner(self) # needs to be here otherwise the owner disappears
|
to_handle.set_owner(self) # needs to be here otherwise the owner disappears
|
||||||
if input.is_action_pressed("mouse_right"):
|
if input.is_action_pressed("mouse_right"):
|
||||||
_return_postits_to_panels()
|
_return_sticky_notes_to_panels()
|
||||||
else:
|
else:
|
||||||
if is_in_dropzone(to_handle):
|
if is_in_dropzone(to_handle):
|
||||||
if to_handle.has_overlapping_areas():
|
if to_handle.has_overlapping_areas():
|
||||||
for area in to_handle.get_overlapping_areas():
|
for area in to_handle.get_overlapping_areas():
|
||||||
if area is Card:
|
if area is Card:
|
||||||
if area.has_postit_attached():
|
if area.has_sticky_note_attached():
|
||||||
area.exchange_postIt_with(to_handle).reparent(dropzone)
|
area.exchange_sticky_note_with(to_handle).reparent(dropzone)
|
||||||
else:
|
else:
|
||||||
to_handle.rotation = to_handle.base_rotation
|
to_handle.rotation = to_handle.base_rotation
|
||||||
to_handle.scale = to_handle.base_scale
|
to_handle.scale = to_handle.base_scale
|
||||||
else:
|
else:
|
||||||
current_context = POST_IT_LIST
|
current_context = POST_IT_LIST
|
||||||
_return_postits_to_panels()
|
_return_sticky_notes_to_panels()
|
||||||
|
|
||||||
func _return_postits_to_panels():
|
func _return_sticky_notes_to_panels():
|
||||||
for panel in postit_container.get_children():
|
for panel in sticky_note_container.get_children():
|
||||||
panel.reclaim_postit()
|
panel.reclaim_sticky_note()
|
||||||
|
|
||||||
func is_board_complete() -> bool:
|
func is_board_complete() -> bool:
|
||||||
if mementos_collected == 4:
|
if mementos_collected == 4:
|
||||||
for card in dropzone.get_children():
|
for card in dropzone.get_children():
|
||||||
if card is Card:
|
if card is Card:
|
||||||
if not card.has_postit_attached():
|
if not card.has_sticky_note_attached():
|
||||||
return false
|
return false
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
func is_board_lore() -> bool:
|
func is_board_lore() -> bool:
|
||||||
for card in dropzone.get_children():
|
for card in dropzone.get_children():
|
||||||
if card.has_postit_attached():
|
if card.has_sticky_note_attached():
|
||||||
if not card.current_post_it.is_in_group(card.name): return false
|
if not card.current_sticky_note.is_in_group(card.name): return false
|
||||||
return true
|
return true
|
||||||
|
|
||||||
# Mark area that was hovered over as currently selected
|
# Mark area that was hovered over as currently selected
|
||||||
|
|
@ -190,11 +200,11 @@ func handle_hover(to_handle: Area2D):
|
||||||
currently_active_node = to_handle
|
currently_active_node = to_handle
|
||||||
|
|
||||||
if is_in_dropzone(to_handle):
|
if is_in_dropzone(to_handle):
|
||||||
if to_handle is Card or (to_handle is PostIt and to_handle.on_board):
|
if to_handle is Card or (to_handle is StickyNote and to_handle.on_board):
|
||||||
current_dropzone_id = dropzone.get_children().find(to_handle)
|
current_dropzone_id = dropzone.get_children().find(to_handle)
|
||||||
current_context = DROPZONE
|
current_context = DROPZONE
|
||||||
else:
|
else:
|
||||||
current_postIt_id = postit_container.get_children().find(to_handle.attatched_to)
|
current_sticky_note_id = sticky_note_container.get_children().find(to_handle.attatched_to)
|
||||||
current_context = POST_IT_LIST
|
current_context = POST_IT_LIST
|
||||||
|
|
||||||
# Adds a child at the correct child indext in an area
|
# Adds a child at the correct child indext in an area
|
||||||
|
|
@ -202,10 +212,11 @@ func insert_area(parent: Control, node: Area2D):
|
||||||
var children = parent.get_children()
|
var children = parent.get_children()
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
if children != []: while children[i].global_position.y > node.global_position.y: i+=1
|
|
||||||
|
|
||||||
if not node in get_children(): node.reparent(parent)
|
if not node in get_children(): node.reparent(parent)
|
||||||
parent.move_child(node, i)
|
|
||||||
|
if children.size() > 0:
|
||||||
|
while children[i].global_position.y > node.global_position.y and i+1 < children.size(): i+=1
|
||||||
|
parent.move_child(node, i)
|
||||||
|
|
||||||
# Takes the inputs for control inputs
|
# Takes the inputs for control inputs
|
||||||
func _input(event):
|
func _input(event):
|
||||||
|
|
@ -218,13 +229,13 @@ func _input(event):
|
||||||
|
|
||||||
if event.is_action_pressed("ui_up"): # up to select an element above
|
if event.is_action_pressed("ui_up"): # up to select an element above
|
||||||
if current_context == POST_IT_LIST:
|
if current_context == POST_IT_LIST:
|
||||||
current_postIt_id -= 1
|
current_sticky_note_id -= 1
|
||||||
else:
|
else:
|
||||||
current_dropzone_id -= 1
|
current_dropzone_id -= 1
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_down"): # down to select an element beneath
|
elif event.is_action_pressed("ui_down"): # down to select an element beneath
|
||||||
if current_context == POST_IT_LIST:
|
if current_context == POST_IT_LIST:
|
||||||
current_postIt_id += 1
|
current_sticky_note_id += 1
|
||||||
else:
|
else:
|
||||||
current_dropzone_id += 1
|
current_dropzone_id += 1
|
||||||
|
|
||||||
|
|
@ -235,22 +246,22 @@ func _input(event):
|
||||||
elif event.is_action_pressed("ui_right"): # right to switch context to the right
|
elif event.is_action_pressed("ui_right"): # right to switch context to the right
|
||||||
current_context = POST_IT_LIST
|
current_context = POST_IT_LIST
|
||||||
|
|
||||||
elif event.is_action_pressed("ui_accept"): # select the selected post it
|
elif event.is_action_pressed("ui_accept"): # select the selected note it
|
||||||
var card:Card = dropzone.get_child(current_dropzone_id)
|
var card:Card = dropzone.get_child(current_dropzone_id)
|
||||||
if current_context == ASSIGN_POST_IT: # to assign it to a card
|
if current_context == ASSIGN_POST_IT: # to assign it to a card
|
||||||
if card.has_postit_attached():
|
if card.has_sticky_note_attached():
|
||||||
currently_active_node = card.exchange_postIt_with(currently_active_node)
|
currently_active_node = card.exchange_sticky_note_with(currently_active_node)
|
||||||
else:
|
else:
|
||||||
card.attach_postit(currently_active_node)
|
card.attach_sticky_note(currently_active_node)
|
||||||
current_context = DROPZONE
|
current_context = DROPZONE
|
||||||
else:
|
else:
|
||||||
if card.has_postit_attached():
|
if card.has_sticky_note_attached():
|
||||||
currently_active_node = card.remove_postIt()
|
currently_active_node = card.remove_sticky_note()
|
||||||
current_context == ASSIGN_POST_IT
|
current_context == ASSIGN_POST_IT
|
||||||
|
|
||||||
# move the post 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(post_it: Area2D, card: Area2D):
|
func _select_card_for_assigning(sticky_note: Area2D, card: Area2D):
|
||||||
post_it.tween_transform_to(card.get_child(3).global_position)
|
sticky_note.tween_transform_to(card.get_child(3).global_position)
|
||||||
|
|
||||||
func on_scene_skipped(i: int):
|
func on_scene_skipped(i: int):
|
||||||
mementos_collected += i
|
mementos_collected += i
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
extends Area2D
|
extends Area2D
|
||||||
class_name Card
|
class_name Card
|
||||||
var compatible_postits: Array[PostIt] = []
|
var compatible_sticky_notes: Array[StickyNote] = []
|
||||||
var own_postits: Array[PostIt] = []
|
var own_sticky_notes: Array[StickyNote] = []
|
||||||
var current_post_it: PostIt = null
|
var current_sticky_note: StickyNote = null
|
||||||
var wiggle_pos: float = 0
|
var wiggle_pos: float = 0
|
||||||
var wiggle_intensity: float = 0
|
var wiggle_intensity: float = 0
|
||||||
var noise: Noise = FastNoiseLite.new()
|
var noise: Noise = FastNoiseLite.new()
|
||||||
|
|
@ -53,7 +53,7 @@ var scale_tween
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
@export var is_dragable: bool = false
|
@export var is_dragable: bool = false
|
||||||
@onready var diameter = $CollisionShape2D.shape.height
|
@onready var diameter = $CollisionShape2D.shape.height
|
||||||
@onready var postit_anchor: Control = get_child(3)
|
@onready var sticky_note_anchor: Node2D = $"sticky note anchor"
|
||||||
|
|
||||||
var is_dragged: bool = false:
|
var is_dragged: bool = false:
|
||||||
set(dragged):
|
set(dragged):
|
||||||
|
|
@ -67,17 +67,17 @@ func _ready():
|
||||||
|
|
||||||
_handle_wiggle(0)
|
_handle_wiggle(0)
|
||||||
if not Engine.is_editor_hint() and is_inside_tree():
|
if not Engine.is_editor_hint() and is_inside_tree():
|
||||||
for postit in self.get_children():
|
for sticky_note in self.get_children():
|
||||||
if postit is PostIt: self.own_postits.append(postit as PostIt)
|
if sticky_note is StickyNote: self.own_sticky_notes.append(sticky_note as StickyNote)
|
||||||
|
|
||||||
for postit in get_tree().get_nodes_in_group(name):
|
for sticky_note in get_tree().get_nodes_in_group(name):
|
||||||
if postit is PostIt: self.compatible_postits.append(postit as PostIt)
|
if sticky_note is StickyNote: self.compatible_sticky_notes.append(sticky_note as StickyNote)
|
||||||
|
|
||||||
compatible_postits.append_array(own_postits)
|
compatible_sticky_notes.append_array(own_sticky_notes)
|
||||||
|
|
||||||
if own_postits.size() == 2:
|
if own_sticky_notes.size() == 2:
|
||||||
own_postits[0].sibling = own_postits[1]
|
own_sticky_notes[0].sibling = own_sticky_notes[1]
|
||||||
own_postits[1].sibling = own_postits[0]
|
own_sticky_notes[1].sibling = own_sticky_notes[0]
|
||||||
|
|
||||||
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
|
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
|
||||||
$Label.text = self.text
|
$Label.text = self.text
|
||||||
|
|
@ -112,8 +112,8 @@ func _handle_wiggle(delta):
|
||||||
## Deprecated
|
## Deprecated
|
||||||
func replace_with(card: Card):
|
func replace_with(card: Card):
|
||||||
self.text = card.text
|
self.text = card.text
|
||||||
self.compatible_postits = card.compatible_postits
|
self.compatible_sticky_notes = card.compatible_sticky_notes
|
||||||
self.own_postits = card.own_postits
|
self.own_sticky_notes = card.own_sticky_notes
|
||||||
self.voice_line = card.voice_line
|
self.voice_line = card.voice_line
|
||||||
self.name = card.name
|
self.name = card.name
|
||||||
|
|
||||||
|
|
@ -126,9 +126,9 @@ func _on_focus_exited():
|
||||||
func _on_mouse_entered():
|
func _on_mouse_entered():
|
||||||
is_mouse_entered = true
|
is_mouse_entered = true
|
||||||
if not Input.is_action_pressed("mouse_left"):
|
if not Input.is_action_pressed("mouse_left"):
|
||||||
# Do nothing if mouse hovers over postIt
|
# Do nothing if mouse hovers over sticky_note
|
||||||
if has_postit_attached():
|
if has_sticky_note_attached():
|
||||||
if postit_anchor.get_child(-1).highlighted:
|
if sticky_note_anchor.get_child(-1).highlighted:
|
||||||
return
|
return
|
||||||
highlighted = true
|
highlighted = true
|
||||||
if "handle_hover" in owner:
|
if "handle_hover" in owner:
|
||||||
|
|
@ -154,37 +154,37 @@ func _move_card():
|
||||||
if is_dragged:
|
if is_dragged:
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func has_postit_attached() -> bool:
|
func has_sticky_note_attached() -> bool:
|
||||||
return is_instance_valid(current_post_it)
|
return is_instance_valid(current_sticky_note)
|
||||||
|
|
||||||
func preview_postit(postit: PostIt):
|
func preview_sticky_note(sticky_note: StickyNote):
|
||||||
if has_postit_attached():
|
if has_sticky_note_attached():
|
||||||
postit.tween_transform_to(postit_anchor.global_transform + postit.diameter)
|
sticky_note.tween_transform_to(sticky_note_anchor.global_transform + sticky_note.diameter)
|
||||||
else:
|
else:
|
||||||
postit.tween_transform_to(postit_anchor.global_transform)
|
sticky_note.tween_transform_to(sticky_note_anchor.global_transform)
|
||||||
|
|
||||||
func attach_postit(postit: PostIt) -> bool:
|
func attach_sticky_note(sticky_note: StickyNote) -> bool:
|
||||||
if is_instance_valid(current_post_it):
|
if is_instance_valid(current_sticky_note):
|
||||||
return false
|
return false
|
||||||
postit.reparent(get_child(3, true))
|
sticky_note.reparent(get_child(3, true))
|
||||||
postit.position = Vector2(0,0)
|
sticky_note.position = Vector2(0,0)
|
||||||
postit.on_board = false
|
sticky_note.on_board = false
|
||||||
current_post_it = postit
|
current_sticky_note = sticky_note
|
||||||
postit.attatched_to = self
|
sticky_note.attatched_to = self
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func remove_postit() -> PostIt:
|
func remove_sticky_note() -> StickyNote:
|
||||||
if not is_instance_valid(current_post_it): return null
|
if not is_instance_valid(current_sticky_note): return null
|
||||||
var former_child:PostIt = current_post_it
|
var former_child:StickyNote = current_sticky_note
|
||||||
current_post_it = null
|
current_sticky_note = null
|
||||||
former_child.reparent(get_parent())
|
former_child.reparent(get_parent())
|
||||||
former_child.on_board = true
|
former_child.on_board = true
|
||||||
former_child.attatched_to = null
|
former_child.attatched_to = null
|
||||||
return former_child
|
return former_child
|
||||||
|
|
||||||
func exchange_postIt_with(new_post: PostIt) -> PostIt:
|
func exchange_sticky_note_with(new_note: StickyNote) -> StickyNote:
|
||||||
var tmp = remove_postit()
|
var tmp = remove_sticky_note()
|
||||||
attach_postit(new_post)
|
attach_sticky_note(new_note)
|
||||||
return tmp
|
return tmp
|
||||||
|
|
||||||
## TODO why does this exist?
|
## TODO why does this exist?
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ theme = ExtResource("3_rktsa")
|
||||||
theme_type_variation = &"card_text"
|
theme_type_variation = &"card_text"
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
|
|
||||||
[node name="postit anchor" type="Node2D" parent="."]
|
[node name="sticky note anchor" type="Node2D" parent="."]
|
||||||
position = Vector2(-66, 83)
|
position = Vector2(-66, 83)
|
||||||
|
|
||||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@ class_name PostItPanel
|
||||||
extends Panel
|
extends Panel
|
||||||
|
|
||||||
var stored_costum_minimum_size:Vector2
|
var stored_costum_minimum_size:Vector2
|
||||||
var attatched_postIt: PostIt
|
var attatched_sticky_note: StickyNote
|
||||||
@onready var ancor = $"post-it_anchor"
|
@onready var ancor = $"sticky-note_anchor"
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
stored_costum_minimum_size = custom_minimum_size
|
stored_costum_minimum_size = custom_minimum_size
|
||||||
ancor.position = Vector2(ancor.position.x, 0)
|
ancor.position = Vector2(ancor.position.x, 0)
|
||||||
custom_minimum_size = Vector2(custom_minimum_size.x, 0)
|
custom_minimum_size = Vector2(custom_minimum_size.x, 0)
|
||||||
|
|
||||||
func attatch_postit(attatchment: PostIt, tween:bool = true):
|
func attatch_sticky_note(attatchment: StickyNote, tween:bool = true):
|
||||||
attatchment.on_board = false
|
attatchment.on_board = false
|
||||||
if tween:
|
if tween:
|
||||||
var height_tween: Tween = create_tween()
|
var height_tween: Tween = create_tween()
|
||||||
|
|
@ -18,29 +18,33 @@ func attatch_postit(attatchment: PostIt, tween:bool = true):
|
||||||
height_tween.tween_property(ancor, "position", Vector2(ancor.position.x, stored_costum_minimum_size.y/2), 0.3)
|
height_tween.tween_property(ancor, "position", Vector2(ancor.position.x, stored_costum_minimum_size.y/2), 0.3)
|
||||||
attatchment.tween_transform_to(ancor.global_position)
|
attatchment.tween_transform_to(ancor.global_position)
|
||||||
await attatchment.transform_tween_finished
|
await attatchment.transform_tween_finished
|
||||||
|
else:
|
||||||
|
custom_minimum_size = stored_costum_minimum_size
|
||||||
attatchment.reparent(self)
|
attatchment.reparent(self)
|
||||||
attatched_postIt = attatchment
|
attatched_sticky_note = attatchment
|
||||||
attatchment.owner = self.owner
|
attatchment.owner = self.owner
|
||||||
attatchment.attatched_to = self
|
attatchment.attatched_to = self
|
||||||
|
attatchment.transform = ancor.transform
|
||||||
|
|
||||||
func reclaim_postit():
|
func reclaim_sticky_note():
|
||||||
if is_empty():
|
if is_empty():
|
||||||
attatched_postIt.on_board = false
|
attatched_sticky_note.on_board = false
|
||||||
attatched_postIt.tween_transform_to(ancor.global_position)
|
attatched_sticky_note.tween_transform_to(ancor.global_position)
|
||||||
await attatched_postIt.transform_tween_finished
|
await attatched_sticky_note.transform_tween_finished
|
||||||
attatched_postIt.reparent(self)
|
attatched_sticky_note.reparent(self)
|
||||||
attatched_postIt.owner = self.owner
|
attatched_sticky_note.owner = self.owner
|
||||||
|
|
||||||
func dissolve():
|
func clear_if_empty():
|
||||||
if attatched_postIt.attatched_to == self: attatched_postIt.attatched_to = null
|
if !is_empty(): return
|
||||||
|
if attatched_sticky_note.attatched_to == self: attatched_sticky_note.attatched_to = null
|
||||||
var height_tween: Tween = create_tween()
|
var height_tween: Tween = create_tween()
|
||||||
height_tween.tween_property(self, "custom_minimum_size", Vector2.ZERO, 0.3)
|
height_tween.tween_property(self, "custom_minimum_size", Vector2.ZERO, 0.3)
|
||||||
await height_tween.finished
|
await height_tween.finished
|
||||||
self.free()
|
self.free()
|
||||||
|
|
||||||
func replace_postit_with(new_postit: PostIt):
|
func replace_sticky_note_with(new_sticky_note: StickyNote):
|
||||||
if is_empty():
|
if is_empty():
|
||||||
attatched_postIt = new_postit
|
attatched_sticky_note = new_sticky_note
|
||||||
|
|
||||||
func is_empty():
|
func is_empty() -> bool:
|
||||||
return ancor.get_child_count() == 0
|
return ancor.get_child_count() == 0
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=2 format=3 uid="uid://chwf61qpn2sqw"]
|
[gd_scene load_steps=2 format=3 uid="uid://chwf61qpn2sqw"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://logic-scenes/board/empty_postIt_panel.gd" id="1_1dtc4"]
|
[ext_resource type="Script" path="res://logic-scenes/board/empty_sticky_note_panel.gd" id="1_1dtc4"]
|
||||||
|
|
||||||
[node name="Panel" type="Panel"]
|
[node name="Panel" type="Panel"]
|
||||||
self_modulate = Color(1, 1, 1, 0)
|
self_modulate = Color(1, 1, 1, 0)
|
||||||
|
|
@ -10,5 +10,5 @@ offset_bottom = 120.0
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
script = ExtResource("1_1dtc4")
|
script = ExtResource("1_1dtc4")
|
||||||
|
|
||||||
[node name="post-it_anchor" type="Node2D" parent="."]
|
[node name="sticky-note_anchor" type="Node2D" parent="."]
|
||||||
position = Vector2(105, 57)
|
position = Vector2(105, 57)
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
[ext_resource type="Shader" path="res://logic-scenes/board/physics-board.gdshader" id="1_ggnth"]
|
[ext_resource type="Shader" path="res://logic-scenes/board/physics-board.gdshader" id="1_ggnth"]
|
||||||
[ext_resource type="Script" path="res://logic-scenes/board/card-board.gd" id="3_8v4c4"]
|
[ext_resource type="Script" path="res://logic-scenes/board/card-board.gd" id="3_8v4c4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"]
|
[ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://chwf61qpn2sqw" path="res://logic-scenes/board/empty_postIt_panel.tscn" id="5_dr0qs"]
|
[ext_resource type="PackedScene" uid="uid://chwf61qpn2sqw" path="res://logic-scenes/board/empty_sticky_note_panel.tscn" id="5_dr0qs"]
|
||||||
[ext_resource type="Script" path="res://logic-scenes/board/card collider.gd" id="6_wpxls"]
|
[ext_resource type="Script" path="res://logic-scenes/board/card collider.gd" id="6_wpxls"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@tool
|
@tool
|
||||||
|
|
||||||
extends Area2D
|
extends Area2D
|
||||||
class_name PostIt
|
class_name StickyNote
|
||||||
var sibling
|
var sibling
|
||||||
var shift_tween
|
var shift_tween
|
||||||
var modulate_tween
|
var modulate_tween
|
||||||
|
|
@ -64,14 +64,14 @@ func _ready() -> void:
|
||||||
$Content/BackgroundSprite.frame = text.hash() % $Content/BackgroundSprite.sprite_frames.get_frame_count($Content/BackgroundSprite.animation)
|
$Content/BackgroundSprite.frame = text.hash() % $Content/BackgroundSprite.sprite_frames.get_frame_count($Content/BackgroundSprite.animation)
|
||||||
|
|
||||||
|
|
||||||
func replace_with(postit: PostIt):
|
func replace_with(sticky_note: StickyNote):
|
||||||
self.text = postit.text
|
self.text = sticky_note.text
|
||||||
self.voice_line = postit.voice_line
|
self.voice_line = sticky_note.voice_line
|
||||||
self.sibling = postit.sibling
|
self.sibling = sticky_note.sibling
|
||||||
self.name = postit.name
|
self.name = sticky_note.name
|
||||||
for group in self.get_groups():
|
for group in self.get_groups():
|
||||||
self.remove_from_group(group)
|
self.remove_from_group(group)
|
||||||
for group in postit.get_groups():
|
for group in sticky_note.get_groups():
|
||||||
self.add_to_group(group)
|
self.add_to_group(group)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
|
@ -84,7 +84,7 @@ func _process(delta: float) -> void:
|
||||||
var diff:Vector2 = position - area.position
|
var diff:Vector2 = position - area.position
|
||||||
position -= diff.normalized() * ((diff.length()-diameter)/diameter) * bounce_speed * (delta/(1.0/60))
|
position -= diff.normalized() * ((diff.length()-diameter)/diameter) * bounce_speed * (delta/(1.0/60))
|
||||||
|
|
||||||
_move_post_it()
|
_move_sticky_note()
|
||||||
|
|
||||||
|
|
||||||
func _on_focus_entered():
|
func _on_focus_entered():
|
||||||
|
|
@ -101,12 +101,12 @@ func _on_mouse_entered():
|
||||||
|
|
||||||
func _on_mouse_exited():
|
func _on_mouse_exited():
|
||||||
highlighted = false
|
highlighted = false
|
||||||
if is_postit_attached() and "check_hover" in get_parent():
|
if is_sticky_note_attached() and "check_hover" in get_parent():
|
||||||
get_parent().check_hover()
|
get_parent().check_hover()
|
||||||
|
|
||||||
func _on_input_event(viewport, event, shape_idx):
|
func _on_input_event(viewport, event, shape_idx):
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
_move_post_it()
|
_move_sticky_note()
|
||||||
|
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT:
|
if event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT:
|
||||||
|
|
@ -114,16 +114,16 @@ func _on_input_event(viewport, event, shape_idx):
|
||||||
mouse_offset = (get_viewport().get_mouse_position() - global_position)
|
mouse_offset = (get_viewport().get_mouse_position() - global_position)
|
||||||
owner.handle_mouse_button(self, event)
|
owner.handle_mouse_button(self, event)
|
||||||
|
|
||||||
func _move_post_it():
|
func _move_sticky_note():
|
||||||
if is_dragged:
|
if is_dragged:
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func is_postit_attached() -> bool:
|
func is_sticky_note_attached() -> bool:
|
||||||
# there is probably a nicer way to do this
|
# there is probably a nicer way to do this
|
||||||
return self.get_parent().get_parent() is Card
|
return self.get_parent().get_parent() is Card
|
||||||
|
|
||||||
func tween_transform_to(target: Vector2):
|
func tween_transform_to(target: Transform2D):
|
||||||
var transform_tween: Tween = create_tween()
|
var transform_tween: Tween = create_tween()
|
||||||
transform_tween.tween_property(self, "position", target, 0.25)
|
transform_tween.tween_property(self, "transform", target, 0.25)
|
||||||
await transform_tween.finished
|
await transform_tween.finished
|
||||||
emit_signal("transform_tween_finished")
|
emit_signal("transform_tween_finished")
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=18 format=3 uid="uid://vkcdj8c3ytbq"]
|
[gd_scene load_steps=18 format=3 uid="uid://vkcdj8c3ytbq"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://logic-scenes/board/post-it.gd" id="1_yvh5n"]
|
[ext_resource type="Script" path="res://logic-scenes/board/sticky-note.gd" id="1_yvh5n"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c8ckkjmdegyis" path="res://logic-scenes/board/card-textures/postitsheet.png" id="2_j17jn"]
|
[ext_resource type="Texture2D" uid="uid://c8ckkjmdegyis" path="res://logic-scenes/board/card-textures/postitsheet.png" id="2_j17jn"]
|
||||||
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_hu2as"]
|
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_hu2as"]
|
||||||
|
|
||||||
|
|
@ -100,10 +100,10 @@ animations = [{
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="post-it" type="Area2D"]
|
[node name="sticky-note" type="Area2D"]
|
||||||
script = ExtResource("1_yvh5n")
|
script = ExtResource("1_yvh5n")
|
||||||
highlight_color = Color(1.2, 1.2, 1.2, 1)
|
highlight_color = Color(1.2, 1.2, 1.2, 1)
|
||||||
metadata/type = "post-it"
|
metadata/type = "sticky-note"
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(99.5, 0)
|
position = Vector2(99.5, 0)
|
||||||
|
|
@ -184,7 +184,7 @@ theme = ExtResource("3_mi4ah")
|
||||||
theme_type_variation = &"card_text"
|
theme_type_variation = &"card_text"
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
|
|
||||||
[node name="postit anchor" type="Node2D" parent="."]
|
[node name="sticky_note anchor" type="Node2D" parent="."]
|
||||||
position = Vector2(-65.6478, 60.3852)
|
position = Vector2(-65.6478, 60.3852)
|
||||||
|
|
||||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
|
|
|
||||||
|
|
@ -88,18 +88,18 @@ func fill_card_slots(id: int):
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
func fill_post_slots():
|
func fill_post_slots():
|
||||||
var post_its: Array[PostIt] = []
|
var sticky_notes: Array[StickyNote] = []
|
||||||
for card in output:
|
for card in output:
|
||||||
post_its.append_array(card.own_postits)
|
sticky_notes.append_array(card.own_sticky_notes)
|
||||||
|
|
||||||
post_its.shuffle()
|
sticky_notes.shuffle()
|
||||||
options = []
|
options = []
|
||||||
for ancor in $postIts.get_children():
|
for ancor in $sticky_notes.get_children():
|
||||||
ancor.remove_child(ancor.get_child(1))
|
ancor.remove_child(ancor.get_child(1))
|
||||||
|
|
||||||
for i in range(post_its.size()):
|
for i in range(sticky_notes.size()):
|
||||||
options.append(post_its[i])
|
options.append(sticky_notes[i])
|
||||||
$postIts.get_child(i).add_child(options[i], false)
|
$sticky_notes.get_child(i).add_child(options[i], false)
|
||||||
options[i].owner = self
|
options[i].owner = self
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
|
|
@ -166,7 +166,7 @@ func pick(id: int):
|
||||||
selection_state = TRANSITION
|
selection_state = TRANSITION
|
||||||
options = []
|
options = []
|
||||||
anim_players = []
|
anim_players = []
|
||||||
for control in $postIts.get_children():
|
for control in $sticky_notes.get_children():
|
||||||
options.append(control.get_child(1))
|
options.append(control.get_child(1))
|
||||||
anim_players.append(control.get_child(0))
|
anim_players.append(control.get_child(0))
|
||||||
control.get_child(0).play("post")
|
control.get_child(0).play("post")
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://logic-scenes/card_picker/card_picker.gd" id="1_pjntm"]
|
[ext_resource type="Script" path="res://logic-scenes/card_picker/card_picker.gd" id="1_pjntm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="2_dqebt"]
|
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="2_dqebt"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="3_ggbxq"]
|
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/sticky-note.tscn" id="3_ggbxq"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_1kvte"]
|
[ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_1kvte"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_dinvx"]
|
[sub_resource type="Animation" id="Animation_dinvx"]
|
||||||
|
|
@ -1557,71 +1557,71 @@ libraries = {
|
||||||
[node name="card" parent="cards/card_3" instance=ExtResource("2_dqebt")]
|
[node name="card" parent="cards/card_3" instance=ExtResource("2_dqebt")]
|
||||||
text = "Slot 3"
|
text = "Slot 3"
|
||||||
|
|
||||||
[node name="postIts" type="Panel" parent="."]
|
[node name="sticky_notes" type="Panel" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="postIt_1" type="Control" parent="postIts"]
|
[node name="sticky_note_1" type="Control" parent="sticky_notes"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = -150.0
|
offset_top = -150.0
|
||||||
offset_bottom = -150.0
|
offset_bottom = -150.0
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="postIts/postIt_1"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_1"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
autoplay = "ini"
|
autoplay = "ini"
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_ga4dm")
|
"": SubResource("AnimationLibrary_ga4dm")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="post-it" parent="postIts/postIt_1" instance=ExtResource("3_ggbxq")]
|
[node name="sticky-note" parent="sticky_notes/sticky_note_1" instance=ExtResource("3_ggbxq")]
|
||||||
text = "Post 1"
|
text = "Post 1"
|
||||||
|
|
||||||
[node name="postIt_2" type="Control" parent="postIts"]
|
[node name="sticky_note_2" type="Control" parent="sticky_notes"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = -50.0
|
offset_top = -50.0
|
||||||
offset_bottom = -50.0
|
offset_bottom = -50.0
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="postIts/postIt_2"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_2"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
autoplay = "ini"
|
autoplay = "ini"
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_sxnmi")
|
"": SubResource("AnimationLibrary_sxnmi")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="post-it" parent="postIts/postIt_2" instance=ExtResource("3_ggbxq")]
|
[node name="sticky-note" parent="sticky_notes/sticky_note_2" instance=ExtResource("3_ggbxq")]
|
||||||
text = "Post 2"
|
text = "Post 2"
|
||||||
|
|
||||||
[node name="postIt_3" type="Control" parent="postIts"]
|
[node name="sticky_note_3" type="Control" parent="sticky_notes"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = 50.0
|
offset_top = 50.0
|
||||||
offset_bottom = 50.0
|
offset_bottom = 50.0
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="postIts/postIt_3"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_3"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
autoplay = "ini"
|
autoplay = "ini"
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_xs06v")
|
"": SubResource("AnimationLibrary_xs06v")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="post-it" parent="postIts/postIt_3" instance=ExtResource("3_ggbxq")]
|
[node name="sticky-note" parent="sticky_notes/sticky_note_3" instance=ExtResource("3_ggbxq")]
|
||||||
text = "Post 3"
|
text = "Post 3"
|
||||||
|
|
||||||
[node name="postIt_4" type="Control" parent="postIts"]
|
[node name="sticky_note_4" type="Control" parent="sticky_notes"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = 150.0
|
offset_top = 150.0
|
||||||
offset_bottom = 150.0
|
offset_bottom = 150.0
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="postIts/postIt_4"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_4"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
autoplay = "ini"
|
autoplay = "ini"
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_tdl1s")
|
"": SubResource("AnimationLibrary_tdl1s")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="post-it" parent="postIts/postIt_4" instance=ExtResource("3_ggbxq")]
|
[node name="sticky-note" parent="sticky_notes/sticky_note_4" instance=ExtResource("3_ggbxq")]
|
||||||
text = "Post 4"
|
text = "Post 4"
|
||||||
|
|
||||||
[node name="board of devs" parent="." instance=ExtResource("4_1kvte")]
|
[node name="board of devs" parent="." instance=ExtResource("4_1kvte")]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
[ext_resource type="FontFile" uid="uid://cb66e4mqysgf8" path="res://import/fonts/title_handwriting.tres" id="2_jb5y5"]
|
[ext_resource type="FontFile" uid="uid://cb66e4mqysgf8" path="res://import/fonts/title_handwriting.tres" id="2_jb5y5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bwicl5q0lw06q" path="res://import/interface-elements/bottom.png" id="3_oob40"]
|
[ext_resource type="Texture2D" uid="uid://bwicl5q0lw06q" path="res://import/interface-elements/bottom.png" id="3_oob40"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="4_48hwg"]
|
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="4_48hwg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="5_sfuv4"]
|
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/sticky-note.tscn" id="5_sfuv4"]
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_ugp0t"]
|
[sub_resource type="GDScript" id="GDScript_ugp0t"]
|
||||||
script/source = "extends Button
|
script/source = "extends Button
|
||||||
|
|
@ -143,7 +143,7 @@ process_mode = 4
|
||||||
position = Vector2(1164, 301)
|
position = Vector2(1164, 301)
|
||||||
text = "Lukas did not ask for consent, he didn't explain a thing, I didn’t even move! Yet he dared to assume, that "
|
text = "Lukas did not ask for consent, he didn't explain a thing, I didn’t even move! Yet he dared to assume, that "
|
||||||
|
|
||||||
[node name="post-it" parent="childhood/PanelContainer/card" instance=ExtResource("5_sfuv4")]
|
[node name="sticky-note" parent="childhood/PanelContainer/card" instance=ExtResource("5_sfuv4")]
|
||||||
position = Vector2(-61, 110)
|
position = Vector2(-61, 110)
|
||||||
text = "I was wet so I must have been into it"
|
text = "I was wet so I must have been into it"
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ process_mode = 4
|
||||||
position = Vector2(1170, 589)
|
position = Vector2(1170, 589)
|
||||||
text = "Lukas jumped me, he didn't even explain a thing or ask consent. I was confused and paralised, so "
|
text = "Lukas jumped me, he didn't even explain a thing or ask consent. I was confused and paralised, so "
|
||||||
|
|
||||||
[node name="post-it" parent="childhood/PanelContainer/card2" instance=ExtResource("5_sfuv4")]
|
[node name="sticky-note" parent="childhood/PanelContainer/card2" instance=ExtResource("5_sfuv4")]
|
||||||
position = Vector2(-61, 110)
|
position = Vector2(-61, 110)
|
||||||
text = "I didn't say stop"
|
text = "I didn't say stop"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue