feat(engine): Esc dismisses Home / accepts default on Restore prompt
Home and Restore-prompt previously ignored Esc, which after the last fix meant Esc just did nothing on those screens. Now both honor the "Esc closes the modal" convention every other modal already follows. - Home: Esc behaves like the Cancel button — despawns the modal so the player keeps the underlying default deal. - Restore: Esc maps to Continue rather than New Game; a reflexive dismiss press preserves the saved game, matching how the primary action already advertises the Enter accelerator. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -333,10 +333,16 @@ fn handle_home_card_click(
|
||||
|
||||
fn handle_home_cancel_button(
|
||||
mut commands: Commands,
|
||||
keys: Option<Res<ButtonInput<KeyCode>>>,
|
||||
cancel_buttons: Query<&Interaction, (With<HomeCancelButton>, Changed<Interaction>)>,
|
||||
screens: Query<Entity, With<HomeScreen>>,
|
||||
) {
|
||||
if !cancel_buttons.iter().any(|i| *i == Interaction::Pressed) {
|
||||
if screens.is_empty() {
|
||||
return;
|
||||
}
|
||||
let click = cancel_buttons.iter().any(|i| *i == Interaction::Pressed);
|
||||
let esc = keys.is_some_and(|k| k.just_pressed(KeyCode::Escape));
|
||||
if !click && !esc {
|
||||
return;
|
||||
}
|
||||
for entity in &screens {
|
||||
|
||||
Reference in New Issue
Block a user