结构(旧 game/core+engine → 新 engine/ 域): - engine/kernel/ 时钟/随机/插件协议/fxqueue/timesense/format/urgency/guide/names(原 core) - engine/narrative/ legacy/报告/列传/谱系/年轴(原 core 叙事族) - engine/runtime/ World/creation/pcgen/ApiFacade/capabilities/pluginManager/boot/clocks + Systems/*(12 系统) - engine/sim/ Market(未来 WorldSim 同行) - 旧 game/core、engine/systems、engine/world.ts 等路径全部废弃(无 re-export 兼容层) 验证:35 套件/967 测试全绿(金钟罩三档零漂移=纯搬迁无行为变化) typecheck 0 error
35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
import { useGameStore } from '../store'
|
|
import { computeUrgency } from '../../game/engine/kernel/urgency'
|
|
|
|
export function UrgentBadges() {
|
|
const world = useGameStore((s) => s.world)
|
|
const revision = useGameStore((s) => s.revision)
|
|
const setPanel = useGameStore((s) => s.setPanel)
|
|
const setSpeed = useGameStore((s) => s.setSpeed)
|
|
void revision
|
|
if (!world) return null
|
|
const u = computeUrgency(world)
|
|
const items: { key: string; label: string; cls: string; onClick: () => void }[] = []
|
|
if (u.blockedCount > 0)
|
|
items.push({ key: 'block', label: `瓶颈·${u.blockedCount}`, cls: 'badge-safe', onClick: () => { setPanel('family') } })
|
|
if (u.injuredCount > 0)
|
|
items.push({ key: 'inj', label: `重伤·${u.injuredCount}`, cls: 'badge-bad', onClick: () => setPanel('family') })
|
|
if (u.missionCount > 0)
|
|
items.push({ key: 'mis', label: `在外·${u.missionCount}`, cls: 'badge-info', onClick: () => setPanel('expedition') })
|
|
if (u.marriageReady >= 2)
|
|
items.push({ key: 'mar', label: `媒缘·${u.marriageReady}`, cls: 'badge-warn', onClick: () => setPanel('family') })
|
|
if (u.noHeir)
|
|
items.push({ key: 'heir', label: '孤嗣之忧', cls: 'badge-bad', onClick: () => setPanel('genealogy') })
|
|
|
|
if (items.length === 0) return null
|
|
return (
|
|
<div className="urgent-badges">
|
|
{items.map((b) => (
|
|
<button key={b.key} className={`badge ${b.cls}`} onClick={b.onClick}>
|
|
{b.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|