From 11cb53ab2946f68a1d690caccc08c8f68757cd1e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Apr 2026 02:57:34 +0000 Subject: [PATCH] =?UTF-8?q?feat(engine):=20InfoToastEvent=20=E2=80=94=20sh?= =?UTF-8?q?ow=20locked-mode=20messages=20on-screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- solitaire_engine/src/animation_plugin.rs | 10 +++++++++- solitaire_engine/src/challenge_plugin.rs | 11 ++++++----- solitaire_engine/src/events.rs | 5 +++++ solitaire_engine/src/input_plugin.rs | 13 +++++++------ solitaire_engine/src/lib.rs | 6 +++--- solitaire_engine/src/time_attack_plugin.rs | 11 ++++++----- 6 files changed, 36 insertions(+), 20 deletions(-) diff --git a/solitaire_engine/src/animation_plugin.rs b/solitaire_engine/src/animation_plugin.rs index 348055f..8de9ccc 100644 --- a/solitaire_engine/src/animation_plugin.rs +++ b/solitaire_engine/src/animation_plugin.rs @@ -11,7 +11,7 @@ use crate::auto_complete_plugin::AutoCompleteState; use crate::card_plugin::CardEntity; use crate::challenge_plugin::ChallengeAdvancedEvent; use crate::daily_challenge_plugin::{DailyChallengeCompletedEvent, DailyGoalAnnouncementEvent}; -use crate::events::NewGameConfirmEvent; +use crate::events::{InfoToastEvent, NewGameConfirmEvent}; use crate::events::{AchievementUnlockedEvent, GameWonEvent}; use crate::game_plugin::GameMutation; use crate::layout::LayoutResource; @@ -93,6 +93,7 @@ impl Plugin for AnimationPlugin { .add_event::() .add_event::() .add_event::() + .add_event::() .init_resource::() .add_systems(Startup, init_slide_duration) .add_systems( @@ -111,6 +112,7 @@ impl Plugin for AnimationPlugin { handle_settings_toast, handle_auto_complete_toast, handle_new_game_confirm_toast, + handle_info_toast, tick_toasts, ) .after(GameMutation), @@ -322,6 +324,12 @@ fn handle_new_game_confirm_toast( } } +fn handle_info_toast(mut commands: Commands, mut events: EventReader) { + for ev in events.read() { + spawn_toast(&mut commands, ev.0.clone(), 3.0); + } +} + fn tick_toasts( mut commands: Commands, time: Res