증강 윷놀이: 이의있음!은 모두 고른 뒤 화면 전체에 크게 띄우고, 그 선택에서 모두가 고른 증강을 없앤 채 모두 새 후보로 다시 고름

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-08 02:05:51 +09:00
parent f4fb796dfe
commit 2403b6747f
5 changed files with 122 additions and 19 deletions

View File

@@ -73,7 +73,15 @@ export const AUG_CSS = `
.aug-pop .aug-pop-state { font-weight: 800; color: var(--danger); }
.aug-chip[tabindex] { cursor: help; }
@keyframes aug-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .aug-toast, .aug-pop { animation: none; } }
.aug-objection { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; background: rgba(17, 24, 39, .72); cursor: pointer;
animation: aug-obj-bg .25s ease both; }
.aug-objection-box { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; text-align: center; color: #fff; max-width: min(92vw, 640px); }
.aug-objection-box strong { font-size: clamp(3.2rem, 15vw, 7rem); line-height: 1; font-weight: 900; color: #fde047; letter-spacing: -.02em;
text-shadow: 0 4px 0 #b91c1c, 0 8px 24px rgba(0, 0, 0, .5); transform: rotate(-4deg); animation: aug-obj-hit .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.aug-objection-box p { margin: 0; font-size: 1.05rem; font-weight: 700; }
@keyframes aug-obj-hit { 0% { opacity: 0; transform: rotate(-4deg) scale(2.4); } 60% { opacity: 1; transform: rotate(-4deg) scale(.92); } 100% { transform: rotate(-4deg) scale(1); } }
@keyframes aug-obj-bg { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aug-toast, .aug-pop, .aug-objection, .aug-objection-box strong { animation: none; } }
`;
// ---------------------------------------------------------------- round bar
@@ -435,10 +443,18 @@ export function AugFxLayer({ v, players, me }: { v: YutView; players: Record<str
const seen = useRef(fx.reduce((m, f) => Math.max(m, f.no), 0));
const [popup, setPopup] = useState<AugFx | null>(null);
const [toast, setToast] = useState<{ key: number; text: string } | null>(null);
const [objection, setObjection] = useState<AugFx | null>(null);
useEffect(() => {
const fresh = fx.filter((f) => f.no > seen.current);
if (!fresh.length) return;
seen.current = Math.max(...fresh.map((f) => f.no));
// 이의있음!: a big full-screen call, then the (already open) new selection shows underneath
const obj = fresh.find((f) => f.kind === 'objection');
if (obj) {
setObjection(obj);
sounds.buzz();
haptic(80);
}
// When the game just ended the result window says it all.
const big = v.phase === 'finished' ? undefined : fresh.find((f) => f.kind === 'win' || f.kind === 'out' || f.kind === 'bronze');
if (big) {
@@ -447,7 +463,7 @@ export function AugFxLayer({ v, players, me }: { v: YutView; players: Record<str
if (big.kind === 'out') (mine ? sounds.lose : sounds.buzz)();
else (mine ? sounds.win : sounds.ding)();
}
const small = fresh.filter((f) => f !== big && f.kind !== 'flick');
const small = fresh.filter((f) => f !== big && f !== obj && f.kind !== 'flick');
if (small.length) setToast({ key: small[small.length - 1]!.no, text: small.map((f) => f.text).join(' · ') });
}, [fx.map((f) => f.no).join(',')]); // eslint-disable-line react-hooks/exhaustive-deps
useEffect(() => {
@@ -455,8 +471,24 @@ export function AugFxLayer({ v, players, me }: { v: YutView; players: Record<str
const t = setTimeout(() => setToast(null), fxMs(3200));
return () => clearTimeout(t);
}, [toast]);
useEffect(() => {
if (!objection) return;
const t = setTimeout(() => setObjection(null), fxMs(2800));
return () => clearTimeout(t);
}, [objection]);
return (
<>
{objection &&
createPortal(
<div className="aug-objection" role="alert" onClick={() => setObjection(null)}>
<div className="aug-objection-box">
<AugIcon id="objection" size={72} />
<strong>이의있음!</strong>
<p>{objection.text}</p>
</div>
</div>,
document.body,
)}
{toast && (
<div key={toast.key} className="aug-toast" role="status" aria-live="polite">
{toast.text}