모든 게임: 결과·팝업은 애니메이션이 끝난 뒤에, 증강 윷놀이: 이의있음!이 다음 판에도 뜨게, 증강 고르는 목록·나오게 할 증강을 팝업 목록으로
- lib/motion: motionBusy / useMotionHold / useMotionSettled / useAfterMotionValue / AfterMotion - 방 화면: 결과 창과 상태 줄은 판이 멈춘 뒤에(실시간 게임은 상태 줄 그대로), 새 판마다 판 화면을 새로 그림 (결과 창에 둔 채 다음 판이 시작되면 이전 판의 효과 번호가 남아 이의있음!·알림이 안 뜨던 문제) - 41개 게임: 결과 패널·배너·점수·팝업이 마지막 움직임 뒤에 나오도록 게임별로 정리 - 증강 윷놀이: 명탐정·배달·손버릇·따라쟁이·착각 대상은 아이콘과 설명이 다 보이는 목록에서, 방 설정의 나오게 할 증강은 팝업 목록에서 스위치로 켜고 끔 - e2e: 늦게 바뀌는 상태 줄·결과 창과 새 증강 화면에 맞춤 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import type { PublicUser } from '@bg/shared/lite';
|
||||
import { Avatar, ConfirmSheet } from '../../components/ui';
|
||||
import { TurnTimer, useServerNow } from '../../components/TurnTimer';
|
||||
import { haptic, sfx, sounds } from '../../lib/feedback';
|
||||
import { AfterMotion, useAfterMotionValue, useMotionSettled } from '../../lib/motion';
|
||||
import type { BoardProps, GameUI, OptionsProps } from '../types';
|
||||
import { MascotIcon, RaceCard } from './art';
|
||||
import { helpNow } from './help';
|
||||
@@ -708,8 +709,9 @@ function Board({ view: v, me, players, act, pending }: BoardProps<HotStreakView>
|
||||
}
|
||||
}, [v.turnSeq]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
const lastRes = v.results.at(-1);
|
||||
const showPayout = v.phase === 'payout' && lastRes && !replay.busy;
|
||||
const answered = v.phase === 'payout' && lastRes && !replay.busy ? lastRes.side.yes : null;
|
||||
// The payout and the side answer wait until the race has played to the end (its last 1등!/실격! floats included).
|
||||
const showPayout = useMotionSettled(v.phase === 'payout' && !!lastRes && !replay.busy);
|
||||
const answered = showPayout && lastRes ? lastRes.side.yes : null;
|
||||
const r = v.race;
|
||||
const house = HOUSE(v);
|
||||
const shownLog = r && line ? r.log.filter((l) => l.n <= line.n) : [];
|
||||
@@ -726,12 +728,14 @@ function Board({ view: v, me, players, act, pending }: BoardProps<HotStreakView>
|
||||
))}
|
||||
{v.phase !== 'finished' && <SideCard v={v} answered={answered} />}
|
||||
</div>
|
||||
{v.result && <FinalPanel v={v} me={me} players={players} />}
|
||||
<AfterMotion when={!!v.result}>
|
||||
<FinalPanel v={v} me={me} players={players} />
|
||||
</AfterMotion>
|
||||
{v.phase === 'draft' && v.mode === 'tickets' && v.draft && <DraftPanel v={v} me={me} players={players} act={act} pending={pending} />}
|
||||
{v.phase === 'double' && <DoublePanel v={v} me={me} players={players} act={act} pending={pending} />}
|
||||
{v.phase === 'draft' && v.mode === 'pots' && <PotPanel v={v} me={me} act={act} pending={pending} />}
|
||||
{v.phase === 'submit' && <SubmitPanel v={v} me={me} act={act} pending={pending} />}
|
||||
{showPayout && <PayoutPanel v={v} me={me} players={players} act={act} pending={pending} res={lastRes} />}
|
||||
{showPayout && lastRes && <PayoutPanel v={v} me={me} players={players} act={act} pending={pending} res={lastRes} />}
|
||||
<RaceArea v={v} me={me} act={act} pending={pending} replay={replay} compact={compact} />
|
||||
{v.faceUp.length > 0 && (v.phase === 'draft' || v.phase === 'double' || v.phase === 'submit') && <DeckList v={v} />}
|
||||
{shownLog.length > 0 && (
|
||||
@@ -779,6 +783,9 @@ function Side({ view: v, me, players, act, deadline, active }: BoardProps<HotStr
|
||||
const total = v.options.turnSeconds ? v.options.turnSeconds * 1000 : 30_000;
|
||||
const playing = v.phase !== 'finished';
|
||||
const timed = v.phase === 'draft' || v.phase === 'double' || v.phase === 'submit';
|
||||
// Money changes at the payout: the new amounts show once the race has finished playing on the board.
|
||||
const moneyKey = useAfterMotionValue(v.seats.map((p) => v.money[p] ?? 0).join(','));
|
||||
const money = Object.fromEntries(v.seats.map((p, i) => [p, Number(moneyKey.split(',')[i] ?? v.money[p] ?? 0)]));
|
||||
return (
|
||||
<>
|
||||
<section className="card stack" style={{ padding: 12, gap: 8 }} aria-label="참가자">
|
||||
@@ -797,8 +804,8 @@ function Side({ view: v, me, players, act, deadline, active }: BoardProps<HotStr
|
||||
</div>
|
||||
<div className="small muted">{statusOf(v, p)}</div>
|
||||
</div>
|
||||
<strong style={{ fontSize: '1.15rem', fontVariantNumeric: 'tabular-nums' }} aria-label={`${nick(players, p)} ${v.money[p]}달러`}>
|
||||
{$(v.money[p]!)}
|
||||
<strong style={{ fontSize: '1.15rem', fontVariantNumeric: 'tabular-nums' }} aria-label={`${nick(players, p)} ${money[p]}달러`}>
|
||||
{$(money[p]!)}
|
||||
</strong>
|
||||
{on && playing && <TurnTimer deadline={deadline} totalMs={total} mine={p === me} size={34} />}
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useEffect, useRef, useState, type ReactElement } from 'react';
|
||||
import type { HsRaceView, RaceLine, Racer } from '@bg/games/hot-streak';
|
||||
import { MASCOTS, MASCOT_IDS, josa, type MascotId } from '@bg/games/hot-streak/cards';
|
||||
import { noise, sfx, tone } from '../../lib/feedback';
|
||||
import { fxMs } from '../../lib/motion';
|
||||
import { fxMs, useMotionHold } from '../../lib/motion';
|
||||
import { MascotFace } from './art';
|
||||
|
||||
export const reducedMotion = () => typeof matchMedia !== 'undefined' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
@@ -210,6 +210,8 @@ export function useReplay(r: HsRaceView | null) {
|
||||
q.current.push(...fresh);
|
||||
if (!s.playing) pump();
|
||||
}, [r?.no, r?.log.at(-1)?.n]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
// The lines play with timers (gaps between hops are not animations): results wait until the last line has played.
|
||||
useMotionHold(busy);
|
||||
|
||||
return { shown, floats, busy };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user