fix: Pause Menu works.
This commit is contained in:
parent
03f427b76a
commit
d58225f21b
|
|
@ -1,23 +1,27 @@
|
|||
class_name CardBurner
|
||||
extends Playable
|
||||
|
||||
|
||||
@onready var cursor: CandleCursor = %CandleCursor
|
||||
@onready var ancors: Array[Control] = [%Ancor1, %Ancor2, %Ancor3, %Ancor4]
|
||||
|
||||
signal card_burned
|
||||
|
||||
|
||||
var cards : Array[Card] = []
|
||||
var _submitted := false
|
||||
|
||||
var _populated : bool = false
|
||||
|
||||
var _input_locked : bool:
|
||||
get: return _submitted or not visible
|
||||
get: return _submitted or not visible or not _populated
|
||||
|
||||
|
||||
func _ready():
|
||||
print("CardBurner.gd: %s._ready()" % self.name)
|
||||
super._ready()
|
||||
%SkipButton.pressed.connect(card_burned.emit)
|
||||
|
||||
|
||||
func vanish():
|
||||
super.vanish()
|
||||
await Main.curtain.black() # Go straight to loading screen
|
||||
|
|
@ -27,7 +31,21 @@ func vanish():
|
|||
## Main play coroutine - simple linear flow for burning a card
|
||||
func play() -> void:
|
||||
print("CardBurner: Starting card burning sequence")
|
||||
_populate()
|
||||
|
||||
# 4. Wait for player to burn a card (or skip)
|
||||
print("CardBurner: Waiting for player to burn a card...")
|
||||
await card_burned
|
||||
|
||||
# 5. Play vanish animation and wait for completion
|
||||
print("CardBurner: Card burned, playing vanish animation")
|
||||
$AnimationPlayer.play("vanish")
|
||||
await $AnimationPlayer.animation_finished
|
||||
|
||||
print("CardBurner: Sequence complete")
|
||||
|
||||
|
||||
func _populate() -> void:
|
||||
# 1. Get all card names from the board (excluding stickies which start with "p")
|
||||
var card_names: Array[StringName] = []
|
||||
for item_name in State.save_game.board_positions.keys():
|
||||
|
|
@ -51,18 +69,7 @@ func play() -> void:
|
|||
print("CardBurner: Added card '%s' to anchor" % card.name)
|
||||
|
||||
print("CardBurner: ", len(cards))
|
||||
|
||||
# 4. Wait for player to burn a card (or skip)
|
||||
print("CardBurner: Waiting for player to burn a card...")
|
||||
await card_burned
|
||||
|
||||
# 5. Play vanish animation and wait for completion
|
||||
print("CardBurner: Card burned, playing vanish animation")
|
||||
$AnimationPlayer.play("vanish")
|
||||
await $AnimationPlayer.animation_finished
|
||||
|
||||
print("CardBurner: Sequence complete")
|
||||
|
||||
_populated = true
|
||||
|
||||
func handle_hover(card: Draggable) -> void:
|
||||
if _input_locked: return
|
||||
|
|
@ -80,6 +87,7 @@ func handle_mouse_button(event: InputEventMouseButton, card: Card) -> void:
|
|||
if event.button_index == MOUSE_BUTTON_MASK_LEFT and event.is_pressed() and not event.is_echo():
|
||||
_submit(card)
|
||||
|
||||
|
||||
func _submit(card : Card):
|
||||
_submitted = true
|
||||
%ActionPrompt.visible = false
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ func pick(id: int) -> void:
|
|||
await yield_to
|
||||
if not card_anim_skipped: transition()
|
||||
|
||||
|
||||
func transition():
|
||||
if selection_state == CARDS_SELECTED:
|
||||
selection_state = TRANSITION
|
||||
|
|
@ -194,6 +195,7 @@ func transition():
|
|||
cards_picked.emit(out_str)
|
||||
selection_state = DONE
|
||||
|
||||
|
||||
func show_posts():
|
||||
for player:AnimationPlayer in anim_players:
|
||||
player.play("RESET")
|
||||
|
|
@ -207,6 +209,7 @@ func handle_hover(draggable: Draggable) -> void:
|
|||
if draggable.mouse_over:
|
||||
curr_selection_id = options.find(draggable)
|
||||
|
||||
|
||||
func handle_mouse_button(event: InputEventMouseButton, draggable: Draggable) -> void:
|
||||
if _input_locked: return
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,6 @@ func play_burner() -> void:
|
|||
func interact() -> void:
|
||||
Scenes.player_enable.emit(false)
|
||||
|
||||
|
||||
# we must wait for our own collapse, so it doesnt change its caption while the canvas shows
|
||||
await collapse()
|
||||
get_tree().call_group("interactables", "collapse")
|
||||
|
|
|
|||
|
|
@ -268,8 +268,7 @@ var crouch_toggled: bool = false
|
|||
var crouch_start_time: float = 0
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not enabled:
|
||||
return
|
||||
if not enabled: return
|
||||
|
||||
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
_handle_mouse_input(event)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ func _load_room(scene_path: String) -> void:
|
|||
ResourceLoader.THREAD_LOAD_LOADED:
|
||||
var next_scene := ResourceLoader.load_threaded_get(scene_path) as PackedScene
|
||||
State.room = next_scene.instantiate() as Room
|
||||
get_tree().root.add_child(State.room)
|
||||
%Stage.add_child(State.room)
|
||||
await get_tree().process_frame
|
||||
%Loading.stop()
|
||||
return
|
||||
|
|
|
|||
|
|
@ -99,6 +99,9 @@ youth_room_path = "uid://b3b0gyvklqn50"
|
|||
transition_room_path = "uid://fgp3tbah7msy"
|
||||
adulthood_room_path = "uid://flisupth27th"
|
||||
|
||||
[node name="Stage" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Curtain" parent="." instance=ExtResource("2_nbcxq")]
|
||||
unique_name_in_owner = true
|
||||
z_index = -1
|
||||
|
|
@ -132,6 +135,7 @@ layout_mode = 1
|
|||
|
||||
[node name="PauseMenu" type="Panel" parent="."]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 2
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://d7sqqr8pkydk"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_m0plu"]
|
||||
script/source = "extends Node3D
|
||||
|
||||
func _input(event : InputEvent):
|
||||
prints(name, event)
|
||||
"
|
||||
|
||||
[node name="InputOrderTests" type="Node"]
|
||||
|
||||
[node name="Item1" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item2" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item3" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item4" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item5" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item6" type="Node3D" parent="."]
|
||||
process_priority = -10
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item7" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
||||
[node name="Item8" type="Node3D" parent="."]
|
||||
script = SubResource("GDScript_m0plu")
|
||||
|
|
@ -9,7 +9,7 @@ class_name PauseMenu extends Control
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
resume_button.pressed.connect(func(): Main.state = Main.AppState.PLAY)
|
||||
resume_button.pressed.connect(func(): disappear())
|
||||
#to_menu_button.pressed.connect(_process)
|
||||
to_desktop_button.pressed.connect(func(): get_tree().quit())
|
||||
#to_settings_button.pressed.connect(_process)
|
||||
|
|
@ -19,10 +19,20 @@ func _ready() -> void:
|
|||
func _on_help_pressed():
|
||||
OS.shell_open("https://findahelpline.com/")
|
||||
|
||||
var last_mouse_mode: Input.MouseMode
|
||||
func appear():
|
||||
get_tree().paused = true
|
||||
show()
|
||||
last_mouse_mode = Input.mouse_mode
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
%ResumeButton.grab_focus.call_deferred()
|
||||
|
||||
|
||||
func disappear():
|
||||
hide()
|
||||
Input.mouse_mode = last_mouse_mode
|
||||
get_tree().paused = false
|
||||
|
||||
func _unhandled_input(_event: InputEvent) -> void:
|
||||
if not visible: return
|
||||
get_viewport().set_input_as_handled()
|
||||
|
|
|
|||
Loading…
Reference in New Issue