保存切换后的 模型/衣服 信息

在使用默认CDN的情况下,切换模型或者衣服的时候,修改modelTexturesId。
This commit is contained in:
kis 2023-12-30 22:29:30 +08:00
parent 1ac32abfd6
commit 6a70293f51

View File

@ -29,7 +29,11 @@ class Model {
showMessage(message, 4000, 10);
if (this.useCDN) {
if (!this.modelList) await this.loadModelList();
const target = randomSelection(this.modelList.models[modelId]);
let target = modelTexturesId;
if (typeof modelTexturesId === 'number') {
target = randomSelection(this.modelList.models[modelId]);
localStorage.setItem("modelTexturesId", target);
}
loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
} else {
loadlive2d("live2d", `${this.apiPath}get/?id=${modelId}-${modelTexturesId}`);
@ -43,6 +47,7 @@ class Model {
if (this.useCDN) {
if (!this.modelList) await this.loadModelList();
const target = randomSelection(this.modelList.models[modelId]);
localStorage.setItem("modelTexturesId", modelTexturesId);
loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
showMessage("我的新衣服好看嘛?", 4000, 10);
} else {