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