Update sounds.vue

This commit is contained in:
syuilo 2025-03-03 11:21:26 +09:00
parent a898bda4dc
commit fd73c362a1
1 changed files with 35 additions and 30 deletions

View File

@ -4,43 +4,48 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div class="_gaps_m"> <SearchMarker path="/settings/sounds" :label="i18n.ts.sounds" :keywords="['sounds']" icon="ti ti-music">
<MkSwitch v-model="notUseSound"> <div class="_gaps_m">
<template #label>{{ i18n.ts.notUseSound }}</template> <SearchMarker>
</MkSwitch> <MkSwitch v-model="notUseSound">
<MkSwitch v-model="useSoundOnlyWhenActive"> <template #label><SearchLabel>{{ i18n.ts.notUseSound }}</SearchLabel></template>
<template #label>{{ i18n.ts.useSoundOnlyWhenActive }}</template> </MkSwitch>
</MkSwitch> </SearchMarker>
<MkRange v-model="masterVolume" :min="0" :max="1" :step="0.05" :textConverter="(v) => `${Math.floor(v * 100)}%`">
<template #label>{{ i18n.ts.masterVolume }}</template>
</MkRange>
<FormSection> <MkSwitch v-model="useSoundOnlyWhenActive">
<template #label>{{ i18n.ts.sounds }}</template> <template #label>{{ i18n.ts.useSoundOnlyWhenActive }}</template>
<div class="_gaps_s"> </MkSwitch>
<MkFolder v-for="type in operationTypes" :key="type"> <MkRange v-model="masterVolume" :min="0" :max="1" :step="0.05" :textConverter="(v) => `${Math.floor(v * 100)}%`">
<template #label>{{ i18n.ts._sfx[type] }}</template> <template #label>{{ i18n.ts.masterVolume }}</template>
<template #suffix>{{ getSoundTypeName(sounds[type].type) }}</template> </MkRange>
<Suspense>
<template #default>
<XSound :type="sounds[type].type" :volume="sounds[type].volume" :fileId="sounds[type].fileId" :fileUrl="sounds[type].fileUrl" @update="(res) => updated(type, res)"/>
</template>
<template #fallback>
<MkLoading/>
</template>
</Suspense>
</MkFolder>
</div>
</FormSection>
<MkButton danger @click="reset()"><i class="ti ti-reload"></i> {{ i18n.ts.default }}</MkButton> <FormSection>
</div> <template #label>{{ i18n.ts.sounds }}</template>
<div class="_gaps_s">
<MkFolder v-for="type in operationTypes" :key="type">
<template #label>{{ i18n.ts._sfx[type] }}</template>
<template #suffix>{{ getSoundTypeName(sounds[type].type) }}</template>
<Suspense>
<template #default>
<XSound :type="sounds[type].type" :volume="sounds[type].volume" :fileId="sounds[type].fileId" :fileUrl="sounds[type].fileUrl" @update="(res) => updated(type, res)"/>
</template>
<template #fallback>
<MkLoading/>
</template>
</Suspense>
</MkFolder>
</div>
</FormSection>
<MkButton danger @click="reset()"><i class="ti ti-reload"></i> {{ i18n.ts.default }}</MkButton>
</div>
</SearchMarker>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import type { Ref } from 'vue';
import XSound from './sounds.sound.vue'; import XSound from './sounds.sound.vue';
import type { Ref } from 'vue';
import type { SoundType, OperationType } from '@/scripts/sound.js'; import type { SoundType, OperationType } from '@/scripts/sound.js';
import type { SoundStore } from '@/store.js'; import type { SoundStore } from '@/store.js';
import MkRange from '@/components/MkRange.vue'; import MkRange from '@/components/MkRange.vue';