방 설정 "다음 문제까지"(5/10/15/30초, 기본 5초)와 "다음문제인원(이상)" 투표: 정답 공개 시간을 방마다 고르고, 공개 중 ⏭ 다음 문제(Ctrl+K) 표가 기준 이상이면 바로 넘어감(마지막 문제는 결과로). 공개 화면에 남은 초, 방 카드 요약에 '공개 N초', 관리자 기본값·잠금
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
LISTEN_SECS,
|
||||
LYRICS_SECS,
|
||||
MODES,
|
||||
REVEAL_SECS,
|
||||
VOTE_RULES,
|
||||
listenLabel,
|
||||
voteLabel,
|
||||
@@ -394,6 +395,12 @@ export function RoomSettings({
|
||||
<Seg label="다시듣기인원" value={c.replayVotes} disabled={ro} onChange={(replayVotes) => onPatch({ replayVotes })} options={vote(VOTE_RULES)} />
|
||||
</Section>
|
||||
)}
|
||||
<Section title="다음 문제까지" tip="정답을 공개한 뒤 다음 문제로 넘어가기까지 기다리는 시간. 그동안 노래는 계속 나와요">
|
||||
<Seg label="다음 문제까지" value={c.revealSec} disabled={ro} onChange={(revealSec) => onPatch({ revealSec })} options={REVEAL_SECS.map((v) => ({ v, label: `${v}초` }))} />
|
||||
</Section>
|
||||
<Section title="다음문제인원(이상)" tip="정답 공개 중에 바로 다음 문제로 넘어가려면 다음 문제를 눌러야하는 인원 설정">
|
||||
<Seg label="다음문제인원" value={c.nextVotes} disabled={ro} onChange={(nextVotes) => onPatch({ nextVotes })} options={vote(VOTE_RULES)} />
|
||||
</Section>
|
||||
<Section title="문제 수">
|
||||
<Seg
|
||||
label="문제 수"
|
||||
|
||||
@@ -49,7 +49,10 @@ export function GameScreen({ room, game }: { room: RoomView; game: GameView }) {
|
||||
const isHost = room.hostId === me.id;
|
||||
const c = room.config;
|
||||
const send = (m: unknown) => socket.send(m);
|
||||
const vote = (kind: 'skip' | 'hint' | 'replay') => send({ t: 'vote', kind });
|
||||
const vote = (kind: 'skip' | 'hint' | 'replay' | 'next') => send({ t: 'vote', kind });
|
||||
// Ctrl+K during the reveal = 다음 문제 (the shortcut handler is set up once, so it reads the phase from a ref).
|
||||
const phaseRef = useRef(game.phase);
|
||||
phaseRef.current = game.phase;
|
||||
const name = (id: string) => room.players.find((x) => x.id === id)?.nickname ?? game.scores.find((x) => x.id === id)?.nickname ?? '?';
|
||||
const inQuestion = game.participants.includes(me.id) && !game.excluded.includes(me.id);
|
||||
const listening = game.mode !== 'lyrics';
|
||||
@@ -62,7 +65,7 @@ export function GameScreen({ room, game }: { room: RoomView; game: GameView }) {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey) {
|
||||
const k = e.key.toLowerCase();
|
||||
const kind = k === 'i' ? 'hint' : k === 'k' ? 'skip' : k === 'r' ? 'replay' : null;
|
||||
const kind = k === 'i' ? 'hint' : k === 'k' ? (phaseRef.current === 'reveal' ? 'next' : 'skip') : k === 'r' ? 'replay' : null;
|
||||
if (kind) {
|
||||
e.preventDefault();
|
||||
vote(kind);
|
||||
@@ -83,7 +86,7 @@ export function GameScreen({ room, game }: { room: RoomView; game: GameView }) {
|
||||
const elapsed = game.clock.elapsedMs + (game.clock.runningSince !== null ? Math.max(0, now - game.clock.runningSince) : 0);
|
||||
const countdown = game.startAt !== null && now < game.startAt && !game.paused ? Math.ceil((game.startAt - now) / 1000) : 0;
|
||||
const reveal = game.phase === 'reveal' ? game.history.at(-1) : undefined;
|
||||
const voteBtn = (kind: 'skip' | 'hint' | 'replay', icon: string, label: string, key: string) => {
|
||||
const voteBtn = (kind: 'skip' | 'hint' | 'replay' | 'next', icon: string, label: string, key: string) => {
|
||||
const need = game.need[kind];
|
||||
const n = game.votes[kind].length;
|
||||
const on = game.votes[kind].includes(me.id);
|
||||
@@ -121,7 +124,7 @@ export function GameScreen({ room, game }: { room: RoomView; game: GameView }) {
|
||||
<span className="badge dark">★{c.level}</span>
|
||||
<div className="grow" />
|
||||
{voteBtn('hint', '💡', '힌트', 'Ctrl+I')}
|
||||
{voteBtn('skip', '⏭', '스킵', 'Ctrl+K')}
|
||||
{reveal ? voteBtn('next', '⏭', '다음 문제', 'Ctrl+K') : voteBtn('skip', '⏭', '스킵', 'Ctrl+K')}
|
||||
{listening && voteBtn('replay', '🔁', '다시듣기', 'Ctrl+R')}
|
||||
{listening && (
|
||||
<label className="vol" title="볼륨">
|
||||
@@ -166,7 +169,7 @@ export function GameScreen({ room, game }: { room: RoomView; game: GameView }) {
|
||||
<div className="gcenter">
|
||||
<section className={`stage ${reveal ? 'revealed' : ''}`} aria-live="polite">
|
||||
{reveal ? (
|
||||
<RevealCard item={reveal} />
|
||||
<RevealCard item={reveal} left={Math.max(0, Math.ceil(((game.revealUntil ?? now) - now) / 1000))} last={game.n >= game.total} />
|
||||
) : (
|
||||
<>
|
||||
{listening ? <div className={`lp ${p.playing && !game.paused ? 'spin' : ''}`} aria-hidden /> : null}
|
||||
@@ -278,7 +281,7 @@ export function GameScreen({ room, game }: { room: RoomView; game: GameView }) {
|
||||
);
|
||||
}
|
||||
|
||||
function RevealCard({ item }: { item: GameHistoryItem }) {
|
||||
function RevealCard({ item, left, last }: { item: GameHistoryItem; left: number; last: boolean }) {
|
||||
return (
|
||||
<div className="reveal">
|
||||
{item.videoId ? <img className="art" src={`https://i.ytimg.com/vi/${item.videoId}/hqdefault.jpg`} alt="" /> : <div className="art lp" aria-hidden />}
|
||||
@@ -290,6 +293,9 @@ function RevealCard({ item }: { item: GameHistoryItem }) {
|
||||
<div className="small muted">
|
||||
{[item.year, ...item.genres].filter(Boolean).join(' · ')} <Stars n={item.level} />
|
||||
</div>
|
||||
<div className="small muted next-in">
|
||||
{last ? '결과까지' : '다음 문제까지'} <b className="mono">{left}초</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -195,6 +195,8 @@ const LOCKABLE: [keyof RoomConfig, string][] = [
|
||||
['hint', '힌트공개'],
|
||||
['skipVotes', '스킵인원'],
|
||||
['replayVotes', '다시듣기인원'],
|
||||
['revealSec', '다음 문제까지'],
|
||||
['nextVotes', '다음문제인원'],
|
||||
['count', '문제 수'],
|
||||
['visibility', '방 공개'],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user