diff --git a/apps/web/src/games/cockroach-poker/index.tsx b/apps/web/src/games/cockroach-poker/index.tsx index 308dc94..2daa4a9 100644 --- a/apps/web/src/games/cockroach-poker/index.tsx +++ b/apps/web/src/games/cockroach-poker/index.tsx @@ -211,44 +211,70 @@ function BackCard({ size = 'md', fx }: { size?: 'sm' | 'md' | 'lg'; fx?: string // ---------------------------------------------------------------- styles const CSS = ` -.cp-board { width: 100%; max-width: 1040px; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 2px; } -.cp-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; } -.cp-seat { position: relative; background: var(--surface); border-radius: var(--radius-lg); padding: 9px 11px; box-shadow: var(--shadow); border: 3px solid transparent; display: flex; flex-direction: column; gap: 6px; min-width: 0; } -.cp-seat.turn { border-color: var(--focus); } -.fx-ghost.cp-ghost { background: linear-gradient(135deg, #7c2d12, #431407); border: 2px solid #fdba74; border-radius: 7px; box-shadow: 0 3px 8px rgba(0,0,0,.35); } -.cp-seat.loser { border-color: var(--danger); } +.cp-board { width: 100%; max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 370px); gap: 12px; align-items: start; padding: 2px; } +.cp-felt { position: relative; border-radius: 26px; border: 8px solid var(--wood); box-shadow: var(--shadow); color: #fff; padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 540px; + background: radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.14), rgba(255,255,255,0) 60%), var(--felt); } +.cp-actions { display: flex; flex-direction: column; gap: 10px; min-width: 0; } +.cp-opps { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; } +.cp-seat { position: relative; flex: 1 1 170px; max-width: 280px; min-width: 0; background: rgba(0,0,0,.24); border-radius: 16px; padding: 8px 10px; border: 3px solid transparent; + display: flex; flex-direction: column; gap: 6px; transition: background .3s ease; } +.cp-seat.turn, .cp-me.turn { border-color: #fde047; } +.cp-seat.target { background: rgba(250,204,21,.18); } +.cp-seat.loser, .cp-me.loser { border-color: #f87171; background: rgba(127,29,29,.45); } +.fx-ghost.cp-ghost { background: repeating-radial-gradient(circle at 30% 30%, #7c3aed 0 4px, #6d28d9 4px 8px); border: 2px solid #ede9fe; border-radius: 7px; box-shadow: 0 3px 8px rgba(0,0,0,.35); } .cp-head { display: flex; align-items: center; gap: 7px; min-height: 30px; min-width: 0; } .cp-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; } -.cp-badges { display: flex; gap: 4px; flex-wrap: wrap; } -.cp-badge { display: inline-block; border-radius: 999px; padding: 1px 8px; font-weight: 800; font-size: .78rem; background: var(--surface-2); color: var(--text); white-space: nowrap; } -.cp-badge.turn { background: var(--focus); color: #1c1e21; } -.cp-badge.seen { background: var(--primary-soft); color: var(--text); } -.cp-badge.lose { background: var(--danger-soft); color: var(--danger); } -.cp-badge.win { background: var(--success-soft); color: var(--success); } -.cp-meta { font-size: .85rem; color: var(--text-sub); display: flex; gap: 6px; align-items: center; } -.cp-front { display: flex; flex-wrap: wrap; gap: 4px; min-height: 30px; align-items: center; } -.cp-chip { display: inline-flex; align-items: center; gap: 2px; border-radius: 9px; padding: 1px 6px 1px 2px; font-weight: 900; font-size: .85rem; border: 2px solid transparent; font-variant-numeric: tabular-nums; } -.cp-chip.warn { border-color: var(--warning); background: var(--warning-soft); } -.cp-chip.danger { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); } -.cp-chip .cp-mark { font-size: .72rem; margin-left: 1px; } -.cp-empty { font-size: .82rem; color: var(--text-sub); } -.cp-bubble { position: absolute; right: 8px; top: -12px; background: var(--text); color: var(--surface); border-radius: 12px; padding: 3px 10px; font-weight: 800; font-size: .85rem; box-shadow: var(--shadow); animation: cp-pop .25s ease-out; z-index: 2; max-width: 80%; } -.cp-mid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 12px; align-items: start; } -.cp-table { background: var(--felt); color: #fff; border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; min-height: 230px; } -.cp-table .small { color: #fff; opacity: .92; } -.cp-chain { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; } +.cp-badges { display: flex; gap: 4px; flex-wrap: wrap; min-height: 0; } +.cp-badge { display: inline-block; border-radius: 999px; padding: 1px 8px; font-weight: 800; font-size: .76rem; background: rgba(255,255,255,.2); color: #fff; white-space: nowrap; } +.cp-badge.turn { background: #fde047; color: #422006; animation: cp-breathe 1.2s ease-in-out infinite; } +.cp-badge.seen { background: #c4b5fd; color: #2e1065; } +.cp-badge.lose { background: #fecaca; color: #7f1d1d; } +.cp-badge.win { background: #bbf7d0; color: #14532d; } +.cp-meta { font-size: .8rem; opacity: .9; display: flex; gap: 2px 6px; align-items: center; flex-wrap: wrap; } +.cp-meta > span { white-space: nowrap; } +.cp-handfan { display: inline-flex; align-items: center; padding-left: 8px; } +.cp-handfan i { width: 14px; height: 20px; border-radius: 3px; margin-left: -8px; border: 1.5px solid #ede9fe; background: repeating-radial-gradient(circle at 30% 30%, #7c3aed 0 3px, #6d28d9 3px 6px); + box-shadow: 0 1px 2px rgba(0,0,0,.4); transform: rotate(var(--r)); } +.cp-front { display: flex; flex-wrap: wrap; gap: 8px 6px; min-height: 46px; align-items: flex-end; } +.cp-chip { position: relative; display: inline-flex; flex-direction: column; align-items: center; border-radius: 8px; padding: 0 0 2px; } +.cp-chip .cp-mini { --w: 30px; width: var(--w); height: calc(var(--w) * 1.32); border-radius: 5px; border: 2px solid; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(0,0,0,.35); } +.cp-chip .cp-mini + .cp-mini { margin-top: calc(var(--w) * -1.32 + 8px); } +.cp-chip .cp-mini svg { width: 86%; height: auto; } +.cp-chip .cp-n { position: absolute; right: -7px; bottom: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: #111827; color: #fff; font-weight: 900; font-size: .75rem; + display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #fff; font-variant-numeric: tabular-nums; } +.cp-chip.warn .cp-mini:last-child { box-shadow: 0 0 0 3px #facc15; } +.cp-chip.danger .cp-mini:last-child { box-shadow: 0 0 0 3px #ef4444, 0 0 12px rgba(239,68,68,.8); } +.cp-chip.danger .cp-n { background: #dc2626; animation: cp-breathe 1s ease-in-out infinite; } +.cp-chip.new .cp-mini:last-of-type { animation: cp-land .5s cubic-bezier(.3,.7,.3,1.3) 1.4s both; } +${KINDS.map((k) => `.fx-ghost.cp-face-${k} { background: ${KIND_COLOR[k].bg}; color: ${KIND_COLOR[k].ink}; border: 2px solid ${KIND_COLOR[k].ink}; border-radius: 7px; display: flex; align-items: flex-end; justify-content: center; font: 800 9px/1.6 system-ui, sans-serif; box-shadow: 0 3px 8px rgba(0,0,0,.35); }`).join('\n')} +.cp-empty { font-size: .8rem; opacity: .75; } +.cp-bubble { position: absolute; right: 8px; top: -14px; background: #fff; color: #1c1e21; border-radius: 12px; padding: 3px 10px; font-weight: 800; font-size: .85rem; box-shadow: 0 3px 10px rgba(0,0,0,.3); animation: cp-pop .25s ease-out; z-index: 3; max-width: 80%; } +.cp-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 220px; text-align: center; } +.cp-route { display: flex; align-items: center; gap: 8px; font-weight: 800; flex-wrap: wrap; justify-content: center; } +.cp-route .who { display: inline-flex; align-items: center; gap: 5px; background: rgba(0,0,0,.28); border-radius: 999px; padding: 2px 10px 2px 3px; } +.cp-route .arr { font-size: 1.3rem; color: #fde047; animation: cp-arrow 1s ease-in-out infinite; } +.cp-chain { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; justify-content: center; font-size: .82rem; font-weight: 700; opacity: .92; } .cp-chain .arrow { opacity: .8; } .cp-chain .said { background: rgba(255,255,255,.18); border-radius: 8px; padding: 0 6px; } -.cp-flight { display: flex; align-items: center; gap: 12px; } -.cp-speech { background: #fff; color: #1c1e21; border-radius: 14px; padding: 8px 12px; font-weight: 900; font-size: 1.05rem; position: relative; max-width: 170px; } -.cp-speech::before { content: ''; position: absolute; left: -8px; top: 50%; margin-top: -7px; border: 7px solid transparent; border-right-color: #fff; border-left: 0; } -.cp-speech .who { display: block; font-size: .78rem; font-weight: 700; color: #4a4f57; } -.cp-seenrow { font-size: .85rem; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; align-items: center; } -.cp-seenrow .s { background: rgba(0,0,0,.25); border-radius: 999px; padding: 0 8px; font-weight: 700; } -.cp-reveal { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.22); border-radius: 12px; padding: 8px 10px; width: 100%; } +.cp-flight { display: flex; align-items: center; gap: 14px; justify-content: center; } +.cp-flight .cp-card.lg { transform: rotate(-4deg); } +.cp-speech { background: #fff; color: #1c1e21; border-radius: 16px; padding: 9px 14px; font-weight: 900; font-size: 1.15rem; position: relative; max-width: 190px; box-shadow: 0 4px 12px rgba(0,0,0,.3); animation: cp-pop .35s ease-out; } +.cp-speech::before { content: ''; position: absolute; left: -9px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-right-color: #fff; border-left: 0; } +.cp-speech .who { display: block; font-size: .76rem; font-weight: 700; color: #4a4f57; } +.cp-seenrow { font-size: .82rem; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; align-items: center; } +.cp-seenrow .s { background: rgba(0,0,0,.28); border-radius: 999px; padding: 0 8px; font-weight: 700; } +.cp-reveal { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,.24); border-radius: 14px; padding: 8px 12px; text-align: left; max-width: 100%; } .cp-reveal .verdict { font-weight: 900; font-size: 1.05rem; } .cp-reveal .verdict.ok { color: #86efac; } .cp-reveal .verdict.no { color: #fca5a5; } +.cp-reveal.big { flex-direction: column; text-align: center; background: none; padding: 0; } +.cp-revealcard { position: relative; display: inline-block; } +.cp-stamp { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg); font-weight: 900; font-size: 1.35rem; letter-spacing: .04em; padding: 2px 10px; + border: 4px solid; border-radius: 10px; background: rgba(255,255,255,.88); white-space: nowrap; pointer-events: none; } +.cp-stamp.ok { color: #15803d; border-color: #15803d; } +.cp-stamp.no { color: #b91c1c; border-color: #b91c1c; } +.cp-stamp.fresh { animation: cp-stamp .45s cubic-bezier(.3,.7,.3,1.4) .55s both; } +.cp-wait { font-weight: 800; } .cp-card { --w: 64px; width: var(--w); height: calc(var(--w) * 1.32); border-radius: 10px; border: 2px solid; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: 0 3px 0 rgba(0,0,0,.28); flex: none; user-select: none; position: relative; } .cp-card.sm { --w: 40px; border-radius: 7px; } @@ -259,10 +285,14 @@ const CSS = ` .cp-card.back { background: repeating-radial-gradient(circle at 30% 30%, #7c3aed 0 5px, #6d28d9 5px 10px); border-color: #3b0764; color: #fff; } .cp-back-q { font-weight: 900; font-size: calc(var(--w) * .5); text-shadow: 0 2px 0 rgba(0,0,0,.35); } .cp-card.slide { animation: cp-slide .45s ease-out; } -.cp-card.flip { animation: cp-flip .55s ease-out; } +.cp-card.flip { animation: cp-flip .6s ease-out both; } .cp-card.mine { outline: 3px dashed #fde047; outline-offset: 3px; } -@keyframes cp-slide { 0% { transform: translateX(-40px) rotate(-12deg); opacity: .2; } 100% { transform: none; opacity: 1; } } -@keyframes cp-flip { 0% { transform: rotateY(90deg) scale(.9); } 100% { transform: none; } } +@keyframes cp-slide { 0% { transform: translateY(-60px) rotate(-20deg) scale(.7); opacity: .2; } 100% { transform: rotate(-4deg); opacity: 1; } } +@keyframes cp-flip { 0% { transform: perspective(600px) rotateY(180deg) scale(.9); filter: brightness(.3); } 50% { transform: perspective(600px) rotateY(90deg) scale(1.08); filter: brightness(.6); } 100% { transform: none; filter: none; } } +@keyframes cp-stamp { 0% { transform: translate(-50%, -50%) rotate(-14deg) scale(2.4); opacity: 0; } 100% { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: 1; } } +@keyframes cp-land { 0% { transform: translateY(-26px) scale(1.25); opacity: 0; } 100% { transform: none; opacity: 1; } } +@keyframes cp-breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } } +@keyframes cp-arrow { 0%,100% { transform: translateX(-3px); } 50% { transform: translateX(3px); } } @keyframes cp-pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } } .cp-panel { container-type: inline-size; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; } .cp-step { display: flex; flex-direction: column; gap: 6px; } @@ -298,11 +328,18 @@ const CSS = ` .cp-true:hover:not(:disabled), .cp-false:hover:not(:disabled) { filter: brightness(1.08); } .cp-peek { min-height: 56px; } .cp-why { font-size: .85rem; color: var(--text-sub); } -.cp-me { position: relative; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 10px 12px; border: 3px solid var(--primary); display: flex; flex-direction: column; gap: 8px; } -.cp-me.turn { border-color: var(--focus); } +.cp-me { position: relative; background: rgba(0,0,0,.3); border-radius: 18px; padding: 10px 12px; border: 3px solid rgba(255,255,255,.28); display: flex; flex-direction: column; gap: 8px; } +.cp-myhand { display: flex; align-items: flex-end; justify-content: center; padding: 8px 0 2px 12px; min-height: 96px; flex-wrap: nowrap; } +.cp-myhand .cp-card { --w: 60px; } +.cp-myhand .grp { position: relative; margin-left: -12px; padding: 0; transition: transform .18s ease; transform: rotate(var(--r)) translateY(var(--y)); transform-origin: 50% 120%; } +.cp-myhand .grp:hover { transform: rotate(var(--r)) translateY(calc(var(--y) - 10px)); z-index: 2; } +.cp-myhand .grp .cp-count { right: auto; left: -6px; top: -8px; } +.cp-myhand .grp.new .cp-card { animation: cp-land .5s cubic-bezier(.3,.7,.3,1.3) both; } /* My own 빠른 말: next to my name (the timer sits on the right). */ .cp-me > .cp-bubble { right: auto; left: 16px; top: -16px; } -.cp-me-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; } +.cp-me-row { display: flex; flex-direction: column; gap: 8px; } +.cp-me-row > div { width: 100%; } +.cp-me .small { color: #fff; opacity: .88; } .cp-me-row > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; } .cp-help { font-size: .85rem; color: var(--text-sub); } .cp-say { display: flex; flex-wrap: wrap; gap: 6px; } @@ -310,12 +347,21 @@ const CSS = ` .cp-say button:disabled { opacity: .45; cursor: not-allowed; } .cp-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .9rem; } .cp-log li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } +@media (max-width: 899px) { + .cp-board { grid-template-columns: minmax(0, 1fr); } + .cp-felt { min-height: 0; } +} @media (max-width: 719px) { - .cp-board { max-height: none; overflow: visible; } - .cp-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } - .cp-seat { padding: 7px 8px; } - .cp-mid { grid-template-columns: minmax(0, 1fr); } - .cp-table { min-height: 0; } + .cp-felt { border-width: 6px; border-radius: 20px; padding: 8px; gap: 8px; } + .cp-opps { gap: 6px; } + .cp-seat { flex: 1 1 calc(50% - 6px); max-width: none; padding: 6px 7px; } + .cp-center { min-height: 0; } + .cp-chip .cp-mini { --w: 24px; } + .cp-myhand .cp-card { --w: 44px; } + .cp-myhand .grp { margin-left: -10px; } + .cp-myhand { min-height: 74px; } + .cp-handfan i:nth-child(n+6) { display: none; } + .cp-speech { font-size: 1rem; max-width: 150px; } .cp-card { --w: 54px; } .cp-card.lg { --w: 76px; } .cp-targets { grid-template-columns: repeat(2, minmax(0, 1fr)); } @@ -323,24 +369,35 @@ const CSS = ` .cp-claim { min-height: 70px; font-size: .82rem; } } @media (prefers-reduced-motion: reduce) { - .cp-card.slide, .cp-card.flip, .cp-bubble { animation: none; } + .cp-card.slide, .cp-card.flip, .cp-bubble, .cp-stamp, .cp-chip .cp-mini, .cp-badge.turn, .cp-route .arr, .cp-speech, .cp-myhand .grp .cp-card, .cp-n { animation: none !important; } .cp-pick[aria-pressed='true'] .cp-card { transform: none; } } `; // ---------------------------------------------------------------- pieces -function FrontChips({ front, loseCount, size = 22 }: { front: FrontView; loseCount: number; size?: number }) { +/** 앞마당: the face-up cards in front of a player, one small overlapping stack per critter (most first). */ +function FrontChips({ front, loseCount, fresh, small }: { front: FrontView; loseCount: number; fresh?: Kind | null; small?: boolean }) { if (front.total === 0) return 앞마당 비어 있음; return ( <> {front.kinds.map((k) => { const lv = front.level[k]; + const n = front.counts[k]; + const col = KIND_COLOR[k]; return ( - - - {front.counts[k]} - {lv === 'danger' && !} + + {Array.from({ length: Math.min(n, 4) }, (_, i) => ( + + + + + + ))} + + {n} + {lv === 'danger' ? '!' : ''} + ); })} @@ -348,7 +405,19 @@ function FrontChips({ front, loseCount, size = 22 }: { front: FrontView; loseCou ); } -function Seat({ id, v, me, players, deadline, bubble }: { id: string; v: CockroachView; me: string | null; players: Record; deadline: number | null; bubble: string | null }) { +/** Someone's hand, face down: a little fan of backs (count in text next to it). */ +function HandFan({ n }: { n: number }) { + const shown = Math.min(n, 8); + return ( + + {Array.from({ length: shown }, (_, i) => ( + + ))} + + ); +} + +function Seat({ id, v, me, players, deadline, bubble, fresh }: { id: string; v: CockroachView; me: string | null; players: Record; deadline: number | null; bubble: string | null; fresh: Kind | null }) { const u = userOf(players, id); const r = v.round; const active = waitingOn(v) === id; @@ -357,7 +426,7 @@ function Seat({ id, v, me, players, deadline, bubble }: { id: string; v: Cockroa const role = v.phase === 'finished' ? null : r.holder === id ? (r.peeked ? '넘기는 중' : '받는 중') : r.holder === null && r.starter === id ? '건네는 중' : null; const label = `${u.nickname}님${id === me ? '(나)' : ''}: 손패 ${v.handCounts[id]}장, ${frontText(front, v.loseCount)}${role ? `, ${role}` : ''}${r.seen.includes(id) && r.holder !== null ? ', 이 카드를 봤어요' : ''}${v.away[id] ? ', 자리 비움' : ''}`; return ( -
+
{bubble && ( {bubble} @@ -378,11 +447,12 @@ function Seat({ id, v, me, players, deadline, bubble }: { id: string; v: Cockroa {v.final && {loser ? '패배' : '승리'}}
+ 손패 {v.handCounts[id]}장 · 앞마당 {front.total}장
- +
); @@ -406,14 +476,21 @@ function Chain({ claims, players }: { claims: ClaimEntry[]; players: Record; me: string | null; fresh: boolean }) { +function RevealLine({ rv, players, me, fresh, big }: { rv: LastReveal; players: Record; me: string | null; fresh: boolean; big?: boolean }) { const callWord = rv.call === 'true' ? '진짜!' : '거짓말!'; const truth = rv.kind === rv.claim; const caller = rv.caller === me ? '내가' : `${nick(players, rv.caller)}님이`; const taker = rv.takenBy === me ? '내' : `${nick(players, rv.takenBy)}님`; return ( -
- +
+ + + {big && ( + + {truth ? '진짜' : '거짓'} + + )} + "{KIND_KO[rv.claim]}"{hasBatchim(KIND_KO[rv.claim]) ? "이라는" : "라는"} 말에 {caller} "{callWord}"{rv.auto ? '(시간 초과)' : ''} → 실제로는 {KIND_KO[rv.kind]}({truth ? '진짜' : '거짓'})
@@ -423,55 +500,65 @@ function RevealLine({ rv, players, me, fresh }: { rv: LastReveal; players: Recor ); } +function Who({ id, players, me }: { id: string; players: Record; me: string | null }) { + return ( + + + {id === me ? '나' : nick(players, id)} + + ); +} + +/** The middle of the felt: the card being passed (with what was said), or the last verdict while the next card is chosen. */ function Table({ v, me, players, fresh }: { v: CockroachView; me: string | null; players: Record; fresh: { slide: boolean; flip: boolean } }) { const r = v.round; if (v.phase === 'finished') { const f = v.final!; return ( -
- 게임이 끝났어요 +
+ 게임이 끝났어요 {f.losingKind && } - - {nick(players, f.loser)}님 패배 · 나머지 모두 승리 - + {nick(players, f.loser)}님 패배 · 나머지 모두 승리 {v.lastReveal && }
); } - return ( -
- {r.holder !== null && r.claim ? ( - <> - {v.options.claimHistory && } -
- {v.card && v.card.known ? : } - - - {r.lastPasser === me ? '내가' : `${nick(players, r.lastPasser!)}님이`} {r.holder === me ? '나에게' : `${nick(players, r.holder)}님에게`} - - {claimLine(r.claim)} + if (r.holder !== null && r.claim) { + return ( +
+
+ + ➜ + +
+
+ {v.card && v.card.known ? : } + + + {r.lastPasser === me ? '내가' : `${nick(players, r.lastPasser!)}님이`} {r.holder === me ? '나에게' : `${nick(players, r.holder)}님에게`} -
- {v.card?.known && 점선 카드는 내가 아는 카드예요{v.card.kind === r.claim ? ' (지금 주장은 진짜)' : ' (지금 주장은 거짓)'}} -
nick(players, p)).join(', ')}`}> - 👁 본 사람 - {r.seen.map((p) => ( - - {p === me ? '나' : nick(players, p)} - - ))} - {r.passes > 0 && · {r.passes}번 넘어왔어요} -
- - ) : ( - <> - - - {r.starter === me ? '내가 카드를 건넬 차례예요' : `${nick(players, r.starter)}님의 카드를 기다리는 중`} + {claimLine(r.claim)} - - )} - {v.lastReveal && (r.holder === null || v.lastReveal.round === r.no - 1) && } +
+ {v.card?.known && 점선 카드는 내가 아는 카드예요{v.card.kind === r.claim ? ' (지금 주장은 진짜)' : ' (지금 주장은 거짓)'}} + {v.options.claimHistory && r.claims.length > 1 && } +
nick(players, p)).join(', ')}`}> + 👁 본 사람 + {r.seen.map((p) => ( + + {p === me ? '나' : nick(players, p)} + + ))} + {r.passes > 0 && · {r.passes}번 넘어왔어요} +
+
+ ); + } + const last = v.lastReveal && v.lastReveal.round === r.no - 1 ? v.lastReveal : null; + return ( +
+ {last ? : } + {r.starter === me ? '내가 카드를 건넬 차례예요' : `${nick(players, r.starter)}님의 카드를 기다리는 중`}
); } @@ -695,6 +782,7 @@ function MyArea({ deadline, offering, bubble, + fresh, }: { v: CockroachView; me: string; @@ -703,12 +791,13 @@ function MyArea({ offering: boolean; /** What I just said with 빠른 말: shown over my own area too, like everybody else's. */ bubble: string | null; + fresh: Kind | null; }) { const front = v.fronts[me]!; const active = waitingOn(v) === me; const total = v.handCounts[me] ?? 0; return ( -
+
{bubble && ( {bubble} @@ -721,27 +810,28 @@ function MyArea({ {active && }
-
- 내 앞마당 {front.total}장 -
- -
-
- 내 손패 {total}장{offering ? ' (위에서 고르세요)' : ''} - {!offering && ( -
`${KIND_KO[g.kind]} ${g.ids.length}장`).join(', ') || '없음'}`}> - {(v.myHand ?? []).map((g) => ( - - + 내 손패 {total}장{offering ? ' · 건넬 카드는 "1/3 건넬 카드 고르기"에서 골라요' : ''} +
`${KIND_KO[g.kind]} ${g.ids.length}장`).join(', ') || '없음'}`}> + {(v.myHand ?? []).map((g, i, all) => { + const mid = (all.length - 1) / 2; + return ( + + {g.ids.length} - ))} - {total === 0 && 손패가 없어요. 카드를 건넬 차례가 오면 져요.} -
- )} + ); + })} + {total === 0 && 손패가 없어요. 카드를 건넬 차례가 오면 져요.} +
+
+
+ 내 앞마당 {front.total}장 +
+ +
@@ -789,13 +879,14 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP sfx.cardFlip(); setTimeout(() => (rv.correct ? sfx.good() : cpSfx.wrong()), fxMs(260)); showBanner(rv.call === 'true' ? '진짜!' : '거짓말!', rv.correct ? 'green' : 'red', `${rv.caller === me ? '내가' : `${nick(players, rv.caller)}님이`} ${rv.correct ? '맞혔어요' : '틀렸어요'}`); - flyGhost(document.querySelector('.cp-table'), seatEl(rv.takenBy), { delay: 380, ms: 480, className: 'cp-ghost' }); + // After the flip and the stamp, a face-up copy goes to the 앞마당 of whoever takes it. + flyGhost(document.querySelector('.cp-revealcard') ?? document.querySelector('.cp-table'), seatEl(rv.takenBy), { delay: 1000, ms: 480, className: `cp-face-${rv.kind}`, label: KIND_KO[rv.kind] }); setTimeout(() => { bump(seatEl(rv.takenBy), 'shake'); const n = v.fronts[rv.takenBy]?.counts[rv.kind] ?? 0; if (!over && n >= v.loseCount - 1) cpSfx.danger(); else cpSfx.splat(); - }, fxMs(820)); + }, fxMs(1500)); } if (over && !p.over && v.final) { const f = v.final; @@ -803,7 +894,7 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP showBanner(`${f.loser === me ? '내가' : `${nick(players, f.loser)}님`} 패배!`, 'dark', f.losingKind ? `${KIND_KO[f.losingKind]}${hasBatchim(KIND_KO[f.losingKind]) ? '이' : '가'} 너무 많아요` : undefined); cpSfx.danger(); bump(seatEl(f.loser), 'shake'); - }, flip ? fxMs(1300) : 0); + }, flip ? fxMs(1900) : 0); } if (flip) { const rv = v.lastReveal!; @@ -828,7 +919,7 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP prev.current = { claims: claimsKey, reveal: revealKey, said: lastSaid, waiting: w, peek: peekKey, over }; if (slide || flip) { setFresh({ slide, flip }); - const t = setTimeout(() => setFresh({ slide: false, flip: false }), fxMs(700)); + const t = setTimeout(() => setFresh({ slide: false, flip: false }), fxMs(2400)); return () => clearTimeout(t); } return undefined; @@ -839,16 +930,23 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP const responding = amPlayer && v.round.holder === me && !v.round.peeked && v.phase === 'respond'; const seats = amPlayer ? v.order.slice(v.order.indexOf(me!) + 1).concat(v.order.slice(0, v.order.indexOf(me!))) : v.order; + // The card that just went face up lands in front of whoever took it. + const landed = fresh.flip && v.lastReveal ? { id: v.lastReveal.takenBy, kind: v.lastReveal.kind } : null; + const landedFor = (id: string) => (landed?.id === id ? landed.kind : null); + return (
-
- {seats.map((p) => ( - - ))} -
-
+
+
+ {seats.map((p) => ( + + ))} +
+ {amPlayer && } + +
{offering || passing ? ( ) : responding ? ( @@ -857,7 +955,6 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP )}
- {amPlayer && }

{announce}

diff --git a/apps/web/src/games/cockroach-poker/quick.tsx b/apps/web/src/games/cockroach-poker/quick.tsx index 4ef6640..435daf2 100644 --- a/apps/web/src/games/cockroach-poker/quick.tsx +++ b/apps/web/src/games/cockroach-poker/quick.tsx @@ -5,13 +5,20 @@ import type { QuickCard } from '../types'; function Card({ x, y, face, w = 44, h = 62, tilt = 0, red = false }: { x: number; y: number; face?: string; w?: number; h?: number; tilt?: number; red?: boolean }) { return ( - + + {!face && ( + + + + + + )} {face ? ( {face} ) : ( - + ? )} @@ -26,22 +33,26 @@ function Person({ x, y, label }: { x: number; y: number; label: string }) { 🙂 - + {label} ); } +/** Wood-rimmed felt, like the game table. */ +const Felt = () => ; + const GivePic = ( + - + - + @@ -54,7 +65,8 @@ const GivePic = ( const ChoosePic = ( - + + ⭕ 진짜! @@ -70,15 +82,21 @@ const ChoosePic = ( ); +/** 앞마당 as on the table: the same critter stacked, a count badge, red rim when it is too many. */ const LosePic = ( - - - - - - - + + {[0, 1, 2, 3].map((i) => ( + + ))} + + + 4! + + + + + 4장이면 패배 @@ -99,7 +117,7 @@ export const quickStart: QuickCard[] = [ }, { pic: LosePic, - alt: '앞마당에 쥐 카드 4장이 빨간 테두리로 모여 있어요', + alt: '앞마당에 쥐 카드 4장이 겹쳐 쌓여 빨간 테두리로 빛나요', title: '같은 벌레가 모이면 져요', text: '앞마당에 같은 벌레가 4장(2명이면 5장, 방 설정에 따라 다름) 모인 사람 한 명이 지고, 나머지는 모두 이겨요.', }, diff --git a/apps/web/src/games/halli-galli/index.tsx b/apps/web/src/games/halli-galli/index.tsx index 001f0cf..60ca314 100644 --- a/apps/web/src/games/halli-galli/index.tsx +++ b/apps/web/src/games/halli-galli/index.tsx @@ -44,19 +44,44 @@ const CSS = ` .hg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; } .hg-table { position: relative; width: 100%; height: clamp(440px, 64vh, 600px); border-radius: 28px; border: 8px solid var(--wood); box-shadow: var(--shadow); background: radial-gradient(ellipse at center, rgba(255,255,255,.14), rgba(255,255,255,0) 62%), var(--felt); overflow: hidden; touch-action: manipulation; } -.hg-seat { position: absolute; transform: translate(-50%, -50%); width: var(--sw); display: flex; flex-direction: column; align-items: center; gap: 3px; - padding: 5px 5px 6px; border-radius: 14px; background: rgba(0,0,0,.28); color: #fff; border: 3px solid transparent; z-index: 2; } -.hg-seat[data-me='true'] { background: rgba(0,0,0,.42); } -.hg-seat[data-turn='true'] { border-color: #fde047; animation: hg-blink 1s ease-in-out infinite; } -.hg-seat[data-out='true'] { opacity: .6; } +.hg-table::before { content: ''; position: absolute; left: 50%; top: 50%; width: calc(var(--bell) * 1.55); height: calc(var(--bell) * 1.55); transform: translate(-50%, -50%); + border-radius: 50%; border: 3px dashed rgba(255,255,255,.18); background: radial-gradient(circle, rgba(0,0,0,.16), rgba(0,0,0,0) 70%); pointer-events: none; } +.hg-seat { position: absolute; transform: translate(-50%, -50%); width: var(--sw); display: flex; flex-direction: column; align-items: center; gap: 4px; + padding: 4px 5px 5px; border-radius: 16px; background: rgba(0,0,0,.2); color: #fff; border: 3px solid transparent; z-index: 2; transition: background .3s ease; } +.hg-seat[data-me='true'] { background: rgba(0,0,0,.34); } +.hg-seat[data-turn='true'] { border-color: #fde047; animation: hg-blink 1.1s ease-in-out infinite; } +.hg-seat[data-out='true'] { opacity: .55; } +.hg-seat[data-win='true'] { background: rgba(250,204,21,.38); } .hg-seat .nm { display: flex; align-items: center; gap: 4px; max-width: 100%; font-weight: 800; font-size: .86rem; line-height: 1.2; } .hg-seat .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.hg-pile { position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); } -.hg-pile .stack { position: absolute; inset: 0; border-radius: 9px; } +.hg-cards { display: flex; align-items: flex-end; gap: 6px; } +.hg-seat[data-side='right'] .hg-cards { flex-direction: row-reverse; } +.hg-deck { position: relative; width: calc(var(--cw) * .72); height: calc(var(--cw) * .72 * 1.4); flex: none; } +.hg-deck .layer { position: absolute; inset: 0; border-radius: 7px; overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,.35); } +.hg-deck .none { position: absolute; inset: 0; border-radius: 7px; border: 2px dashed rgba(255,255,255,.3); } +.hg-deck[data-click='true'] { cursor: pointer; } +.hg-deck[data-click='true'] .layer:last-of-type { box-shadow: 0 0 0 3px #fde047, 0 4px 10px rgba(0,0,0,.4); animation: hg-nudge 1.1s ease-in-out infinite; } +.hg-pile { position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); perspective: 600px; flex: none; } +.hg-pile .layer { position: absolute; inset: 0; border-radius: 9px; background: #f3efe2; border: 1px solid #b9b2a0; } .hg-pile .empty { position: absolute; inset: 0; border-radius: 9px; border: 2px dashed rgba(255,255,255,.45); } -.hg-pile .shadow1 { position: absolute; inset: 0; transform: translate(3px, 3px); border-radius: 9px; background: #e7e2d3; border: 1px solid #b9b2a0; } -.hg-pile .face { position: absolute; inset: 0; animation: hg-flip .22s ease-out; } -.hg-pile .gauge { position: absolute; right: -12px; bottom: -8px; width: 30px; height: 30px; } +.hg-pile .face { position: absolute; inset: 0; transform-style: preserve-3d; } +.hg-pile .face > .f, .hg-pile .face > .b { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; } +.hg-pile .face > .b { transform: rotateY(180deg); } +.hg-pile .face[data-anim='true'] { animation: hg-flipin .5s cubic-bezier(.3,.7,.3,1) both; } +.hg-pile .gauge { position: absolute; right: -12px; bottom: -8px; width: 30px; height: 30px; z-index: 2; } +.hg-turnchip { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); background: #fde047; color: #422006; font-weight: 900; font-size: .72rem; border-radius: 999px; + padding: 1px 8px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.3); animation: hg-bob 1.1s ease-in-out infinite; pointer-events: none; } +.hg-float { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-weight: 900; font-size: 1.35rem; color: #fde047; text-shadow: 0 2px 0 #713f12, 0 0 8px rgba(0,0,0,.5); + pointer-events: none; animation: hg-float 1.3s ease-out forwards; z-index: 4; white-space: nowrap; } +.hg-float.bad { color: #fecaca; text-shadow: 0 2px 0 #7f1d1d, 0 0 8px rgba(0,0,0,.5); } +.hg-hand { position: absolute; width: calc(var(--bell) * .5); height: calc(var(--bell) * .5); transform: translate(-50%, -50%); z-index: 6; pointer-events: none; + animation: hg-slap .42s cubic-bezier(.5,.05,.4,1) forwards; left: var(--fx); top: var(--fy); } +.hg-hand svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); } +.hg-wave { position: absolute; left: 50%; top: 50%; width: var(--bell); height: var(--bell); border-radius: 50%; transform: translate(-50%, -50%) scale(.9); border: 6px solid #fde047; + pointer-events: none; z-index: 2; opacity: 0; animation: hg-wave .9s ease-out forwards; } +.hg-wave.bad { border-color: #f87171; } +.hg-wave.w2 { animation-delay: .16s; } +.hg-wave.w3 { animation-delay: .32s; } .hg-meta { display: flex; gap: 6px; align-items: center; font-size: .82rem; font-weight: 800; font-variant-numeric: tabular-nums; } .hg-back { display: inline-block; width: 11px; height: 15px; border-radius: 3px; background: #1e3a8a; border: 1.5px solid #93c5fd; vertical-align: -2px; } .hg-tag { border-radius: 999px; padding: 0 6px; font-size: .72rem; font-weight: 800; line-height: 1.6; white-space: nowrap; } @@ -75,7 +100,7 @@ const CSS = ` .hg-keys { color: var(--text-sub); font-weight: 600; font-size: .85rem; } .hg-pot { position: absolute; left: 50%; top: -2px; transform: translateX(-50%); color: #fff; font-weight: 800; font-size: .78rem; z-index: 4; pointer-events: none; background: #1e3a8a; border: 2px solid #93c5fd; border-radius: 999px; padding: 1px 8px; white-space: nowrap; } -.hg-bubble { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); z-index: 6; background: #fff; color: #111827; border-radius: 16px; padding: 8px 16px; +.hg-bubble { position: absolute; left: 50%; top: calc(50% - var(--bell) / 2 - 62px); transform: translateX(-50%); z-index: 6; background: #fff; color: #111827; border-radius: 16px; padding: 8px 16px; font-weight: 900; font-size: 1.25rem; box-shadow: 0 6px 18px rgba(0,0,0,.3); animation: hg-pop .3s ease; max-width: 92%; text-align: center; pointer-events: none; } .hg-bubble.ok { border: 4px solid #16a34a; } .hg-bubble.bad { border: 4px solid #dc2626; } @@ -98,14 +123,23 @@ const CSS = ` .hg-panel { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; } .hg-log { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; max-height: 220px; overflow: auto; } .hg-fruit-ic { width: 26px; height: 26px; display: inline-block; vertical-align: middle; } -.hg-seat[data-shake='true'] .hg-pile { animation: anim-shake .45s ease; } -.hg-seat[data-out='true'] .hg-pile { filter: grayscale(.7); transition: filter .4s ease; } +.hg-seat[data-shake='true'] .hg-cards { animation: anim-shake .45s ease; } +.hg-seat[data-out='true'] .hg-cards { filter: grayscale(.7); transition: filter .4s ease; } .hg-meta .gain { display: inline-block; } .hg-count b { display: block; animation: hg-count .9s ease-out both; } .hg-flipbtn.anim-glow { animation-duration: 1.1s; } @keyframes hg-count { 0% { transform: scale(1.8); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.85); opacity: .85; } } @keyframes hg-blink { 0%,100% { box-shadow: 0 0 0 0 rgba(253,224,71,.0); } 50% { box-shadow: 0 0 0 6px rgba(253,224,71,.55); } } -@keyframes hg-flip { from { transform: rotateY(85deg) scale(.9); } to { transform: none; } } +@keyframes hg-flipin { 0% { transform: translate(var(--from, 0px), 0px) rotateY(180deg) scale(.72); z-index: 3; } + 55% { transform: translate(calc(var(--from, 0px) * .3), -14px) rotateY(70deg) scale(1.08); } 100% { transform: none; } } +@keyframes hg-nudge { 0%,100% { transform: none; } 50% { transform: translateY(-4px); } } +@keyframes hg-bob { 0%,100% { transform: translateX(-50%); } 50% { transform: translateX(-50%) translateY(-3px); } } +@keyframes hg-float { 0% { transform: translate(-50%, -20%) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -170%) scale(1); opacity: 0; } } +@keyframes hg-slap { 0% { left: var(--fx); top: var(--fy); opacity: .2; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.3); } + 70% { left: 50%; top: calc(50% - var(--bell) * .18); opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); } + 82% { left: 50%; top: calc(50% - var(--bell) * .18); transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(.92, .78); } + 100% { left: 50%; top: calc(50% - var(--bell) * .18); opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); } } +@keyframes hg-wave { 0% { opacity: .9; transform: translate(-50%, -50%) scale(.9); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.9); } } @keyframes hg-pop { 0% { transform: translateX(-50%) scale(.6); opacity: 0; } 70% { transform: translateX(-50%) scale(1.06); opacity: 1; } 100% { transform: translateX(-50%) scale(1); } } @keyframes hg-ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(5deg); } } @keyframes hg-fly { from { left: var(--fx); top: var(--fy); opacity: 1; } 85% { opacity: .9; } to { left: var(--tx); top: var(--ty); opacity: 0; transform: translate(-50%, -50%) scale(.6); } } @@ -118,8 +152,8 @@ const CSS = ` } @media (prefers-reduced-motion: reduce) { .hg-seat[data-turn='true'] { animation: none; box-shadow: 0 0 0 4px rgba(253,224,71,.55); } - .hg-pile .face, .hg-bell .art[data-ring='true'], .hg-bubble, .hg-count b, .hg-seat[data-shake='true'] .hg-pile { animation: none; } - .hg-ghost { display: none; } + .hg-pile .face[data-anim='true'], .hg-bell .art[data-ring='true'], .hg-bubble, .hg-count b, .hg-seat[data-shake='true'] .hg-cards, .hg-turnchip, .hg-deck .layer { animation: none !important; } + .hg-ghost, .hg-hand, .hg-wave, .hg-float { display: none; } } `; @@ -214,9 +248,15 @@ export function FruitCardArt({ card }: { card: Pick if (!card) { return ( - - - + + + {[0, 1, 2, 3, 4, 5].map((i) => ( + + ))} + + + + ); } @@ -253,11 +293,35 @@ function BellArt() { ); } +/** The palm that slaps the bell (seen from above, fingers toward the bell). */ +function HandArt({ bad }: { bad: boolean }) { + const skin = bad ? '#fca5a5' : '#fcd9b6'; + const ink = bad ? '#991b1b' : '#9a5b2c'; + return ( + + {[ + [24, 14, 30], + [38, 6, 34], + [52, 6, 34], + [66, 12, 30], + ].map(([x, y, h]) => ( + + ))} + + + + ); +} + // ---------------------------------------------------------------- geometry interface Pos { left: string; top: string; + /** Which half of the table the seat sits on (its face-up pile goes on the bell's side). */ + side?: 'left' | 'right' | 'mid'; + /** Rough direction from the bell to the seat (unit circle), for the slapping hand. */ + dir?: [number, number]; } const CENTER: Pos = { left: '50%', top: '50%' }; @@ -272,9 +336,12 @@ function seatPositions(n: number, seat: { w: number; h: number }, maxRx: number, const t = (2 * Math.PI * k) / n; const c = f(Math.cos(t)); const y = tall && c !== 0 ? Math.sign(c) * Math.max(Math.abs(c), 0.75) : c; + const sn = f(Math.sin(t)); return { - left: `calc(50% - ${f(Math.sin(t))} * min(50% - ${seat.w / 2 + 6}px, ${maxRx}px))`, + left: `calc(50% - ${sn} * min(50% - ${seat.w / 2 + 6}px, ${maxRx}px))`, top: `calc(50% + ${y} * (50% - ${seat.h / 2 + 6}px))`, + side: sn > 0.2 ? 'left' : sn < -0.2 ? 'right' : 'mid', + dir: [-sn, y], }; }); } @@ -318,7 +385,44 @@ function seatLabel(s: SeatView, players: Record, me: string return parts.join(', '); } -function Seat({ s, v, pos, players, me, now, shake }: { s: SeatView; v: HalliGalliView; pos: Pos; players: Record; me: string | null; now: number; shake: boolean }) { +/** Face-down deck: a few stacked backs (more cards, taller stack). */ +function Deck({ n, onFlip }: { n: number; onFlip?: () => void }) { + const layers = n === 0 ? 0 : Math.min(5, 1 + Math.floor(n / 7)); + return ( +
+ {layers === 0 && } + {Array.from({ length: layers }, (_, i) => ( + + + + ))} +
+ ); +} + +function Seat({ + s, + v, + pos, + players, + me, + now, + shake, + win, + float, + onFlip, +}: { + s: SeatView; + v: HalliGalliView; + pos: Pos; + players: Record; + me: string | null; + now: number; + shake: boolean; + win: boolean; + float: { key: string; text: string; bad: boolean } | null; + onFlip?: () => void; +}) { const u = userOf(players, s.id); const locked = s.lockedUntil > now && s.status === 'playing'; // The deck count bumps when it grows (cards won with the bell or given as a penalty). @@ -328,31 +432,57 @@ function Seat({ s, v, pos, players, me, now, shake }: { s: SeatView; v: HalliGal if (s.deck > lastDeck.current) setGain((g) => g + 1); lastDeck.current = s.deck; }, [s.deck]); + // Only cards flipped while the table is on screen turn over from the deck (not the ones there on load). + const firstTop = useRef(s.top?.key ?? null); + const turning = v.phase === 'playing' && s.isTurn; + const side = pos.side === 'right' ? 'right' : 'left'; return (
  • + {turning && ( + + {s.id === me ? '내가 뒤집을 차례' : '뒤집는 중'} + + )}
    {s.id === me ? '나' : u.nickname}
    -
    - {s.pile > 1 && } - {s.top ? ( - - - - ) : ( - - )} - {s.isTurn && v.phase === 'playing' && v.turnDeadline !== null && } +
    + +
    + {Array.from({ length: Math.min(3, Math.max(0, s.pile - 1)) }, (_, i) => ( + + ))} + {s.top ? ( + + + + + + + + + ) : ( + + )} + {turning && v.turnDeadline !== null && } +
    0 ? 'gain anim-bump' : 'gain'}> @@ -374,6 +504,11 @@ function Seat({ s, v, pos, players, me, now, shake }: { s: SeatView; v: HalliGal )}
    + {float && ( + + {float.text} + + )}
  • ); } @@ -415,6 +550,10 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps([]); const [hit, setHit] = useState(0); const [shake, setShake] = useState<{ id: string; seq: number } | null>(null); + /** The bell just judged: the hand that slapped it, the rings, the winner's glow and "+N장" / "-N장". */ + const [slap, setSlap] = useState<{ seq: number; from: Pos; bad: boolean } | null>(null); + const [floats, setFloats] = useState>({}); + const [winner, setWinner] = useState(null); const [announce, setAnnounce] = useState(''); const sentFor = useRef(null); const prev = useRef(null); @@ -423,9 +562,9 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps s.id === me); const rot = myIdx < 0 ? v.seats : [...v.seats.slice(myIdx), ...v.seats.slice(0, myIdx)]; const many = rot.length >= 5; - const cw = phone ? (many ? 46 : 54) : many ? 70 : 86; - const sw = phone ? (many ? 74 : 86) : many ? 116 : 132; - const pos = seatPositions(rot.length, { w: sw, h: cw * 1.4 + (phone ? 50 : 58) }, phone ? 400 : 380, phone); + const cw = phone ? (many ? 40 : 50) : many ? 64 : 80; + const sw = Math.round(cw * 1.72 + 6 + 12); + const pos = seatPositions(rot.length, { w: sw, h: cw * 1.4 + (phone ? 50 : 58) + 34 }, phone ? 400 : 400, phone); const posOf = (id: string) => pos[rot.findIndex((s) => s.id === id)] ?? CENTER; const mine = v.seats.find((s) => s.id === me) ?? null; const playing = v.phase === 'playing'; @@ -501,6 +640,12 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps = {}; + if (b.correct) fl[b.player] = { key: `f${b.seq}`, text: `+${b.cards}장`, bad: false }; + else if (b.cards > 0) fl[b.player] = { key: `f${b.seq}`, text: `-${b.cards}장`, bad: true }; + setFloats(fl); // Someone else's bell wobbles too (mine already did on the press). if (b.player !== me) setHit((h) => h + 1); if (b.correct) { @@ -541,6 +686,16 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps clearTimeout(t); }, [ghosts]); + useEffect(() => { + if (!slap) return; + const t = setTimeout(() => { + setSlap(null); + setWinner(null); + setFloats({}); + }, fxMs(1400)); + return () => clearTimeout(t); + }, [slap]); + useEffect(() => { if (!shake) return; const t = setTimeout(() => setShake(null), fxMs(500)); @@ -603,7 +758,19 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps
      {rot.map((s, i) => ( - + ))}
    @@ -644,6 +811,21 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps )}
    + {slap && ( + <> + + + {!slap.bad && } + + + + + )} {ghosts.map((g) => ( - - + + + + + + ); +} + +/** Face-down deck: three stacked backs. */ +function Deck({ x, y }: { x: number; y: number }) { + return ( + + + + ); } @@ -65,7 +79,8 @@ function Bell({ x, y }: { x: number; y: number }) { function Table({ children }: { children: ReactNode }) { return ( - + + {children} ); @@ -75,9 +90,9 @@ export const quickStart: QuickCard[] = [ { pic: (
    - - - + + + diff --git a/docs/games/cockroach-poker.md b/docs/games/cockroach-poker.md index 1650c72..2591bc5 100644 --- a/docs/games/cockroach-poker.md +++ b/docs/games/cockroach-poker.md @@ -165,6 +165,7 @@ interface CockroachResult { - 판정 화면: 큰 버튼 두 개 "진짜!"(초록), "거짓말!"(빨강) + "몰래 보고 넘기기"(파랑, 넘길 사람이 없으면 비활성 + 이유). - 공개 애니메이션: 카드 뒤집기 후 "맞혔어요!/틀렸어요!"와 앞마당으로 날아가는 연출. - 초보자 도움말: "같은 벌레 4장 모이면 져요", 위험 경고 툴팁. +- 화면 개편(2026-10-14): 왼쪽(휴대폰은 위) 나무 테두리 펠트 테이블, 오른쪽(휴대폰은 아래) 행동 칸(건네기 3단계·판정 버튼·기다림 안내는 그대로). 테이블 위쪽은 상대 자리 판(이름, 손패는 뒷면 부채 + 장수, 앞마당은 벌레별로 실제 작은 카드를 겹쳐 쌓은 더미 + 장수 배지, 노란/빨간 테두리로 위험 표시), 받는 사람 자리는 노랗게 밝아진다. 가운데는 "[건넨 사람] ➜ [받는 사람]"(움직이는 화살표), 날아와 기울어 놓인 큰 카드와 주장 말풍선, 본 사람, 주장 기록. 판정이 끝나면 가운데 카드가 3D로 뒤집히며 실제 벌레가 드러나고 "진짜"/"거짓" 도장이 찍힌 뒤, 앞면 카드가 가져가는 사람 앞마당으로 날아가 더미 위에 내려앉는다(다음 카드가 건네질 때까지 판정 결과를 가운데에 남김). 테이블 아래쪽은 내 자리: 내 손패를 벌레별 카드 부채(장수 배지는 왼쪽 위)로, 그 아래 내 앞마당 더미. 움직임은 게임 속도 배율을 따른다. ## 10. 테스트 체크리스트 - [ ] 인원별 손패 장수가 4장 표와 일치, 2인은 10장 제거 후 27장씩, 카드 총합 보존. diff --git a/docs/games/halli-galli.md b/docs/games/halli-galli.md index 74dea47..15841fb 100644 --- a/docs/games/halli-galli.md +++ b/docs/games/halli-galli.md @@ -175,6 +175,7 @@ interface HalliGalliResult { - 키보드(PC): 스페이스 = 종, 엔터 = 뒤집기. - 어린이 모드: 느린 뒤집기, 과일별 합계 막대(공개 정보로 계산), "5개가 되면 종을 쳐요" 상시 안내. - 효과음은 끄기 가능, 진동(지원 기기) 옵션. +- 화면 개편(2026-10-14): 나무 테두리 펠트 테이블 가운데에 종(바닥에 점선 원). 자리마다 이름표 아래 **뒷면 덱 더미**(장수가 많을수록 높게 쌓임, 최대 5겹)와 **펼친 더미**(밑에 깔린 장수만큼 살짝 어긋난 카드)를 나란히 두고, 펼친 더미가 종 쪽을 향한다. 뒤집으면 카드가 덱에서 들려 3D로 뒤집히며 펼친 더미에 내려앉는다(처음 들어올 때 이미 펼쳐진 카드는 그대로). 차례인 자리는 노란 테두리와 "뒤집는 중"(내 차례면 "내가 뒤집을 차례") 말표, 내 차례면 내 덱이 들썩이고 덱을 눌러도 뒤집힌다(아래 [뒤집기] 버튼도 그대로). 종이 판정되면 친 사람 쪽에서 손바닥이 날아와 종을 때리고 파동이 퍼진다(정답 노란 3겹, 오답 빨간 2겹 + 빨간 손). 정답이면 펼친 카드들이 정답자에게 쓸려 가고 그 자리가 금빛으로 빛나며 "+N장", 오답이면 자리가 흔들리고 "-N장"과 벌칙 카드가 다른 사람에게 날아간다. "땡!/삐!" 말풍선은 종 바로 위에 뜬다. 움직임은 게임 속도 배율을 따른다. ## 10. 테스트 체크리스트 - [ ] 덱: 56장, 과일별 14장, 개수별 5/3/3/2/1장.