Files
wechat-minigame/js/content/navigation/runtime-nav.js
manpengan d7bea9aed5 nav: 全量 world-catalog + status active/planned 分层
- world-catalog.js: 6洲48国127城市全量 NavNode catalog
  - 统一 schema(isEnabled → status: active|planned)
  - 64 个 NavNode 覆盖所有洲/国家/地区
- runtime-nav.js: 从 catalog 自动过滤 active 节点
  - MVP_OVERRIDES 机制跳过国家层直连城市
  - V1.1+ 删除覆写即恢复完整层级
- 删除 future-catalog.js,旧 shim 指向 world-catalog
- game-design 2.3 更新 schema + Framework Ready 说明

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 23:37:17 +08:00

43 lines
1.1 KiB
JavaScript

/**
* Runtime Navigation — 从 world-catalog 自动生成
*
* 只包含 status === 'active' 的节点。
* MVP 阶段手动覆写亚洲的 childType 为 'city'(跳过国家层),
* V1.1+ 切换为 catalog 默认的 'country'。
*/
import { worldCatalog } from './world-catalog.js'
// MVP 覆写:亚洲直接指向城市,不经过国家层
const MVP_OVERRIDES = {
asia: {
childType: 'city',
childIds: ['beijing', 'tokyo', 'bangkok', 'seoul', 'singapore', 'istanbul'],
},
}
function buildRuntimeNav() {
const activeNodes = worldCatalog.filter(n => n.status === 'active')
return activeNodes.map(node => {
const override = MVP_OVERRIDES[node.id]
if (override) {
return { ...node, ...override }
}
return { ...node }
})
}
export const runtimeNavNodes = buildRuntimeNav()
export function getNavNode(id) {
return runtimeNavNodes.find(n => n.id === id) || null
}
export function getEnabledRoots() {
return runtimeNavNodes.filter(n => n.parentId === null)
}
export function getChildren(parentId) {
return runtimeNavNodes.filter(n => n.parentId === parentId)
}