feat: battle system, state manager enhancements, engine and demo updates

This commit is contained in:
2026-06-14 15:35:31 +08:00
parent 4d066b53bf
commit d0e901bd1f
12 changed files with 515 additions and 6 deletions

View File

@@ -45,6 +45,9 @@ export const useGameStore = defineStore('game', () => {
const antiMistap = ref(localStorage.getItem('antiMistap') !== 'false')
const pauseEnabled = ref(localStorage.getItem('pauseEnabled') !== 'false')
const showSettings = ref(false)
const showBattleResult = ref(false)
const battleResultData = ref<any>(null)
const variables = ref<Record<string, number>>({})
const preferredQuality = ref(localStorage.getItem('preferredQuality') || '')
const introVideo = ref('')
const menuVideo = ref('')
@@ -200,6 +203,21 @@ export const useGameStore = defineStore('game', () => {
function setPauseEnabled(v: boolean) { pauseEnabled.value = v; localStorage.setItem('pauseEnabled', String(v)) }
function setShowSettings(v: boolean) { showSettings.value = v }
function variable(name: string): number {
return variables.value[name] ?? 0
}
function syncVariables(vars: Record<string, number>) {
variables.value = { ...vars }
}
function setBattleResult(data: any) {
battleResultData.value = data
showBattleResult.value = true
}
function setShowBattleResult(v: boolean) { showBattleResult.value = v }
function setPreferredQuality(q: string) { preferredQuality.value = q; localStorage.setItem('preferredQuality', q) }
function setIntroVideo(url: string) { introVideo.value = url }
@@ -226,6 +244,7 @@ export const useGameStore = defineStore('game', () => {
storyLocales,
subFontSize, subBgAlpha, qteTimeRelax, qteSingleKey, antiMistap, pauseEnabled,
showSettings, introVideo, menuVideo,
showBattleResult, battleResultData, variables,
preferredQuality,
setScene, setChoices, clearChoices, setGameEnded,
setTimer, clearTimer, setSaves,
@@ -239,6 +258,7 @@ export const useGameStore = defineStore('game', () => {
setStoryLocales,
setSubFontSize, setSubBgAlpha, setQteTimeRelax, setQteSingleKey, setAntiMistap, setPauseEnabled,
setShowSettings, setIntroVideo, setMenuVideo,
variable, setBattleResult, setShowBattleResult, syncVariables,
setPreferredQuality,
dump,
}