chore: App.vue and useGameEngine updates

This commit is contained in:
2026-06-14 21:03:26 +08:00
parent 35ddef9dcc
commit 8b90ba0501
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch, onMounted, onUnmounted } from 'vue'
import { ref, watch, onMounted, onUnmounted, nextTick } from 'vue'
import GamePlayer from '@/components/GamePlayer.vue'
import ChoicePanel from '@/components/ChoicePanel.vue'
import QTEOverlay from '@/components/QTEOverlay.vue'
@@ -84,6 +84,7 @@ async function init() {
const params = new URLSearchParams(location.search)
if (params.get('startScene')) {
showIntro.value = false
await nextTick()
handleStartFromScene(params.get('startScene')!)
return
}
@@ -92,6 +93,7 @@ async function init() {
const params = new URLSearchParams(location.search)
const startSceneId = params.get('startScene')
if (startSceneId) {
await nextTick()
handleStartFromScene(startSceneId)
}
}

View File

@@ -198,15 +198,13 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
}
function startChapter(chapterId: string) {
const [elA, elB] = videoEls()
if (elA && elB) engine.videoManager.attach(elA, elB)
ensureVideo()
store.setGameEnded(false)
engine.startChapter(chapterId)
}
function startAtScene(chapterId: string, sceneId: string) {
const [elA, elB] = videoEls()
if (elA && elB) engine.videoManager.attach(elA, elB)
ensureVideo()
store.setGameEnded(false)
engine.startAtScene(chapterId, sceneId)
}