mirror of
https://github.com/stevenjoezhang/live2d-widget.git
synced 2024-11-22 12:39:59 +08:00
保存切换后的 模型/衣服 信息
在使用默认CDN的情况下,切换模型或者衣服的时候,修改modelTexturesId。
This commit is contained in:
parent
1ac32abfd6
commit
6a70293f51
@ -29,7 +29,11 @@ class Model {
|
|||||||
showMessage(message, 4000, 10);
|
showMessage(message, 4000, 10);
|
||||||
if (this.useCDN) {
|
if (this.useCDN) {
|
||||||
if (!this.modelList) await this.loadModelList();
|
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`);
|
loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
|
||||||
} else {
|
} else {
|
||||||
loadlive2d("live2d", `${this.apiPath}get/?id=${modelId}-${modelTexturesId}`);
|
loadlive2d("live2d", `${this.apiPath}get/?id=${modelId}-${modelTexturesId}`);
|
||||||
@ -43,6 +47,7 @@ class Model {
|
|||||||
if (this.useCDN) {
|
if (this.useCDN) {
|
||||||
if (!this.modelList) await this.loadModelList();
|
if (!this.modelList) await this.loadModelList();
|
||||||
const target = randomSelection(this.modelList.models[modelId]);
|
const target = randomSelection(this.modelList.models[modelId]);
|
||||||
|
localStorage.setItem("modelTexturesId", modelTexturesId);
|
||||||
loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
|
loadlive2d("live2d", `${this.cdnPath}model/${target}/index.json`);
|
||||||
showMessage("我的新衣服好看嘛?", 4000, 10);
|
showMessage("我的新衣服好看嘛?", 4000, 10);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user