feat(web client): opponent sounds

This commit is contained in:
Henri Bourcereau 2026-05-02 20:01:30 +02:00
parent e0f059e09c
commit 60f33750eb
2 changed files with 65 additions and 2 deletions

View file

@ -224,6 +224,11 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
crate::game::sound::play_hole_scored();
}
}
if let Some(ref ev) = opp_scored_event {
if ev.holes_gained > 0 {
crate::game::sound::play_opp_hole_scored();
}
}
// ── Capture for closures ───────────────────────────────────────────────────
let stage = vs.stage.clone();
@ -473,6 +478,11 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
// ── Game-over overlay ─────────────────────────────────────────────
{stage_is_ended.then(|| {
if winner_is_me {
crate::game::sound::play_victory();
} else {
crate::game::sound::play_defeat();
}
let opp_name_end_clone = opp_name_end.clone();
let winner_text = move || if winner_is_me {
t_string!(i18n, you_win).to_owned()