feat: engine improvements, new scenes, videos, subtitles, hotspot component and docs update

This commit is contained in:
2026-06-08 14:01:58 +08:00
parent e68ed9c962
commit 6b67989007
20 changed files with 354 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { ref, shallowRef } from 'vue'
import type { SceneNode, Choice, QTEDefinition } from '@engine/types'
import type { SceneNode, Choice, QTEDefinition, Hotspot } from '@engine/types'
export interface SlotInfo {
slot: number
@@ -23,6 +23,8 @@ export const useGameStore = defineStore('game', () => {
const qteRemaining = ref(0)
const qteResult = ref<'none' | 'success' | 'fail'>('none')
const videoTime = ref(0)
const hotspots = ref<Hotspot[]>([])
const isImageScene = ref(false)
function setScene(scene: SceneNode) {
currentScene.value = scene
@@ -79,6 +81,18 @@ export const useGameStore = defineStore('game', () => {
videoTime.value = t
}
function setHotspots(list: Hotspot[]) {
hotspots.value = list
}
function clearHotspots() {
hotspots.value = []
}
function setIsImageScene(val: boolean) {
isImageScene.value = val
}
function dump() {
console.group('GameStore')
console.log('currentScene:', currentScene.value?.id)
@@ -94,9 +108,11 @@ export const useGameStore = defineStore('game', () => {
return {
currentScene, choices, gameEnded, timerTotal, timerRemaining, saves,
qteActive, qteDef, qteTotal, qteRemaining, qteResult, videoTime,
hotspots, isImageScene,
setScene, setChoices, clearChoices, setGameEnded,
setTimer, clearTimer, setSaves,
showQTE, updateQTE, resolveQTE, setVideoTime,
setHotspots, clearHotspots, setIsImageScene,
dump,
}
})