"use client"; // 回响星核 / Echo Nexus — 技术树 import { useGameStore } from "@/store/gameStore"; import { TECH_TREE, TECH_BRANCH_META, formatNum } from "@/lib/game/config"; import { sfx } from "@/hooks/useAudio"; import { Card } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Pickaxe, ScanLine, Rocket, BookOpen, Check, Lock, } from "lucide-react"; import type { TechBranch } from "@/lib/game/types"; const ICONS: Record> = { Pickaxe, ScanLine, Rocket, BookOpen, }; const BRANCH_COLOR: Record = { mining: "#34d399", decoding: "#fb7185", expedition: "#fbbf24", narrative: "#e879f9", }; export function TechTree() { const tech = useGameStore((s) => s.tech); const insights = useGameStore((s) => s.insights); const buyTech = useGameStore((s) => s.buyTech); const branches: TechBranch[] = ["mining", "decoding", "expedition", "narrative"]; return (

技术树

洞见 {formatNum(insights)}
{branches.map((b) => { const meta = TECH_BRANCH_META[b]; const Icon = ICONS[meta.icon]; const color = BRANCH_COLOR[b]; const nodes = TECH_TREE.filter((t) => t.branch === b); return (
{meta.name} {meta.desc}
{nodes.map((node) => { const owned = (tech[node.id] ?? 0) >= 1; const affordable = insights >= node.cost; return (
{node.name} {owned && ( )}

{node.desc}

{!owned && ( )}
); })}
); })}
); }