할리갈리·바퀴벌레 포커 화면 다시 만들기
- 할리갈리: 자리마다 뒷면 덱 더미(장수만큼 쌓임)와 펼친 더미를 나란히(펼친 쪽이 종 쪽), 뒤집으면 카드가 덱에서 들려 3D로 뒤집혀 내려앉음, 차례 말표·내 덱 들썩임(덱을 눌러도 뒤집기), 종 판정 때 친 사람 쪽에서 손바닥이 날아와 종을 때리고 파동(정답 노랑/오답 빨강), 정답자 금빛·"+N장", 오답 "-N장", 새 카드 뒷면, 말풍선은 종 바로 위 - 바퀴벌레 포커: 펠트 테이블(왼쪽)과 행동 칸(오른쪽, 휴대폰은 아래). 상대 자리 판(손패 뒷면 부채, 앞마당은 벌레별 실제 카드 더미+장수 배지·위험 테두리), 가운데 "건넨 사람 ➜ 받는 사람"·기울어 놓인 카드·주장 말풍선, 판정 때 카드가 3D로 뒤집히고 "진짜/거짓" 도장 → 앞면 카드가 가져가는 사람 앞마당으로 날아가 더미에 내려앉음, 내 손패 카드 부채 - 두 게임 30초 규칙 그림도 같은 테이블·카드 모양으로, 문서 §9 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user