fix: avoids being able to pause during transitions; also moves pausing request responsibility to UI; also fixes issue w/ trying to pause during intro and main menu

This commit is contained in:
Duncan Brown
2022-05-10 14:37:02 -04:00
committed by Julian Murgia
parent ff178541fc
commit aeffe09e34
5 changed files with 22 additions and 7 deletions

View File

@@ -8,6 +8,9 @@ class_name ESCGame
# Emitted when the user has confirmed the crash popup
signal crash_popup_confirmed
# Signal sent when pause menu has to be displayed
signal request_pause_menu
# Editor debug modes
# NONE - No debugging
@@ -469,3 +472,14 @@ func escoria_show_ui():
# Manage signal room_deady from main.gd.
func _on_room_ready():
room_ready_for_inputs = true
# Input function to manage specific input keys.
# Note that if any child of this class wishes to override _input, the overriding
# method MUST call its parent's version (i.e. this method).
func _input(event):
if escoria.inputs_manager.input_mode == escoria.inputs_manager.INPUT_NONE:
return
if event.is_action_pressed("ui_cancel"):
emit_signal("request_pause_menu")

View File

@@ -3,8 +3,6 @@ tool
extends Node
class_name Escoria
# Signal sent when pause menu has to be displayed
signal request_pause_menu
# Signal sent when Escoria is paused
signal paused
@@ -223,9 +221,6 @@ func _input(event):
and event.is_action_pressed(ESCInputsManager.ESC_SHOW_DEBUG_PROMPT):
escoria.main.get_node("layers/debug_layer/esc_prompt_popup").popup()
if event.is_action_pressed("ui_cancel"):
emit_signal("request_pause_menu")
# Pauses or unpause the game
#

View File

@@ -50,7 +50,7 @@ var custom_input_handler = null
# Register core signals (from escoria.gd)
func register_core():
escoria.connect(
escoria.game_scene.connect(
"request_pause_menu",
self,
"_on_pause_menu_requested"

View File

@@ -336,7 +336,7 @@ func unpause_game():
escoria.set_game_paused(false)
func pause_game():
if not get_node(pause_menu).visible:
if not get_node(pause_menu).visible and not get_node(main_menu).visible:
get_node(pause_menu).reset()
get_node(pause_menu).set_save_enabled(escoria.save_manager.save_enabled)
get_node(pause_menu).show()

View File

@@ -2,6 +2,12 @@
anim_block intro_animation_player RESET
:ready | NO_UI
# Until we have a proper way to skip animations/cutscenes, we want to prevent
# something silly like being able to pause during the intro.
accept_input NONE
anim_block intro_animation_player intro
accept_input ALL
show_menu main