사건 파일 결과 창: 함께 풀기는 모두 같은 순위라 '무승부예요'로 나오던 것을 '🎉 사건을 해결했어요!' / '사건을 풀지 못했어요'로, 소리도 해결이면 이김·아니면 짐
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -741,12 +741,18 @@ function ResultPanel({ room, me, players, onLeave, onAgain }: { room: RoomView;
|
|||||||
const allFirst = !solo && result.ranking.length === 1;
|
const allFirst = !solo && result.ranking.length === 1;
|
||||||
const won = !solo && !allFirst && result.ranking[0]?.includes(me.id);
|
const won = !solo && !allFirst && result.ranking[0]?.includes(me.id);
|
||||||
const lost = !solo && !allFirst && !won && result.ranking.some((g) => g.includes(me.id));
|
const lost = !solo && !allFirst && !won && result.ranking.some((g) => g.includes(me.id));
|
||||||
|
// 사건 파일 함께 풀기: everyone who stayed shares one rank, so it is solved or not rather than a draw.
|
||||||
|
const coop = room.gameId === 'case-file' && (room.options as { mode?: string }).mode !== 'race' && result.reason === 'normal' && !!result.ranking[0]?.includes(me.id);
|
||||||
|
const coopSolved = coop && Object.values(result.scoreText ?? {}).some((t) => t.includes('해결') && !t.includes('미해결'));
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (played.current) return;
|
if (played.current) return;
|
||||||
played.current = true;
|
played.current = true;
|
||||||
if (won) sounds.win();
|
if (coop) {
|
||||||
|
if (coopSolved) sounds.win();
|
||||||
|
else sounds.lose();
|
||||||
|
} else if (won) sounds.win();
|
||||||
else if (lost) sounds.lose();
|
else if (lost) sounds.lose();
|
||||||
}, [won, lost]);
|
}, [won, lost, coop, coopSolved]);
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
return (
|
return (
|
||||||
<div className="bottom-bar">
|
<div className="bottom-bar">
|
||||||
@@ -760,7 +766,7 @@ function ResultPanel({ room, me, players, onLeave, onAgain }: { room: RoomView;
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Sheet onClose={() => setHidden(true)} label="게임 결과">
|
<Sheet onClose={() => setHidden(true)} label="게임 결과">
|
||||||
<h1 style={{ textAlign: 'center' }}>{allFirst ? '무승부예요' : won ? '🎉 이겼어요!' : lost ? '아쉽게 졌어요' : '게임이 끝났어요'}</h1>
|
<h1 style={{ textAlign: 'center' }}>{coop ? (coopSolved ? '🎉 사건을 해결했어요!' : '사건을 풀지 못했어요') : allFirst ? '무승부예요' : won ? '🎉 이겼어요!' : lost ? '아쉽게 졌어요' : '게임이 끝났어요'}</h1>
|
||||||
<p style={{ textAlign: 'center' }}>{result.summary}</p>
|
<p style={{ textAlign: 'center' }}>{result.summary}</p>
|
||||||
{seatedAll.length > seated.length && <p className="muted small" style={{ textAlign: 'center' }}>🤖 연습 게임이라 기록에는 남지 않아요.</p>}
|
{seatedAll.length > seated.length && <p className="muted small" style={{ textAlign: 'center' }}>🤖 연습 게임이라 기록에는 남지 않아요.</p>}
|
||||||
<div className="stack">
|
<div className="stack">
|
||||||
|
|||||||
Reference in New Issue
Block a user