dist/ 为 Wallpaper Engine 网页壁纸「【崩坏:星穹铁道】昔涟」(workshopid 3604974793, version 2), 含两套预设 xilian / kv37,总计 105.1MB。本次提交不做任何修改,仅作为后续优化的对拍基线。
36 lines
1.0 KiB
JavaScript
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;
|
|
}
|
|
}
|