From e0331ab5a7f913ec02a015ab08a452d3e09443f2 Mon Sep 17 00:00:00 2001 From: cocos02 Date: Sun, 14 Jun 2026 17:31:34 +0800 Subject: [PATCH] fix: handle array nextScene in editor sceneEdges and deleteScene --- editor/composables/useGraphEditor.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/editor/composables/useGraphEditor.ts b/editor/composables/useGraphEditor.ts index aeec4a9..5a89ff1 100644 --- a/editor/composables/useGraphEditor.ts +++ b/editor/composables/useGraphEditor.ts @@ -27,7 +27,17 @@ export function useGraphEditor() { } } if (scene.nextScene) { - result.push({ id: `${id}_next`, source: id, target: scene.nextScene, label: '\u2192 \u9ed8\u8ba4' }) + if (Array.isArray(scene.nextScene)) { + for (let ri = 0; ri < scene.nextScene.length; ri++) { + const r = scene.nextScene[ri] + if (r.targetScene) { + const condLabel = r.conditions?.length ? '→ 条件' : '→ 默认' + result.push({ id: `${id}_next_${ri}`, source: id, target: r.targetScene, label: condLabel }) + } + } + } else { + result.push({ id: `${id}_next`, source: id, target: scene.nextScene, label: '\u2192 \u9ed8\u8ba4' }) + } } if (scene.qte) { if (scene.qte.successScene) @@ -93,7 +103,11 @@ export function useGraphEditor() { const s = nextScenes[key] if (s.choices) nextScenes[key] = { ...s, choices: s.choices.filter((c) => c.targetScene !== id) } - if (s.nextScene === id) nextScenes[key] = { ...nextScenes[key], nextScene: '' } + if (Array.isArray(s.nextScene)) { + nextScenes[key] = { ...s, nextScene: s.nextScene.filter((r) => r.targetScene !== id) } + } else if (s.nextScene === id) { + nextScenes[key] = { ...nextScenes[key], nextScene: '' } + } if (s.qte) { const qte = { ...s.qte } let changed = false