Reach Settings/Profile from the pause menu, with a way back

The pause menu (Escape during a question/CCS/flashcards run) only had
Resume/UI Sounds/Exit Run/Log Out. Settings already has an equivalent
"Interface sounds" toggle, so drop the duplicate from the pause menu.
More importantly, "player" and "ccs_player" hide the entire app shell
(header + sidebar), so there was no way to reach Settings or Profile
at all mid-session - add Profile/Settings buttons to the pause menu to
close that gap.

Navigating there follows the existing return_screen payload
convention (already used by simulation_history/results/review) rather
than inventing new navigation infrastructure: _navigate_from_pause()
remembers current_screen_name and passes it through show_screen's
payload. Both screens show a "Back to session" button when that's
set, and hide it otherwise (including on ordinary non-paused visits).

show_screen() unconditionally resumes the question timer via
_close_app_menu() as a side effect of any navigation, so
_navigate_from_pause() re-pauses it immediately when leaving "player" -
the timer then resumes for real, for free, when the user actually
returns via show_screen(return_screen).

progress_profile.gd rebuilds its whole child tree on every theme
toggle (_rebuild -> _build), which would otherwise wipe the button's
visibility - added _refresh_back_to_session_visibility(), called both
after _build() and from on_show(), so it survives a theme change while
paused.

Flipped tests/web_responsive_test.gd's assertion, which previously
required the pause menu NOT to have a Profile button.

Verified end-to-end headlessly: opening the pause menu from a live
"player" session, navigating to Settings and Profile, confirming
current_question_pause_started_at is correctly paused while away and
resumed on return, confirming the back-to-session button appears only
when reached via pause (not on ordinary nav), and confirming it
survives a dark/light theme toggle on the Profile screen.
This commit is contained in:
hz
2026-07-25 22:30:03 -05:00
parent aa5497c516
commit 46953ee71a
4 changed files with 73 additions and 12 deletions
+23 -9
View File
@@ -11,7 +11,6 @@ var header_title: Label
var environment_badge: Label
var app_menu: PanelContainer
var menu_exit_button: Button
var sound_toggle: CheckButton
var theme_button: Button
var feedback_button: Button
var feedback_dialog: Control
@@ -855,7 +854,7 @@ func _build_app_menu() -> void:
app_menu.visible = false
app_menu.top_level = true
app_menu.mouse_filter = Control.MOUSE_FILTER_STOP
app_menu.custom_minimum_size = Vector2(340, 230)
app_menu.custom_minimum_size = Vector2(340, 290)
app_menu.add_theme_stylebox_override("panel", Style.panel_box(Color("172337"), Style.CYAN))
add_child(app_menu)
@@ -877,13 +876,21 @@ func _build_app_menu() -> void:
resume.pressed.connect(_close_app_menu)
content.add_child(resume)
sound_toggle = CheckButton.new()
sound_toggle.text = "UI Sounds"
sound_toggle.button_pressed = UISoundService.are_sounds_enabled()
sound_toggle.custom_minimum_size = Vector2(0, 44)
UISoundService.set_button_sound(sound_toggle, "none")
sound_toggle.toggled.connect(UISoundService.set_sounds_enabled)
content.add_child(sound_toggle)
var profile_button := Button.new()
profile_button.text = "Profile"
profile_button.custom_minimum_size = Vector2(0, 48)
Style.style_chip(profile_button, Style.CYAN)
UISoundService.set_button_sound(profile_button, "open")
profile_button.pressed.connect(_navigate_from_pause.bind("profile"))
content.add_child(profile_button)
var settings_button := Button.new()
settings_button.text = "Settings"
settings_button.custom_minimum_size = Vector2(0, 48)
Style.style_chip(settings_button, Style.CYAN)
UISoundService.set_button_sound(settings_button, "open")
settings_button.pressed.connect(_navigate_from_pause.bind("settings"))
content.add_child(settings_button)
menu_exit_button = Button.new()
menu_exit_button.text = "Exit Run"
@@ -929,6 +936,13 @@ func _close_app_menu() -> void:
BlockSessionService.resume_current_question_timer()
func _navigate_from_pause(target_screen: String) -> void:
var return_screen := current_screen_name
show_screen(target_screen, {"return_screen": return_screen})
if return_screen == "player":
BlockSessionService.pause_current_question_timer()
func _exit_run() -> void:
_close_app_menu()
if current_screen_name == "ccs_player":