feat(engine): UX iteration round — tooltip slider, streak fire, score breakdown
Three small UX improvements bundled because they share ui_theme token
edits.
Tooltip-delay slider in Settings → Gameplay
- Settings.tooltip_delay_secs (f32, #[serde(default)] = 0.5) tunable
via "−" / "+" icon buttons next to a value readout. Range
[TOOLTIP_DELAY_MIN_SECS, TOOLTIP_DELAY_MAX_SECS] = [0.0, 1.5] in
TOOLTIP_DELAY_STEP_SECS (0.1) increments. "Instant" label when
value is 0; "{n:.1} s" otherwise.
- ui_tooltip's hover-delay comparison reads from SettingsResource
with MOTION_TOOLTIP_DELAY_SECS as the fallback when the resource
is absent (test path). New tooltip_should_show(elapsed, delay)
pure helper covers the boundary cases.
- adjust_tooltip_delay clamps; sanitized() carries the clamp through
load. Five round-trip / default / legacy-deserialise tests.
Win-streak milestone fire animation
- New WinStreakMilestoneEvent { streak: u32 } fired from stats_plugin
when win_streak_current crosses any of [3, 5, 10] (only the
threshold crossing — not every subsequent win). HUD streak readout
scale-pulses 1.0 → 1.20 → 1.0 over MOTION_STREAK_FLOURISH_SECS
(0.6 s) on receipt; mirrors the foundation-flourish curve shape.
- Three threshold-crossing tests pin the firing contract.
Score-breakdown reveal on the win modal
- Win modal body replaces the single "Score: N" line with a
per-component reveal: Base score, Time bonus (m:ss), No-undo
bonus, Mode multiplier, separator, Total. Rows fade in over
MOTION_SCORE_BREAKDOWN_FADE_SECS (0.12 s) staggered by
MOTION_SCORE_BREAKDOWN_STAGGER_SECS (0.15 s) so the math reads as
it animates. Skipped rows: zero time bonus, undo-tainted no-undo
bonus, multiplier == 1.0.
- Honours AnimSpeed::Instant: rows spawn fully visible, no stagger.
- New ScoreBreakdown::compute helper sources base from
GameWonEvent.score, time bonus from
solitaire_core::scoring::compute_time_bonus, no-undo from a +25
constant when undo_count == 0, mode multiplier from GameMode (Zen
zeros the total). 9 new tests cover the math and the reveal
cadence.
Test count net: +25 across the workspace (1007 → 1031).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,26 @@ pub struct FoundationCompletedEvent {
|
||||
pub suit: Suit,
|
||||
}
|
||||
|
||||
/// Fired by `StatsPlugin` when the player's `win_streak_current`
|
||||
/// crosses one of the milestone thresholds in
|
||||
/// [`crate::ui_theme::STREAK_MILESTONES`] (currently 3, 5, 10).
|
||||
///
|
||||
/// Fires only on the threshold crossing — i.e. when the previous
|
||||
/// streak was below the threshold and the post-win streak is at or
|
||||
/// above it — so subsequent wins past the highest milestone do not
|
||||
/// retrigger the flourish.
|
||||
///
|
||||
/// Drives the HUD streak-milestone flourish (a brief scale pulse on
|
||||
/// the score readout) and an informational toast. UI/audio cue only;
|
||||
/// not persisted, not synchronised.
|
||||
#[derive(Message, Debug, Clone, Copy)]
|
||||
pub struct WinStreakMilestoneEvent {
|
||||
/// The new `win_streak_current` value at the moment the
|
||||
/// threshold was crossed. Always equal to a value in
|
||||
/// [`crate::ui_theme::STREAK_MILESTONES`].
|
||||
pub streak: u32,
|
||||
}
|
||||
|
||||
/// Fired when a card's face-up state changes during gameplay.
|
||||
#[derive(Message, Debug, Clone, Copy)]
|
||||
pub struct CardFlippedEvent(pub u32);
|
||||
|
||||
Reference in New Issue
Block a user