모든 게임: 결과·팝업은 애니메이션이 끝난 뒤에, 증강 윷놀이: 이의있음!이 다음 판에도 뜨게, 증강 고르는 목록·나오게 할 증강을 팝업 목록으로

- lib/motion: motionBusy / useMotionHold / useMotionSettled / useAfterMotionValue / AfterMotion
- 방 화면: 결과 창과 상태 줄은 판이 멈춘 뒤에(실시간 게임은 상태 줄 그대로), 새 판마다 판 화면을 새로 그림
  (결과 창에 둔 채 다음 판이 시작되면 이전 판의 효과 번호가 남아 이의있음!·알림이 안 뜨던 문제)
- 41개 게임: 결과 패널·배너·점수·팝업이 마지막 움직임 뒤에 나오도록 게임별로 정리
- 증강 윷놀이: 명탐정·배달·손버릇·따라쟁이·착각 대상은 아이콘과 설명이 다 보이는 목록에서,
  방 설정의 나오게 할 증강은 팝업 목록에서 스위치로 켜고 끔
- e2e: 늦게 바뀌는 상태 줄·결과 창과 새 증강 화면에 맞춤

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-08 09:07:27 +09:00
parent f18909c44f
commit 4e0eb4d52c
52 changed files with 2142 additions and 855 deletions

View File

@@ -10,7 +10,7 @@ import { reducedMotion, useBanner } from '../card-fx';
import type { BoardProps, GameUI, OptionsProps } from '../types';
import { helpNow } from './help';
import { quickStart } from './quick';
import { fxMs } from '../../lib/motion';
import { AfterMotion, fxMs, useAfterMotionValue, useMotionHold } from '../../lib/motion';
type Color = 'black' | 'white';
const COLOR_KO: Record<Color, string> = { black: '흑', white: '백' };
@@ -160,6 +160,9 @@ function BadukBoard({ view: v, act, pending, tapConfirm }: BoardProps<BadukView>
// Counting starts / the game ends (for both players and watchers).
const prevPhase = useRef(v.phase);
// The winner banner waits for the territory marks to finish popping in (held, so the result window waits too).
const [endWait, setEndWait] = useState(false);
useMotionHold(endWait);
useEffect(() => {
const before = prevPhase.current;
prevPhase.current = v.phase;
@@ -168,8 +171,21 @@ function BadukBoard({ view: v, act, pending, tapConfirm }: BoardProps<BadukView>
showBanner('계가', 'blue', '두 사람 모두 패스했어요. 사석을 확인해요');
sfx.whoosh();
} else if (v.phase === 'finished' && v.result) {
const w = v.result.winner;
showBanner(w ? `${COLOR_KO[w]} 승리!` : '무승부', w ? (w === v.myColor ? 'gold' : v.myColor ? 'dark' : 'blue') : 'green', v.result.summaryKo);
const r = v.result;
const w = r.winner;
setEndWait(true);
// Marks pop in staggered from the corner (up to 0.9 s) and take 0.32 s each.
const t = setTimeout(
() => {
setEndWait(false);
showBanner(w ? `${COLOR_KO[w]} 승리!` : '무승부', w ? (w === v.myColor ? 'gold' : v.myColor ? 'dark' : 'blue') : 'green', r.summaryKo);
},
r.score && !reducedMotion() ? fxMs(1250) : 0,
);
return () => {
clearTimeout(t);
setEndWait(false);
};
}
}, [v.phase]); // eslint-disable-line react-hooks/exhaustive-deps
@@ -566,18 +582,25 @@ function BadukSide({ view: v, me, players, act, pending, deadline }: BoardProps<
<strong>상대가 패스했어요.</strong> 끝내려면 나도 패스하세요. 더 둘 곳이 있으면 계속 둬도 돼요.
</div>
)}
{v.phase === 'scoring' && <ScoringPanel view={v} act={act} pending={pending} />}
{/* The counted score and the result show once the 계가 banner / territory marks / winner banner have played. */}
{v.phase === 'scoring' && (
<AfterMotion>
<ScoringPanel view={v} act={act} pending={pending} />
</AfterMotion>
)}
{v.phase === 'finished' && v.result?.score && (
<div className="card stack" style={{ padding: 14, gap: 8 }}>
<strong style={{ fontSize: '1.15rem' }}>{v.result.summaryKo}</strong>
<div style={{ fontSize: '1.5rem', fontWeight: 800, textAlign: 'center', fontVariantNumeric: 'tabular-nums' }}>
<span className="sr-only">{`흑 ${v.result.score.black.total} : 백 ${v.result.score.white.total}`}</span>
<span aria-hidden>
흑 <CountUp to={v.result.score.black.total} live={ended.current.live} /> : 백 <CountUp to={v.result.score.white.total} live={ended.current.live} />
</span>
<AfterMotion>
<div className="card stack" style={{ padding: 14, gap: 8 }}>
<strong style={{ fontSize: '1.15rem' }}>{v.result.summaryKo}</strong>
<div style={{ fontSize: '1.5rem', fontWeight: 800, textAlign: 'center', fontVariantNumeric: 'tabular-nums' }}>
<span className="sr-only">{`흑 ${v.result.score.black.total} : 백 ${v.result.score.white.total}`}</span>
<span aria-hidden>
흑 <CountUp to={v.result.score.black.total} live={ended.current.live} /> : 백 <CountUp to={v.result.score.white.total} live={ended.current.live} />
</span>
</div>
<ScoreTable score={v.result.score} heading />
</div>
<ScoreTable score={v.result.score} heading />
</div>
</AfterMotion>
)}
{v.phase === 'playing' && v.myColor && (
<div className="stack" style={{ gap: 8 }}>
@@ -685,6 +708,8 @@ function PlayerBar({ view: v, color, players, deadline, me }: { view: BadukView;
const c = v.clock;
const elapsed = active ? Math.max(0, now - c.turnStartedAt) : 0;
const mine = id === me;
// The capture count goes up once the captured stones have been lifted off the board.
const captures = useAfterMotionValue(v.captures[color]);
let clock: React.ReactNode = null;
let periodSecLeft: number | null = null;
if (c.kind === 'byoyomi') {
@@ -742,7 +767,7 @@ function PlayerBar({ view: v, color, players, deadline, me }: { view: BadukView;
{mine && <span className="muted small"> (나)</span>}
</div>
<div className="muted small">
{COLOR_KO[color]} · 따낸 돌 {v.captures[color]}
{COLOR_KO[color]} · 따낸 돌 {captures}
{color === 'white' && v.rules.komi ? ` · 덤 ${v.rules.komi}` : ''}
{active ? ' · 두는 중' : ''}
{v.phase === 'scoring' && v.scoring?.agreed[color] ? ' · 동의함' : ''}