Files
SpineWallpaper/dist/scripts/preset-controller.js
T
Shuery d8c7e492f7 chore: 基线 — 已发布壁纸现状原样入库(未做任何改动)
dist/ 为 Wallpaper Engine 网页壁纸「【崩坏:星穹铁道】昔涟」(workshopid 3604974793, version 2),
含两套预设 xilian / kv37,总计 105.1MB。本次提交不做任何修改,仅作为后续优化的对拍基线。
2026-09-19 19:08:49 +08:00

36 lines
1.0 KiB
JavaScript

export default class PresetController {
constructor(presetStore) {
this.presetStore = presetStore;
this.previousPreset = "";
this.currentPreset = "";
}
getName() {
return Object.keys(this.presetStore);
}
set(newPreset, currentAudioSource, currentAudioVolume) {
let newPresetData = JSON.parse(JSON.stringify(this.presetStore[newPreset]));
if (this.previousPreset) {
if (
currentAudioSource &&
this.presetStore[this.previousPreset].audioOptions.source !==
currentAudioSource
) {
newPresetData.audioOptions.source = currentAudioSource;
}
if (
currentAudioVolume ||
(currentAudioVolume === 0 &&
this.presetStore[this.previousPreset].audioOptions.volume !==
currentAudioVolume)
) {
newPresetData.audioOptions.volume = currentAudioVolume;
}
}
if (this.currentPreset) {
this.previousPreset = this.currentPreset;
}
this.currentPreset = newPreset;
return newPresetData;
}
}