할리갈리·바퀴벌레 포커 화면 다시 만들기
- 할리갈리: 자리마다 뒷면 덱 더미(장수만큼 쌓임)와 펼친 더미를 나란히(펼친 쪽이 종 쪽), 뒤집으면 카드가 덱에서 들려 3D로 뒤집혀 내려앉음, 차례 말표·내 덱 들썩임(덱을 눌러도 뒤집기), 종 판정 때 친 사람 쪽에서 손바닥이 날아와 종을 때리고 파동(정답 노랑/오답 빨강), 정답자 금빛·"+N장", 오답 "-N장", 새 카드 뒷면, 말풍선은 종 바로 위 - 바퀴벌레 포커: 펠트 테이블(왼쪽)과 행동 칸(오른쪽, 휴대폰은 아래). 상대 자리 판(손패 뒷면 부채, 앞마당은 벌레별 실제 카드 더미+장수 배지·위험 테두리), 가운데 "건넨 사람 ➜ 받는 사람"·기울어 놓인 카드·주장 말풍선, 판정 때 카드가 3D로 뒤집히고 "진짜/거짓" 도장 → 앞면 카드가 가져가는 사람 앞마당으로 날아가 더미에 내려앉음, 내 손패 카드 부채 - 두 게임 30초 규칙 그림도 같은 테이블·카드 모양으로, 문서 §9 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 <span className="cp-empty">앞마당 비어 있음</span>;
|
||||
return (
|
||||
<>
|
||||
{front.kinds.map((k) => {
|
||||
const lv = front.level[k];
|
||||
const n = front.counts[k];
|
||||
const col = KIND_COLOR[k];
|
||||
return (
|
||||
<span key={k} className={`cp-chip ${lv}`} title={`${KIND_KO[k]} ${front.counts[k]}장${lv === 'danger' ? ` · ${loseCount}장이 되면 져요` : ''}`} style={lv === 'ok' ? { background: KIND_COLOR[k].bg, color: KIND_COLOR[k].ink } : undefined}>
|
||||
<CritterIcon kind={k} size={size} />
|
||||
{front.counts[k]}
|
||||
{lv === 'danger' && <span className="cp-mark">!</span>}
|
||||
<span key={k} className={`cp-chip ${lv}${fresh === k ? ' new' : ''}`} title={`${KIND_KO[k]} ${n}장${lv === 'danger' ? ` · ${loseCount}장이 되면 져요` : ''}`}>
|
||||
{Array.from({ length: Math.min(n, 4) }, (_, i) => (
|
||||
<span key={i} className="cp-mini" style={{ background: col.bg, borderColor: col.ink, ...(small ? { '--w': '24px' } : {}) } as React.CSSProperties}>
|
||||
<svg viewBox="0 0 64 64" aria-hidden focusable="false">
|
||||
<CritterArt kind={k} />
|
||||
</svg>
|
||||
</span>
|
||||
))}
|
||||
<span className="cp-n">
|
||||
{n}
|
||||
{lv === 'danger' ? '!' : ''}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
@@ -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<string, PublicUser>; 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 (
|
||||
<span className="cp-handfan" aria-hidden>
|
||||
{Array.from({ length: shown }, (_, i) => (
|
||||
<i key={i} style={{ '--r': `${(i - (shown - 1) / 2) * 6}deg` } as React.CSSProperties} />
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function Seat({ id, v, me, players, deadline, bubble, fresh }: { id: string; v: CockroachView; me: string | null; players: Record<string, PublicUser>; 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 (
|
||||
<section className={`cp-seat${active ? ' turn anim-glow' : ''}${loser ? ' loser' : ''}`} data-fx-seat={id} aria-label={label}>
|
||||
<section className={`cp-seat${active ? ' turn' : ''}${r.holder === id ? ' target' : ''}${loser ? ' loser' : ''}`} data-fx-seat={id} aria-label={label}>
|
||||
{bubble && (
|
||||
<span className="cp-bubble" aria-hidden>
|
||||
{bubble}
|
||||
@@ -378,11 +447,12 @@ function Seat({ id, v, me, players, deadline, bubble }: { id: string; v: Cockroa
|
||||
{v.final && <span className={`cp-badge ${loser ? 'lose' : 'win'}`}>{loser ? '패배' : '승리'}</span>}
|
||||
</div>
|
||||
<div className="cp-meta" aria-hidden>
|
||||
<HandFan n={v.handCounts[id] ?? 0} />
|
||||
<span>손패 {v.handCounts[id]}장</span>
|
||||
<span>· 앞마당 {front.total}장</span>
|
||||
</div>
|
||||
<div className="cp-front" aria-hidden>
|
||||
<FrontChips front={front} loseCount={v.loseCount} />
|
||||
<FrontChips front={front} loseCount={v.loseCount} fresh={fresh} small />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
@@ -406,14 +476,21 @@ function Chain({ claims, players }: { claims: ClaimEntry[]; players: Record<stri
|
||||
);
|
||||
}
|
||||
|
||||
function RevealLine({ rv, players, me, fresh }: { rv: LastReveal; players: Record<string, PublicUser>; me: string | null; fresh: boolean }) {
|
||||
function RevealLine({ rv, players, me, fresh, big }: { rv: LastReveal; players: Record<string, PublicUser>; 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 (
|
||||
<div className="cp-reveal" role="group" aria-label="지난 판정">
|
||||
<FaceCard kind={rv.kind} size="sm" fx={fresh ? 'flip' : undefined} />
|
||||
<div className={`cp-reveal${big ? ' big' : ''}`} role="group" aria-label="지난 판정">
|
||||
<span className="cp-revealcard">
|
||||
<FaceCard kind={rv.kind} size={big ? 'lg' : 'sm'} fx={fresh ? 'flip' : undefined} />
|
||||
{big && (
|
||||
<span className={`cp-stamp ${truth ? 'ok' : 'no'}${fresh ? ' fresh' : ''}`} aria-hidden>
|
||||
{truth ? '진짜' : '거짓'}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="small" style={{ lineHeight: 1.45 }}>
|
||||
"{KIND_KO[rv.claim]}"{hasBatchim(KIND_KO[rv.claim]) ? "이라는" : "라는"} 말에 {caller} "{callWord}"{rv.auto ? '(시간 초과)' : ''} → 실제로는 {KIND_KO[rv.kind]}({truth ? '진짜' : '거짓'})
|
||||
<br />
|
||||
@@ -423,55 +500,65 @@ function RevealLine({ rv, players, me, fresh }: { rv: LastReveal; players: Recor
|
||||
);
|
||||
}
|
||||
|
||||
function Who({ id, players, me }: { id: string; players: Record<string, PublicUser>; me: string | null }) {
|
||||
return (
|
||||
<span className="who">
|
||||
<Avatar user={userOf(players, id)} size={22} />
|
||||
{id === me ? '나' : nick(players, id)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** 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<string, PublicUser>; fresh: { slide: boolean; flip: boolean } }) {
|
||||
const r = v.round;
|
||||
if (v.phase === 'finished') {
|
||||
const f = v.final!;
|
||||
return (
|
||||
<div className="cp-table" role="group" aria-label="테이블">
|
||||
<strong style={{ fontSize: '1.15rem', textAlign: 'center' }}>게임이 끝났어요</strong>
|
||||
<div className="cp-center cp-table" role="group" aria-label="테이블">
|
||||
<strong style={{ fontSize: '1.2rem' }}>게임이 끝났어요</strong>
|
||||
{f.losingKind && <FaceCard kind={f.losingKind} size="lg" />}
|
||||
<span style={{ textAlign: 'center' }}>
|
||||
{nick(players, f.loser)}님 패배 · 나머지 모두 승리
|
||||
</span>
|
||||
<span>{nick(players, f.loser)}님 패배 · 나머지 모두 승리</span>
|
||||
{v.lastReveal && <RevealLine rv={v.lastReveal} players={players} me={me} fresh={false} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="cp-table" role="group" aria-label="테이블">
|
||||
{r.holder !== null && r.claim ? (
|
||||
<>
|
||||
{v.options.claimHistory && <Chain claims={r.claims} players={players} />}
|
||||
<div className="cp-flight">
|
||||
{v.card && v.card.known ? <FaceCard kind={v.card.kind} size="lg" fx={`mine${fresh.slide ? ' slide' : ''}`} /> : <BackCard size="lg" fx={fresh.slide ? 'slide' : undefined} />}
|
||||
<span className="cp-speech" role="status">
|
||||
<span className="who">
|
||||
{r.lastPasser === me ? '내가' : `${nick(players, r.lastPasser!)}님이`} {r.holder === me ? '나에게' : `${nick(players, r.holder)}님에게`}
|
||||
</span>
|
||||
{claimLine(r.claim)}
|
||||
if (r.holder !== null && r.claim) {
|
||||
return (
|
||||
<div className="cp-center cp-table" role="group" aria-label="테이블">
|
||||
<div className="cp-route" aria-hidden>
|
||||
<Who id={r.lastPasser!} players={players} me={me} />
|
||||
<span className="arr">➜</span>
|
||||
<Who id={r.holder} players={players} me={me} />
|
||||
</div>
|
||||
<div className="cp-flight">
|
||||
{v.card && v.card.known ? <FaceCard kind={v.card.kind} size="lg" fx={`mine${fresh.slide ? ' slide' : ''}`} /> : <BackCard size="lg" fx={fresh.slide ? 'slide' : undefined} />}
|
||||
<span key={`${r.no}-${r.claims.length}`} className="cp-speech" role="status">
|
||||
<span className="who">
|
||||
{r.lastPasser === me ? '내가' : `${nick(players, r.lastPasser!)}님이`} {r.holder === me ? '나에게' : `${nick(players, r.holder)}님에게`}
|
||||
</span>
|
||||
</div>
|
||||
{v.card?.known && <span className="small">점선 카드는 내가 아는 카드예요{v.card.kind === r.claim ? ' (지금 주장은 진짜)' : ' (지금 주장은 거짓)'}</span>}
|
||||
<div className="cp-seenrow" aria-label={`이 카드를 본 사람: ${r.seen.map((p) => nick(players, p)).join(', ')}`}>
|
||||
<span aria-hidden>👁 본 사람</span>
|
||||
{r.seen.map((p) => (
|
||||
<span key={p} className="s" aria-hidden>
|
||||
{p === me ? '나' : nick(players, p)}
|
||||
</span>
|
||||
))}
|
||||
{r.passes > 0 && <span aria-hidden>· {r.passes}번 넘어왔어요</span>}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<BackCard size="lg" />
|
||||
<span style={{ fontWeight: 800, textAlign: 'center' }}>
|
||||
{r.starter === me ? '내가 카드를 건넬 차례예요' : `${nick(players, r.starter)}님의 카드를 기다리는 중`}
|
||||
{claimLine(r.claim)}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{v.lastReveal && (r.holder === null || v.lastReveal.round === r.no - 1) && <RevealLine rv={v.lastReveal} players={players} me={me} fresh={fresh.flip} />}
|
||||
</div>
|
||||
{v.card?.known && <span className="small">점선 카드는 내가 아는 카드예요{v.card.kind === r.claim ? ' (지금 주장은 진짜)' : ' (지금 주장은 거짓)'}</span>}
|
||||
{v.options.claimHistory && r.claims.length > 1 && <Chain claims={r.claims} players={players} />}
|
||||
<div className="cp-seenrow" aria-label={`이 카드를 본 사람: ${r.seen.map((p) => nick(players, p)).join(', ')}`}>
|
||||
<span aria-hidden>👁 본 사람</span>
|
||||
{r.seen.map((p) => (
|
||||
<span key={p} className="s" aria-hidden>
|
||||
{p === me ? '나' : nick(players, p)}
|
||||
</span>
|
||||
))}
|
||||
{r.passes > 0 && <span aria-hidden>· {r.passes}번 넘어왔어요</span>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const last = v.lastReveal && v.lastReveal.round === r.no - 1 ? v.lastReveal : null;
|
||||
return (
|
||||
<div className="cp-center cp-table" role="group" aria-label="테이블">
|
||||
{last ? <RevealLine rv={last} players={players} me={me} fresh={fresh.flip} big /> : <BackCard size="lg" />}
|
||||
<span className="cp-wait">{r.starter === me ? '내가 카드를 건넬 차례예요' : `${nick(players, r.starter)}님의 카드를 기다리는 중`}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -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 (
|
||||
<section className={`cp-me${active ? ' turn anim-glow' : ''}`} data-fx-seat={me} aria-label="내 자리">
|
||||
<section className={`cp-me${active ? ' turn' : ''}${v.final?.loser === me ? ' loser' : ''}`} data-fx-seat={me} aria-label="내 자리">
|
||||
{bubble && (
|
||||
<span className="cp-bubble" aria-hidden>
|
||||
{bubble}
|
||||
@@ -721,27 +810,28 @@ function MyArea({
|
||||
{active && <TurnTimer deadline={deadline} totalMs={v.turnMs} mine size={30} />}
|
||||
</div>
|
||||
<div className="cp-me-row">
|
||||
<div>
|
||||
<span className="small muted">내 앞마당 {front.total}장</span>
|
||||
<div className="cp-front" role="img" aria-label={`내 ${frontText(front, v.loseCount)}`}>
|
||||
<FrontChips front={front} loseCount={v.loseCount} size={26} />
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<span className="small muted">내 손패 {total}장{offering ? ' (위에서 고르세요)' : ''}</span>
|
||||
{!offering && (
|
||||
<div className="cp-hand" role="list" aria-label={`내 손패: ${(v.myHand ?? []).map((g) => `${KIND_KO[g.kind]} ${g.ids.length}장`).join(', ') || '없음'}`}>
|
||||
{(v.myHand ?? []).map((g) => (
|
||||
<span key={g.kind} className="cp-pick" role="listitem" aria-label={`${KIND_KO[g.kind]} ${g.ids.length}장`}>
|
||||
<FaceCard kind={g.kind} size="sm" />
|
||||
<span className="small">내 손패 {total}장{offering ? ' · 건넬 카드는 "1/3 건넬 카드 고르기"에서 골라요' : ''}</span>
|
||||
<div className="cp-myhand" role="list" aria-label={`내 손패: ${(v.myHand ?? []).map((g) => `${KIND_KO[g.kind]} ${g.ids.length}장`).join(', ') || '없음'}`}>
|
||||
{(v.myHand ?? []).map((g, i, all) => {
|
||||
const mid = (all.length - 1) / 2;
|
||||
return (
|
||||
<span key={g.kind} className="grp cp-pick" role="listitem" aria-label={`${KIND_KO[g.kind]} ${g.ids.length}장`} style={{ '--r': `${(i - mid) * 4}deg`, '--y': `${Math.abs(i - mid) * 2}px` } as React.CSSProperties}>
|
||||
<FaceCard kind={g.kind} />
|
||||
<span className="cp-count" aria-hidden>
|
||||
{g.ids.length}
|
||||
</span>
|
||||
</span>
|
||||
))}
|
||||
{total === 0 && <span className="cp-empty">손패가 없어요. 카드를 건넬 차례가 오면 져요.</span>}
|
||||
</div>
|
||||
)}
|
||||
);
|
||||
})}
|
||||
{total === 0 && <span className="cp-empty">손패가 없어요. 카드를 건넬 차례가 오면 져요.</span>}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span className="small">내 앞마당 {front.total}장</span>
|
||||
<div className="cp-front" role="img" aria-label={`내 ${frontText(front, v.loseCount)}`}>
|
||||
<FrontChips front={front} loseCount={v.loseCount} fresh={fresh} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -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 (
|
||||
<div className="cp-board" role="region" aria-label="바퀴벌레 포커 판">
|
||||
<style>{CSS}</style>
|
||||
<div className="cp-seats">
|
||||
{seats.map((p) => (
|
||||
<Seat key={p} id={p} v={v} me={me} players={players} deadline={deadline} bubble={bubbles[p] ?? null} />
|
||||
))}
|
||||
</div>
|
||||
<div className="cp-mid">
|
||||
<div className="cp-felt">
|
||||
<div className="cp-opps">
|
||||
{seats.map((p) => (
|
||||
<Seat key={p} id={p} v={v} me={me} players={players} deadline={deadline} bubble={bubbles[p] ?? null} fresh={landedFor(p)} />
|
||||
))}
|
||||
</div>
|
||||
<Table v={v} me={me} players={players} fresh={fresh} />
|
||||
{amPlayer && <MyArea v={v} me={me!} players={players} deadline={deadline} offering={offering} bubble={bubbles[me!] ?? null} fresh={landedFor(me!)} />}
|
||||
</div>
|
||||
<div className="cp-actions">
|
||||
{offering || passing ? (
|
||||
<GiveFlow v={v} players={players} act={act} pending={pending} />
|
||||
) : responding ? (
|
||||
@@ -857,7 +955,6 @@ function CockroachBoard({ view: v, me, players, act, pending, deadline }: BoardP
|
||||
<WaitPanel v={v} players={players} me={me} />
|
||||
)}
|
||||
</div>
|
||||
{amPlayer && <MyArea v={v} me={me!} players={players} deadline={deadline} offering={offering} bubble={bubbles[me!] ?? null} />}
|
||||
<p className="sr-only" aria-live="polite">
|
||||
{announce}
|
||||
</p>
|
||||
|
||||
@@ -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 (
|
||||
<g transform={`translate(${x} ${y}) rotate(${tilt})`}>
|
||||
<rect x={-w / 2} y={-h / 2} width={w} height={h} rx={6} fill={face ? '#fffaf0' : '#5b3f8c'} stroke={red ? '#b91c1c' : '#3b2a5c'} strokeWidth={red ? 3 : 1.5} />
|
||||
<rect x={-w / 2} y={-h / 2} width={w} height={h} rx={6} fill={face ? '#fffaf0' : '#6d28d9'} stroke={red ? '#ef4444' : face ? '#3b2a5c' : '#ede9fe'} strokeWidth={red ? 3 : 2} />
|
||||
{!face && (
|
||||
<g fill="none" stroke="#8b5cf6" strokeWidth={2}>
|
||||
<circle cx={0} cy={0} r={w * 0.16} />
|
||||
<circle cx={0} cy={0} r={w * 0.3} />
|
||||
<circle cx={0} cy={0} r={w * 0.44} />
|
||||
</g>
|
||||
)}
|
||||
{face ? (
|
||||
<text x={0} y={9} textAnchor="middle" fontSize={26}>
|
||||
{face}
|
||||
</text>
|
||||
) : (
|
||||
<text x={0} y={8} textAnchor="middle" fontSize={22} fill="#e7def5">
|
||||
<text x={0} y={8} textAnchor="middle" fontSize={22} fontWeight={900} fill="#fff">
|
||||
?
|
||||
</text>
|
||||
)}
|
||||
@@ -26,22 +33,26 @@ function Person({ x, y, label }: { x: number; y: number; label: string }) {
|
||||
<text x={x} y={y + 7} textAnchor="middle" fontSize={20}>
|
||||
🙂
|
||||
</text>
|
||||
<text x={x} y={y + 38} textAnchor="middle" fontSize={12} fill="#333">
|
||||
<text x={x} y={y + 38} textAnchor="middle" fontSize={12} fontWeight={700} fill="#fff">
|
||||
{label}
|
||||
</text>
|
||||
</g>
|
||||
);
|
||||
}
|
||||
|
||||
/** Wood-rimmed felt, like the game table. */
|
||||
const Felt = () => <rect x={2} y={2} width={256} height={166} rx={16} fill="#1f6b4a" stroke="#c8913f" strokeWidth={5} />;
|
||||
|
||||
const GivePic = (
|
||||
<svg viewBox="0 0 260 170" width={260} height={170} aria-hidden>
|
||||
<Felt />
|
||||
<Person x={36} y={110} label="나" />
|
||||
<Person x={224} y={110} label="받는 사람" />
|
||||
<Card x={130} y={112} tilt={-6} />
|
||||
<path d="M70 128 Q130 160 190 128" fill="none" stroke="#4f46e5" strokeWidth={2.5} strokeDasharray="5 4" markerEnd="url(#cpq-arrow)" />
|
||||
<path d="M70 128 Q130 160 190 128" fill="none" stroke="#fde047" strokeWidth={2.5} strokeDasharray="5 4" markerEnd="url(#cpq-arrow)" />
|
||||
<defs>
|
||||
<marker id="cpq-arrow" viewBox="0 0 10 10" refX={6} refY={5} markerWidth={7} markerHeight={7} orient="auto">
|
||||
<path d="M0 0 L10 5 L0 10 z" fill="#4f46e5" />
|
||||
<path d="M0 0 L10 5 L0 10 z" fill="#fde047" />
|
||||
</marker>
|
||||
</defs>
|
||||
<rect x={64} y={14} width={132} height={44} rx={14} fill="#fff" stroke="#333" strokeWidth={1.5} />
|
||||
@@ -54,7 +65,8 @@ const GivePic = (
|
||||
|
||||
const ChoosePic = (
|
||||
<svg viewBox="0 0 260 170" width={260} height={170} aria-hidden>
|
||||
<Card x={130} y={40} />
|
||||
<Felt />
|
||||
<Card x={130} y={42} tilt={-4} />
|
||||
<rect x={14} y={84} width={110} height={36} rx={10} fill="#dcfce7" stroke="#15803d" strokeWidth={2} />
|
||||
<text x={69} y={108} textAnchor="middle" fontSize={16} fontWeight={700} fill="#14532d">
|
||||
⭕ 진짜!
|
||||
@@ -70,15 +82,21 @@ const ChoosePic = (
|
||||
</svg>
|
||||
);
|
||||
|
||||
/** 앞마당 as on the table: the same critter stacked, a count badge, red rim when it is too many. */
|
||||
const LosePic = (
|
||||
<svg viewBox="0 0 260 170" width={260} height={170} aria-hidden>
|
||||
<Card x={40} y={66} face="🐀" red />
|
||||
<Card x={100} y={66} face="🐀" red />
|
||||
<Card x={160} y={66} face="🐀" red />
|
||||
<Card x={220} y={66} face="🐀" red />
|
||||
<Card x={70} y={140} face="🦇" w={34} h={46} />
|
||||
<Card x={110} y={140} face="🐸" w={34} h={46} />
|
||||
<text x={186} y={147} textAnchor="middle" fontSize={17} fontWeight={800} fill="#b91c1c">
|
||||
<Felt />
|
||||
{[0, 1, 2, 3].map((i) => (
|
||||
<Card key={i} x={70} y={52 + i * 14} face="🐀" red={i === 3} />
|
||||
))}
|
||||
<circle cx={96} cy={122} r={12} fill="#dc2626" stroke="#fff" strokeWidth={2} />
|
||||
<text x={96} y={127} textAnchor="middle" fontSize={13} fontWeight={900} fill="#fff">
|
||||
4!
|
||||
</text>
|
||||
<Card x={150} y={66} face="🦇" w={34} h={46} />
|
||||
<Card x={150} y={80} face="🦇" w={34} h={46} />
|
||||
<Card x={196} y={73} face="🐸" w={34} h={46} />
|
||||
<text x={170} y={140} textAnchor="middle" fontSize={17} fontWeight={800} fill="#fecaca">
|
||||
4장이면 패배
|
||||
</text>
|
||||
</svg>
|
||||
@@ -99,7 +117,7 @@ export const quickStart: QuickCard[] = [
|
||||
},
|
||||
{
|
||||
pic: LosePic,
|
||||
alt: '앞마당에 쥐 카드 4장이 빨간 테두리로 모여 있어요',
|
||||
alt: '앞마당에 쥐 카드 4장이 겹쳐 쌓여 빨간 테두리로 빛나요',
|
||||
title: '같은 벌레가 모이면 져요',
|
||||
text: '앞마당에 같은 벌레가 4장(2명이면 5장, 방 설정에 따라 다름) 모인 사람 한 명이 지고, 나머지는 모두 이겨요.',
|
||||
},
|
||||
|
||||
@@ -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<TopCard, 'fruit' | 'count'>
|
||||
if (!card) {
|
||||
return (
|
||||
<svg viewBox="0 0 100 140" width="100%" height="100%" aria-hidden>
|
||||
<rect x="2" y="2" width="96" height="136" rx="11" fill="#1e3a8a" stroke="#93c5fd" strokeWidth="3" />
|
||||
<rect x="12" y="12" width="76" height="116" rx="7" fill="none" stroke="#93c5fd" strokeWidth="2" strokeDasharray="6 5" />
|
||||
<circle cx="50" cy="70" r="16" fill="#fbbf24" stroke="#fde68a" strokeWidth="3" />
|
||||
<rect x="2" y="2" width="96" height="136" rx="11" fill="#1d4ed8" stroke="#fff" strokeWidth="4" />
|
||||
<rect x="11" y="11" width="78" height="118" rx="7" fill="#1e3a8a" />
|
||||
{[0, 1, 2, 3, 4, 5].map((i) => (
|
||||
<path key={i} d={`M11 ${22 + i * 20} l39 -12 l39 12`} fill="none" stroke="#3b82f6" strokeWidth="3" opacity=".7" />
|
||||
))}
|
||||
<circle cx="50" cy="70" r="19" fill="#fbbf24" stroke="#fff" strokeWidth="3" />
|
||||
<path d="M40 78 C40 66 44 59 50 59 C56 59 60 66 60 78 Z" fill="#fff7d1" stroke="#92400e" strokeWidth="2" />
|
||||
<circle cx="50" cy="57" r="3" fill="#b91c1c" />
|
||||
<rect x="37" y="77" width="26" height="4" rx="2" fill="#92400e" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -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 (
|
||||
<svg viewBox="0 0 100 100" aria-hidden>
|
||||
{[
|
||||
[24, 14, 30],
|
||||
[38, 6, 34],
|
||||
[52, 6, 34],
|
||||
[66, 12, 30],
|
||||
].map(([x, y, h]) => (
|
||||
<rect key={x} x={x! - 6} y={y} width="13" height={h} rx="6.5" fill={skin} stroke={ink} strokeWidth="2.5" />
|
||||
))}
|
||||
<path d="M18 40 C18 34 82 34 82 40 L80 70 C78 86 64 94 50 94 C34 94 22 86 20 70 Z" fill={skin} stroke={ink} strokeWidth="2.5" />
|
||||
<path d="M80 52 C88 46 96 48 94 56 C90 64 84 70 78 74" fill={skin} stroke={ink} strokeWidth="2.5" strokeLinecap="round" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- 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<string, PublicUser>, me: string
|
||||
return parts.join(', ');
|
||||
}
|
||||
|
||||
function Seat({ s, v, pos, players, me, now, shake }: { s: SeatView; v: HalliGalliView; pos: Pos; players: Record<string, PublicUser>; 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 (
|
||||
<div className="hg-deck" data-click={!!onFlip} onClick={onFlip} aria-hidden>
|
||||
{layers === 0 && <span className="none" />}
|
||||
{Array.from({ length: layers }, (_, i) => (
|
||||
<span key={i} className="layer" style={{ transform: `translate(${-i * 1.5}px, ${-i * 2}px)` }}>
|
||||
<FruitCardArt card={null} />
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Seat({
|
||||
s,
|
||||
v,
|
||||
pos,
|
||||
players,
|
||||
me,
|
||||
now,
|
||||
shake,
|
||||
win,
|
||||
float,
|
||||
onFlip,
|
||||
}: {
|
||||
s: SeatView;
|
||||
v: HalliGalliView;
|
||||
pos: Pos;
|
||||
players: Record<string, PublicUser>;
|
||||
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 (
|
||||
<li
|
||||
className="hg-seat"
|
||||
data-turn={s.isTurn && v.phase === 'playing'}
|
||||
data-turn={turning}
|
||||
data-out={s.status !== 'playing'}
|
||||
data-shake={shake}
|
||||
data-win={win}
|
||||
data-me={s.id === me}
|
||||
data-seat={s.id}
|
||||
data-side={side}
|
||||
style={{ left: pos.left, top: pos.top }}
|
||||
aria-label={seatLabel(s, players, me)}
|
||||
>
|
||||
{turning && (
|
||||
<span className="hg-turnchip" aria-hidden>
|
||||
{s.id === me ? '내가 뒤집을 차례' : '뒤집는 중'}
|
||||
</span>
|
||||
)}
|
||||
<div className="nm">
|
||||
<Avatar user={u} size={18} />
|
||||
<span>{s.id === me ? '나' : u.nickname}</span>
|
||||
</div>
|
||||
<div className="hg-pile">
|
||||
{s.pile > 1 && <span className="shadow1" />}
|
||||
{s.top ? (
|
||||
<span key={s.top.key} className="face">
|
||||
<FruitCardArt card={s.top} />
|
||||
</span>
|
||||
) : (
|
||||
<span className="empty" />
|
||||
)}
|
||||
{s.isTurn && v.phase === 'playing' && v.turnDeadline !== null && <Gauge start={v.turnStartedAt} end={v.turnDeadline} now={now} />}
|
||||
<div className="hg-cards">
|
||||
<Deck n={s.deck} onFlip={onFlip} />
|
||||
<div className="hg-pile">
|
||||
{Array.from({ length: Math.min(3, Math.max(0, s.pile - 1)) }, (_, i) => (
|
||||
<span key={i} className="layer" style={{ transform: `translate(${(i + 1) * 1.5}px, ${(i + 1) * 2}px) rotate(${(i % 2 ? -1 : 1) * (2 + i)}deg)` }} />
|
||||
))}
|
||||
{s.top ? (
|
||||
<span
|
||||
key={s.top.key}
|
||||
className="face"
|
||||
data-anim={s.top.key !== firstTop.current}
|
||||
style={{ '--from': side === 'right' ? 'calc(var(--cw) * .86 + 6px)' : 'calc(var(--cw) * -.86 - 6px)' } as CSSProperties}
|
||||
>
|
||||
<span className="f">
|
||||
<FruitCardArt card={s.top} />
|
||||
</span>
|
||||
<span className="b">
|
||||
<FruitCardArt card={null} />
|
||||
</span>
|
||||
</span>
|
||||
) : (
|
||||
<span className="empty" />
|
||||
)}
|
||||
{turning && v.turnDeadline !== null && <Gauge start={v.turnStartedAt} end={v.turnDeadline} now={now} />}
|
||||
</div>
|
||||
</div>
|
||||
<div className="hg-meta" aria-hidden>
|
||||
<span key={gain} className={gain > 0 ? 'gain anim-bump' : 'gain'}>
|
||||
@@ -374,6 +504,11 @@ function Seat({ s, v, pos, players, me, now, shake }: { s: SeatView; v: HalliGal
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{float && (
|
||||
<span key={float.key} className={`hg-float${float.bad ? ' bad' : ''}`} aria-hidden>
|
||||
{float.text}
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
@@ -415,6 +550,10 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps<Hall
|
||||
const [ghosts, setGhosts] = useState<Ghost[]>([]);
|
||||
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<Record<string, { key: string; text: string; bad: boolean }>>({});
|
||||
const [winner, setWinner] = useState<string | null>(null);
|
||||
const [announce, setAnnounce] = useState('');
|
||||
const sentFor = useRef<number | null>(null);
|
||||
const prev = useRef<HalliGalliView | null>(null);
|
||||
@@ -423,9 +562,9 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps<Hall
|
||||
const myIdx = v.seats.findIndex((s) => 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<Hall
|
||||
}
|
||||
const to = posOf(b.player);
|
||||
const fly: Ghost[] = [];
|
||||
setSlap({ seq: b.seq, from: to, bad: !b.correct });
|
||||
if (b.correct) setWinner(b.player);
|
||||
const fl: Record<string, { key: string; text: string; bad: boolean }> = {};
|
||||
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<Hall
|
||||
return () => 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<Hall
|
||||
>
|
||||
<ul style={{ listStyle: 'none', margin: 0, padding: 0 }} aria-label="사람들의 펼친 카드">
|
||||
{rot.map((s, i) => (
|
||||
<Seat key={s.id} s={s} v={v} pos={pos[i]!} players={players} me={me} now={now} shake={shake?.id === s.id} />
|
||||
<Seat
|
||||
key={s.id}
|
||||
s={s}
|
||||
v={v}
|
||||
pos={pos[i]!}
|
||||
players={players}
|
||||
me={me}
|
||||
now={now}
|
||||
shake={shake?.id === s.id}
|
||||
win={winner === s.id}
|
||||
float={floats[s.id] ?? null}
|
||||
onFlip={s.id === me && canFlip ? flip : undefined}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<div className="hg-center">
|
||||
@@ -644,6 +811,21 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps<Hall
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{slap && (
|
||||
<>
|
||||
<span key={`w1-${slap.seq}`} className={`hg-wave${slap.bad ? ' bad' : ''}`} aria-hidden />
|
||||
<span key={`w2-${slap.seq}`} className={`hg-wave w2${slap.bad ? ' bad' : ''}`} aria-hidden />
|
||||
{!slap.bad && <span key={`w3-${slap.seq}`} className="hg-wave w3" aria-hidden />}
|
||||
<span
|
||||
key={`h-${slap.seq}`}
|
||||
className="hg-hand"
|
||||
aria-hidden
|
||||
style={{ '--fx': slap.from.left, '--fy': slap.from.top, '--rot': `${Math.round((-Math.atan2(slap.from.dir?.[0] ?? 0, slap.from.dir?.[1] ?? 1) * 180) / Math.PI)}deg` } as CSSProperties}
|
||||
>
|
||||
<HandArt bad={slap.bad} />
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{ghosts.map((g) => (
|
||||
<span
|
||||
key={g.key}
|
||||
|
||||
@@ -42,11 +42,25 @@ function Card({ f, n, x, y }: { f: F; n: number; x: number; y: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
/** Card back as on the table: blue, white rim, a little bell in a gold disc. */
|
||||
function Back({ x, y }: { x: number; y: number }) {
|
||||
return (
|
||||
<g transform={`translate(${x} ${y})`}>
|
||||
<rect x={0} y={0} width={40} height={56} rx={5} fill="#1e3a8a" stroke="#93c5fd" strokeWidth={2} />
|
||||
<circle cx={20} cy={28} r={7} fill="#fbbf24" />
|
||||
<rect x={0} y={0} width={40} height={56} rx={5} fill="#1d4ed8" stroke="#fff" strokeWidth={2} />
|
||||
<rect x={4} y={4} width={32} height={48} rx={3} fill="#1e3a8a" />
|
||||
<circle cx={20} cy={28} r={8} fill="#fbbf24" stroke="#fff" strokeWidth={1.5} />
|
||||
<path d="M16 31 C16 26 18 23 20 23 C22 23 24 26 24 31 Z" fill="#fff7d1" />
|
||||
</g>
|
||||
);
|
||||
}
|
||||
|
||||
/** Face-down deck: three stacked backs. */
|
||||
function Deck({ x, y }: { x: number; y: number }) {
|
||||
return (
|
||||
<g>
|
||||
<Back x={x + 3} y={y + 4} />
|
||||
<Back x={x + 1.5} y={y + 2} />
|
||||
<Back x={x} y={y} />
|
||||
</g>
|
||||
);
|
||||
}
|
||||
@@ -65,7 +79,8 @@ function Bell({ x, y }: { x: number; y: number }) {
|
||||
function Table({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<svg viewBox="0 0 240 150" width={240} height={150} aria-hidden>
|
||||
<rect x={0} y={0} width={240} height={150} rx={14} fill="#166534" />
|
||||
<rect x={2} y={2} width={236} height={146} rx={16} fill="#1f6b4a" stroke="#c8913f" strokeWidth={5} />
|
||||
<ellipse cx={120} cy={75} rx={90} ry={52} fill="#ffffff" opacity={0.07} />
|
||||
{children}
|
||||
</svg>
|
||||
);
|
||||
@@ -75,9 +90,9 @@ export const quickStart: QuickCard[] = [
|
||||
{
|
||||
pic: (
|
||||
<Table>
|
||||
<Back x={20} y={80} />
|
||||
<path d="M66 108 L88 108" stroke="#fff" strokeWidth={3} />
|
||||
<path d="M84 102 L92 108 L84 114" fill="none" stroke="#fff" strokeWidth={3} />
|
||||
<Deck x={20} y={78} />
|
||||
<path d="M44 74 Q72 50 104 74" fill="none" stroke="#fde047" strokeWidth={3} strokeDasharray="5 4" />
|
||||
<path d="M98 66 L106 76 L94 78" fill="none" stroke="#fde047" strokeWidth={3} />
|
||||
<Card f="banana" n={3} x={100} y={80} />
|
||||
<Card f="strawberry" n={2} x={60} y={12} />
|
||||
<Card f="banana" n={1} x={140} y={12} />
|
||||
|
||||
@@ -165,6 +165,7 @@ interface CockroachResult {
|
||||
- 판정 화면: 큰 버튼 두 개 "진짜!"(초록), "거짓말!"(빨강) + "몰래 보고 넘기기"(파랑, 넘길 사람이 없으면 비활성 + 이유).
|
||||
- 공개 애니메이션: 카드 뒤집기 후 "맞혔어요!/틀렸어요!"와 앞마당으로 날아가는 연출.
|
||||
- 초보자 도움말: "같은 벌레 4장 모이면 져요", 위험 경고 툴팁.
|
||||
- 화면 개편(2026-10-14): 왼쪽(휴대폰은 위) 나무 테두리 펠트 테이블, 오른쪽(휴대폰은 아래) 행동 칸(건네기 3단계·판정 버튼·기다림 안내는 그대로). 테이블 위쪽은 상대 자리 판(이름, 손패는 뒷면 부채 + 장수, 앞마당은 벌레별로 실제 작은 카드를 겹쳐 쌓은 더미 + 장수 배지, 노란/빨간 테두리로 위험 표시), 받는 사람 자리는 노랗게 밝아진다. 가운데는 "[건넨 사람] ➜ [받는 사람]"(움직이는 화살표), 날아와 기울어 놓인 큰 카드와 주장 말풍선, 본 사람, 주장 기록. 판정이 끝나면 가운데 카드가 3D로 뒤집히며 실제 벌레가 드러나고 "진짜"/"거짓" 도장이 찍힌 뒤, 앞면 카드가 가져가는 사람 앞마당으로 날아가 더미 위에 내려앉는다(다음 카드가 건네질 때까지 판정 결과를 가운데에 남김). 테이블 아래쪽은 내 자리: 내 손패를 벌레별 카드 부채(장수 배지는 왼쪽 위)로, 그 아래 내 앞마당 더미. 움직임은 게임 속도 배율을 따른다.
|
||||
|
||||
## 10. 테스트 체크리스트
|
||||
- [ ] 인원별 손패 장수가 4장 표와 일치, 2인은 10장 제거 후 27장씩, 카드 총합 보존.
|
||||
|
||||
@@ -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장.
|
||||
|
||||
Reference in New Issue
Block a user