fix: picker wasn't propagate up
This commit is contained in:
parent
b9525ce3b0
commit
a169add7d1
|
|
@ -1,10 +1,24 @@
|
||||||
[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3 uid="uid://bgplfqxa852wo"]
|
[gd_resource type="Resource" script_class="SaveGame" load_steps=2 format=3 uid="uid://vycsxg8kexkp"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://d06gpwuxmkxkt" path="res://dev-util/savegame.gd" id="1_jr18u"]
|
[ext_resource type="Script" uid="uid://d06gpwuxmkxkt" path="res://dev-util/savegame.gd" id="1_jr18u"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_jr18u")
|
script = ExtResource("1_jr18u")
|
||||||
unique_save_name = "DEBUG"
|
unique_save_name = "DEBUG"
|
||||||
mementos_complete = 1
|
current_room = 1
|
||||||
last_saved = 1756993270
|
mementos_complete = 5
|
||||||
|
board_positions = Dictionary[StringName, Vector2]({
|
||||||
|
&"@Area2D@363": Vector2(458, 300),
|
||||||
|
&"@Area2D@364": Vector2(37.973812, 125.31358),
|
||||||
|
&"c_boy_stuff": Vector2(1345, 549),
|
||||||
|
&"c_comic_heroes": Vector2(848, 557),
|
||||||
|
&"c_teasing": Vector2(1047, 408),
|
||||||
|
&"p_effort": Vector2(133.33333, 110),
|
||||||
|
&"p_girls": Vector2(133.33333, 220),
|
||||||
|
&"p_my_own_good": Vector2(37.973812, 93.98519)
|
||||||
|
})
|
||||||
|
player_position = Vector3(2.6459198, -0.012512123, -0.10338242)
|
||||||
|
player_yaw = -1.2473134
|
||||||
|
player_pitch = -0.31394038
|
||||||
|
last_saved = 1768818601
|
||||||
metadata/_custom_type_script = "uid://d06gpwuxmkxkt"
|
metadata/_custom_type_script = "uid://d06gpwuxmkxkt"
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,8 @@ func get_cards_by_name_array(names: Array[StringName]) -> Dictionary[String, Arr
|
||||||
else:
|
else:
|
||||||
if not card_name in sticky_ids:
|
if not card_name in sticky_ids:
|
||||||
push_error("No card or sticky with name '%s'!" % card_name)
|
push_error("No card or sticky with name '%s'!" % card_name)
|
||||||
output["sticky_notes"].append(create_from_id(all_ids[card_name]))
|
else:
|
||||||
|
output["sticky_notes"].append(create_from_id(all_ids[card_name]))
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
save_game = State.save_game
|
save_game = State.save_game
|
||||||
save_game.current_room = id
|
save_game.current_room = id
|
||||||
|
save_game.player_position = %PlayerController.global_position
|
||||||
|
|
||||||
if not Main.normal_boot:
|
if not Main.normal_boot:
|
||||||
start_room.call_deferred()
|
start_room.call_deferred()
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ signal card_burned
|
||||||
var cards : Array[Card] = []
|
var cards : Array[Card] = []
|
||||||
var _submitted := false
|
var _submitted := false
|
||||||
|
|
||||||
|
var _input_locked : bool:
|
||||||
|
get: return _submitted or not visible
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
print_debug("CardBurner.gd: %s._ready()" % self.name)
|
print_debug("CardBurner.gd: %s._ready()" % self.name)
|
||||||
super._ready()
|
super._ready()
|
||||||
|
|
@ -62,13 +65,18 @@ func play() -> void:
|
||||||
|
|
||||||
|
|
||||||
func handle_hover(card: Draggable) -> void:
|
func handle_hover(card: Draggable) -> void:
|
||||||
if _submitted: return
|
if _input_locked: return
|
||||||
if not card is Card: return
|
|
||||||
selection = cards.find(card)
|
if card.mouse_over:
|
||||||
|
selection = cards.find(card)
|
||||||
|
else:
|
||||||
|
card.highlighted = false
|
||||||
cursor.gamepad_mode = false
|
cursor.gamepad_mode = false
|
||||||
|
|
||||||
|
|
||||||
func handle_mouse_button(event: InputEventMouseButton, card: Card) -> void:
|
func handle_mouse_button(event: InputEventMouseButton, card: Card) -> void:
|
||||||
|
if _input_locked: return
|
||||||
|
|
||||||
if event.button_index == MOUSE_BUTTON_MASK_LEFT and event.is_pressed() and not event.is_echo():
|
if event.button_index == MOUSE_BUTTON_MASK_LEFT and event.is_pressed() and not event.is_echo():
|
||||||
_submit(card)
|
_submit(card)
|
||||||
|
|
||||||
|
|
@ -82,7 +90,8 @@ func _submit(card : Card):
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if _submitted: return
|
if _input_locked: return
|
||||||
|
|
||||||
if event.is_action_pressed("ui_up"):
|
if event.is_action_pressed("ui_up"):
|
||||||
handle_direction_input(Vector2.UP)
|
handle_direction_input(Vector2.UP)
|
||||||
elif event.is_action_pressed("ui_down"):
|
elif event.is_action_pressed("ui_down"):
|
||||||
|
|
@ -97,7 +106,7 @@ func _input(event: InputEvent) -> void:
|
||||||
|
|
||||||
var focus_cards: bool = false:
|
var focus_cards: bool = false:
|
||||||
set(focus):
|
set(focus):
|
||||||
if _submitted: return
|
if _input_locked: return
|
||||||
focus_cards = focus
|
focus_cards = focus
|
||||||
if focus_cards:
|
if focus_cards:
|
||||||
cursor.visible = true
|
cursor.visible = true
|
||||||
|
|
@ -109,7 +118,7 @@ var focus_cards: bool = false:
|
||||||
|
|
||||||
var selection: int:
|
var selection: int:
|
||||||
set(value):
|
set(value):
|
||||||
if _submitted: return
|
if _input_locked: return
|
||||||
selection = value % len(cards)
|
selection = value % len(cards)
|
||||||
for i in range(len(cards)):
|
for i in range(len(cards)):
|
||||||
var card := cards[i]
|
var card := cards[i]
|
||||||
|
|
@ -121,7 +130,8 @@ var selection: int:
|
||||||
|
|
||||||
|
|
||||||
func handle_direction_input(direction: Vector2) -> void:
|
func handle_direction_input(direction: Vector2) -> void:
|
||||||
if _submitted: return
|
if _input_locked: return
|
||||||
|
|
||||||
if not cursor.gamepad_mode:
|
if not cursor.gamepad_mode:
|
||||||
cursor.gamepad_mode = true
|
cursor.gamepad_mode = true
|
||||||
focus_cards = focus_cards
|
focus_cards = focus_cards
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ enum {
|
||||||
|
|
||||||
@export var current_scene_id : Scenes.id = Scenes.id.NONE
|
@export var current_scene_id : Scenes.id = Scenes.id.NONE
|
||||||
|
|
||||||
|
var _input_locked: bool:
|
||||||
|
get: return (selection_state != CARDS and selection_state != POSTS) or not visible
|
||||||
|
|
||||||
var _input_locked: bool = true
|
|
||||||
|
|
||||||
var selection_state := INI:
|
var selection_state := INI:
|
||||||
set(state):
|
set(state):
|
||||||
print_debug("Setting picker state to %s" % ["INI","CARDS","CARDS_SELECTED","TRANSITION","POSTS","POSTS_SELECTED","DONE"][state])
|
print_debug("Setting picker state to %s" % ["INI","CARDS","CARDS_SELECTED","TRANSITION","POSTS","POSTS_SELECTED","DONE"][state])
|
||||||
selection_state = state
|
selection_state = state
|
||||||
_input_locked = !(state == CARDS or state == POSTS)
|
|
||||||
|
|
||||||
if state == CARDS_SELECTED:
|
if state == CARDS_SELECTED:
|
||||||
var tween: Tween = get_tree().create_tween()
|
var tween: Tween = get_tree().create_tween()
|
||||||
|
|
@ -34,13 +34,12 @@ var anim_players:Array[AnimationPlayer] = []
|
||||||
var curr_selection_id: int = -1:
|
var curr_selection_id: int = -1:
|
||||||
set(new_id):
|
set(new_id):
|
||||||
if selection_state == CARDS or selection_state == POSTS:
|
if selection_state == CARDS or selection_state == POSTS:
|
||||||
if not curr_selection_id == -1: options[curr_selection_id].highlighted = false
|
# Wrap around
|
||||||
|
curr_selection_id = new_id % options.size()
|
||||||
|
|
||||||
if new_id > options.size() -1: curr_selection_id = 0
|
# Update all highlights
|
||||||
elif new_id < 0: curr_selection_id = options.size() - 1
|
for i in range(options.size()):
|
||||||
else: curr_selection_id = new_id
|
options[i].highlighted = (i == curr_selection_id)
|
||||||
|
|
||||||
options[curr_selection_id].highlighted = true
|
|
||||||
else:
|
else:
|
||||||
curr_selection_id = new_id
|
curr_selection_id = new_id
|
||||||
|
|
||||||
|
|
@ -49,11 +48,8 @@ var options:Array = []
|
||||||
|
|
||||||
signal cards_picked(cardnames: Array[String])
|
signal cards_picked(cardnames: Array[String])
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
func play() -> void:
|
||||||
func _ready() -> void:
|
await pick_cards(Scenes.id.YOUTH_CHILDHOOD)
|
||||||
if current_scene_id != Scenes.id.NONE:
|
|
||||||
pick_cards(current_scene_id)
|
|
||||||
|
|
||||||
|
|
||||||
func reset():
|
func reset():
|
||||||
card_anim_skipped = false
|
card_anim_skipped = false
|
||||||
|
|
@ -76,7 +72,7 @@ func fill_card_slots(id: int):
|
||||||
$cards.get_child(i).add_child(new_card)
|
$cards.get_child(i).add_child(new_card)
|
||||||
new_card.owner = self
|
new_card.owner = self
|
||||||
|
|
||||||
new_card.connect("mouse_entered", Callable(self, "get_highlight"))
|
# No need to connect signals - Draggable base class handles this
|
||||||
options.append(new_card)
|
options.append(new_card)
|
||||||
anim_players.append($cards.get_child(i).get_child(0))
|
anim_players.append($cards.get_child(i).get_child(0))
|
||||||
|
|
||||||
|
|
@ -102,43 +98,20 @@ func fill_post_slots():
|
||||||
var picked_player: AnimationPlayer
|
var picked_player: AnimationPlayer
|
||||||
var random_player: AnimationPlayer
|
var random_player: AnimationPlayer
|
||||||
|
|
||||||
var on_cooldown: bool = false
|
|
||||||
var card_anim_skipped:bool = false
|
var card_anim_skipped:bool = false
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if not _input_locked:
|
if _input_locked: return
|
||||||
if not on_cooldown:
|
|
||||||
# Navigation: keyboard arrows, gamepad D-pad, and analog stick
|
|
||||||
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_focus_next"):
|
|
||||||
curr_selection_id -= 1
|
|
||||||
on_cooldown = true
|
|
||||||
get_tree().create_timer(0.15).timeout.connect(func(): on_cooldown = false, CONNECT_ONE_SHOT)
|
|
||||||
elif event.is_action_pressed("ui_down") or event.is_action_pressed("ui_right") or event.is_action_pressed("ui_focus_prev"):
|
|
||||||
curr_selection_id += 1
|
|
||||||
on_cooldown = true
|
|
||||||
get_tree().create_timer(0.15).timeout.connect(func(): on_cooldown = false, CONNECT_ONE_SHOT)
|
|
||||||
|
|
||||||
# Selection: Enter/Space on keyboard, A button (Joy 0) on gamepad, or left click
|
# Navigation
|
||||||
if event.is_action_pressed("ui_accept") or event.is_action_pressed("collect_memento_ui"):
|
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_left"):
|
||||||
pick(curr_selection_id)
|
curr_selection_id -= 1
|
||||||
elif event.is_action_pressed("skip"):
|
elif event.is_action_pressed("ui_down") or event.is_action_pressed("ui_right"):
|
||||||
$Meaning.stop()
|
curr_selection_id += 1
|
||||||
if selection_state == CARDS_SELECTED:
|
|
||||||
picked_player.play("skip_pick", .1)
|
# Selection
|
||||||
random_player.play("skip_shuffle", .1)
|
elif event.is_action_pressed("ui_accept"):
|
||||||
for player in anim_players:
|
pick(curr_selection_id)
|
||||||
player.advance(10.0)
|
|
||||||
transition()
|
|
||||||
card_anim_skipped = true
|
|
||||||
show_posts()
|
|
||||||
elif selection_state == POSTS_SELECTED:
|
|
||||||
for player:AnimationPlayer in anim_players + [picked_player, random_player]:
|
|
||||||
player.play("ini")
|
|
||||||
# I do not know, why process_frame won't work here, but this is workaround seems to prevent the notes from flashing the next selection.
|
|
||||||
await(get_tree().create_timer(0.1).timeout)
|
|
||||||
transition()
|
|
||||||
elif selection_state == TRANSITION:
|
|
||||||
show_posts()
|
|
||||||
|
|
||||||
|
|
||||||
func pick(id: int) -> void:
|
func pick(id: int) -> void:
|
||||||
|
|
@ -227,17 +200,22 @@ func show_posts():
|
||||||
selection_state = POSTS
|
selection_state = POSTS
|
||||||
|
|
||||||
|
|
||||||
func handle_hover(new_highlight):
|
func handle_hover(draggable: Draggable) -> void:
|
||||||
if not _input_locked:
|
if _input_locked: return
|
||||||
curr_selection_id = options.find(new_highlight)
|
|
||||||
|
|
||||||
func handle_mouse_button(button_event: InputEventMouseButton, new_selection: Node):
|
draggable.highlighted = draggable.mouse_over
|
||||||
if not _input_locked:
|
if draggable.mouse_over:
|
||||||
if button_event.button_index == MOUSE_BUTTON_LEFT and button_event.pressed and not button_event.is_echo():
|
curr_selection_id = options.find(draggable)
|
||||||
pick(options.find(new_selection))
|
|
||||||
|
func handle_mouse_button(event: InputEventMouseButton, draggable: Draggable) -> void:
|
||||||
|
if _input_locked: return
|
||||||
|
|
||||||
|
if event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() and not event.is_echo():
|
||||||
|
pick(options.find(draggable))
|
||||||
|
|
||||||
|
|
||||||
func pick_cards(id: Scenes.id):
|
func pick_cards(id: Scenes.id):
|
||||||
|
prints("------------- PICKING CARDS -------------")
|
||||||
current_scene_id = id
|
current_scene_id = id
|
||||||
hide()
|
hide()
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
|
|
||||||
|
|
@ -1741,11 +1741,9 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
mouse_filter = 2
|
|
||||||
script = ExtResource("1_pjntm")
|
script = ExtResource("1_pjntm")
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
[node name="Control" type="Control" parent="."]
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="label" type="Label" parent="Control"]
|
[node name="label" type="Label" parent="Control"]
|
||||||
|
|
@ -1759,6 +1757,7 @@ horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="cards" type="Panel" parent="."]
|
[node name="cards" type="Panel" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="card_1" type="Control" parent="cards"]
|
[node name="card_1" type="Control" parent="cards"]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
|
@ -1767,6 +1766,7 @@ offset_top = 25.0
|
||||||
offset_right = -317.0
|
offset_right = -317.0
|
||||||
offset_bottom = 25.0
|
offset_bottom = 25.0
|
||||||
rotation = -0.109599
|
rotation = -0.109599
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="cards/card_1"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="cards/card_1"]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
@ -1777,6 +1777,7 @@ libraries = {
|
||||||
|
|
||||||
[node name="card_2" type="Control" parent="cards"]
|
[node name="card_2" type="Control" parent="cards"]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="cards/card_2"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="cards/card_2"]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
@ -1802,11 +1803,13 @@ libraries = {
|
||||||
|
|
||||||
[node name="sticky_notes" type="Panel" parent="."]
|
[node name="sticky_notes" type="Panel" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="sticky_note_1" type="Control" parent="sticky_notes"]
|
[node name="sticky_note_1" type="Control" parent="sticky_notes"]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = -150.0
|
offset_top = -150.0
|
||||||
offset_bottom = -150.0
|
offset_bottom = -150.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_1"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_1"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
|
|
@ -1821,6 +1824,7 @@ autoplay = "ini"
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = -50.0
|
offset_top = -50.0
|
||||||
offset_bottom = -50.0
|
offset_bottom = -50.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_2"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_2"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
|
|
@ -1835,6 +1839,7 @@ autoplay = "ini"
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = 50.0
|
offset_top = 50.0
|
||||||
offset_bottom = 50.0
|
offset_bottom = 50.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_3"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_3"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
|
|
@ -1849,6 +1854,7 @@ autoplay = "ini"
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = 150.0
|
offset_top = 150.0
|
||||||
offset_bottom = 150.0
|
offset_bottom = 150.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_4"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="sticky_notes/sticky_note_4"]
|
||||||
root_node = NodePath(".")
|
root_node = NodePath(".")
|
||||||
|
|
@ -1861,6 +1867,7 @@ autoplay = "ini"
|
||||||
|
|
||||||
[node name="thought_prompt" type="Control" parent="."]
|
[node name="thought_prompt" type="Control" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="thought_prompt"]
|
[node name="Label" type="Label" parent="thought_prompt"]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ class_name Playable
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
hide()
|
hide()
|
||||||
|
if get_parent() == get_tree().root:
|
||||||
|
play.call_deferred()
|
||||||
|
|
||||||
## Awaitable that encapsulates the core interaction with this Playable
|
## Awaitable that encapsulates the core interaction with this Playable
|
||||||
func play() -> void:
|
func play() -> void:
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ func _ready() -> void:
|
||||||
else:
|
else:
|
||||||
print_debug("main.gd: direct boot (hiding menus and entering main loop)")
|
print_debug("main.gd: direct boot (hiding menus and entering main loop)")
|
||||||
app_state = AppState.PLAY
|
app_state = AppState.PLAY
|
||||||
|
curtain.open()
|
||||||
|
|
||||||
|
|
||||||
func start_game(save: SaveGame) -> void:
|
func start_game(save: SaveGame) -> void:
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
script = ExtResource("1_rqkns")
|
script = ExtResource("1_rqkns")
|
||||||
youth_room_path = "uid://b3b0gyvklqn50"
|
youth_room_path = "uid://b3b0gyvklqn50"
|
||||||
transition_room_path = "uid://fgp3s28h7msy"
|
transition_room_path = "uid://fgp3s28h7msy"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue