chore: App.vue and useGameEngine updates
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<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 GamePlayer from '@/components/GamePlayer.vue'
|
||||||
import ChoicePanel from '@/components/ChoicePanel.vue'
|
import ChoicePanel from '@/components/ChoicePanel.vue'
|
||||||
import QTEOverlay from '@/components/QTEOverlay.vue'
|
import QTEOverlay from '@/components/QTEOverlay.vue'
|
||||||
@@ -84,6 +84,7 @@ async function init() {
|
|||||||
const params = new URLSearchParams(location.search)
|
const params = new URLSearchParams(location.search)
|
||||||
if (params.get('startScene')) {
|
if (params.get('startScene')) {
|
||||||
showIntro.value = false
|
showIntro.value = false
|
||||||
|
await nextTick()
|
||||||
handleStartFromScene(params.get('startScene')!)
|
handleStartFromScene(params.get('startScene')!)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -92,6 +93,7 @@ async function init() {
|
|||||||
const params = new URLSearchParams(location.search)
|
const params = new URLSearchParams(location.search)
|
||||||
const startSceneId = params.get('startScene')
|
const startSceneId = params.get('startScene')
|
||||||
if (startSceneId) {
|
if (startSceneId) {
|
||||||
|
await nextTick()
|
||||||
handleStartFromScene(startSceneId)
|
handleStartFromScene(startSceneId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,15 +198,13 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startChapter(chapterId: string) {
|
function startChapter(chapterId: string) {
|
||||||
const [elA, elB] = videoEls()
|
ensureVideo()
|
||||||
if (elA && elB) engine.videoManager.attach(elA, elB)
|
|
||||||
store.setGameEnded(false)
|
store.setGameEnded(false)
|
||||||
engine.startChapter(chapterId)
|
engine.startChapter(chapterId)
|
||||||
}
|
}
|
||||||
|
|
||||||
function startAtScene(chapterId: string, sceneId: string) {
|
function startAtScene(chapterId: string, sceneId: string) {
|
||||||
const [elA, elB] = videoEls()
|
ensureVideo()
|
||||||
if (elA && elB) engine.videoManager.attach(elA, elB)
|
|
||||||
store.setGameEnded(false)
|
store.setGameEnded(false)
|
||||||
engine.startAtScene(chapterId, sceneId)
|
engine.startAtScene(chapterId, sceneId)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user