chore: App.vue and useGameEngine updates
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user