fix: handle array nextScene in editor sceneEdges and deleteScene

This commit is contained in:
2026-06-14 17:31:34 +08:00
parent 73fade1b94
commit e0331ab5a7

View File

@@ -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