feat: editor services, stores, and graph improvements

This commit is contained in:
2026-06-14 17:46:34 +08:00
parent 271c909398
commit 82bfae0e1b
5 changed files with 291 additions and 371 deletions

View File

@@ -121,3 +121,44 @@ P3 完成的编辑器支持基本的场景节点编辑。以下是与引擎 P4~P
| **P2** | E14 | 面板标签页——属性字段达到 20+ 后优势明显 |
| **P3** | E2/E3/E5 | 单字段编辑——BGM/loop/prompt改动小 |
| **P3** | E13 | 撤销/重做——重要但改动不小 |
---
## E15: 编辑器架构重构 — 三层分离
目标:为应对状态增多和功能复杂化,确保扩展性和可维护性。编辑器重构为三层分离架构,与引擎分层一致。
**当前问题:** `App.vue` 310 行 god 组件 / `useGraphEditor.ts` 混合 JSON + Vue refs / 无 Pinia store
**目标架构:**
```
editor/
├── services/ GraphService.ts + AssetResolver.ts # 纯函数数据层
├── stores/ editorStore.ts # Pinia 全局状态 + undo/redo
├── composables/ useGraphEditor.ts # 编排层→60行
├── components/ Toolbar / SceneGraphPanel / NodeEditorPanel / SceneList / StatusBar
└── App.vue # 精简布局组合→30行
```
**实施步骤:**
1. 创建 `editorStore.ts`Pinia
2. 创建 `GraphService.ts`(纯函数剥离)
3. 精简 `App.vue` + `useGraphEditor`
4. 新增 `SceneList.vue` + `StatusBar.vue`
### 优先级建议(更新)
| 优先级 | 编号 | 说明 |
|:--:|------|------|
| **P0** | **E15** | 架构重构——所有后续功能的基础 ✅ 已完成 2026-06-13 |
| **P0** | E4 | i18n key 编辑 |
| **P0** | E10 | 内嵌快速测试 |
| **P1** | E1 | 热点编辑 |
| **P1** | E6 | 顶级字段 |
| **P1** | E12 | JSON 校验 |
| **P2** | E7/E8/E9 | 条件路由/关键节点/战斗 |
| **P2** | E11 | 场景列表搜索 |
| **P2** | E14 | 面板标签页 |
| **P3** | E2/E3/E5 | 单字段编辑 |
| **P3** | E13 | 撤销/重做 |