From 6a70293f5173c5ad6ddba9fdd55c83558e82aeda Mon Sep 17 00:00:00 2001 From: kis <2330029579@qq.com> Date: Sat, 30 Dec 2023 22:29:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=88=87=E6=8D=A2=E5=90=8E?= =?UTF-8?q?=E7=9A=84=20=E6=A8=A1=E5=9E=8B/=E8=A1=A3=E6=9C=8D=20=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在使用默认CDN的情况下,切换模型或者衣服的时候,修改modelTexturesId。 --- src/model.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/model.js b/src/model.js index 23b036a..216eae1 100644 --- a/src/model.js +++ b/src/model.js @@ -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 {