feat(engine): surface daily/weekly completions as toasts + progression panel

Phase 6 part 3 (partial):
- AnimationPlugin now shows a 3-second toast on DailyChallengeCompletedEvent
  and WeeklyGoalCompletedEvent.
- Stats overlay (S key) appends a Progression section with level, total XP,
  daily streak, and a live Weekly Goals list pulling from WEEKLY_GOALS.

Special modes (Time Attack / Challenge / Zen) and unlock UI deferred.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-24 19:28:13 -07:00
parent 0609d4eef3
commit 363ddc9b75
2 changed files with 76 additions and 6 deletions
+34
View File
@@ -7,10 +7,12 @@ use bevy::prelude::*;
use crate::achievement_plugin::display_name_for;
use crate::card_plugin::CardEntity;
use crate::daily_challenge_plugin::DailyChallengeCompletedEvent;
use crate::events::{AchievementUnlockedEvent, GameWonEvent};
use crate::game_plugin::GameMutation;
use crate::layout::LayoutResource;
use crate::progress_plugin::LevelUpEvent;
use crate::weekly_goals_plugin::WeeklyGoalCompletedEvent;
/// Duration of a card slide (move) animation in seconds.
pub const SLIDE_SECS: f32 = 0.15;
@@ -18,6 +20,8 @@ pub const SLIDE_SECS: f32 = 0.15;
const WIN_TOAST_SECS: f32 = 4.0;
const ACHIEVEMENT_TOAST_SECS: f32 = 3.0;
const LEVELUP_TOAST_SECS: f32 = 3.0;
const DAILY_TOAST_SECS: f32 = 3.0;
const WEEKLY_TOAST_SECS: f32 = 3.0;
const CASCADE_STAGGER: f32 = 0.05;
const CASCADE_DURATION: f32 = 0.5;
@@ -53,6 +57,8 @@ impl Plugin for AnimationPlugin {
app.add_event::<GameWonEvent>()
.add_event::<AchievementUnlockedEvent>()
.add_event::<LevelUpEvent>()
.add_event::<DailyChallengeCompletedEvent>()
.add_event::<WeeklyGoalCompletedEvent>()
.add_systems(
Update,
(
@@ -60,6 +66,8 @@ impl Plugin for AnimationPlugin {
handle_win_cascade,
handle_achievement_toast,
handle_levelup_toast,
handle_daily_toast,
handle_weekly_toast,
tick_toasts,
)
.after(GameMutation),
@@ -147,6 +155,32 @@ fn handle_levelup_toast(mut commands: Commands, mut events: EventReader<LevelUpE
}
}
fn handle_daily_toast(
mut commands: Commands,
mut events: EventReader<DailyChallengeCompletedEvent>,
) {
for ev in events.read() {
spawn_toast(
&mut commands,
format!("Daily Challenge Complete! (Streak: {})", ev.streak),
DAILY_TOAST_SECS,
);
}
}
fn handle_weekly_toast(
mut commands: Commands,
mut events: EventReader<WeeklyGoalCompletedEvent>,
) {
for ev in events.read() {
spawn_toast(
&mut commands,
format!("Weekly Goal: {}", ev.description),
WEEKLY_TOAST_SECS,
);
}
}
fn tick_toasts(
mut commands: Commands,
time: Res<Time>,