섯다: 화투 월 숫자를 왼쪽 아래에 크게(흰 글씨 + 검은 테두리) 표시, 겹친 상대 카드에서도 보이게
HwatuCard에 monthStyle='corner' 추가(기본 'badge'는 고스톱 등 그대로). 상대 자리 카드는 다음 카드가 오른쪽 30%를 덮어 오른쪽 위 배지가 가려졌는데, 왼쪽 아래 숫자는 겹쳐도 보인다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* Hwatu card: the real 48-card hwatu artwork from Wikimedia Commons "SVG Hwatu" (Marcus Richert after Louie Mantia Jr.,
|
||||
* CC BY-SA 4.0 — ./hwatu/ATTRIBUTION.txt, docs/games/seotda.md "화투 그림"), bundled from our own origin (no external
|
||||
* URLs). A small month badge stays on top so beginners can read the card at a glance;
|
||||
* URLs). A small month badge stays on top so beginners can read the card at a glance (섯다 instead draws a big outlined
|
||||
* number in the bottom-left corner, which stays visible when cards overlap);
|
||||
* 쌍피 / bonus cards get their value tag (고스톱). The back and the bonus cards are drawn here.
|
||||
*/
|
||||
import type { CSSProperties } from 'react';
|
||||
@@ -70,6 +71,15 @@ function BonusFace({ w, h, value }: { w: number; h: number; value: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
/** Dark outline around white text (8 directions + soft shadow), readable on both the white and black parts of a card. */
|
||||
const cornerOutline = (t: number): string =>
|
||||
[
|
||||
[-t, -t], [0, -t], [t, -t], [-t, 0], [t, 0], [-t, t], [0, t], [t, t],
|
||||
]
|
||||
.map(([x, y]) => `${x}px ${y}px 0 #111827`)
|
||||
.concat('0 1px 3px rgba(0,0,0,0.6)')
|
||||
.join(', ');
|
||||
|
||||
export function HwatuCard({
|
||||
card,
|
||||
size = 'md',
|
||||
@@ -78,6 +88,7 @@ export function HwatuCard({
|
||||
dimmed,
|
||||
highlight,
|
||||
showMonth = true,
|
||||
monthStyle = 'badge',
|
||||
onClick,
|
||||
className,
|
||||
style,
|
||||
@@ -91,6 +102,8 @@ export function HwatuCard({
|
||||
highlight?: boolean;
|
||||
/** Small month number badge (on by default). */
|
||||
showMonth?: boolean;
|
||||
/** 'badge': small dark circle top-right. 'corner': big white outlined number bottom-left (섯다). */
|
||||
monthStyle?: 'badge' | 'corner';
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
style?: CSSProperties;
|
||||
@@ -142,7 +155,27 @@ export function HwatuCard({
|
||||
) : (
|
||||
<img src={hwatuSrc(card.id)} alt="" draggable={false} width={w} height={h} decoding="async" style={{ display: 'block', width: w, height: h, borderRadius: radius }} />
|
||||
)}
|
||||
{showMonth && card.month > 0 && (
|
||||
{showMonth && card.month > 0 && monthStyle === 'corner' && (
|
||||
<span
|
||||
aria-hidden
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: Math.round(w * 0.08),
|
||||
bottom: Math.round(w * 0.06),
|
||||
color: '#fff',
|
||||
fontSize: Math.max(12, Math.round(8 + w * 0.26)),
|
||||
fontWeight: 900,
|
||||
lineHeight: 1,
|
||||
letterSpacing: '-0.04em',
|
||||
textShadow: cornerOutline(Math.max(1, Math.round(w * 0.025))),
|
||||
fontFamily: 'Pretendard Variable, sans-serif',
|
||||
pointerEvents: 'none',
|
||||
}}
|
||||
>
|
||||
{card.month}
|
||||
</span>
|
||||
)}
|
||||
{showMonth && card.month > 0 && monthStyle === 'badge' && (
|
||||
<span
|
||||
aria-hidden
|
||||
style={{
|
||||
|
||||
@@ -185,7 +185,7 @@ function SeatCards({ seat, view: v, width }: { seat: SeotdaSeatView; view: Seotd
|
||||
<div className="sd-cards">
|
||||
{seat.cards.map((c, i) =>
|
||||
isCard(c) ? (
|
||||
<HwatuCard key={c.key} card={c} width={width} className="anim-flip" style={{ marginLeft: i ? -Math.round(width * 0.3) : 0, ['--anim-delay' as string]: `${i * 90}ms` }} />
|
||||
<HwatuCard key={c.key} card={c} width={width} monthStyle="corner" className="anim-flip" style={{ marginLeft: i ? -Math.round(width * 0.3) : 0, ['--anim-delay' as string]: `${i * 90}ms` }} />
|
||||
) : (
|
||||
<HwatuCard key={`b${tag}-${i}`} card={null} width={width} className="anim-deal" style={{ marginLeft: i ? -Math.round(width * 0.3) : 0, ['--anim-delay' as string]: `${i * 80}ms` }} />
|
||||
),
|
||||
@@ -298,6 +298,7 @@ function MySeat({ seat, view: v, players, deadline, winner, setRef, phone }: { s
|
||||
key={c.key}
|
||||
card={c}
|
||||
width={w}
|
||||
monthStyle="corner"
|
||||
className="anim-deal"
|
||||
highlight={!!v.myChosen?.includes(c.id) || (!v.myChosen && v.myOpened === c.id)}
|
||||
dimmed={(!!v.myChosen && !v.myChosen.includes(c.id)) || seat.folded}
|
||||
@@ -566,7 +567,7 @@ function OpenBox({ view: v, me, act, pending }: { view: SeotdaView; me: string;
|
||||
</p>
|
||||
<div className="row" style={{ justifyContent: 'center', gap: 10 }}>
|
||||
{cards.map((c) => (
|
||||
<HwatuCard key={c.key} card={c} size="lg" selected={pick === c.id} onClick={() => setPick(c.id)} />
|
||||
<HwatuCard key={c.key} card={c} size="lg" monthStyle="corner" selected={pick === c.id} onClick={() => setPick(c.id)} />
|
||||
))}
|
||||
</div>
|
||||
<button type="button" className="btn btn-primary" disabled={pick === null || pending} onClick={() => act({ type: 'open', cardId: pick })}>
|
||||
@@ -609,7 +610,7 @@ function ChooseBox({ view: v, me, act, pending }: { view: SeotdaView; me: string
|
||||
</p>
|
||||
<div className="row" style={{ justifyContent: 'center', gap: 10 }}>
|
||||
{cards.map((c) => (
|
||||
<HwatuCard key={c.key} card={c} size="lg" selected={pick.includes(c.id)} onClick={() => toggle(c.id)} />
|
||||
<HwatuCard key={c.key} card={c} size="lg" monthStyle="corner" selected={pick.includes(c.id)} onClick={() => toggle(c.id)} />
|
||||
))}
|
||||
</div>
|
||||
{v.options.hints && v.myCombos && (
|
||||
|
||||
@@ -20,8 +20,8 @@ function Pair({ a, b, label, size = 'sm' }: { a: [number, boolean]; b: [number,
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 4 }}>
|
||||
<div style={{ display: 'flex' }}>
|
||||
<HwatuCard card={hw(...a)} size={size} />
|
||||
<HwatuCard card={hw(...b)} size={size} style={{ marginLeft: size === 'md' ? 4 : -10 }} />
|
||||
<HwatuCard card={hw(...a)} size={size} monthStyle="corner" />
|
||||
<HwatuCard card={hw(...b)} size={size} monthStyle="corner" style={{ marginLeft: size === 'md' ? 4 : -10 }} />
|
||||
</div>
|
||||
<strong style={{ fontSize: size === 'md' ? '1.1rem' : '0.85rem', whiteSpace: 'nowrap' }}>{label}</strong>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user