feat(engine): InfoToastEvent — show locked-mode messages on-screen

Replaces silent info!() log calls with on-screen toasts when the player
presses Z/X/T without reaching the required unlock level. Any system
can now fire InfoToastEvent(message) to surface a brief text overlay
without depending on a specific plugin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-04-27 02:57:34 +00:00
parent 4a33cbdc22
commit 11cb53ab29
6 changed files with 36 additions and 20 deletions
+7 -6
View File
@@ -25,8 +25,8 @@ use solitaire_core::rules::{can_place_on_foundation, can_place_on_tableau};
use crate::card_plugin::{CardEntity, TABLEAU_FAN_FRAC};
use crate::challenge_plugin::CHALLENGE_UNLOCK_LEVEL;
use crate::events::{
DrawRequestEvent, MoveRejectedEvent, MoveRequestEvent, NewGameConfirmEvent, NewGameRequestEvent,
StateChangedEvent, UndoRequestEvent,
DrawRequestEvent, InfoToastEvent, MoveRejectedEvent, MoveRequestEvent, NewGameConfirmEvent,
NewGameRequestEvent, StateChangedEvent, UndoRequestEvent,
};
use crate::game_plugin::GameMutation;
use crate::progress_plugin::ProgressResource;
@@ -48,6 +48,7 @@ pub struct InputPlugin;
impl Plugin for InputPlugin {
fn build(&self, app: &mut App) {
app.add_event::<NewGameConfirmEvent>()
.add_event::<InfoToastEvent>()
.add_systems(
Update,
(
@@ -75,6 +76,7 @@ fn handle_keyboard(
mut undo: EventWriter<UndoRequestEvent>,
mut new_game: EventWriter<NewGameRequestEvent>,
mut confirm_event: EventWriter<NewGameConfirmEvent>,
mut info_toast: EventWriter<InfoToastEvent>,
mut draw: EventWriter<DrawRequestEvent>,
) {
// Tick down any active confirmation window.
@@ -114,10 +116,9 @@ fn handle_keyboard(
mode: Some(solitaire_core::game_state::GameMode::Zen),
});
} else {
info!(
"Zen mode locked — reach level {} (currently {}).",
CHALLENGE_UNLOCK_LEVEL, level
);
info_toast.send(InfoToastEvent(format!(
"Zen mode unlocks at level {CHALLENGE_UNLOCK_LEVEL}"
)));
}
}
if keys.just_pressed(KeyCode::KeyD) {