feat: adaptive bitrate support, engine improvements, demo updates, and electron preload

This commit is contained in:
2026-06-12 17:15:30 +08:00
parent 6575b0be0f
commit b6231e4efd
17 changed files with 139 additions and 4 deletions

View File

@@ -111,6 +111,10 @@ watch([() => store.qteTimeRelax, () => store.qteSingleKey], () => {
applyQteParams()
})
watch(() => store.preferredQuality, (q) => {
engine.videoManager.streamingQuality = q
})
watch(
() => [
showPauseMenu.value, showMenu.value,

View File

@@ -12,6 +12,15 @@ const emit = defineEmits<{
const fontSizeOptions = [20, 24, 28, 32]
const bgAlphaOptions = [0, 0.3, 0.5, 0.7, 0.9]
const qualityOptions = [
{ key: '', label: '自动' },
{ key: '超清 (1080P)', label: '超清 (1080P)', speed: '需要 2.5 Mbps' },
{ key: '高清 (720P)', label: '高清 (720P)', speed: '需要 2 Mbps' },
{ key: '标清 (480P)', label: '标清 (480P)', speed: '需要 0.8 Mbps' },
]
const isWeb = typeof window !== 'undefined' && !(window as any).__ELECTRON__
const langLabels: Record<string, string> = {
zh: '中文',
en: 'English',
@@ -39,6 +48,15 @@ const langLabels: Record<string, string> = {
</select>
</div>
<div class="setting-row" v-if="isWeb">
<span class="setting-label">画质</span>
<select :value="store.preferredQuality" @change="store.setPreferredQuality(($event.target as HTMLSelectElement).value)">
<option v-for="q in qualityOptions" :key="q.key" :value="q.key">
{{ q.label }}{{ q.speed ? '' + q.speed + '' : '' }}
</option>
</select>
</div>
<div class="setting-row">
<span class="setting-label">{{ t('ui.subtitleSize') }}</span>
<select :value="store.subFontSize" @change="store.setSubFontSize(+($event.target as HTMLSelectElement).value)">

View File

@@ -45,6 +45,7 @@ export const useGameStore = defineStore('game', () => {
const antiMistap = ref(localStorage.getItem('antiMistap') !== 'false')
const pauseEnabled = ref(localStorage.getItem('pauseEnabled') !== 'false')
const showSettings = ref(false)
const preferredQuality = ref(localStorage.getItem('preferredQuality') || '')
const introVideo = ref('')
const menuVideo = ref('')
@@ -199,6 +200,8 @@ 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 setPreferredQuality(q: string) { preferredQuality.value = q; localStorage.setItem('preferredQuality', q) }
function setIntroVideo(url: string) { introVideo.value = url }
function setMenuVideo(url: string) { menuVideo.value = url }
@@ -223,6 +226,7 @@ export const useGameStore = defineStore('game', () => {
storyLocales,
subFontSize, subBgAlpha, qteTimeRelax, qteSingleKey, antiMistap, pauseEnabled,
showSettings, introVideo, menuVideo,
preferredQuality,
setScene, setChoices, clearChoices, setGameEnded,
setTimer, clearTimer, setSaves,
showQTE, updateQTE, resolveQTE, clearQTE, setVideoTime,
@@ -235,6 +239,7 @@ export const useGameStore = defineStore('game', () => {
setStoryLocales,
setSubFontSize, setSubBgAlpha, setQteTimeRelax, setQteSingleKey, setAntiMistap, setPauseEnabled,
setShowSettings, setIntroVideo, setMenuVideo,
setPreferredQuality,
dump,
}
})