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:
@@ -361,6 +361,14 @@ pub const MOTION_CASCADE_STAGGER_SECS: f32 = 0.06;
|
||||
/// (overshoot) plus ±15° Z-rotation. 500 ms.
|
||||
pub const MOTION_CASCADE_SLIDE_SECS: f32 = 0.50;
|
||||
|
||||
/// Per-line stagger between score-breakdown rows during the win modal
|
||||
/// reveal animation, in seconds.
|
||||
pub const MOTION_SCORE_BREAKDOWN_STAGGER_SECS: f32 = 0.15;
|
||||
|
||||
/// Per-line fade-in duration during the win modal score reveal, in
|
||||
/// seconds.
|
||||
pub const MOTION_SCORE_BREAKDOWN_FADE_SECS: f32 = 0.12;
|
||||
|
||||
/// Screen shake on win — wider and longer than the old 0.6 s / 8 px.
|
||||
/// 800 ms.
|
||||
pub const MOTION_WIN_SHAKE_SECS: f32 = 0.80;
|
||||
@@ -395,6 +403,23 @@ pub const MOTION_FOUNDATION_FLOURISH_SECS: f32 = 0.4;
|
||||
/// 1.0 at `t=0` to this value at `t=0.5` and back to 1.0 at `t=1.0`.
|
||||
pub const FOUNDATION_FLOURISH_PEAK_SCALE: f32 = 1.15;
|
||||
|
||||
/// Total duration of the streak-milestone flourish on the HUD score
|
||||
/// readout, in seconds. Mirrors the foundation flourish in feel — a
|
||||
/// brief celebratory pulse that does not block subsequent gameplay.
|
||||
pub const MOTION_STREAK_FLOURISH_SECS: f32 = 0.6;
|
||||
|
||||
/// Peak scale magnification reached at the midpoint of the streak
|
||||
/// flourish (1.0 → this → 1.0). Larger than the foundation flourish
|
||||
/// peak so the lifetime-streak celebration reads as a bigger deal than
|
||||
/// the per-suit completion.
|
||||
pub const STREAK_FLOURISH_PEAK_SCALE: f32 = 1.20;
|
||||
|
||||
/// Win-streak counts that trigger the flourish. The flourish fires
|
||||
/// only when the streak crosses a threshold from below — never at
|
||||
/// every win past the highest threshold. Static for now; could become
|
||||
/// a `Settings`-tunable list later if play-testing surfaces it.
|
||||
pub const STREAK_MILESTONES: &[u32] = &[3, 5, 10];
|
||||
|
||||
/// Loading-ellipsis cycle — `.`/`..`/`...` toggles every step.
|
||||
/// 400 ms.
|
||||
pub const MOTION_LOADING_TICK_SECS: f32 = 0.40;
|
||||
|
||||
Reference in New Issue
Block a user