새 게임 사건 파일: 직접 지은 협력 추리 게임(1~5명). 정해진 날짜·시간 안에 단서를 골라 읽고(이동 시간·야근·돋보기·조언), 마지막에 객관식 수사 보고서로 점수와 등급(S/A/B/미해결)
- 엔진 packages/games/src/case-file/(types·index·cases): 의뢰→수사→보고서→결과, 함께 풀기(반장 돌아가며/투표/아무나)·따로 겨루기, 시간·야근·피로, 열림 규칙(OR)·깊이 보기로 열림, 아침 소식, 조언 감점, 남은 시간 보너스, 한 사람만 읽기, 팀 답 다수결·동점 처리, 시간 초과·자리 비움·나가기 - 사건 3개(c1·c2·c3)를 docs/games/case-file-cases.md 글 그대로 cases/<id>.ts로 옮김(서버 전용). 웹은 types 모듈(라벨·스키마)만 가져오고, view에는 읽은 단서 본문만 나감 - 옵션: 문서 §2 전부(사건·모드·결정 방식·하루 시간·야근·돋보기·조언·남은 시간 보너스·아침 소식·읽기 모드·고르기/보고서/전체 제한 시간). kidSafeChat은 방 채팅을 그대로 쓰므로 방 설정의 채팅 필터로 대신(문서 구현 메모) - 컴퓨터 상대 없음(문서 §8.7, BOT_GAMES에 넣지 않음) - 웹 apps/web/src/games/case-file/: 수사 막대(날짜·시각·돋보기·조언·피로·반장·타이머), 탭 [단서·보고서·결과] [기록] [자료] [메모], 종이 서류 본문 카드(16px 이상), 지도, 장소별 단서 카드(이동+시간·🔍·야근·추천), 두 번 눌러 확정, 투표, 보고서, 등급 도장·문제별 답·풀이·놓친 단서, 30초 요약·도움말 - 등록: GAMES·CATALOG·GAME_UI·GAME_ICON·여럿이 파티 탭, @bg/games/case-file/types 내보내기, docs/games/README.md, e2e/games.e2e.ts - 테스트: 사건 데이터 검사(id·여는 조건·도달·이동표·문제·점수표·고운 말·빠듯한 길을 실제 엔진으로 따라가 해결), 규칙 30여 개(문서 §10), 무작위 판(1~5명·옵션 7조합) 비밀 유출·JSON 왕복·결정성, onTimeout 합법, 방 통합(의뢰·반장·보고서·따로 겨루기 시계), 웹 빌드 결과물에 사건 본문·정답·풀이가 없는지 검사(no-case-text.test.ts), E2E(PC+휴대폰, 한 사람만 읽기 비밀·깊이 보기·하루 마치기·보고서·결과, 320px 가로 넘침 없음) - 문서: case-file.md 구현 메모, case-file-cases.md c2 빠듯한 길 수정(원래 길은 열림 조건상 갈 수 없었음) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
37
apps/web/src/games/case-file/help.ts
Normal file
37
apps/web/src/games/case-file/help.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/** 사건 파일 [?] "지금 할 수 있는 것" (docs/07 §5). Pure: only reads the client view (never the case data). */
|
||||
import type { CaseFileView } from '@bg/games/case-file';
|
||||
import type { PublicUser } from '@bg/shared/lite';
|
||||
|
||||
const nm = (players: Record<string, PublicUser>, id: string | null | undefined) => `${(id && players[id]?.nickname) || '다른 사람'}님`;
|
||||
export const clock = (h: number) => `${String(Math.floor(h)).padStart(2, '0')}:00`;
|
||||
|
||||
export function helpNow(v: CaseFileView, me: string | null, players: Record<string, PublicUser>): string {
|
||||
const goal = '정해진 날짜와 시간 안에 단서를 골라 읽고, 마지막에 수사 보고서 문제를 풀어 점수를 받아요.';
|
||||
if (v.phase === 'ended') {
|
||||
return `수사가 끝났어요. ${v.final?.summary ?? ''}`.trim() + '\n[결과] 탭에서 정답과 풀이, [놓친 단서 보기]로 못 본 단서를 모두 읽을 수 있어요.';
|
||||
}
|
||||
if (v.phase === 'briefing') {
|
||||
return v.can.ready
|
||||
? `의뢰를 읽고 [수사 시작]을 눌러요. 모두 누르거나 60초가 지나면 수사가 시작돼요.\n${goal}`
|
||||
: `의뢰를 읽는 중이에요. 다른 사람이 [수사 시작]을 누르길 기다려요.\n${goal}`;
|
||||
}
|
||||
const inv = v.inv;
|
||||
const time = inv ? `지금 ${inv.day}일째 ${clock(inv.hour)}, ${inv.placeName}에 있어요(하루는 ${clock(inv.dayEnd)}까지).` : '';
|
||||
if (v.can.answer) {
|
||||
return `보고서를 쓸 차례예요. 문제마다 답을 고르고 [보고서 내기]를 두 번 눌러 확정해요. 낸 뒤에는 고칠 수 없어요.\n[기록]·[자료] 탭에서 읽은 단서를 다시 볼 수 있어요.`;
|
||||
}
|
||||
if (v.phase === 'report' || inv?.reported) return '보고서를 냈어요. 다른 사람이 다 낼 때까지 기다려요. 끝나면 정답과 풀이가 나와요.';
|
||||
if (!me || !v.seats.some((s) => s.id === me)) return `관전 중이에요. ${time}\n${goal}`;
|
||||
const travel = '다른 동네로 가면 이동 시간이 더 들어요. 하루 끝을 넘기면 야근이에요(1시간마다 −1점).';
|
||||
if (v.mode === 'race') return `따로 겨루기예요. 내 속도로 단서를 고르고, 다 됐으면 [보고서 쓰기]를 눌러요. ${time}\n${travel}`;
|
||||
if (v.decision === 'vote') {
|
||||
return v.myVote
|
||||
? `투표했어요. 모두 투표하거나 시간이 끝나면 가장 많이 고른 칸을 해요. ${time}`
|
||||
: `다 같이 투표로 정해요. 단서 카드나 아래 칸에서 [투표]를 눌러요. ${time}\n${travel}`;
|
||||
}
|
||||
if (v.can.control) {
|
||||
const free = v.decision === 'free' ? ' 누르면 [정말 이걸로 해요]로 한 번 더 확인해요. 보고서는 모두 [보고서 쓰자]를 눌러야 써요.' : '';
|
||||
return `${v.decision === 'rotate' ? '내가 반장이에요. ' : ''}다음 단서를 골라요.${free} ${time}\n${travel} 읽은 단서에 🔍가 있으면 돋보기로 깊이 볼 수 있어요.`;
|
||||
}
|
||||
return `지금 반장은 ${nm(players, v.decider)}이에요. 단서 카드의 [추천]을 누르거나 채팅으로 의견을 내요. 단서를 하나 읽으면 반장이 넘어가요. ${time}`;
|
||||
}
|
||||
781
apps/web/src/games/case-file/index.tsx
Normal file
781
apps/web/src/games/case-file/index.tsx
Normal file
@@ -0,0 +1,781 @@
|
||||
/**
|
||||
* 사건 파일 화면 (docs/games/case-file.md §9). Imports only types and labels from the engine: the case texts reach
|
||||
* the browser through the view, one read lead at a time (no-case-text.test.ts checks the built bundle).
|
||||
*/
|
||||
import { Fragment, useEffect, useRef, useState, type ReactNode } from 'react';
|
||||
import type { CaseFileOptions, CaseFileView, Choice, ChoiceView, LeadCardView, LogEntryView, PlayerScore } from '@bg/games/case-file';
|
||||
import { CASE_LIST } from '@bg/games/case-file/types';
|
||||
import type { PublicUser } from '@bg/shared/lite';
|
||||
import { Sheet } from '../../components/ui';
|
||||
import { TurnTimer } from '../../components/TurnTimer';
|
||||
import { sfx, sounds } from '../../lib/feedback';
|
||||
import type { BoardProps, GameUI, OptionsProps } from '../types';
|
||||
import { clock, helpNow } from './help';
|
||||
import { quickStart } from './quick';
|
||||
|
||||
type Players = Record<string, PublicUser>;
|
||||
const nick = (players: Players, id: string | null | undefined) => (id && players[id]?.nickname) || '알 수 없음';
|
||||
|
||||
const CSS = `
|
||||
.cf { width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 12px; align-self: stretch; margin: 0 auto; }
|
||||
@media (min-width: 1100px) { .cf { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; } }
|
||||
.cf.ended { padding-bottom: 96px; }
|
||||
.cf-bar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 14px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
|
||||
.cf-bar h2 { font-size: 1.05rem; margin: 0; flex: 1 1 100%; }
|
||||
.cf-bar .cf-clock { font-weight: 800; font-variant-numeric: tabular-nums; }
|
||||
.cf-dots { display: inline-flex; gap: 4px; }
|
||||
.cf-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); display: inline-block; }
|
||||
.cf-dots i.on { background: var(--primary); }
|
||||
.cf-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius); position: sticky; top: 0; z-index: 2; }
|
||||
.cf-tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; padding: 0 4px; }
|
||||
.cf-tabs button[aria-selected='true'] { background: var(--surface); box-shadow: var(--shadow); color: var(--primary); }
|
||||
.cf-paper { background: #fffaf0; color: #2b2116; border: 1px solid #e7d9bd; border-radius: 6px; padding: 16px; box-shadow: 0 2px 8px rgba(80,60,20,.12); position: relative; }
|
||||
:root[data-theme='dark'] .cf-paper { background: #2a2620; color: #f1eadc; border-color: #4a4130; }
|
||||
@media (prefers-color-scheme: dark) { :root[data-theme='auto'] .cf-paper { background: #2a2620; color: #f1eadc; border-color: #4a4130; } }
|
||||
.cf-stamp { display: inline-block; font-size: .85rem; font-weight: 800; color: #b91c1c; border: 2px solid currentColor; border-radius: 6px; padding: 1px 8px; transform: rotate(-2deg); margin-bottom: 6px; }
|
||||
.cf-doc { font-size: max(16px, 1.05rem); line-height: 1.75; overflow-wrap: anywhere; }
|
||||
.cf-doc p { margin: 0 0 .7em; }
|
||||
.cf-doc ul { margin: 0 0 .7em; padding-left: 1.2em; }
|
||||
.cf-doc table { border-collapse: collapse; margin: 0 0 .7em; font-size: max(16px, 1rem); }
|
||||
.cf-doc td, .cf-doc th { border: 1px solid #d6c7a6; padding: 4px 10px; text-align: left; }
|
||||
.cf-deep { border-left: 4px solid #2563eb; padding: 8px 12px; margin-top: 8px; background: rgba(37,99,235,.07); border-radius: 4px; }
|
||||
.cf-leads { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
|
||||
@media (max-width: 560px) { .cf-leads { grid-template-columns: minmax(0, 1fr); } }
|
||||
.cf-lead { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); }
|
||||
.cf-lead.mine { border-color: var(--primary); }
|
||||
.cf-lead.no { opacity: .55; }
|
||||
.cf-lead strong { font-size: max(16px, 1rem); }
|
||||
.cf-cost { font-size: .95rem; color: var(--text-sub); }
|
||||
.cf-tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); margin-right: 4px; }
|
||||
.cf-tag.warn { background: var(--warning-soft); color: var(--warning); }
|
||||
.cf-btns { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.cf-btns .btn { flex: 1 1 auto; min-height: 44px; }
|
||||
.cf-place { font-size: .95rem; font-weight: 800; margin: 6px 0 2px; color: var(--text-sub); }
|
||||
.cf-zones { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.cf-zone { padding: 4px 10px; border-radius: 999px; border: 2px solid var(--border); font-size: .95rem; }
|
||||
.cf-zone.here { border-color: var(--primary); background: var(--primary-soft); font-weight: 800; }
|
||||
.cf-log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
|
||||
.cf-log button.cf-row { width: 100%; text-align: left; min-height: 48px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
|
||||
.cf-person { padding: 10px 12px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); display: flex; gap: 8px; align-items: flex-start; }
|
||||
.cf-person[data-sus='1'] { border-color: #eab308; }
|
||||
.cf-person[data-sus='2'] { border-color: #dc2626; }
|
||||
.cf-q { display: flex; flex-direction: column; gap: 8px; }
|
||||
.cf-q .cf-choices { display: flex; flex-direction: column; gap: 6px; }
|
||||
.cf-q .cf-choices button { text-align: left; justify-content: flex-start; min-height: 48px; font-size: max(16px, 1rem); }
|
||||
.cf-grade { font-size: 2.6rem; font-weight: 900; color: #b91c1c; border: 5px double currentColor; border-radius: 12px; padding: 4px 18px; display: inline-block; transform: rotate(-6deg); animation: cf-stamp .5s ease-out; }
|
||||
.cf-grade.ok { color: #15803d; }
|
||||
@keyframes cf-stamp { from { transform: scale(2.4) rotate(-6deg); opacity: 0; } to { transform: scale(1) rotate(-6deg); opacity: 1; } }
|
||||
@media (prefers-reduced-motion: reduce) { .cf-grade { animation: none; } }
|
||||
.cf-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
|
||||
.cf-table td, .cf-table th { border-bottom: 1px solid var(--border); padding: 6px 4px; text-align: left; vertical-align: top; }
|
||||
.cf-memo { width: 100%; min-height: 220px; font: inherit; font-size: max(16px, 1rem); line-height: 1.6; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
|
||||
`;
|
||||
|
||||
// ---------------------------------------------------------------- device-only notes (§9)
|
||||
|
||||
function roomCode(): string {
|
||||
return /\/r\/(\d{6})/.exec(typeof location !== 'undefined' ? location.pathname : '')?.[1] ?? 'replay';
|
||||
}
|
||||
function useStored<T>(kind: string, startedAt: number, init: T): [T, (v: T) => void] {
|
||||
const key = `bg:case-file:${kind}:${roomCode()}:${startedAt}`;
|
||||
const [val, setVal] = useState<T>(() => {
|
||||
try {
|
||||
const raw = localStorage.getItem(key);
|
||||
return raw === null ? init : (JSON.parse(raw) as T);
|
||||
} catch {
|
||||
return init;
|
||||
}
|
||||
});
|
||||
const set = (v: T) => {
|
||||
setVal(v);
|
||||
try {
|
||||
localStorage.setItem(key, JSON.stringify(v));
|
||||
} catch {
|
||||
/* storage full or blocked: keep it in memory */
|
||||
}
|
||||
};
|
||||
return [val, set];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- text (a small markdown subset of the case doc)
|
||||
|
||||
function Inline({ text, titles }: { text: string; titles: Record<string, string> }) {
|
||||
const parts = text.split(/(\*\*[^*]+\*\*|`c\d-\d\d`)/g);
|
||||
return (
|
||||
<>
|
||||
{parts.map((p, i) => {
|
||||
if (p.startsWith('**') && p.endsWith('**')) return <strong key={i}>{p.slice(2, -2)}</strong>;
|
||||
if (/^`c\d-\d\d`$/.test(p)) return <Fragment key={i}>「{titles[p.slice(1, -1)] ?? p.slice(1, -1)}」</Fragment>;
|
||||
return <Fragment key={i}>{p}</Fragment>;
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Doc({ text, titles = {} }: { text: string; titles?: Record<string, string> }) {
|
||||
const blocks = text.split(/\n\s*\n/);
|
||||
return (
|
||||
<div className="cf-doc">
|
||||
{blocks.map((b, i) => {
|
||||
const lines = b.split('\n');
|
||||
if (lines.every((l) => l.startsWith('|'))) {
|
||||
const rows = lines.filter((l) => !/^\|[-| ]+\|$/.test(l)).map((l) => l.slice(1, -1).split('|').map((c) => c.trim()));
|
||||
return (
|
||||
<table key={i}>
|
||||
<tbody>
|
||||
{rows.map((r, ri) => (
|
||||
<tr key={ri}>{r.map((c, ci) => (ri === 0 ? <th key={ci}>{c}</th> : <td key={ci}>{c}</td>))}</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
if (lines.every((l) => l.startsWith('- '))) {
|
||||
return (
|
||||
<ul key={i}>
|
||||
{lines.map((l, li) => (
|
||||
<li key={li}><Inline text={l.slice(2)} titles={titles} /></li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<p key={i}>
|
||||
{lines.map((l, li) => (
|
||||
<Fragment key={li}>
|
||||
{li > 0 && <br />}
|
||||
<Inline text={l} titles={titles} />
|
||||
</Fragment>
|
||||
))}
|
||||
</p>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- shared bits
|
||||
|
||||
const actionOf = (ch: Choice): unknown => {
|
||||
switch (ch.type) {
|
||||
case 'lead':
|
||||
return { type: 'pick', lead: ch.lead };
|
||||
case 'deep':
|
||||
return { type: 'deep', lead: ch.lead };
|
||||
default:
|
||||
return { type: ch.type };
|
||||
}
|
||||
};
|
||||
const keyOf = (ch: Choice) => (ch.type === 'lead' || ch.type === 'deep' ? `${ch.type}:${ch.lead}` : ch.type);
|
||||
|
||||
/** Runs a choice: a vote in vote mode, otherwise a direct action that needs a second press to confirm (§5.2 free). */
|
||||
function useChooser(v: CaseFileView, act: (a: unknown) => void) {
|
||||
const [armed, setArmed] = useState<string | null>(null);
|
||||
useEffect(() => setArmed(null), [v.inv?.log.length, v.inv?.day, v.phase, v.decider]);
|
||||
const voting = v.can.vote;
|
||||
const mine = (key: string) => !!v.myVote && v.myVote !== 'pass' && keyOf(v.myVote) === key;
|
||||
const press = (c: ChoiceView) => {
|
||||
if (voting) {
|
||||
sfx.select();
|
||||
act({ type: 'vote', choice: c.choice });
|
||||
return;
|
||||
}
|
||||
if (armed !== c.key) {
|
||||
setArmed(c.key);
|
||||
sfx.click();
|
||||
return;
|
||||
}
|
||||
setArmed(null);
|
||||
if (c.choice.type === 'lead') sfx.cardFlip();
|
||||
act(actionOf(c.choice));
|
||||
};
|
||||
const label = (c: ChoiceView, base: string) => (voting ? (mine(c.key) ? `✓ 투표함: ${base}` : `투표: ${base}`) : armed === c.key ? '정말 이걸로 해요' : base);
|
||||
return { press, label, armed, voting, mine };
|
||||
}
|
||||
|
||||
function CaseBar({ v, players, deadline }: { v: CaseFileView; players: Players; deadline: number | null }) {
|
||||
const inv = v.inv;
|
||||
const mineTurn = v.can.control || (v.can.vote && !v.myVote) || v.can.answer || v.can.ready;
|
||||
return (
|
||||
<header className="cf-bar" aria-label="수사 현황">
|
||||
<h2>🔍 {v.title} <span className="small muted">({v.level})</span></h2>
|
||||
{inv && v.phase === 'investigate' && !inv.reported && (
|
||||
<>
|
||||
<span className="cf-clock">{inv.day}일째 {clock(inv.hour)} / {clock(inv.dayEnd)}까지</span>
|
||||
<span className="cf-dots" aria-label={`${v.days}일 중 ${inv.day}일째`}>
|
||||
{Array.from({ length: v.days }, (_, i) => <i key={i} className={i < inv.day ? 'on' : ''} />)}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{inv && (
|
||||
<span className="small">
|
||||
<span title="돋보기">🔍 {inv.magnifiers}</span> · <span title="남은 조언">💡 {inv.hintsLeft}</span> · <span title="피로(야근)">😪 {inv.fatigue}</span>
|
||||
</span>
|
||||
)}
|
||||
{v.phase === 'investigate' && v.mode === 'coop' && v.decision === 'rotate' && <span className="small">지금 반장: <strong>{v.decider === v.me ? '나' : `${nick(players, v.decider)}님`}</strong></span>}
|
||||
{v.phase === 'investigate' && v.mode === 'coop' && v.decision === 'vote' && <span className="small">투표 {v.seats.filter((s) => s.voted).length}/{v.seats.filter((s) => !s.left).length}</span>}
|
||||
{deadline && v.phase !== 'ended' && <TurnTimer deadline={deadline} totalMs={v.deadlineTotalMs} mine={mineTurn} size={44} />}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function ReadCard({ e, v, players, chooser, titles }: { e: LogEntryView; v: CaseFileView; players: Players; chooser?: ReturnType<typeof useChooser>; titles: Record<string, string> }) {
|
||||
const deep = v.choices.find((c) => c.key === `deep:${e.lead}`);
|
||||
return (
|
||||
<article className="cf-paper" aria-label={`단서: ${e.title}`}>
|
||||
<span className="cf-stamp">{e.day}일째 {clock(e.at)} · {e.placeName}</span>
|
||||
<h3 style={{ margin: '0 0 8px', fontSize: '1.1rem' }}>{e.title}</h3>
|
||||
{e.text !== null ? <Doc text={e.text} titles={titles} /> : <p className="cf-doc">📖 {nick(players, e.by)}님이 읽고 있어요. 채팅으로 들려 달라고 해 보세요.</p>}
|
||||
{e.deepUsed && (e.deepText !== null ? (
|
||||
<div className="cf-deep"><strong>🔍 깊이 보기</strong><Doc text={e.deepText} titles={titles} /></div>
|
||||
) : (
|
||||
<p className="small">🔍 {nick(players, e.deepBy)}님이 깊이 봤어요.</p>
|
||||
))}
|
||||
{e.opened.length > 0 && <p className="small" style={{ margin: '6px 0 0' }}>새로 열린 단서: {e.opened.join(', ')}</p>}
|
||||
{e.deepOpened.length > 0 && <p className="small" style={{ margin: '4px 0 0' }}>깊이 보기로 열린 단서: {e.deepOpened.join(', ')}</p>}
|
||||
{deep && chooser && (
|
||||
<div className="cf-btns" style={{ marginTop: 8 }}>
|
||||
<button type="button" className="btn btn-secondary" onClick={() => chooser.press(deep)}>{chooser.label(deep, '🔍 깊이 보기(돋보기 1개)')}</button>
|
||||
</div>
|
||||
)}
|
||||
{!deep && e.hasDeep && !e.deepUsed && v.phase === 'investigate' && <p className="small muted" style={{ margin: '6px 0 0' }}>🔍 이 단서는 깊이 볼 수 있어요{v.inv?.magnifiers ? '' : '(돋보기가 없어요)'}.</p>}
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
function LeadCard({ l, v, players, chooser, onPin }: { l: LeadCardView; v: CaseFileView; players: Players; chooser: ReturnType<typeof useChooser>; onPin: (lead: string | null) => void }) {
|
||||
const c = v.choices.find((x) => x.key === `lead:${l.id}`);
|
||||
const myPin = v.me ? v.seats.find((s) => s.id === v.me)?.pin === l.id : false;
|
||||
const multi = v.seats.length > 1;
|
||||
return (
|
||||
<div className={`cf-lead${l.ok ? '' : ' no'}${chooser.mine(`lead:${l.id}`) || myPin ? ' mine' : ''}`}>
|
||||
<strong>{l.title}</strong>
|
||||
<span className="cf-cost">
|
||||
{l.travel > 0 ? `이동 ${l.travel} + ` : ''}단서 {l.hours}시간 = {l.total}시간
|
||||
</span>
|
||||
<span>
|
||||
{l.deep && <span className="cf-tag">🔍 깊이 보기 있음</span>}
|
||||
{l.overtime > 0 && <span className="cf-tag warn">야근 {l.overtime}시간</span>}
|
||||
{!l.ok && <span className="cf-tag warn">{l.why}</span>}
|
||||
</span>
|
||||
{l.pins.length > 0 && <span className="small">👍 {l.pins.map((p) => (p === v.me ? '나' : nick(players, p))).join(', ')}</span>}
|
||||
<div className="cf-btns">
|
||||
{c && <button type="button" className={`btn ${chooser.armed === c.key ? 'btn-primary' : 'btn-secondary'}`} onClick={() => chooser.press(c)}>{chooser.label(c, '고르기')}</button>}
|
||||
{v.can.pin && multi && (
|
||||
<button type="button" className="btn btn-ghost" aria-pressed={myPin} onClick={() => (sfx.pop(), onPin(myPin ? null : l.id))}>
|
||||
{myPin ? '추천 취소' : '👍 추천'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LeadsTab({ v, players, act, titles }: { v: CaseFileView; players: Players; act: (a: unknown) => void; titles: Record<string, string> }) {
|
||||
const inv = v.inv!;
|
||||
const chooser = useChooser(v, act);
|
||||
const onPin = (lead: string | null) => act({ type: 'pin', lead });
|
||||
const last = inv.log.at(-1);
|
||||
const today = inv.news.find((n) => n.day === inv.day);
|
||||
const groups = new Map<string, LeadCardView[]>();
|
||||
for (const l of inv.leads) groups.set(l.placeName, [...(groups.get(l.placeName) ?? []), l]);
|
||||
const extra = v.choices.filter((c) => c.choice.type === 'hint' || c.choice.type === 'endDay' || c.choice.type === 'report');
|
||||
const free = v.mode === 'coop' && v.decision === 'free';
|
||||
const meSeat = v.seats.find((s) => s.id === v.me);
|
||||
const here = v.seats.filter((s) => !s.left && s.idle === 0);
|
||||
return (
|
||||
<div className="stack" style={{ gap: 12 }}>
|
||||
{today && inv.hour === 9 && (
|
||||
<div className="cf-paper"><span className="cf-stamp">📰 {today.day}일째 아침 소식</span><Doc text={today.text} /></div>
|
||||
)}
|
||||
{last && <ReadCard e={last} v={v} players={players} chooser={chooser} titles={titles} />}
|
||||
<section aria-label="지도">
|
||||
<div className="small" style={{ marginBottom: 4 }}>📍 지금 위치: <strong>{inv.placeName}</strong> ({inv.zoneName})</div>
|
||||
<div className="cf-zones">
|
||||
{v.zones.map((z) => (
|
||||
<span key={z.id} className={`cf-zone${z.id === inv.zone ? ' here' : ''}`}>
|
||||
{z.name} {z.id === inv.zone ? '🕵️' : `· ${v.travel[inv.zone]?.[z.id] ?? 0}시간`}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section aria-label="고를 수 있는 단서" className="stack" style={{ gap: 4 }}>
|
||||
<h3 style={{ margin: 0, fontSize: '1.05rem' }}>고를 수 있는 단서 {inv.leads.length}개</h3>
|
||||
{!v.can.control && !v.can.vote && v.mode === 'coop' && <p className="small muted" style={{ margin: 0 }}>{v.decision === 'rotate' ? '반장이 골라요. 마음에 드는 단서에 [추천]을 눌러 주세요.' : '지금은 고를 수 없어요.'}</p>}
|
||||
{[...groups].map(([place, list]) => (
|
||||
<div key={place}>
|
||||
<div className="cf-place">{place}</div>
|
||||
<div className="cf-leads">
|
||||
{list.map((l) => <LeadCard key={l.id} l={l} v={v} players={players} chooser={chooser} onPin={onPin} />)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{inv.leads.length === 0 && <p className="muted">더 고를 단서가 없어요. 하루를 마치거나 보고서를 써요.</p>}
|
||||
</section>
|
||||
{extra.length > 0 && (
|
||||
<div className="cf-btns" role="group" aria-label="수사 행동">
|
||||
{extra.map((c) => {
|
||||
const base = c.choice.type === 'hint' ? `💡 ${c.label}(−2점, ${inv.hintsLeft}번 남음)` : c.choice.type === 'endDay' ? (inv.day >= v.days ? '🌙 마지막 날 마치기(보고서로)' : '🌙 하루 마치기') : '📝 보고서 쓰기';
|
||||
if (free && c.choice.type === 'report') {
|
||||
const agreed = !!meSeat?.agree;
|
||||
return (
|
||||
<button key={c.key} type="button" className={`btn ${agreed ? 'btn-primary' : 'btn-secondary'}`} aria-pressed={agreed} onClick={() => act({ type: 'report' })}>
|
||||
📝 보고서 쓰자 ({v.seats.filter((s) => s.agree).length}/{here.length} 동의){agreed ? ' · 취소' : ''}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<button key={c.key} type="button" className={`btn ${chooser.armed === c.key ? 'btn-primary' : 'btn-secondary'}`} onClick={() => chooser.press(c)}>
|
||||
{chooser.label(c, base)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
{inv.hints.length > 0 && (
|
||||
<div className="cf-paper"><span className="cf-stamp">💡 반장님 조언</span><ol className="cf-doc" style={{ margin: 0, paddingLeft: '1.3em' }}>{inv.hints.map((h, i) => <li key={i}>{h}</li>)}</ol></div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LogTab({ v, players, startedAt, titles }: { v: CaseFileView; players: Players; startedAt: number; titles: Record<string, string> }) {
|
||||
const inv = v.inv;
|
||||
const [open, setOpen] = useState<number | null>(null);
|
||||
const [stars, setStars] = useStored<string[]>('star', startedAt, []);
|
||||
if (!inv || inv.log.length === 0) return <p className="muted">아직 읽은 단서가 없어요.</p>;
|
||||
const e = open === null ? null : inv.log[open - 1];
|
||||
return (
|
||||
<>
|
||||
<ol className="cf-log" aria-label="수사 기록">
|
||||
{inv.log.map((x) => (
|
||||
<li key={x.n} style={{ display: 'flex', gap: 6 }}>
|
||||
<button type="button" className="cf-row" onClick={() => setOpen(x.n)}>
|
||||
<span className="small muted">{x.day}일째 {clock(x.at)} · {x.placeName}</span>
|
||||
<br />
|
||||
<strong>{x.title}</strong>
|
||||
{x.deepUsed && ' 🔍'}
|
||||
{x.text === null && <span className="small muted"> · {nick(players, x.by)}님이 읽음</span>}
|
||||
</button>
|
||||
<button type="button" className="btn btn-ghost" style={{ minWidth: 48 }} aria-pressed={stars.includes(x.lead)} aria-label={`${x.title} 중요 표시`} onClick={() => setStars(stars.includes(x.lead) ? stars.filter((s) => s !== x.lead) : [...stars, x.lead])}>
|
||||
{stars.includes(x.lead) ? '★' : '☆'}
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
{e && (
|
||||
<Sheet onClose={() => setOpen(null)} label={e.title}>
|
||||
<ReadCard e={e} v={v} players={players} titles={titles} />
|
||||
<button type="button" className="btn btn-secondary btn-block" onClick={() => setOpen(null)}>닫기</button>
|
||||
</Sheet>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const SUS = ['흰색', '노랑', '빨강'];
|
||||
function PeopleTab({ v, startedAt }: { v: CaseFileView; startedAt: number }) {
|
||||
const inv = v.inv;
|
||||
const [sus, setSus] = useStored<Record<string, number>>('suspect', startedAt, {});
|
||||
return (
|
||||
<div className="stack" style={{ gap: 8 }}>
|
||||
<h3 style={{ margin: 0, fontSize: '1.05rem' }}>자료실 · 인물</h3>
|
||||
{(inv?.people ?? []).map((p) => (
|
||||
<div key={p.id} className="cf-person" data-sus={sus[p.id] ?? 0}>
|
||||
<div style={{ flex: 1 }}>
|
||||
<strong>{p.name}</strong>
|
||||
<div className="cf-doc" style={{ lineHeight: 1.5 }}>{p.line}</div>
|
||||
<div className="small muted">{p.fromTitle ? `처음 나온 단서: ${p.fromTitle}` : '의뢰에서'}</div>
|
||||
</div>
|
||||
<button type="button" className="btn btn-ghost btn-sm" aria-label={`${p.name} 의심 정도: ${SUS[sus[p.id] ?? 0]}`} onClick={() => setSus({ ...sus, [p.id]: ((sus[p.id] ?? 0) + 1) % 3 })}>
|
||||
{['⚪', '🟡', '🔴'][sus[p.id] ?? 0]}
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<h3 style={{ margin: '8px 0 0', fontSize: '1.05rem' }}>장소</h3>
|
||||
<ul className="small" style={{ margin: 0, paddingLeft: '1.2em' }}>
|
||||
{v.zones.map((z) => (
|
||||
<li key={z.id}><strong>{z.name}</strong>: {v.places.filter((p) => p.zone === z.id).map((p) => p.name).join(', ')}</li>
|
||||
))}
|
||||
</ul>
|
||||
{inv && inv.news.length > 0 && (
|
||||
<>
|
||||
<h3 style={{ margin: '8px 0 0', fontSize: '1.05rem' }}>아침 소식</h3>
|
||||
{inv.news.map((n) => <div key={n.day} className="cf-paper"><span className="cf-stamp">{n.day}일째 아침</span><Doc text={n.text} /></div>)}
|
||||
</>
|
||||
)}
|
||||
<details>
|
||||
<summary>의뢰 다시 읽기</summary>
|
||||
<div className="cf-paper" style={{ marginTop: 6 }}><Doc text={v.briefing} /></div>
|
||||
</details>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function MemoTab({ startedAt }: { startedAt: number }) {
|
||||
const [memo, setMemo] = useStored<string>('note', startedAt, '');
|
||||
return (
|
||||
<label className="stack" style={{ gap: 6 }}>
|
||||
<span className="small muted">메모는 이 기기에만 남아요.</span>
|
||||
<textarea className="cf-memo" value={memo} onChange={(e) => setMemo(e.target.value)} placeholder="알아낸 것, 시간표, 의심 가는 점을 적어 두세요." />
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
function ReportTab({ v, players, act }: { v: CaseFileView; players: Players; act: (a: unknown) => void }) {
|
||||
const [armed, setArmed] = useState(false);
|
||||
const qs = v.questions ?? [];
|
||||
const mine = v.myAnswers ?? {};
|
||||
const answered = qs.filter((q) => mine[q.id] !== undefined).length;
|
||||
return (
|
||||
<div className="stack" style={{ gap: 12 }}>
|
||||
<div className="cf-paper">
|
||||
<span className="cf-stamp">수사 보고서</span>
|
||||
<p className="cf-doc" style={{ margin: 0 }}>문제마다 답을 하나씩 골라요. {v.mode === 'coop' ? '모두 내면 많이 고른 답이 팀 답이 돼요.' : '내 답으로 내 점수가 나와요.'} 범인 문제를 맞히고 기준 점수를 넘어야 해결이에요.</p>
|
||||
</div>
|
||||
{qs.map((q, qi) => (
|
||||
<section key={q.id} className="card cf-q" aria-label={`문제 ${qi + 1}`}>
|
||||
<strong className="cf-doc" style={{ lineHeight: 1.5 }}>Q{qi + 1}. {q.text} <span className="small muted">({q.points}점{q.culprit ? ' · 범인' : ''})</span></strong>
|
||||
<div className="cf-choices" role="group" aria-label={q.text}>
|
||||
{q.choices.map((c, i) => (
|
||||
<button key={i} type="button" className={`btn ${mine[q.id] === i ? 'btn-primary' : 'btn-secondary'}`} aria-pressed={mine[q.id] === i} disabled={!v.can.answer} onClick={() => (sfx.select(), act({ type: 'answer', q: q.id, choice: i }))}>
|
||||
{'①②③④⑤⑥'[i]} {c}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
{v.can.answer ? (
|
||||
<button type="button" className={`btn ${armed ? 'btn-danger' : 'btn-primary'} btn-block`} onClick={() => (armed ? (setArmed(false), act({ type: 'submit' })) : setArmed(true))}>
|
||||
{armed ? `정말 낼까요? (${answered}/${qs.length}문제 답함 · 낸 뒤에는 못 고쳐요)` : '📝 보고서 내기'}
|
||||
</button>
|
||||
) : (
|
||||
<p className="muted">보고서를 냈어요. {v.seats.filter((s) => !s.left && !s.submitted).map((s) => `${nick(players, s.id)}님`).join(', ') || '모두'} 기다리는 중…</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const gradeText = (x: PlayerScore) => (x.grade === '미해결' ? '미해결' : `${x.grade} 해결`);
|
||||
function scoreLine(x: PlayerScore, timeBonus: boolean): string {
|
||||
const parts = [`맞힌 문제 ${x.correct}점`];
|
||||
if (x.fatigue) parts.push(`피로 −${x.fatigue}`);
|
||||
if (x.hintsUsed) parts.push(`조언 −${x.hintsUsed * 2}`);
|
||||
if (timeBonus) parts.push(`남은 시간 보너스 +${x.bonus}`);
|
||||
return `${parts.join(' · ')} = ${x.score}점`;
|
||||
}
|
||||
|
||||
function ResultTab({ v, players, titles }: { v: CaseFileView; players: Players; titles: Record<string, string> }) {
|
||||
const f = v.final!;
|
||||
const [missed, setMissed] = useState(false);
|
||||
const qs = v.questions ?? [];
|
||||
const me = v.me;
|
||||
const head = v.mode === 'coop' ? f.teamScore : me ? f.scores[me] : null;
|
||||
const ans = (a: number | null | undefined, q: (typeof qs)[number]) => (a === null || a === undefined ? '—' : `${'①②③④⑤⑥'[a]} ${q.choices[a]}`);
|
||||
const people = v.seats.map((s) => s.id);
|
||||
const unread = f.leads.filter((l) => !l.read);
|
||||
if (f.reason === 'abandoned') return <p className="muted">{f.summary}</p>;
|
||||
return (
|
||||
<div className="stack" style={{ gap: 12 }}>
|
||||
{head && (
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<span className={`cf-grade${head.solved ? ' ok' : ''}`} aria-label={`등급 ${gradeText(head)}`}>{head.grade}</span>
|
||||
<p style={{ margin: '10px 0 0', fontWeight: 800 }}>{v.mode === 'coop' ? '팀' : '내'} {head.score}점 · {gradeText(head)}</p>
|
||||
<p className="small muted" style={{ margin: 0 }}>{scoreLine(head, v.timeBonus)}</p>
|
||||
</div>
|
||||
)}
|
||||
<section className="card" aria-label="문제별 답">
|
||||
<table className="cf-table">
|
||||
<thead>
|
||||
<tr><th>문제</th><th>정답</th>{v.mode === 'coop' && <th>팀 답</th>}</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{qs.map((q, qi) => (
|
||||
<tr key={q.id}>
|
||||
<td>Q{qi + 1}. {q.text} ({q.points}점)
|
||||
<div className="small muted">{people.map((p) => `${p === me ? '나' : nick(players, p)}: ${f.answers[p]?.[q.id] === undefined ? '—' : '①②③④⑤⑥'[f.answers[p]![q.id]!]}${f.answers[p]?.[q.id] === f.correct[q.id] ? '✓' : ''}`).join(' · ')}</div>
|
||||
</td>
|
||||
<td>{ans(f.correct[q.id], q)}</td>
|
||||
{v.mode === 'coop' && <td>{ans(f.team?.[q.id], q)} {f.team?.[q.id] === f.correct[q.id] ? '✅' : '❌'}</td>}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
<ul className="small" style={{ margin: '8px 0 0', paddingLeft: '1.2em' }}>
|
||||
{people.map((p) => f.scores[p] && (
|
||||
<li key={p}>{p === me ? '나' : `${nick(players, p)}님`}: {v.mode === 'coop' ? `이 답이었다면 ${f.scores[p]!.score}점(${gradeText(f.scores[p]!)})` : `${f.scores[p]!.score}점 · ${gradeText(f.scores[p]!)} · 남은 시간 ${f.scores[p]!.remaining}시간`}</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
<div className="cf-paper"><span className="cf-stamp">정답과 풀이</span><Doc text={f.solution} titles={titles} /></div>
|
||||
<button type="button" className="btn btn-secondary btn-block" aria-expanded={missed} onClick={() => setMissed(!missed)}>
|
||||
{missed ? '놓친 단서 접기' : `🔎 놓친 단서 보기 (${unread.length}개)`}
|
||||
</button>
|
||||
{missed && unread.map((l) => (
|
||||
<article key={l.id} className="cf-paper">
|
||||
<span className="cf-stamp">{l.placeName} · {l.hours}시간</span>
|
||||
<h3 style={{ margin: '0 0 8px', fontSize: '1.1rem' }}>{l.title}</h3>
|
||||
<Doc text={l.text} titles={titles} />
|
||||
{l.deep && <div className="cf-deep"><strong>🔍 깊이 보기</strong><Doc text={l.deep} /></div>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- board
|
||||
|
||||
type Tab = 'main' | 'log' | 'people' | 'memo';
|
||||
|
||||
function Board({ view: v, me, players, act, deadline }: BoardProps<CaseFileView>) {
|
||||
const [tab, setTab] = useState<Tab>('main');
|
||||
const [live, setLive] = useState('');
|
||||
const reportOpen = v.questions !== null && v.phase !== 'ended';
|
||||
const stage = v.phase === 'ended' ? 'ended' : reportOpen ? 'report' : v.phase;
|
||||
useEffect(() => setTab('main'), [stage]);
|
||||
const n = v.inv?.log.length ?? 0;
|
||||
const prev = useRef(n);
|
||||
useEffect(() => {
|
||||
if (n > prev.current) {
|
||||
const last = v.inv!.log.at(-1)!;
|
||||
setLive(`${last.title}을(를) 읽었어요.${last.opened.length ? ` 새 단서 ${last.opened.length}개가 열렸어요.` : ''}`);
|
||||
sfx.cardFlip();
|
||||
}
|
||||
prev.current = n;
|
||||
}, [n, v.inv]);
|
||||
useEffect(() => {
|
||||
if (v.phase === 'report') sounds.ding();
|
||||
}, [v.phase]);
|
||||
const titles: Record<string, string> = Object.fromEntries((v.final?.leads ?? v.inv?.log ?? []).map((l) => ['id' in l ? l.id : l.lead, l.title]));
|
||||
if (v.phase === 'briefing') {
|
||||
const ready = v.seats.filter((s) => s.ready).length;
|
||||
return (
|
||||
<div className="cf">
|
||||
<style>{CSS}</style>
|
||||
<CaseBar v={v} players={players} deadline={deadline} />
|
||||
<article className="cf-paper" aria-label="의뢰">
|
||||
<span className="cf-stamp">의뢰 · 해오름 탐정사무소</span>
|
||||
<Doc text={v.briefing} />
|
||||
</article>
|
||||
<section aria-label="알고 있는 사람" className="stack" style={{ gap: 6 }}>
|
||||
{v.inv?.people.map((p) => <div key={p.id} className="cf-person"><div><strong>{p.name}</strong><div className="cf-doc" style={{ lineHeight: 1.5 }}>{p.line}</div></div></div>)}
|
||||
</section>
|
||||
<p className="small muted" style={{ margin: 0 }}>
|
||||
{v.days}일 동안 하루 {v.hoursPerDay}시간씩 수사해요{v.overtime ? '(야근 2시간까지)' : ''}. {v.mode === 'race' ? '따로 겨루기: 각자 수사하고 점수로 겨뤄요.' : v.decision === 'rotate' ? '반장이 돌아가며 다음 단서를 골라요.' : v.decision === 'vote' ? '다 같이 투표로 다음 단서를 정해요.' : '누구든 먼저 고르면 그 단서를 따라가요.'}
|
||||
</p>
|
||||
{v.can.ready ? (
|
||||
<button type="button" className="btn btn-primary btn-block" onClick={() => (sfx.select(), act({ type: 'ready' }))}>🕵️ 수사 시작 ({ready}/{v.seats.filter((s) => !s.left).length})</button>
|
||||
) : (
|
||||
me && <p className="muted" style={{ textAlign: 'center' }}>다른 사람을 기다려요… ({ready}/{v.seats.filter((s) => !s.left).length})</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const mainLabel = stage === 'ended' ? '결과' : stage === 'report' ? '보고서' : '단서';
|
||||
const tabs: [Tab, string][] = [['main', mainLabel], ['log', `기록 ${n}`], ['people', '자료'], ['memo', '메모']];
|
||||
return (
|
||||
<div className={`cf${stage === 'ended' ? ' ended' : ''}`}>
|
||||
<style>{CSS}</style>
|
||||
<CaseBar v={v} players={players} deadline={deadline} />
|
||||
<div className="sr-only" aria-live="polite">{live}</div>
|
||||
<div className="cf-tabs" role="tablist" aria-label="수사 화면">
|
||||
{tabs.map(([k, label]) => (
|
||||
<button key={k} type="button" role="tab" aria-selected={tab === k} onClick={() => setTab(k)}>{label}</button>
|
||||
))}
|
||||
</div>
|
||||
<div role="tabpanel" aria-label={tabs.find((t) => t[0] === tab)![1]}>
|
||||
{tab === 'main' && stage === 'investigate' && v.inv && <LeadsTab v={v} players={players} act={act} titles={titles} />}
|
||||
{tab === 'main' && stage === 'investigate' && !v.inv && <p className="muted">따로 겨루기를 관전 중이에요. 오른쪽에서 각자의 진행을 볼 수 있어요.</p>}
|
||||
{tab === 'main' && stage === 'report' && <ReportTab v={v} players={players} act={act} />}
|
||||
{tab === 'main' && stage === 'ended' && v.final && <ResultTab v={v} players={players} titles={titles} />}
|
||||
{tab === 'main' && stage === 'report' && !v.questions && <p className="muted">보고서를 쓰는 중이에요.</p>}
|
||||
{tab === 'log' && <LogTab v={v} players={players} startedAt={v.startedAt} titles={titles} />}
|
||||
{tab === 'people' && <PeopleTab v={v} startedAt={v.startedAt} />}
|
||||
{tab === 'memo' && <MemoTab startedAt={v.startedAt} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- side
|
||||
|
||||
function Side({ view: v, me, players }: BoardProps<CaseFileView>) {
|
||||
const status = (s: CaseFileView['seats'][number]): string => {
|
||||
if (s.left) return '나감';
|
||||
if (v.phase === 'briefing') return s.ready ? '준비 ✓' : '읽는 중';
|
||||
if (v.phase === 'ended') return '';
|
||||
if (s.progress) return s.submitted ? '보고서 냄 📝' : s.progress.reported ? '보고서 쓰는 중' : `${s.progress.day}일째 ${clock(s.progress.hour)} · 단서 ${s.progress.read}개`;
|
||||
if (v.phase === 'report') return s.submitted ? '보고서 냄 📝' : '쓰는 중';
|
||||
const tags: string[] = [];
|
||||
if (v.decision === 'rotate' && v.decider === s.id) tags.push('👑 반장');
|
||||
if (v.decision === 'vote') tags.push(s.voted ? '투표함 ✓' : '투표 중');
|
||||
if (v.decision === 'free' && s.agree) tags.push('보고서 쓰자 ✓');
|
||||
if (s.idle >= (v.decision === 'rotate' ? 3 : 1)) tags.push('💤 자리 비움');
|
||||
if (s.pin && v.inv) tags.push(`👍 ${v.inv.leads.find((l) => l.id === s.pin)?.title ?? ''}`);
|
||||
return tags.join(' · ');
|
||||
};
|
||||
return (
|
||||
<div className="stack" style={{ gap: 10 }}>
|
||||
<section className="card stack" style={{ gap: 6, padding: 12 }} aria-label="탐정들">
|
||||
<strong>{v.mode === 'race' ? '🏁 따로 겨루기' : '🕵️ 해오름 탐정사무소 팀'}</strong>
|
||||
<ul className="stack" style={{ gap: 4, listStyle: 'none', padding: 0, margin: 0 }}>
|
||||
{v.seats.map((s) => (
|
||||
<li key={s.id} style={{ display: 'flex', justifyContent: 'space-between', gap: 8, opacity: s.left ? 0.5 : 1 }}>
|
||||
<span style={{ fontWeight: v.decider === s.id ? 800 : 500 }}>{s.id === me ? '나' : nick(players, s.id)}</span>
|
||||
<span className="small muted" style={{ textAlign: 'right' }}>{status(s)}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
{v.lastTally && v.phase === 'investigate' && (
|
||||
<p className="small" style={{ margin: 0 }}>
|
||||
지난 투표: {v.lastTally.label ? <strong>{v.lastTally.label}</strong> : '아무도 투표하지 않았어요'}
|
||||
{v.lastTally.counts.length > 0 && ` (${v.lastTally.counts.map((c) => `${c.label} ${c.n}표`).join(', ')})`}
|
||||
</p>
|
||||
)}
|
||||
{v.mode === 'race' && v.phase !== 'ended' && <p className="small muted" style={{ margin: 0 }}>🤫 따로 겨루기에서는 채팅으로 단서를 알려 주지 말아 주세요. 방장이 방 설정에서 채팅을 끌 수 있어요.</p>}
|
||||
{v.mode === 'coop' && v.readMode === 'reader' && v.phase === 'investigate' && v.seats.length > 1 && <p className="small muted" style={{ margin: 0 }}>📖 고른 사람만 단서 글을 봐요. 채팅으로 들려 주세요. 보고서를 쓸 때는 모두에게 열려요.</p>}
|
||||
{v.mode === 'coop' && v.phase === 'investigate' && v.seats.length > 1 && <p className="small muted" style={{ margin: 0 }}>💬 채팅으로 의견을 나눠요.</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- status, options, rules
|
||||
|
||||
function isMyTurn(v: CaseFileView, me: string | null): boolean {
|
||||
if (!me || v.me !== me) return false;
|
||||
return v.can.ready || v.can.control || (v.can.vote && !v.myVote) || v.can.answer;
|
||||
}
|
||||
|
||||
function statusText(v: CaseFileView, me: string | null, players: Players): string {
|
||||
switch (v.phase) {
|
||||
case 'briefing':
|
||||
return v.can.ready ? '의뢰를 읽고 [수사 시작]을 눌러요' : '의뢰를 읽는 중이에요';
|
||||
case 'investigate':
|
||||
if (v.can.answer) return '보고서를 써요';
|
||||
if (v.mode === 'race') return v.inv?.reported ? '다른 사람을 기다려요' : '내 속도로 수사해요';
|
||||
if (v.decision === 'rotate') return v.decider === me ? '내가 반장이에요 · 단서를 골라요' : `${nick(players, v.decider)}님이 반장이에요`;
|
||||
if (v.decision === 'vote') return v.can.vote && !v.myVote ? '다음 할 일을 투표해요' : '투표를 기다려요';
|
||||
return '누구든 단서를 골라요';
|
||||
case 'report':
|
||||
return v.can.answer ? '보고서를 써요' : '보고서를 기다려요';
|
||||
case 'ended':
|
||||
return v.final?.summary ?? '수사가 끝났어요';
|
||||
}
|
||||
}
|
||||
|
||||
function Seg<T extends string | number | boolean | null>({ value, options, onChange, label }: { value: T; options: [T, string][]; onChange: (v: T) => void; label: string }) {
|
||||
return (
|
||||
<div className="segmented" role="group" aria-label={label}>
|
||||
{options.map(([k, l]) => (
|
||||
<button key={String(k)} type="button" aria-pressed={value === k} onClick={() => onChange(k)}>{l}</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
function Field({ label, children, help }: { label: string; children: ReactNode; help?: string }) {
|
||||
return (
|
||||
<div className="stack" style={{ gap: 6 }}>
|
||||
<strong>{label}</strong>
|
||||
{children}
|
||||
{help && <span className="small muted">{help}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const onOff: [boolean, string][] = [[false, '끄기'], [true, '켜기']];
|
||||
|
||||
function Options({ value: o, onChange }: OptionsProps<CaseFileOptions>) {
|
||||
const set = (patch: Partial<CaseFileOptions>) => onChange({ ...o, ...patch });
|
||||
const race = o.mode === 'race';
|
||||
return (
|
||||
<div className="stack" style={{ gap: 16 }}>
|
||||
<Field label="사건" help={o.caseId === 'random' ? '어떤 사건인지 시작하면 알아요.' : undefined}>
|
||||
<Seg label="사건" value={o.caseId} options={[...CASE_LIST.map((c) => [c.id, `${c.title}(${c.level})`] as [CaseFileOptions['caseId'], string]), ['random', '아무거나']]} onChange={(caseId) => set({ caseId })} />
|
||||
</Field>
|
||||
<Field label="함께 풀기 / 따로 겨루기">
|
||||
<Seg label="함께 풀기 / 따로 겨루기" value={o.mode} options={[['coop', '함께 풀기'], ['race', '따로 겨루기']]} onChange={(mode) => set({ mode })} />
|
||||
</Field>
|
||||
{!race && (
|
||||
<Field label="다음 단서를 누가 고르나" help="혼자 할 때는 상관없어요.">
|
||||
<Seg label="다음 단서를 누가 고르나" value={o.decision} options={[['rotate', '반장이 돌아가며'], ['vote', '다 같이 투표'], ['free', '아무나 먼저']]} onChange={(decision) => set({ decision })} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="하루 수사 시간">
|
||||
<Seg label="하루 수사 시간" value={o.timeBudget} options={[['relaxed', '넉넉하게 10시간'], ['normal', '보통 8시간'], ['tight', '빠듯하게 6시간']]} onChange={(timeBudget) => set({ timeBudget })} />
|
||||
</Field>
|
||||
<Field label="야근" help="하루 2시간까지 더 일하고, 1시간마다 피로 1(−1점).">
|
||||
<Seg label="야근" value={o.overtime} options={onOff} onChange={(overtime) => set({ overtime })} />
|
||||
</Field>
|
||||
<Field label="돋보기(깊이 보기) 개수">
|
||||
<Seg label="돋보기 개수" value={o.magnifiers} options={[[0, '없음'], [2, '2개'], [3, '3개'], [5, '5개']]} onChange={(magnifiers) => set({ magnifiers })} />
|
||||
</Field>
|
||||
<Field label="반장님 조언(1번에 −2점)">
|
||||
<Seg label="반장님 조언" value={o.hints} options={[[0, '없음'], [1, '1번'], [3, '3번']]} onChange={(hints) => set({ hints })} />
|
||||
</Field>
|
||||
<Field label="남은 시간 보너스" help="보고서를 쓸 때 남은 2시간마다 +1점(최대 +5점).">
|
||||
<Seg label="남은 시간 보너스" value={o.timeBonus} options={onOff} onChange={(timeBonus) => set({ timeBonus })} />
|
||||
</Field>
|
||||
<Field label="아침 소식">
|
||||
<Seg label="아침 소식" value={o.morningNews} options={onOff} onChange={(morningNews) => set({ morningNews })} />
|
||||
</Field>
|
||||
{!race && (
|
||||
<Field label="단서 글 읽기(2명 이상)" help={o.readMode === 'reader' ? '고른 사람만 글을 보고 채팅으로 전해요. 보고서 때는 모두 볼 수 있어요.' : undefined}>
|
||||
<Seg label="단서 글 읽기" value={o.readMode} options={[['all', '모두 읽기'], ['reader', '고른 사람만 읽기']]} onChange={(readMode) => set({ readMode })} />
|
||||
</Field>
|
||||
)}
|
||||
{!race && (
|
||||
<Field label="다음 단서 고르기 제한 시간">
|
||||
<Seg label="다음 단서 고르기 제한 시간" value={o.turnSeconds} options={[[60, '60초'], [120, '120초'], [180, '180초'], [300, '300초'], [null, '무제한']]} onChange={(turnSeconds) => set({ turnSeconds })} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="보고서 쓰기 제한 시간">
|
||||
<Seg label="보고서 쓰기 제한 시간" value={o.reportSeconds} options={[[180, '3분'], [300, '5분'], [600, '10분'], [null, '무제한']]} onChange={(reportSeconds) => set({ reportSeconds })} />
|
||||
</Field>
|
||||
{race && (
|
||||
<Field label="따로 겨루기 전체 제한 시간">
|
||||
<Seg label="따로 겨루기 전체 제한 시간" value={o.raceMinutes} options={[[30, '30분'], [45, '45분'], [60, '60분'], [90, '90분'], [null, '무제한']]} onChange={(raceMinutes) => set({ raceMinutes })} />
|
||||
</Field>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function optionsSummary(o: CaseFileOptions): string {
|
||||
const c = CASE_LIST.find((x) => x.id === o.caseId);
|
||||
const parts = [c ? `${c.title}(${c.level})` : '사건 아무거나', o.mode === 'race' ? '따로 겨루기' : { rotate: '반장 돌아가며', vote: '투표', free: '아무나' }[o.decision]];
|
||||
parts.push({ relaxed: '하루 10시간', normal: '하루 8시간', tight: '하루 6시간' }[o.timeBudget]);
|
||||
parts.push(`돋보기 ${o.magnifiers}`, `조언 ${o.hints}`);
|
||||
if (!o.overtime) parts.push('야근 없음');
|
||||
if (o.timeBonus) parts.push('남은 시간 보너스');
|
||||
if (o.mode === 'coop' && o.readMode === 'reader') parts.push('한 사람만 읽기');
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
function Rules({ options }: { options?: CaseFileOptions }) {
|
||||
const race = options?.mode === 'race';
|
||||
return (
|
||||
<div className="stack">
|
||||
<p>탐정 사무소 팀이 되어 사건 하나를 <strong>함께 푸는 추리 게임</strong>이에요. 정해진 날짜와 시간 안에서 어떤 단서를 따라갈지 고르고, 고른 단서의 글을 읽고, 마지막에 객관식 <strong>수사 보고서</strong>를 내서 점수를 받아요.</p>
|
||||
<p><strong>시간</strong>: 하루는 09:00에 사무소에서 시작해요(하루 6·8·10시간). 단서마다 1~2시간이 들고, 다른 동네로 가면 이동 시간이 더 들어요. 하루 끝을 넘기면 <strong>야근</strong>(하루 2시간까지, 1시간마다 −1점). [하루 마치기]를 누르면 남은 시간을 버리고 다음 날로 가요.</p>
|
||||
<p><strong>단서</strong>: 읽은 단서에서 새 단서가 열려요. 🔍가 있는 단서는 <strong>돋보기</strong>를 하나 써서 숨은 문단을 더 볼 수 있어요(시간 안 듦). <strong>반장님 조언</strong>은 1번에 −2점이에요. 자료실의 인물 카드와 수사 기록은 언제든 공짜로 다시 봐요.</p>
|
||||
{!race && <p><strong>누가 고르나</strong>: 반장이 돌아가며(다른 사람은 [추천]과 채팅), 다 같이 투표, 아무나 먼저 누르기 중 방 설정대로 해요.</p>}
|
||||
<p><strong>보고서</strong>: 수사를 마치면 그때 문제가 나와요. {race ? '각자 낸 답으로 각자 점수를 받아요. 동점이면 남은 시간이 많은 사람이 앞서요.' : '각자 답을 내면 문제마다 가장 많이 고른 답이 팀 답이에요.'}</p>
|
||||
<p><strong>점수</strong> = 맞힌 문제 점수 − 피로 − 조언 × 2 (+ 남은 시간 보너스). 범인 문제를 맞히고 사건의 기준 점수를 넘으면 <strong>해결</strong>(S·A·B 등급)이에요. 끝나면 정답과 풀이, 못 본 단서를 모두 볼 수 있어요.</p>
|
||||
<p className="small muted">사건과 인물은 모두 이 사이트를 위해 새로 지은 이야기예요. 진행 방식은 『디텍티브: 모던 크라임 보드게임』에서 영감을 받았어요.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const ui: GameUI<CaseFileView, CaseFileOptions> = {
|
||||
Board,
|
||||
Side,
|
||||
statusText,
|
||||
isMyTurn,
|
||||
Options,
|
||||
optionsSummary,
|
||||
Rules,
|
||||
quickStart,
|
||||
helpNow,
|
||||
};
|
||||
|
||||
export default ui;
|
||||
69
apps/web/src/games/case-file/no-case-text.test.ts
Normal file
69
apps/web/src/games/case-file/no-case-text.test.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* 웹 빌드에 사건 글이 없어야 해요 (docs/games/case-file.md §8.3, §10): the case content is server only, so the built
|
||||
* bundle (apps/web/dist, `bunx vite build`) must not contain any lead text, deep look, answer or solution.
|
||||
* Also checks the web sources never import the case data at runtime.
|
||||
*/
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { CASES } from '@bg/games/case-file';
|
||||
|
||||
const DIST = join(import.meta.dir, '../../../dist');
|
||||
const SRC = join(import.meta.dir, '../..');
|
||||
|
||||
function files(dir: string, keep: (f: string) => boolean): string[] {
|
||||
const out: string[] = [];
|
||||
for (const name of readdirSync(dir)) {
|
||||
const p = join(dir, name);
|
||||
if (statSync(p).isDirectory()) out.push(...files(p, keep));
|
||||
else if (keep(p)) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** A distinctive middle piece of a text (skips quotes/markup at the edges). */
|
||||
const piece = (t: string) => {
|
||||
const flat = t.replace(/\s+/g, ' ');
|
||||
const start = Math.floor(flat.length / 3);
|
||||
return flat.slice(start, start + 14);
|
||||
};
|
||||
/** esbuild may write non-ASCII as \uXXXX escapes. */
|
||||
const escaped = (t: string) => [...t].map((ch) => (ch.charCodeAt(0) > 127 ? `\\u${ch.charCodeAt(0).toString(16).padStart(4, '0')}` : ch)).join('');
|
||||
|
||||
const probes: string[] = [];
|
||||
for (const c of Object.values(CASES)) {
|
||||
for (const l of c.leads) {
|
||||
probes.push(piece(l.text));
|
||||
if (l.deep) probes.push(piece(l.deep));
|
||||
}
|
||||
probes.push(piece(c.solution), ...c.hints.map(piece));
|
||||
for (const q of c.questions) {
|
||||
const a = q.choices[q.answer]!;
|
||||
if (a.length >= 8) probes.push(a);
|
||||
}
|
||||
}
|
||||
|
||||
describe('사건 글은 브라우저로 미리 가지 않아요', () => {
|
||||
test('웹 코드는 사건 데이터를 실행 중에 가져오지 않아요(타입·라벨만)', () => {
|
||||
for (const f of files(SRC, (p) => /\.(ts|tsx)$/.test(p) && !/\.test\.ts$|test-util\.ts$/.test(p))) {
|
||||
const src = readFileSync(f, 'utf8');
|
||||
for (const m of src.matchAll(/^import\s+(?!type\b)[^;]*from\s+'(@bg\/games[^']*)'/gm)) {
|
||||
const mod = m[1]!;
|
||||
expect(mod === '@bg/games/case-file' || mod.includes('case-file/cases'), `${f}: ${mod}`).toBe(false);
|
||||
if (mod === '@bg/games') throw new Error(`${f}: imports every game module at runtime`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test.skipIf(!existsSync(DIST))('빌드 결과물(apps/web/dist)에 단서 본문·깊이 보기·정답·풀이가 없어요', () => {
|
||||
const bundle = files(DIST, (p) => /\.(js|css|html|json|webmanifest)$/.test(p)).map((f) => readFileSync(f, 'utf8')).join('\n');
|
||||
expect(bundle.length).toBeGreaterThan(1000);
|
||||
expect(probes.length).toBeGreaterThan(80);
|
||||
// Sanity: the probes would be found if the data were bundled — the title (an option label) is there on purpose.
|
||||
expect(bundle.includes('달빛제과의 사라진 레시피 노트') || bundle.includes(escaped('달빛제과의 사라진 레시피 노트'))).toBe(true);
|
||||
for (const p of probes) {
|
||||
expect(bundle.includes(p), p).toBe(false);
|
||||
expect(bundle.includes(escaped(p)), p).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
59
apps/web/src/games/case-file/quick.tsx
Normal file
59
apps/web/src/games/case-file/quick.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
/** 사건 파일 30초 규칙 요약 (docs/games/case-file.md §9). */
|
||||
import type { QuickCard } from '../types';
|
||||
|
||||
function Lead({ x, y, title, t, dim }: { x: number; y: number; title: string; t: string; dim?: boolean }) {
|
||||
return (
|
||||
<g transform={`translate(${x} ${y})`} opacity={dim ? 0.45 : 1}>
|
||||
<rect width={110} height={50} rx={8} fill="#fdf6e3" stroke="#a16207" strokeWidth={2} />
|
||||
<text x={8} y={20} fontSize={12} fontWeight={800} fill="#3f2d0c">{title}</text>
|
||||
<text x={8} y={39} fontSize={11} fill="#6b4f1d">{t}</text>
|
||||
</g>
|
||||
);
|
||||
}
|
||||
|
||||
export const quickStart: QuickCard[] = [
|
||||
{
|
||||
pic: (
|
||||
<svg viewBox="0 0 250 130" width={250} height={130} aria-hidden>
|
||||
<text x={8} y={18} fontSize={13} fontWeight={800} fill="#2563eb">🕘 1일째 09:00 / 17:00까지</text>
|
||||
<Lead x={8} y={30} title="이야기 듣기" t="1시간" />
|
||||
<Lead x={130} y={30} title="CCTV 보기" t="2시간" />
|
||||
<Lead x={8} y={78} title="장부 보기" t="1시간" dim />
|
||||
</svg>
|
||||
),
|
||||
alt: '하루 시간표와 단서 카드 세 장, 단서마다 걸리는 시간',
|
||||
title: '시간 안에 단서를 골라요',
|
||||
text: '단서를 고르면 시계가 가고 글이 열려요. 시간이 모자라 모든 단서를 볼 수는 없어요. 무엇을 볼지 함께 골라요.',
|
||||
},
|
||||
{
|
||||
pic: (
|
||||
<svg viewBox="0 0 250 110" width={250} height={110} aria-hidden>
|
||||
<rect x={10} y={30} width={80} height={50} rx={10} fill="#dbeafe" stroke="#2563eb" strokeWidth={2} />
|
||||
<text x={50} y={60} textAnchor="middle" fontSize={13} fontWeight={800} fill="#1e3a8a">사무소</text>
|
||||
<rect x={160} y={30} width={80} height={50} rx={10} fill="#dcfce7" stroke="#15803d" strokeWidth={2} />
|
||||
<text x={200} y={60} textAnchor="middle" fontSize={13} fontWeight={800} fill="#14532d">골목</text>
|
||||
<line x1={92} y1={55} x2={158} y2={55} stroke="#6b7280" strokeWidth={3} strokeDasharray="6 4" />
|
||||
<text x={125} y={45} textAnchor="middle" fontSize={12} fontWeight={800} fill="#374151">이동 1시간</text>
|
||||
</svg>
|
||||
),
|
||||
alt: '사무소와 골목 사이 이동 1시간',
|
||||
title: '동네를 옮기면 시간이 들어요',
|
||||
text: '같은 동네 안은 이동 0시간, 다른 동네로 가면 1~2시간이 더 들어요. 하루 끝을 넘기면 야근(1시간마다 −1점).',
|
||||
},
|
||||
{
|
||||
pic: (
|
||||
<svg viewBox="0 0 250 120" width={250} height={120} aria-hidden>
|
||||
<rect x={40} y={8} width={170} height={104} rx={8} fill="#fffef9" stroke="#334155" strokeWidth={2} />
|
||||
<text x={56} y={32} fontSize={13} fontWeight={900} fill="#111827">수사 보고서</text>
|
||||
<text x={56} y={56} fontSize={12} fill="#374151">Q1. 범인은? (10점)</text>
|
||||
<rect x={56} y={66} width={60} height={22} rx={6} fill="#2563eb" />
|
||||
<text x={86} y={81} textAnchor="middle" fontSize={11} fontWeight={800} fill="#fff">①</text>
|
||||
<rect x={124} y={66} width={60} height={22} rx={6} fill="#e5e7eb" />
|
||||
<text x={154} y={81} textAnchor="middle" fontSize={11} fill="#111827">②</text>
|
||||
</svg>
|
||||
),
|
||||
alt: '객관식 수사 보고서 문제',
|
||||
title: '마지막에 보고서를 풀어요',
|
||||
text: '수사가 끝나면 그때 문제가 나와요. 각자 답을 내면 많이 고른 답이 팀 답이 돼요. 범인을 맞히고 기준 점수를 넘으면 해결!',
|
||||
},
|
||||
];
|
||||
@@ -9,7 +9,7 @@ import { assertCleanText, eachView, seatIds, usersOf } from './help-kit.test-uti
|
||||
const IDS = Object.keys(GAME_UI);
|
||||
|
||||
test('모든 게임에 도움말이 있어요', () => {
|
||||
expect(IDS).toHaveLength(34);
|
||||
expect(IDS).toHaveLength(35);
|
||||
for (const id of IDS) {
|
||||
const src = readFileSync(join(import.meta.dir, id, 'index.tsx'), 'utf8');
|
||||
expect(src, id).toMatch(/\bquickStart,/);
|
||||
|
||||
@@ -36,6 +36,7 @@ export const GAME_UI: Record<string, () => Promise<{ default: GameUI }>> = {
|
||||
liar: () => import('./liar'),
|
||||
'magical-athlete': () => import('./magical-athlete'),
|
||||
blackjack: () => import('./blackjack'),
|
||||
'case-file': () => import('./case-file'),
|
||||
};
|
||||
|
||||
const cache = new Map<string, GameUI>();
|
||||
|
||||
@@ -33,6 +33,7 @@ export const GAME_ICON: Record<string, string> = {
|
||||
liar: '🤥',
|
||||
'magical-athlete': '🏃',
|
||||
blackjack: '🂡',
|
||||
'case-file': '🔍',
|
||||
};
|
||||
|
||||
/** Shown on the home screen so users know what's coming (docs/12-roadmap.md). */
|
||||
@@ -42,5 +43,5 @@ export const UPCOMING: string[] = [];
|
||||
export const GAME_GROUPS: { key: string; label: string; ids: string[] }[] = [
|
||||
{ key: 'board', label: '판·주사위', ids: ['omok', 'connect-four', 'othello', 'chess', 'janggi', 'baduk', 'quoridor', 'yut', 'marble', 'yacht', 'las-vegas', 'magical-athlete', 'clue'] },
|
||||
{ key: 'cards', label: '카드·패', ids: ['seotda', 'poker', 'blackjack', 'one-card', 'uno', 'gostop', 'dalmuti', 'splendor', 'cockroach-poker', 'ninety-nine', 'old-maid', 'mahjong', 'rummikub', 'davinci-code'] },
|
||||
{ key: 'party', label: '여럿이 파티', ids: ['bang', 'halli-galli', 'dobble', 'catchmind', 'mafia', 'liar', 'apple'] },
|
||||
{ key: 'party', label: '여럿이 파티', ids: ['bang', 'halli-galli', 'dobble', 'catchmind', 'mafia', 'liar', 'apple', 'case-file'] },
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user