fix: emit sceneChange before video start to avoid hotspot flash, prevent game end for hotspot-only scenes

This commit is contained in:
2026-06-08 15:02:38 +08:00
parent d81042174a
commit 077de2a64e

View File

@@ -70,6 +70,8 @@ export class Engine {
return
}
this.emit('sceneChange', scene)
const preloadUrls = this.sceneManager.getCandidateUrls(
scene,
(conds) => conds ? this.stateManager.evaluate(conds) : true
@@ -88,8 +90,6 @@ export class Engine {
} else {
this.videoManager.switchTo(scene.videoUrl, preloadUrls)
}
this.emit('sceneChange', scene)
}
private checkQTE = (time: number) => {
@@ -205,6 +205,9 @@ export class Engine {
} else {
this.endGame()
}
} else if (scene.hotspots?.length) {
// hotspot-only scene: wait for user to click a hotspot
return
} else {
this.endGame()
}