From 07bf1977bd2a29ab88bacc927ca91f352464fed0 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 27 Apr 2026 02:05:08 +0000 Subject: [PATCH] feat(engine): win toast includes score and time "You Win!" now displays "You Win! Score: N Time: M:SS" so the player sees their result without opening the stats screen. Co-Authored-By: Claude Sonnet 4.6 --- solitaire_engine/src/animation_plugin.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/solitaire_engine/src/animation_plugin.rs b/solitaire_engine/src/animation_plugin.rs index 5eb00e9..94eee73 100644 --- a/solitaire_engine/src/animation_plugin.rs +++ b/solitaire_engine/src/animation_plugin.rs @@ -159,9 +159,9 @@ fn handle_win_cascade( cards: Query<(Entity, &Transform), With>, layout: Option>, ) { - if events.read().next().is_none() { + let Some(ev) = events.read().next() else { return; - } + }; let margin = layout.as_ref().map_or(800.0, |l| l.0.card_size.x * 8.0); @@ -177,7 +177,10 @@ fn handle_win_cascade( Vec3::new(-margin, 0.0, 300.0), ]; - spawn_toast(&mut commands, "You Win!".to_string(), WIN_TOAST_SECS); + let m = ev.time_seconds / 60; + let s = ev.time_seconds % 60; + let win_msg = format!("You Win! Score: {} Time: {m}:{s:02}", ev.score); + spawn_toast(&mut commands, win_msg, WIN_TOAST_SECS); for (i, (entity, transform)) in cards.iter().enumerate() { commands.entity(entity).insert(CardAnim {