chore: App.vue updates for player and editor
This commit is contained in:
42
src/App.vue
42
src/App.vue
@@ -81,7 +81,49 @@ async function init() {
|
||||
|
||||
if (store.introVideo) {
|
||||
introWatched.value = await isSceneWatched('__intro__')
|
||||
const params = new URLSearchParams(location.search)
|
||||
if (params.get('startScene')) {
|
||||
showIntro.value = false
|
||||
handleStartFromScene(params.get('startScene')!)
|
||||
return
|
||||
}
|
||||
showIntro.value = true
|
||||
} else {
|
||||
const params = new URLSearchParams(location.search)
|
||||
const startSceneId = params.get('startScene')
|
||||
if (startSceneId) {
|
||||
handleStartFromScene(startSceneId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleStartFromScene(sceneId: string) {
|
||||
started.value = true
|
||||
applyQteParams()
|
||||
const ch = engine.sceneManager.chapters.find(c => {
|
||||
const reachable = new Set<string>()
|
||||
const queue = [c.startScene]
|
||||
while (queue.length > 0) {
|
||||
const id = queue.shift()!
|
||||
if (reachable.has(id)) continue
|
||||
const sc = engine.sceneManager.getScene(id)
|
||||
if (!sc) continue
|
||||
reachable.add(id)
|
||||
if (sc.choices) for (const ch2 of sc.choices) if (ch2.targetScene) queue.push(ch2.targetScene)
|
||||
if (sc.nextScene) {
|
||||
if (Array.isArray(sc.nextScene)) for (const r of sc.nextScene) if (r.targetScene) queue.push(r.targetScene)
|
||||
else queue.push(sc.nextScene)
|
||||
}
|
||||
if (sc.qte) { if (sc.qte.successScene) queue.push(sc.qte.successScene); if (sc.qte.failScene) queue.push(sc.qte.failScene) }
|
||||
if (sc.hotspots) for (const h of sc.hotspots) if (h.targetScene) queue.push(h.targetScene)
|
||||
}
|
||||
return reachable.has(sceneId)
|
||||
})
|
||||
if (ch) {
|
||||
engine.startAtScene(ch.id, sceneId)
|
||||
} else {
|
||||
const scene = engine.sceneManager.getScene(sceneId)
|
||||
if (scene) engine.goToScene(scene)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user