모든 게임이 남는 화면 전체를 쓰도록: 게임별 폭 상한 제거, 판·카드·말을 --play-w/--play-h에 맞춰 키움
- 카드 게임: 펠트가 남는 높이를 채우고 손패·가운데 더미·자리 크기가 화면에 따라 커짐 - 판 게임: 체스·바둑·오목 등은 높이를 다 쓰고, 장기·쿼리도·젬블로는 넓은 화면에서 조작판을 판 옆으로 - 섯다: 자리를 판 크기에 맞춘 타원 위에 고르게 두고, 많을 때 자리 크기를 줄여 8명에서도 겹치지 않게 - 바퀴벌레 포커 6명·야단법석 달리기 5명 선수 뽑기가 PC에서 넘치지 않게 - 휴대폰·태블릿(1100px 아래) 배치는 그대로 - layout-survey: 컴퓨터 넣기 버튼 기다림, 넘친 높이(px) 표시 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import type { BoardProps, GameUI, OptionsProps } from '../types';
|
||||
import { helpNow } from './help';
|
||||
import { quickStart } from './quick';
|
||||
import { fxMs } from '../../lib/motion';
|
||||
import { useWide } from '../../lib/media';
|
||||
|
||||
const FRUITS: Fruit[] = ['strawberry', 'banana', 'lime', 'plum'];
|
||||
const FRUIT_KO: Record<Fruit, string> = { strawberry: '딸기', banana: '바나나', lime: '라임', plum: '자두' };
|
||||
@@ -36,7 +37,8 @@ const hgSound = {
|
||||
};
|
||||
|
||||
const CSS = `
|
||||
.hg { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 10px; align-self: center; }
|
||||
/* Fills the play column; on PC the table takes all the height the top row and my deck row leave. */
|
||||
.hg { width: 100%; display: flex; flex-direction: column; gap: 10px; align-self: stretch; flex: 1 1 auto; min-height: 0; }
|
||||
.hg-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; font-weight: 700; }
|
||||
.hg-top .grp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
|
||||
.hg-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; background: var(--surface); box-shadow: var(--shadow); font-size: .92rem; font-variant-numeric: tabular-nums; }
|
||||
@@ -144,6 +146,12 @@ const CSS = `
|
||||
@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); } }
|
||||
@media (min-width: 720px) {
|
||||
.hg-table { flex: 1 1 auto; height: auto; min-height: clamp(440px, 64vh, 600px); }
|
||||
}
|
||||
@media (min-width: 1100px) {
|
||||
.hg-table { min-height: 440px; }
|
||||
}
|
||||
@media (max-width: 719px) {
|
||||
.hg-table { height: 450px; border-width: 6px; border-radius: 22px; }
|
||||
.hg-seat { padding: 3px 3px 4px; gap: 2px; }
|
||||
@@ -331,7 +339,7 @@ const CENTER: Pos = { left: '50%', top: '50%' };
|
||||
* "half the table minus half a seat", so seats always stay inside the felt whatever its size.
|
||||
* `tall` (narrow phone table): seats that are not level with the bell move further up/down so they clear it.
|
||||
*/
|
||||
function seatPositions(n: number, seat: { w: number; h: number }, maxRx: number, tall: boolean): Pos[] {
|
||||
function seatPositions(n: number, seat: { w: string; h: string }, maxRx: string, tall: boolean): Pos[] {
|
||||
const f = (x: number) => (Math.abs(x) < 1e-9 ? 0 : Number(x.toFixed(4)));
|
||||
return Array.from({ length: n }, (_, k) => {
|
||||
const t = (2 * Math.PI * k) / n;
|
||||
@@ -339,8 +347,8 @@ function seatPositions(n: number, seat: { w: number; h: number }, maxRx: number,
|
||||
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% - ${sn} * min(50% - ${seat.w / 2 + 6}px, ${maxRx}px))`,
|
||||
top: `calc(50% + ${y} * (50% - ${seat.h / 2 + 6}px))`,
|
||||
left: `calc(50% - ${sn} * min(50% - ${seat.w} / 2 - 6px, ${maxRx}))`,
|
||||
top: `calc(50% + ${y} * (50% - ${seat.h} / 2 - 6px))`,
|
||||
side: sn > 0.2 ? 'left' : sn < -0.2 ? 'right' : 'mid',
|
||||
dir: [-sn, y],
|
||||
};
|
||||
@@ -546,6 +554,7 @@ function bellText(v: HalliGalliView, players: Record<string, PublicUser>): Bubbl
|
||||
function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps<HalliGalliView>) {
|
||||
const now = useServerNow(100);
|
||||
const phone = usePhone();
|
||||
const wide = useWide();
|
||||
const rtt = useRoom((s) => s.rttMs);
|
||||
const [bubble, setBubble] = useState<Bubble | null>(null);
|
||||
const [ghosts, setGhosts] = useState<Ghost[]>([]);
|
||||
@@ -563,9 +572,16 @@ 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 ? 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) + 8 }, phone ? 400 : 400, phone);
|
||||
// Card width: fixed on phones/tablets; on PC it grows with the play area (CSS length, so seats and fly-ins follow live resizes).
|
||||
const cwPx = phone ? (many ? 40 : 50) : many ? 64 : 80;
|
||||
const cw = !wide
|
||||
? `${cwPx}px`
|
||||
: many
|
||||
? 'clamp(64px, min(var(--play-w) * .056, var(--play-h) * .088), 128px)'
|
||||
: 'clamp(80px, min(var(--play-w) * .07, var(--play-h) * .11), 160px)';
|
||||
const sw = wide ? 'calc(var(--cw) * 1.72 + 18px)' : `${Math.round(cwPx * 1.72 + 18)}px`;
|
||||
const seatH = wide ? 'calc(var(--cw) * 1.4 + 66px)' : `${cwPx * 1.4 + (phone ? 50 : 58) + 8}px`;
|
||||
const pos = seatPositions(rot.length, { w: sw, h: seatH }, wide ? 'max(400px, var(--bell) * 2.4)' : '400px', 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';
|
||||
@@ -709,7 +725,14 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps<Hall
|
||||
return () => clearTimeout(t);
|
||||
}, [bubble]);
|
||||
|
||||
const bellSize = phone ? (rot.length >= 5 ? 128 : 'min(40vw, 156px)') : 'clamp(140px, 20vh, 190px)';
|
||||
// PC: the bell (and its dashed ring, 1.55x) grows too, but stays clear of the top and bottom seats (table ≈ play height - 130px).
|
||||
const bellSize = phone
|
||||
? rot.length >= 5
|
||||
? 128
|
||||
: 'min(40vw, 156px)'
|
||||
: wide
|
||||
? 'clamp(140px, min(var(--play-h) * .26, var(--play-w) * .2, (var(--play-h) - 142px - 2 * (var(--cw) * 1.4 + 66px)) / 1.55), 320px)'
|
||||
: 'clamp(140px, 20vh, 190px)';
|
||||
const countdown = v.phase === 'countdown' ? Math.max(0, Math.ceil((v.countdownEndsAt - now) / 1000)) : 0;
|
||||
const totals = FRUITS.map((f) => ({ f, n: v.seats.reduce((a, s) => a + (s.top && s.top.fruit === f ? s.top.count : 0), 0) }));
|
||||
const timeLeft = v.endsAt !== null ? Math.max(0, v.endsAt - Math.max(now, v.countdownEndsAt)) : null;
|
||||
@@ -755,7 +778,7 @@ function HalliGalliBoard({ view: v, me, players, act, pending }: BoardProps<Hall
|
||||
className="hg-table"
|
||||
role="region"
|
||||
aria-label="카드 테이블"
|
||||
style={{ '--bell': typeof bellSize === 'number' ? `${bellSize}px` : bellSize, '--cw': `${cw}px`, '--sw': `${sw}px` } as CSSProperties}
|
||||
style={{ '--bell': typeof bellSize === 'number' ? `${bellSize}px` : bellSize, '--cw': cw, '--sw': sw } as CSSProperties}
|
||||
>
|
||||
<ul style={{ listStyle: 'none', margin: 0, padding: 0 }} aria-label="사람들의 펼친 카드">
|
||||
{rot.map((s, i) => (
|
||||
|
||||
Reference in New Issue
Block a user