dist/ 为 Wallpaper Engine 网页壁纸「【崩坏:星穹铁道】昔涟」(workshopid 3604974793, version 2), 含两套预设 xilian / kv37,总计 105.1MB。本次提交不做任何修改,仅作为后续优化的对拍基线。
88 lines
2.8 KiB
JavaScript
88 lines
2.8 KiB
JavaScript
import PresetStore from "./preset-store.js";
|
|
|
|
import PresetController from "./preset-controller.js";
|
|
import BackgroundController from "./background-controller.js";
|
|
import SpineController from "./spine-controller.js";
|
|
import AudioController from "./audio-controller.js";
|
|
|
|
let presetController = new PresetController(PresetStore);
|
|
|
|
let { backgroundImage, spineConfig, audioOptions } =
|
|
presetController.set("xilian");
|
|
|
|
let backgroundController = new BackgroundController(backgroundImage);
|
|
let spineController = new SpineController("spine-container", spineConfig);
|
|
let audioController = new AudioController("background-music", audioOptions);
|
|
|
|
let currentAudioSource = "";
|
|
let currentAudioVolume = 0;
|
|
|
|
window.addEventListener("load", function () {
|
|
backgroundController.setImage();
|
|
spineController.create();
|
|
audioController.play();
|
|
});
|
|
|
|
window.addEventListener("resize", () => {
|
|
spineController.adjustCanvas();
|
|
});
|
|
|
|
window.wallpaperRegisterListener = {
|
|
applyGeneralProperties: function (properties) {
|
|
if (properties.fps) {
|
|
// wallpaperSettings.fps = properties.fps;
|
|
}
|
|
},
|
|
applyUserProperties: function (properties) {
|
|
if (properties.preset) {
|
|
const preset = properties.preset.value;
|
|
let { backgroundImage, spineConfig, audioOptions } =
|
|
presetController.set(preset);
|
|
backgroundController.changeImage(backgroundImage);
|
|
spineController.changeConfig(spineConfig);
|
|
audioController.changeOptions(audioOptions);
|
|
}
|
|
if (properties.audio_file) {
|
|
const audio_file = properties.audio_file.value;
|
|
currentAudioSource = audio_file;
|
|
audioController.changeSource(audio_file);
|
|
}
|
|
if (properties.audio_volume) {
|
|
const audio_volume = properties.audio_volume.value;
|
|
currentAudioVolume = audio_volume;
|
|
audioController.changeVolume(audio_volume);
|
|
}
|
|
},
|
|
};
|
|
|
|
window.wallpaperPropertyListener = {
|
|
applyGeneralProperties: function (properties) {
|
|
if (properties.fps) {
|
|
// wallpaperSettings.fps = properties.fps;
|
|
}
|
|
},
|
|
applyUserProperties: function (properties) {
|
|
if (properties.preset) {
|
|
const preset = properties.preset.value;
|
|
let { backgroundImage, spineConfig, audioOptions } = presetController.set(
|
|
preset,
|
|
currentAudioSource,
|
|
currentAudioVolume
|
|
);
|
|
backgroundController.changeImage(backgroundImage);
|
|
spineController.changeConfig(spineConfig);
|
|
audioController.changeOptions(audioOptions);
|
|
}
|
|
if (properties.audio_file) {
|
|
const audio_file = properties.audio_file.value;
|
|
currentAudioSource = audio_file;
|
|
audioController.changeSource(audio_file);
|
|
}
|
|
if (properties.audio_volume) {
|
|
const audio_volume = properties.audio_volume.value;
|
|
currentAudioVolume = audio_volume;
|
|
audioController.changeVolume(audio_volume);
|
|
}
|
|
},
|
|
};
|