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

- 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

@@ -12,7 +12,7 @@ import { helpNow } from './help';
import { quickStart } from './quick';
import { COLOR_HEX, COLOR_INK, COLOR_KO, ColorCardArt, colorCardLabel, patternName } from './ColorCard';
import { FX_CSS, useOneCardFx, type Fx } from './fx';
import { fxMs } from '../../lib/motion';
import { AfterMotion, fxMs, useAfterMotionValue, useMotionHold } from '../../lib/motion';
const SUITS: Suit[] = ['S', 'H', 'D', 'C'];
const COLORS: Color[] = ['R', 'Y', 'G', 'B'];
@@ -173,8 +173,11 @@ function seatLabel(s: SeatView, players: Record<string, PublicUser>, me: string
function SeatChip({ s, v, players, me, deadline }: { s: SeatView; v: OneCardView; players: Record<string, PublicUser>; me: string | null; deadline: number | null }) {
const u = userOf(players, s.id);
const place = v.result?.players.find((p) => p.player === s.id)?.rank;
// 다 냄 / 파산 and points change once the last card has landed.
const status = useAfterMotionValue(s.status);
const score = useAfterMotionValue(s.score);
return (
<li className={`oc-seat${s.isTurn ? ' turn' : ''}${s.status === 'bankrupt' || s.status === 'left' ? ' gone' : ''}`} data-seat={s.id} aria-label={seatLabel(s, players, me, v)}>
<li className={`oc-seat${s.isTurn ? ' turn' : ''}${status === 'bankrupt' || status === 'left' ? ' gone' : ''}`} data-seat={s.id} aria-label={seatLabel(s, players, me, v)}>
<div className="row" style={{ gap: 6, flexWrap: 'nowrap' }}>
<Avatar user={u} size={24} />
<span className="nm">{u.nickname}</span>
@@ -190,11 +193,11 @@ function SeatChip({ s, v, players, me, deadline }: { s: SeatView; v: OneCardView
{s.oneCard === 'declared' ? '원카드!' : '1장!'}
</span>
)}
{s.status === 'out' && <span className="oc-badge" style={{ background: 'var(--success)', color: '#fff' }}>{place ? `${place}등` : '다 냄'}</span>}
{s.status === 'bankrupt' && <span className="oc-badge" style={{ background: 'var(--danger)', color: '#fff' }}>파산</span>}
{status === 'out' && <span className="oc-badge" style={{ background: 'var(--success)', color: '#fff' }}>{place ? `${place}등` : '다 냄'}</span>}
{status === 'bankrupt' && <span className="oc-badge" style={{ background: 'var(--danger)', color: '#fff' }}>파산</span>}
{s.status === 'left' && <span className="oc-badge" style={{ background: 'var(--text-sub)', color: '#fff' }}>나감</span>}
{s.away && <span className="oc-badge" style={{ background: 'var(--warning)', color: '#fff' }}>자리 비움</span>}
{v.mode === 'uno-style' && v.options.unoTargetScore > 0 && <span className="small muted">{s.score}점</span>}
{v.mode === 'uno-style' && v.options.unoTargetScore > 0 && <span className="small muted">{score}점</span>}
</div>
</li>
);
@@ -227,6 +230,8 @@ function AttackCount({ n, uno }: { n: number; uno: boolean }) {
);
return () => window.clearInterval(id);
}, [n]);
// Counting up card by card (timer steps): results wait for the count.
useMotionHold(shown < n);
if (n <= 0) return null;
return (
<span key={shown} className="oc-attack grow" aria-live="polite" aria-label={`${uno ? '먹을 카드' : '공격'} ${n}장`} style={{ fontSize: `${1.4 + Math.min(shown, 15) * 0.07}rem` }}>
@@ -807,8 +812,12 @@ function OneCardBoard({ view: v, me, players, act, pending, deadline }: BoardPro
}}
/>
<Wild4Panel v={v} players={players} act={act} pending={pending} />
<RevealPanel v={v} players={players} />
<RoundPanel v={v} players={players} act={act} pending={pending} />
<AfterMotion when={!!v.reveal}>
<RevealPanel v={v} players={players} />
</AfterMotion>
<AfterMotion when={v.phase === 'roundEnd'}>
<RoundPanel v={v} players={players} act={act} pending={pending} />
</AfterMotion>
{v.my && meSeat && meSeat.status === 'playing' && v.phase !== 'roundEnd' && v.phase !== 'finished' && <MyHand v={v} act={act} pending={pending} players={players} arrived={fx.arrived} />}
{meSeat && meSeat.status !== 'playing' && v.phase !== 'finished' && v.phase !== 'roundEnd' && (
<div className="oc-panel">
@@ -840,6 +849,12 @@ function rulesLine(v: Pick<OneCardView, 'mode' | 'options' | 'penalty' | 'bankru
function OneCardSide({ view: v, me, players, deadline }: BoardProps<OneCardView>) {
const scoreMode = v.mode === 'uno-style' && v.options.unoTargetScore > 0;
const waitingId = v.current;
// Seats, the 기록 and the final ranking show what happened only after it has played on the table.
const lastSeq = v.log.length ? v.log[v.log.length - 1]!.seq : 0;
const shownSeq = useAfterMotionValue(lastSeq);
const seatKey = useAfterMotionValue(v.seats.map((s) => `${s.status}:${s.score}`).join(','));
const seatShown = seatKey.split(',');
const showResult = useAfterMotionValue(!!v.result);
return (
<>
<style>{CSS}</style>
@@ -854,25 +869,28 @@ function OneCardSide({ view: v, me, players, deadline }: BoardProps<OneCardView>
</div>
<span className="small muted">{rulesLine(v)}</span>
<ol style={{ listStyle: 'none', margin: 0, padding: 0, display: 'grid', gap: 4 }}>
{v.seats.map((s) => (
<li key={s.id} className="row" style={{ gap: 6, flexWrap: 'nowrap', opacity: s.status === 'bankrupt' || s.status === 'left' ? 0.55 : 1 }} aria-label={seatLabel(s, players, me, v)}>
{v.seats.map((s, i) => {
const [status, score] = (seatShown[i] ?? `${s.status}:${s.score}`).split(':') as [SeatView['status'], string];
return (
<li key={s.id} className="row" style={{ gap: 6, flexWrap: 'nowrap', opacity: status === 'bankrupt' || status === 'left' ? 0.55 : 1 }} aria-label={seatLabel(s, players, me, v)}>
<Avatar user={userOf(players, s.id)} size={24} />
<span style={{ flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', fontWeight: s.id === me ? 800 : 600 }}>
{s.isTurn ? '▶ ' : ''}
{nick(players, s.id)}
{s.id === me ? ' (나)' : ''}
{s.status === 'out' ? ' · 다 냄' : s.status === 'bankrupt' ? ' · 파산' : s.status === 'left' ? ' · 나감' : s.away ? ' · 자리 비움' : ''}
{status === 'out' ? ' · 다 냄' : status === 'bankrupt' ? ' · 파산' : status === 'left' ? ' · 나감' : s.away ? ' · 자리 비움' : ''}
</span>
{scoreMode && <span className="small">{s.score}점</span>}
{scoreMode && <span className="small">{score}점</span>}
<span className="oc-count" aria-hidden>
<i />
{s.cards}
</span>
</li>
))}
);
})}
</ol>
</div>
{v.result && (
{showResult && v.result && (
<div className="card stack" style={{ gap: 4, padding: 12 }}>
<strong>최종 순위</strong>
{v.result.players.map((p) => (
@@ -892,7 +910,7 @@ function OneCardSide({ view: v, me, players, deadline }: BoardProps<OneCardView>
<details className="card wide-open" open style={{ padding: 12 }}>
<summary style={{ cursor: 'pointer', fontWeight: 700 }}>기록</summary>
<ol className="oc-log">
{[...v.log].reverse().map((e) => (
{v.log.filter((e) => e.seq <= shownSeq).reverse().map((e) => (
<li key={`${e.seq}-${e.t}-${'p' in e ? e.p : ''}`} className="small">
{logText(e, players)}
</li>