fix(engine): pause game timer while onboarding modal is visible
tick_elapsed_time already stopped the clock for PausedResource and HomeScreen, but not for the first-run onboarding modal. A new player reading the three welcome slides would see their first-game time inflated by however long they spent on the tutorial. Added OnboardingScreen to the early-return guard using the same pattern as HomeScreen. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -252,20 +252,25 @@ pub fn advance_elapsed(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Increment `GameState.elapsed_seconds` once per real-world second while
|
/// Increment `GameState.elapsed_seconds` once per real-world second while
|
||||||
/// the game is in progress (not won), not paused, and the launch /
|
/// the game is in progress (not won), not paused, and no blocking modal
|
||||||
/// mode-picker Home modal isn't covering the board. Stops counting on
|
/// (Home picker or first-run onboarding) is covering the board. Stops
|
||||||
/// win so the final time reflects how long the player took to solve
|
/// counting on win so the final time reflects how long the player took;
|
||||||
/// the deal; stops while the pause overlay is open; stops while Home
|
/// stops while the pause overlay is open; stops while Home is up so the
|
||||||
/// is up so the timer doesn't tick under the picker before the player
|
/// timer doesn't tick before the player commits to a deal; stops while
|
||||||
/// has actually committed to a deal.
|
/// the onboarding modal is visible so a new player's first-game time
|
||||||
|
/// isn't inflated by reading the tutorial.
|
||||||
fn tick_elapsed_time(
|
fn tick_elapsed_time(
|
||||||
time: Res<Time>,
|
time: Res<Time>,
|
||||||
mut game: ResMut<GameStateResource>,
|
mut game: ResMut<GameStateResource>,
|
||||||
mut accumulator: Local<f32>,
|
mut accumulator: Local<f32>,
|
||||||
paused: Option<Res<crate::pause_plugin::PausedResource>>,
|
paused: Option<Res<crate::pause_plugin::PausedResource>>,
|
||||||
home_screens: Query<(), With<crate::home_plugin::HomeScreen>>,
|
home_screens: Query<(), With<crate::home_plugin::HomeScreen>>,
|
||||||
|
onboarding_screens: Query<(), With<crate::onboarding_plugin::OnboardingScreen>>,
|
||||||
) {
|
) {
|
||||||
if paused.is_some_and(|p| p.0) || !home_screens.is_empty() {
|
if paused.is_some_and(|p| p.0)
|
||||||
|
|| !home_screens.is_empty()
|
||||||
|
|| !onboarding_screens.is_empty()
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let is_won = game.0.is_won;
|
let is_won = game.0.is_won;
|
||||||
|
|||||||
Reference in New Issue
Block a user