fix: prefix locales path with assetBase so fetch resolves correctly

This commit is contained in:
2026-06-10 12:32:20 +08:00
parent 8f6138f97e
commit 5eac0f23a8
2 changed files with 7 additions and 3 deletions

View File

@@ -161,7 +161,7 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide
engine.achievementSystem.init(data.achievements || [], achieved)
store.setEndings(data.endings || [])
store.setStoryLocales(data.locales)
store.setStoryLocales(data.locales, data.assetBase)
const visitedIds = await saveSystem.getVisitedSceneIds()
store.setVisitedSceneIds(visitedIds)

View File

@@ -181,8 +181,12 @@ export const useGameStore = defineStore('game', () => {
visitedSceneIds.value = new Set(visitedSceneIds.value)
}
function setStoryLocales(locales: LocalesConfig | undefined) {
if (locales) storyLocales.value = locales
function setStoryLocales(locales: LocalesConfig | undefined, assetBase?: string) {
if (locales) {
const base = (assetBase || '')
const p = locales.path.startsWith('/') || locales.path.startsWith('http') ? locales.path : base + locales.path
storyLocales.value = { ...locales, path: p }
}
}
function setSubFontSize(v: number) { subFontSize.value = v; localStorage.setItem('subFontSize', String(v)) }