diff --git a/.gitignore b/.gitignore index 900ae04..0dd15e9 100644 --- a/.gitignore +++ b/.gitignore @@ -43,5 +43,5 @@ next-env.d.ts # 로컬 테스트 산출물 .playwright-mcp/ *.png -!public/*.png +!public/**/*.png !src/**/*.png diff --git a/public/assets/tools/cooking.png b/public/assets/tools/cooking.png new file mode 100644 index 0000000..ebc57e5 Binary files /dev/null and b/public/assets/tools/cooking.png differ diff --git a/public/assets/tools/crafting.png b/public/assets/tools/crafting.png new file mode 100644 index 0000000..0e47109 Binary files /dev/null and b/public/assets/tools/crafting.png differ diff --git a/public/assets/tools/fishing.png b/public/assets/tools/fishing.png new file mode 100644 index 0000000..0dfa5f3 Binary files /dev/null and b/public/assets/tools/fishing.png differ diff --git a/public/assets/tools/foraging.png b/public/assets/tools/foraging.png new file mode 100644 index 0000000..a0a67bf Binary files /dev/null and b/public/assets/tools/foraging.png differ diff --git a/public/assets/tools/grooming.png b/public/assets/tools/grooming.png new file mode 100644 index 0000000..8356cf7 Binary files /dev/null and b/public/assets/tools/grooming.png differ diff --git a/public/assets/tools/logging.png b/public/assets/tools/logging.png new file mode 100644 index 0000000..e2b8fe6 Binary files /dev/null and b/public/assets/tools/logging.png differ diff --git a/public/assets/tools/mining.png b/public/assets/tools/mining.png new file mode 100644 index 0000000..3d22ecd Binary files /dev/null and b/public/assets/tools/mining.png differ diff --git a/src/components/game/Game.tsx b/src/components/game/Game.tsx index f87f09d..fcb73a5 100644 --- a/src/components/game/Game.tsx +++ b/src/components/game/Game.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import { useGame } from "@/hooks/useGame"; import VillageView from "@/components/game/VillageView"; import { engine, catRate } from "@/lib/game/engine"; -import { APTITUDE_LABEL, PASSIVES } from "@/lib/game/data"; +import { APTITUDE_LABEL, PASSIVES, TOOL_IMG } from "@/lib/game/data"; import type { Building, Cat, GameState } from "@/lib/game/types"; export default function Game() { @@ -129,9 +129,15 @@ function BuildingCard({ return (
-
-

- {building.emoji} {building.name} Lv{building.level} +
+

+ {/* eslint-disable-next-line @next/next/no-img-element */} + {building.name} + {building.name} Lv{building.level}

필요 적성: {APTITUDE_LABEL[building.aptitude]} diff --git a/src/components/game/VillageView.tsx b/src/components/game/VillageView.tsx index bb9b64c..2499f5e 100644 --- a/src/components/game/VillageView.tsx +++ b/src/components/game/VillageView.tsx @@ -2,6 +2,8 @@ import { useEffect, useRef } from "react"; import { engine, catRate } from "@/lib/game/engine"; +import { TOOL_IMG } from "@/lib/game/data"; +import type { AptitudeKey } from "@/lib/game/types"; // ---------- 아이소메트릭 그리드 ---------- const COLS = 11; @@ -85,6 +87,7 @@ export default function VillageView() { const canvasRef = useRef(null); const animsRef = useRef>(new Map()); const bubblesRef = useRef([]); + const toolImagesRef = useRef>(new Map()); const hitRectsRef = useRef< Array<{ id: string; x: number; y: number; w: number; h: number }> >([]); @@ -100,6 +103,13 @@ export default function VillageView() { canvas.height = CANVAS_H * dpr; ctx.scale(dpr, dpr); + // 도구 일러스트 프리로드 (로드 전에는 이모지로 폴백) + for (const [key, src] of Object.entries(TOOL_IMG)) { + const img = new Image(); + img.src = src; + img.onload = () => toolImagesRef.current.set(key as AptitudeKey, img); + } + let raf = 0; let last = performance.now(); @@ -265,7 +275,15 @@ export default function VillageView() { y, draw: () => { shadow(x, y + 6, 24); - drawEmoji(b.emoji, x, y + 8, 42); + const img = toolImagesRef.current.get(b.aptitude); + if (img) { + // 세로가 긴 일러스트 — 높이 56px 기준으로 비율 유지 + const h = 56; + const w = (img.width / img.height) * h; + ctx.drawImage(img, x - w / 2, y + 8 - h, w, h); + } else { + drawEmoji(b.emoji, x, y + 8, 42); + } ctx.font = "bold 12px sans-serif"; ctx.textAlign = "center"; ctx.fillStyle = "#374151"; diff --git a/src/lib/game/data.ts b/src/lib/game/data.ts index 7546c9f..0f96807 100644 --- a/src/lib/game/data.ts +++ b/src/lib/game/data.ts @@ -4,6 +4,17 @@ import type { AptitudeKey } from "./types"; export const APTITUDE_RATE = [0, 1.0, 2.2, 4.8, 10.0, 21.0, 45.0]; export const BASE_RATE = 0.2; +// 적성별 도구 일러스트 (public/assets/tools/) +export const TOOL_IMG: Record = { + fishing: "/assets/tools/fishing.png", + logging: "/assets/tools/logging.png", + mining: "/assets/tools/mining.png", + foraging: "/assets/tools/foraging.png", + cooking: "/assets/tools/cooking.png", + crafting: "/assets/tools/crafting.png", + grooming: "/assets/tools/grooming.png", +}; + export const APTITUDE_LABEL: Record = { fishing: "낚시", logging: "벌목",