치지직 채널 ID로 입장하게 변경 및 일부 판 커스텀 설정 추가.

This commit is contained in:
kimyu
2026-09-16 05:29:50 +09:00
parent 7c402dfd8f
commit 6f72824598
5 changed files with 170 additions and 31 deletions

View File

@@ -40,6 +40,8 @@ import {
perimeterLength,
randomizeAndSaveBoard,
resizeBoardConfig,
setAllCellsContentVisible,
setBoardConfig,
updateBoardCell,
} from './game/board-config';
@@ -145,16 +147,33 @@ function BoardEditor({
<div>
<h3 className="text-sm font-semibold text-white">주사위판 칸 (board)</h3>
<p className="text-[11px] text-white/50">
가로·세로로 판 크기를 바꾸고, 칸마다 이름·효과·이미지를 설정합니다. 0번(시작) 이름은 고정입니다.
가로·세로로 판 크기를 바꾸고, 칸마다 이름·효과·이미지·내용 표시를 설정합니다. 0번(시작) 이름은
고정입니다.
</p>
</div>
<button
type="button"
className="rounded bg-violet-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-violet-600"
onClick={() => onChange(randomizeAndSaveBoard(board.width, board.height, board))}
>
랜덤 다시 배치
</button>
<div className="flex flex-wrap gap-1.5">
<button
type="button"
className="rounded bg-white/15 px-3 py-1.5 text-xs font-medium text-white hover:bg-white/25"
onClick={() => onChange(setAllCellsContentVisible(true, board))}
>
전체 내용 표시
</button>
<button
type="button"
className="rounded bg-white/15 px-3 py-1.5 text-xs font-medium text-white hover:bg-white/25"
onClick={() => onChange(setAllCellsContentVisible(false, board))}
>
전체 내용 숨김
</button>
<button
type="button"
className="rounded bg-violet-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-violet-600"
onClick={() => onChange(randomizeAndSaveBoard(board.width, board.height, board))}
>
랜덤 다시 배치
</button>
</div>
</div>
<div className="flex flex-wrap items-end gap-3 rounded-lg bg-black/25 p-3">
@@ -195,26 +214,35 @@ function BoardEditor({
{geo.map((g, index) => {
const cell = board.cells[index];
const active = selected === index;
const showContent = cell?.contentVisible !== false;
return (
<button
key={g.id}
type="button"
title={`#${index} ${cell?.type ?? ''}`}
title={`#${index} ${cell?.type ?? ''}${showContent ? '' : ' (내용 숨김)'}`}
onClick={() => setSelected(index)}
className="min-h-10 rounded px-0.5 text-[10px] font-semibold text-white sm:text-[11px]"
className="relative min-h-10 rounded px-0.5 text-[10px] font-semibold text-white sm:text-[11px]"
style={{
gridColumn: g.x + 1,
gridRow: g.y + 1,
backgroundColor: cellColorFor(cell?.eventId, index),
backgroundImage: cell?.imageSrc ? `url(${cell.imageSrc})` : undefined,
backgroundImage:
showContent && cell?.imageSrc ? `url(${cell.imageSrc})` : undefined,
backgroundSize: 'cover',
backgroundPosition: 'center',
textShadow: cell?.imageSrc ? '0 1px 2px rgba(0,0,0,0.9)' : undefined,
textShadow:
showContent && cell?.imageSrc ? '0 1px 2px rgba(0,0,0,0.9)' : undefined,
outline: active ? '2px solid #fde68a' : undefined,
outlineOffset: 1,
opacity: showContent ? 1 : 0.7,
}}
>
{index === 0 ? '시작' : cell?.type}
{!showContent && (
<span className="absolute top-0.5 right-0.5 rounded bg-black/55 px-0.5 text-[8px] font-normal text-white/70">
숨김
</span>
)}
</button>
);
})}
@@ -262,6 +290,27 @@ function BoardEditor({
))}
</select>
</div>
<div className="flex flex-col gap-1 sm:col-span-2">
<label className="inline-flex items-center gap-2 text-sm text-white/85">
<input
type="checkbox"
checked={selectedCell.contentVisible !== false}
onChange={(e) =>
onChange(
updateBoardCell(
selected,
{ contentVisible: e.target.checked },
board,
),
)
}
/>
게임에서 이 칸 내용(이름·이미지) 표시
</label>
<p className="text-[11px] text-white/45">
끄면 판에는 색만 보이고, 착지 시 효과·안내는 그대로 동작합니다.
</p>
</div>
<div className="flex flex-col gap-2 sm:col-span-2">
<div className="flex items-center justify-between gap-2">
<label className="text-xs text-white/60">
@@ -621,7 +670,13 @@ export default function Home() {
<p className="rounded bg-red-900/70 px-3 py-2 text-sm text-white">{error}</p>
)}
<BoardEditor board={board} onChange={setBoard} />
<BoardEditor
board={board}
onChange={(next) => {
setBoardConfig(next);
setBoard(next);
}}
/>
<div className="grid gap-4 sm:grid-cols-2">
<AssetThumb