fix: App.vue and useGameEngine refinements

This commit is contained in:
2026-06-14 21:11:34 +08:00
parent 8b90ba0501
commit b45ad8bbc3
2 changed files with 9 additions and 4 deletions

View File

@@ -49,7 +49,7 @@ const showTopBar = ref(true)
let hideTopBarTimer: ReturnType<typeof setTimeout> | null = null
const { loadGame, start, resumeAutoSave, makeChoice, clickHotspot, startChapter,
skipScene, setSpeed, getSpeed, isSceneWatched, startAtScene,
skipScene, setSpeed, getSpeed, isSceneWatched, startAtScene, jumpToScene,
saveGame, loadGameFromSlot, refreshSaves, saveSystem, engine } =
useGameEngine(() => [videoElA.value, videoElB.value])
@@ -124,8 +124,7 @@ function handleStartFromScene(sceneId: string) {
if (ch) {
startAtScene(ch.id, sceneId)
} else {
const scene = engine.sceneManager.getScene(sceneId)
if (scene) engine.goToScene(scene)
jumpToScene(sceneId)
}
}

View File

@@ -209,6 +209,12 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
engine.startAtScene(chapterId, sceneId)
}
function jumpToScene(sceneId: string) {
ensureVideo()
const scene = engine.sceneManager.getScene(sceneId)
if (scene) engine.goToScene(scene)
}
function skipScene() {
engine.skipCurrentScene()
}
@@ -288,7 +294,7 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
makeChoice,
clickHotspot,
startChapter,
startAtScene,
startAtScene, jumpToScene,
skipScene,
setSpeed,
getSpeed,