refactor: 资源按 游戏/壁纸 分层,预设拆进各自壁纸目录
- assets/<游戏>/<壁纸>/{effects,images,audios}/,每档壁纸自包含
- 每档壁纸自带 preset.js:用 import.meta.url 推导自身资源路径,目录可整体搬走;
目录名用显示名(含「」),代码键用稳定 id(xilian/kv37,与 WE 属性值绑定)
- preset-store.js -> presets.js:静态 import 两份预设并建 id 索引
- 新增 CONTEXT.md 术语表与 ADR-0001/0002
- 新增 check-paths / compare / heatmap 三个验证工具;serve.mjs 改为每帧强制动画相位归零
验证:check-paths 11/11 路径存在(含此前零引用的 昔涟.flac);浏览器 0 个真实 404;
与基线 worktree 同冻结设置对拍,9 对跨版本比较中 4 对逐像素完全相同(差异 0),
其余 ≤0.19/255,远低于基线自身的双模态抖动(2.27/255)。
This commit is contained in:
1 parent
399f99edd7
commit
09ff322fe8
29 files changed
+388
-127
No files matched your search
Vendored
+87
-87
@@ -1,87 +1,87 @@
|
||||
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);
|
||||
}
|
||||
},
|
||||
};
|
||||
import Presets from "./presets.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(Presets);
|
||||
|
||||
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);
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user