원카드 화면: 따로 누르는 원카드 버튼(잡기 N초 세기), 카드 먹을 때 더미에서 한 장씩 날아가고 장마다 소리, 큰 벌칙은 판 흔들림·빨간 번쩍임, 공격 누적 숫자 세어 올라가기, 나눠 주기·섞기·내기·무늬/색 바꾸기 효과, 도움말·규칙·문서·E2E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,14 +3,15 @@ import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type
|
||||
import type { Card, CardFace, Color, LogEntry, OneCardOptions, OneCardView, SeatView, Suit } from '@bg/games/one-card';
|
||||
import type { PublicUser } from '@bg/shared/lite';
|
||||
import { Avatar, Sheet } from '../../components/ui';
|
||||
import { TurnTimer } from '../../components/TurnTimer';
|
||||
import { TurnTimer, useServerNow } from '../../components/TurnTimer';
|
||||
import { PlayingCard } from '../../components/cards/PlayingCard';
|
||||
import { haptic, sounds } from '../../lib/feedback';
|
||||
import { haptic, sounds, tone } from '../../lib/feedback';
|
||||
import { useSeatRows } from '../../lib/seat-rows';
|
||||
import type { BoardProps, GameUI, OptionsProps } from '../types';
|
||||
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';
|
||||
|
||||
const SUITS: Suit[] = ['S', 'H', 'D', 'C'];
|
||||
const COLORS: Color[] = ['R', 'Y', 'G', 'B'];
|
||||
@@ -71,7 +72,7 @@ const CSS = `
|
||||
.oc-pile .cnt { position: absolute; right: -6px; bottom: -8px; background: #111827; color: #fff; border-radius: 999px; padding: 0 8px; font-weight: 800; font-size: .85rem; }
|
||||
.oc-discard { position: relative; width: calc(var(--pw) * 1.12); height: calc(var(--pw) * 1.12 * 1.4); }
|
||||
.oc-discard > .oc-face { position: absolute; inset: 0; }
|
||||
.oc-discard > .oc-face.top { animation: oc-fly .28s ease-out; }
|
||||
.oc-discard > .oc-face.top { animation: oc-fly .32s cubic-bezier(.2,.8,.3,1.1); }
|
||||
.oc-discard[data-drop='true'] { outline: 3px dashed #fde047; outline-offset: 4px; border-radius: 10px; }
|
||||
.oc-info { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
|
||||
.oc-info .row { gap: 6px; }
|
||||
@@ -101,6 +102,11 @@ const CSS = `
|
||||
font-weight: 900; font-size: 1.02rem; line-height: 1.1; padding: 0; cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
|
||||
.oc-onebtn:disabled { background: var(--surface-2); color: var(--text-sub); border-color: var(--border); box-shadow: none; cursor: not-allowed; }
|
||||
.oc-onebtn:not(:disabled) { animation: oc-shake .3s ease-in-out 3; }
|
||||
.oc-onebtn.urgent { animation: oc-shake .3s ease-in-out 3, oc-urgent 1s ease-in-out .9s infinite; }
|
||||
.oc-onebtn.wait { font-size: .85rem; }
|
||||
@keyframes oc-urgent { 50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(251,191,36,.55), 0 0 22px rgba(245,158,11,.9); } }
|
||||
.oc-shuf { display: block; width: 100%; height: 100%; animation: oc-shuffle .6s ease both; }
|
||||
@keyframes oc-shuffle { 20% { transform: translateX(-10px) rotate(-8deg); } 40% { transform: translateX(10px) rotate(8deg); } 60% { transform: translateX(-6px) rotate(-4deg); } 80% { transform: translateY(-6px); } }
|
||||
.oc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
|
||||
.oc-tools .segmented button { min-height: 40px; padding: 0 12px; }
|
||||
.oc-panel { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
|
||||
@@ -112,7 +118,7 @@ const CSS = `
|
||||
.oc-log { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; max-height: 240px; overflow: auto; }
|
||||
.oc-rules td, .oc-rules th { padding: 4px 6px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
|
||||
.oc-rules .oc-face { width: 34px; height: 48px; }
|
||||
@keyframes oc-fly { from { transform: translate(-40px, 30px) scale(.8); opacity: .3; } to { transform: none; opacity: 1; } }
|
||||
@keyframes oc-fly { from { transform: translate(var(--fx, -40px), var(--fy, 30px)) rotate(-25deg) scale(.75); opacity: .4; } }
|
||||
@keyframes oc-pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
|
||||
@keyframes oc-shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
|
||||
/* PC/tablet: many players stack into even rows (9 → 5 + 4) instead of scrolling sideways. Phones keep one swipeable row. */
|
||||
@@ -158,7 +164,7 @@ function SeatChip({ s, v, players, me, deadline }: { s: SeatView; v: OneCardView
|
||||
const u = userOf(players, s.id);
|
||||
const place = v.result?.players.find((p) => p.player === s.id)?.rank;
|
||||
return (
|
||||
<li className={`oc-seat${s.isTurn ? ' turn' : ''}${s.status === 'bankrupt' || s.status === 'left' ? ' gone' : ''}`} aria-label={seatLabel(s, players, me, v)}>
|
||||
<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)}>
|
||||
<div className="row" style={{ gap: 6, flexWrap: 'nowrap' }}>
|
||||
<Avatar user={u} size={24} />
|
||||
<span className="nm">{u.nickname}</span>
|
||||
@@ -186,8 +192,43 @@ function SeatChip({ s, v, players, me, deadline }: { s: SeatView; v: OneCardView
|
||||
|
||||
// ---------------------------------------------------------------- table
|
||||
|
||||
function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: OneCardView; players: Record<string, PublicUser>; canDraw: boolean; onDraw: () => void; onDropCard: (id: string) => void }) {
|
||||
/** The stacked attack: counts up card by card (with a rising tick) when someone adds to it, and grows with the count. */
|
||||
function AttackCount({ n, uno }: { n: number; uno: boolean }) {
|
||||
const [shown, setShown] = useState(n);
|
||||
const prev = useRef(n);
|
||||
useEffect(() => {
|
||||
const from = prev.current;
|
||||
prev.current = n;
|
||||
if (n <= from) {
|
||||
setShown(n);
|
||||
return;
|
||||
}
|
||||
let k = Math.max(from, 1);
|
||||
setShown(k);
|
||||
if (k >= n) return;
|
||||
const id = window.setInterval(
|
||||
() => {
|
||||
k += 1;
|
||||
setShown(k);
|
||||
tone(320 + k * 45, 55, 'square', 0.035);
|
||||
if (k >= n) window.clearInterval(id);
|
||||
},
|
||||
Math.max(45, Math.min(110, 420 / (n - from))),
|
||||
);
|
||||
return () => window.clearInterval(id);
|
||||
}, [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` }}>
|
||||
+{shown}장!
|
||||
<small aria-hidden>{uno ? '먹을 카드' : '공격 누적'}</small>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function TableArea({ v, players, canDraw, onDraw, onDropCard, fx }: { v: OneCardView; players: Record<string, PublicUser>; canDraw: boolean; onDraw: () => void; onDropCard: (id: string) => void; fx: Fx }) {
|
||||
const [over, setOver] = useState(false);
|
||||
const from = fx.playFrom && fx.playFrom.discard === v.discardCount ? fx.playFrom : null;
|
||||
const pw = 'clamp(64px, 9vw, 92px)';
|
||||
const recent = v.recent;
|
||||
const top = recent[recent.length - 1];
|
||||
@@ -202,7 +243,9 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: OneCardView
|
||||
onClick={onDraw}
|
||||
aria-label={`카드 더미 ${v.drawPileCount}장${canDraw ? `. 눌러서 ${drawText}` : ''}`}
|
||||
>
|
||||
<Face card={null} mode={v.mode} />
|
||||
<span key={fx.shuffle} className={fx.shuffle ? 'oc-shuf' : undefined} style={{ display: 'block', width: '100%', height: '100%' }}>
|
||||
<Face card={null} mode={v.mode} />
|
||||
</span>
|
||||
<span className="cnt" aria-hidden>
|
||||
{v.drawPileCount}
|
||||
</span>
|
||||
@@ -228,21 +271,23 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: OneCardView
|
||||
const last = i === arr.length - 1;
|
||||
const rot = last ? 0 : (i - arr.length + 1) * 9;
|
||||
return (
|
||||
<span key={`${v.discardCount - arr.length + i}`} className={`oc-face${last ? ' top' : ''}`} style={{ transform: `rotate(${rot}deg) translate(${rot * 0.6}px, 0)` }}>
|
||||
<span
|
||||
key={`${v.discardCount - arr.length + i}`}
|
||||
className={`oc-face${last ? ' top' : ''}`}
|
||||
style={{ transform: `rotate(${rot}deg) translate(${rot * 0.6}px, 0)`, ...(last && from ? { '--fx': `${Math.round(from.x)}px`, '--fy': `${Math.round(from.y)}px` } : {}) } as CSSProperties}
|
||||
>
|
||||
<Face card={c} mode={v.mode} />
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="oc-info">
|
||||
{v.pendingAttack > 0 && (
|
||||
<span key={v.pendingAttack} className="oc-attack" aria-live="polite">
|
||||
+{v.pendingAttack}장!
|
||||
</span>
|
||||
)}
|
||||
<AttackCount n={v.pendingAttack} uno={v.mode === 'uno-style'} />
|
||||
<div className="row">
|
||||
<span className="oc-dir" data-dir={v.direction} aria-label={v.direction === 1 ? '진행 방향: 시계 방향' : '진행 방향: 반대 방향'}>
|
||||
<b aria-hidden>↻</b>
|
||||
<b key={fx.spin} className={fx.spin ? 'oc-spin' : undefined} aria-hidden>
|
||||
↻
|
||||
</b>
|
||||
{v.direction === 1 ? '시계 방향' : '반대 방향'}
|
||||
</span>
|
||||
{v.extraTurn && <span className="oc-chip">K: 한 번 더</span>}
|
||||
@@ -272,6 +317,15 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: OneCardView
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{fx.flash && <div key={fx.flash.key} className="oc-flash" style={{ '--c': fx.flash.color } as CSSProperties} aria-hidden />}
|
||||
<div className="oc-banners" aria-hidden>
|
||||
{fx.banners.map((b) => (
|
||||
<div key={b.key} className={`oc-banner anim-banner ${b.kind}`} style={b.color ? ({ '--suit': b.color } as CSSProperties) : undefined}>
|
||||
<b>{b.text}</b>
|
||||
{b.sub && <span>{b.sub}</span>}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -297,11 +351,10 @@ interface PickState {
|
||||
kind: 'suit' | 'color';
|
||||
}
|
||||
|
||||
function MyHand({ v, act, pending, players }: { v: OneCardView; act: (a: unknown) => void; pending: boolean; players: Record<string, PublicUser> }) {
|
||||
function MyHand({ v, act, pending, players, arrived }: { v: OneCardView; act: (a: unknown) => void; pending: boolean; players: Record<string, PublicUser>; arrived: Record<string, number> }) {
|
||||
const my = v.my!;
|
||||
const [sortBy, setSortBy] = useState<'suit' | 'rank'>('suit');
|
||||
const [sel, setSel] = useState<string[]>([]);
|
||||
const [declare, setDeclare] = useState(true);
|
||||
const [hints, setHints] = useState(true);
|
||||
const [pick, setPick] = useState<PickState | null>(null);
|
||||
const [note, setNote] = useState('');
|
||||
@@ -314,15 +367,14 @@ function MyHand({ v, act, pending, players }: { v: OneCardView; act: (a: unknown
|
||||
setPick(null);
|
||||
setNote('');
|
||||
}, [turnKey]);
|
||||
useEffect(() => setDeclare(true), [v.turnNo]);
|
||||
|
||||
const byId = (id: string) => my.hand.find((c) => c.id === id);
|
||||
const sameRank = (a: Card, b: Card) => a.kind === 'std' && b.kind === 'std' && a.rank === b.rank;
|
||||
const leavesOne = my.hand.length - Math.max(1, sel.length) === 1;
|
||||
const leavesOne = sel.length > 0 && my.hand.length - sel.length === 1 && !v.options.autoDeclare;
|
||||
|
||||
// Playing never calls "원카드!" (§5.3): that is the round button's own press afterwards.
|
||||
const send = (ids: string[], extra: Record<string, unknown> = {}) => {
|
||||
const leaves = my.hand.length - ids.length === 1;
|
||||
act({ type: 'play', cardIds: ids, ...extra, ...(leaves && declare ? { declareOneCard: true } : {}) });
|
||||
act({ type: 'play', cardIds: ids, ...extra });
|
||||
setSel([]);
|
||||
setPick(null);
|
||||
};
|
||||
@@ -410,7 +462,8 @@ function MyHand({ v, act, pending, players }: { v: OneCardView; act: (a: unknown
|
||||
<button
|
||||
key={c.id}
|
||||
type="button"
|
||||
className="oc-card"
|
||||
className={`oc-card${arrived[c.id] !== undefined ? ' oc-in' : ''}`}
|
||||
style={arrived[c.id] !== undefined ? ({ '--anim-delay': `${arrived[c.id]}ms` } as CSSProperties) : undefined}
|
||||
data-legal={myTurn ? isLegal : undefined}
|
||||
data-id={c.id}
|
||||
aria-pressed={picked}
|
||||
@@ -441,9 +494,7 @@ function MyHand({ v, act, pending, players }: { v: OneCardView; act: (a: unknown
|
||||
canPlay={sel.length > 0 && legal.has(sel[0]!)}
|
||||
playLabel={sel.length > 1 ? `${sel.length}장 내기` : '내기'}
|
||||
onPlay={() => playIds(sel)}
|
||||
leavesOne={leavesOne && sel.length > 0}
|
||||
declare={declare}
|
||||
setDeclare={setDeclare}
|
||||
leavesOne={leavesOne}
|
||||
/>
|
||||
{pick && (
|
||||
<Sheet onClose={() => setPick(null)} label={pick.kind === 'suit' ? '무늬 고르기' : '색 고르기'}>
|
||||
@@ -479,13 +530,9 @@ function ActionBar(props: {
|
||||
playLabel: string;
|
||||
onPlay: () => void;
|
||||
leavesOne: boolean;
|
||||
declare: boolean;
|
||||
setDeclare: (b: boolean) => void;
|
||||
}) {
|
||||
const { v, act, pending, players, canPlay, playLabel, onPlay, leavesOne, declare, setDeclare } = props;
|
||||
const { v, act, pending, players, canPlay, playLabel, onPlay, leavesOne } = props;
|
||||
const my = v.my!;
|
||||
const w = v.oneCardWindow;
|
||||
const oneLabel = !w ? '원카드' : w.player === v.me ? '원카드 외치기' : `${nick(players, w.player)}님 잡기`;
|
||||
const myTurn = v.current === v.me && (v.phase === 'turn' || v.phase === 'afterDraw' || (v.phase === 'wild4Response' && my.legalCardIds.length > 0));
|
||||
return (
|
||||
<div className="oc-actions">
|
||||
@@ -505,27 +552,71 @@ function ActionBar(props: {
|
||||
</button>
|
||||
)}
|
||||
{myTurn && leavesOne && (
|
||||
<label className="row small" style={{ gap: 4, cursor: 'pointer', flex: '1 1 100%' }}>
|
||||
<input type="checkbox" checked={declare} onChange={(e) => setDeclare(e.target.checked)} style={{ width: 22, height: 22 }} />
|
||||
내면서 원카드 외치기
|
||||
</label>
|
||||
<span className="small" style={{ flex: '1 1 100%' }}>
|
||||
내고 나면 1장이 남아요. 낸 다음 [원카드!]를 따로 눌러요.
|
||||
</span>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="oc-onebtn"
|
||||
disabled={!my.canDeclare || pending}
|
||||
onClick={() => {
|
||||
haptic(40);
|
||||
act({ type: 'declareOneCard' });
|
||||
}}
|
||||
aria-label={my.canDeclare ? oneLabel : '원카드 (지금은 누를 수 없어요)'}
|
||||
>
|
||||
원카드!
|
||||
</button>
|
||||
<OneCardButton v={v} act={act} pending={pending} players={players} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ms until others may catch the open window's owner (0 = now / not waiting). The owner may call at once; everyone
|
||||
* else waits out the protection time (`oneCardGrace`), counted on the server clock.
|
||||
*/
|
||||
function useCatchWait(v: OneCardView): number {
|
||||
const now = useServerNow(200);
|
||||
const w = v.oneCardWindow;
|
||||
if (!w || w.declared || w.player === v.me) return 0;
|
||||
// A little margin so a press right at the end is not refused for clock drift.
|
||||
return Math.max(0, w.catchFrom + 100 - now);
|
||||
}
|
||||
|
||||
/** The round "원카드!" button: call my own one card, or catch someone who forgot (after the protection time). */
|
||||
function OneCardButton({ v, act, pending, players }: { v: OneCardView; act: (a: unknown) => void; pending: boolean; players: Record<string, PublicUser> }) {
|
||||
const my = v.my!;
|
||||
const w = v.oneCardWindow;
|
||||
const wait = useCatchWait(v);
|
||||
const mine = !!w && w.player === v.me;
|
||||
const can = my.canDeclare && !pending && wait === 0;
|
||||
const secs = Math.ceil(wait / 1000);
|
||||
const label = !my.canDeclare || !w ? '원카드 (지금은 누를 수 없어요)' : mine ? '원카드 외치기' : wait > 0 ? `${nick(players, w.player)}님 잡기, ${secs}초 뒤에 누를 수 있어요` : `${nick(players, w.player)}님 잡기`;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`oc-onebtn${can && mine ? ' urgent' : ''}${my.canDeclare && wait > 0 ? ' wait' : ''}`}
|
||||
disabled={!can}
|
||||
onClick={() => {
|
||||
haptic(40);
|
||||
act({ type: 'declareOneCard' });
|
||||
}}
|
||||
aria-label={label}
|
||||
>
|
||||
{my.canDeclare && wait > 0 ? (
|
||||
<>
|
||||
잡기
|
||||
<br />
|
||||
{secs}초
|
||||
</>
|
||||
) : (
|
||||
'원카드!'
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
/** For players already out of the round: they may still catch. */
|
||||
function CatchButton({ v, act, pending, players }: { v: OneCardView; act: (a: unknown) => void; pending: boolean; players: Record<string, PublicUser> }) {
|
||||
const wait = useCatchWait(v);
|
||||
const who = v.oneCardWindow ? nick(players, v.oneCardWindow.player) : '';
|
||||
return (
|
||||
<button type="button" className="btn btn-secondary" disabled={pending || wait > 0} onClick={() => act({ type: 'declareOneCard' })}>
|
||||
{wait > 0 ? `${Math.ceil(wait / 1000)}초 뒤에 ${who}님 잡기` : `원카드! (${who}님 잡기)`}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- prompts
|
||||
|
||||
function Wild4Panel({ v, players, act, pending }: { v: OneCardView; players: Record<string, PublicUser>; act: (a: unknown) => void; pending: boolean }) {
|
||||
@@ -673,9 +764,12 @@ function OneCardBoard({ view: v, me, players, act, pending, deadline }: BoardPro
|
||||
const opps = useSeatRows<HTMLUListElement>(others.length);
|
||||
const canDraw = !!v.my?.canDraw && !pending;
|
||||
const meSeat = v.seats.find((s) => s.id === me);
|
||||
const rootRef = useRef<HTMLDivElement>(null);
|
||||
const layerRef = useRef<HTMLDivElement>(null);
|
||||
const fx = useOneCardFx({ view: v, me, nick: (id) => nick(players, id) }, rootRef, layerRef);
|
||||
return (
|
||||
<div className="oc">
|
||||
<style>{CSS}</style>
|
||||
<div className="oc" ref={rootRef}>
|
||||
<style>{CSS + FX_CSS}</style>
|
||||
<ul className="oc-opps" aria-label="다른 사람" ref={opps.ref} style={opps.style}>
|
||||
{others.map((s) => (
|
||||
<SeatChip key={s.id} s={s} v={v} players={players} me={me} deadline={deadline} />
|
||||
@@ -685,36 +779,31 @@ function OneCardBoard({ view: v, me, players, act, pending, deadline }: BoardPro
|
||||
v={v}
|
||||
players={players}
|
||||
canDraw={canDraw}
|
||||
fx={fx}
|
||||
onDraw={() => act({ type: 'draw' })}
|
||||
onDropCard={(id) => {
|
||||
if (v.my?.legalCardIds.includes(id)) {
|
||||
const c = v.my.hand.find((x) => x.id === id);
|
||||
if (c && !((c.kind === 'std' && c.rank === 7) || c.kind === 'wild' || c.kind === 'wild4')) {
|
||||
const leaves = v.my.hand.length === 2;
|
||||
act({ type: 'play', cardIds: [id], ...(leaves ? { declareOneCard: true } : {}) });
|
||||
}
|
||||
if (c && !((c.kind === 'std' && c.rank === 7) || c.kind === 'wild' || c.kind === 'wild4')) act({ type: 'play', cardIds: [id] });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Wild4Panel v={v} players={players} act={act} pending={pending} />
|
||||
<RevealPanel v={v} players={players} />
|
||||
<RoundPanel v={v} players={players} act={act} pending={pending} />
|
||||
{v.my && meSeat && meSeat.status === 'playing' && v.phase !== 'roundEnd' && v.phase !== 'finished' && <MyHand v={v} act={act} pending={pending} players={players} />}
|
||||
{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">
|
||||
<strong>
|
||||
{meSeat.status === 'out' ? '카드를 모두 냈어요! 다른 사람의 게임을 지켜봐요.' : meSeat.status === 'bankrupt' ? '파산했어요. 남은 게임을 지켜봐요.' : '게임에서 나갔어요.'}
|
||||
</strong>
|
||||
{meSeat.status === 'out' && v.my?.canDeclare && (
|
||||
<button type="button" className="btn btn-secondary" disabled={pending} onClick={() => act({ type: 'declareOneCard' })}>
|
||||
원카드! ({v.oneCardWindow ? nick(players, v.oneCardWindow.player) : ''}님 잡기)
|
||||
</button>
|
||||
)}
|
||||
{meSeat.status === 'out' && v.my?.canDeclare && <CatchButton v={v} act={act} pending={pending} players={players} />}
|
||||
</div>
|
||||
)}
|
||||
<p className="sr-only" aria-live="polite">
|
||||
{announce}
|
||||
</p>
|
||||
<div className="oc-fxlayer" ref={layerRef} aria-hidden />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -884,7 +973,12 @@ function Options({ value: o, onChange }: OptionsProps<OneCardOptions>) {
|
||||
<Seg label="끝나는 때" value={o.endCondition} options={[['first-out', '1등이 나오면'], ['last-standing', '꼴찌가 정해질 때까지']]} onChange={(endCondition) => set({ endCondition })} />
|
||||
</Field>
|
||||
<Field label="한 턴 제한 시간">
|
||||
<Seg label="한 턴 제한 시간" value={o.turnSeconds} options={[[10, '10초'], [15, '15초'], [20, '20초'], [30, '30초'], [60, '60초']]} onChange={(turnSeconds) => set({ turnSeconds })} />
|
||||
<Seg
|
||||
label="한 턴 제한 시간"
|
||||
value={o.turnSeconds === null ? 'none' : String(o.turnSeconds)}
|
||||
options={[['10', '10초'], ['15', '15초'], ['20', '20초'], ['30', '30초'], ['60', '60초'], ['none', '무제한']]}
|
||||
onChange={(k) => set({ turnSeconds: k === 'none' ? null : (Number(k) as 10 | 15 | 20 | 30 | 60) })}
|
||||
/>
|
||||
</Field>
|
||||
{!classic && (
|
||||
<Field label="색 바꾸기+4 내는 조건">
|
||||
@@ -953,7 +1047,13 @@ function Options({ value: o, onChange }: OptionsProps<OneCardOptions>) {
|
||||
<Field label="원카드를 못 외치고 잡히면">
|
||||
<Seg label="원카드 벌칙" value={o.oneCardPenalty} options={[['auto', classic ? '1장(기본)' : '2장(기본)'], [1, '1장'], [2, '2장'], [3, '3장']]} onChange={(oneCardPenalty) => set({ oneCardPenalty })} />
|
||||
</Field>
|
||||
<Field label="1장 남으면 자동으로 원카드 외치기">
|
||||
<Field label="원카드 잡기 전 보호 시간" help="1장 남은 사람만 [원카드!]를 누를 수 있는 시간이에요. 지나면 다른 사람이 잡을 수 있어요.">
|
||||
<Seg label="원카드 보호 시간" value={o.oneCardGrace} options={[[1, '1초'], [2, '2초(기본)'], [3, '3초']]} onChange={(oneCardGrace) => set({ oneCardGrace })} />
|
||||
</Field>
|
||||
<Field label="원카드를 외치면 다른 사람이 1장씩 먹기">
|
||||
<Seg label="원카드 보너스" value={o.oneCardBonus} options={onOff} onChange={(oneCardBonus) => set({ oneCardBonus })} />
|
||||
</Field>
|
||||
<Field label="1장 남으면 자동으로 원카드 외치기" help="초보·어린이용이에요. 켜면 아무도 잡을 수 없어요.">
|
||||
<Seg label="자동 원카드" value={o.autoDeclare} options={onOff} onChange={(autoDeclare) => set({ autoDeclare })} />
|
||||
</Field>
|
||||
<Field label="파산 장수">
|
||||
@@ -987,7 +1087,7 @@ function optionsSummary(o: OneCardOptions): string {
|
||||
if (o.unoTargetScore) parts.push(`${o.unoTargetScore}점까지`);
|
||||
}
|
||||
if (o.endCondition === 'last-standing') parts.push('꼴찌까지');
|
||||
parts.push(`${o.turnSeconds}초`);
|
||||
parts.push(o.turnSeconds === null ? '시간 무제한' : `${o.turnSeconds}초`);
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
@@ -1049,6 +1149,8 @@ function Rules({ options }: { options?: OneCardOptions }) {
|
||||
multiPlay: false,
|
||||
oneCardPenalty: 'auto',
|
||||
autoDeclare: false,
|
||||
oneCardGrace: 2,
|
||||
oneCardBonus: false,
|
||||
bankruptLimit: 'auto',
|
||||
voluntaryDraw: true,
|
||||
playAfterDraw: 'auto',
|
||||
@@ -1084,8 +1186,11 @@ function Rules({ options }: { options?: OneCardOptions }) {
|
||||
)}
|
||||
<SpecialTable mode={full.mode} o={full} />
|
||||
<p>
|
||||
<strong>원카드</strong>: 카드를 내서 1장이 남으면 "원카드!" 버튼을 눌러요. 다른 사람이 먼저 누르면 {full.oneCardPenalty === 'auto' ? (classic ? 1 : 2) : full.oneCardPenalty}장을
|
||||
먹어요. 카드를 낼 때 "내면서 원카드 외치기"를 켜 두면 안전해요.
|
||||
<strong>원카드</strong>:{' '}
|
||||
{full.autoDeclare
|
||||
? '카드를 내서 1장이 남으면 저절로 원카드를 외쳐요.'
|
||||
: `카드를 내서 1장이 남으면, 낸 다음 동그란 [원카드!] 버튼을 따로 눌러 외쳐요(카드를 내면서 함께 외칠 수는 없어요). 처음 ${full.oneCardGrace}초는 나만 누를 수 있고, 그 뒤에는 다른 사람이 먼저 눌러 잡을 수 있어요. 잡히면 ${full.oneCardPenalty === 'auto' ? (classic ? 1 : 2) : full.oneCardPenalty}장을 먹어요.`}
|
||||
{full.oneCardBonus ? ' 먼저 외치면 다른 사람이 모두 1장씩 먹어요.' : ''}
|
||||
</p>
|
||||
{classic && (
|
||||
<p>
|
||||
@@ -1100,7 +1205,9 @@ function Rules({ options }: { options?: OneCardOptions }) {
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
시간 안에 고르지 않으면 카드를 내지 않고 자동으로 먹어요(공격받는 중이면 모인 장수만큼).{' '}
|
||||
{full.turnSeconds === null
|
||||
? '한 턴 시간 제한이 없어요(자리를 비운 사람만 잠깐 기다린 뒤 자동으로 먹어요). '
|
||||
: `${full.turnSeconds}초 안에 고르지 않으면 카드를 내지 않고 자동으로 먹어요(공격받는 중이면 모인 장수만큼). `}
|
||||
{full.bankruptLimit === 'none' || (full.bankruptLimit === 'auto' && !classic)
|
||||
? ''
|
||||
: `손에 ${full.bankruptLimit === 'auto' ? 20 : full.bankruptLimit}장 이상 쌓이면 파산해서 탈락해요.`}
|
||||
|
||||
Reference in New Issue
Block a user