feat(engine): convert PauseScreen to modal + add ForfeitConfirmScreen
Pause overlay drops its bespoke full-screen layout and is rebuilt on the standard `ui_modal` scaffold: uniform scrim, centred card, real Resume (Primary, Esc) and Forfeit (Tertiary, G) action buttons. The Draw Mode row stays inline in the body so the existing toggle still fires `SettingsChangedEvent`. The G-key double-press toast countdown is replaced with a real modal: `G` (or clicking Forfeit on Pause) fires the new `ForfeitRequestEvent`, which `PausePlugin` answers by spawning `ForfeitConfirmScreen` at `Z_PAUSE_DIALOG` (above pause). The modal exposes Cancel + "Yes, forfeit" buttons plus Y/Enter/N/Esc accelerators; confirmation despawns both modals, clears `PausedResource`, and fires `ForfeitEvent` for `StatsPlugin`. `toggle_pause` now early-returns when a forfeit modal is visible (and runs `.before(handle_forfeit_keyboard)`) so an Esc that closes the forfeit modal doesn't also re-open pause in the same frame. The legacy `forfeit_countdown` field, `FORFEIT_CONFIRM_WINDOW` constant, and the six pure-function countdown tests are removed; new tests cover the modal-spawn / confirm / cancel paths and the active- game predicate that still gates the G hotkey. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -69,9 +69,9 @@ pub use font_plugin::{FontPlugin, FontResource};
|
||||
pub use cursor_plugin::CursorPlugin;
|
||||
pub use events::{
|
||||
AchievementUnlockedEvent, CardFaceRevealedEvent, CardFlippedEvent, DrawRequestEvent,
|
||||
ForfeitEvent, GameWonEvent, HelpRequestEvent, HintVisualEvent, InfoToastEvent,
|
||||
ManualSyncRequestEvent, MoveRejectedEvent, MoveRequestEvent, NewGameConfirmEvent,
|
||||
NewGameRequestEvent, PauseRequestEvent, StartChallengeRequestEvent,
|
||||
ForfeitEvent, ForfeitRequestEvent, GameWonEvent, HelpRequestEvent, HintVisualEvent,
|
||||
InfoToastEvent, ManualSyncRequestEvent, MoveRejectedEvent, MoveRequestEvent,
|
||||
NewGameConfirmEvent, NewGameRequestEvent, PauseRequestEvent, StartChallengeRequestEvent,
|
||||
StartDailyChallengeRequestEvent, StartTimeAttackRequestEvent, StartZenRequestEvent,
|
||||
StateChangedEvent, SyncCompleteEvent, ToggleAchievementsRequestEvent,
|
||||
ToggleLeaderboardRequestEvent, ToggleProfileRequestEvent, ToggleSettingsRequestEvent,
|
||||
@@ -87,7 +87,7 @@ pub use hud_plugin::{
|
||||
pub use leaderboard_plugin::{LeaderboardPlugin, LeaderboardResource, LeaderboardScreen};
|
||||
pub use input_plugin::InputPlugin;
|
||||
pub use onboarding_plugin::{OnboardingPlugin, OnboardingScreen};
|
||||
pub use pause_plugin::{PausePlugin, PauseScreen, PausedResource};
|
||||
pub use pause_plugin::{ForfeitConfirmScreen, PausePlugin, PauseScreen, PausedResource};
|
||||
pub use profile_plugin::{ProfilePlugin, ProfileScreen};
|
||||
pub use settings_plugin::{
|
||||
SettingsChangedEvent, SettingsPlugin, SettingsResource, SettingsScreen, SFX_STEP,
|
||||
|
||||
Reference in New Issue
Block a user