修复被回滚的内容
This commit is contained in:
parent
2b2e8885dc
commit
e5e57f59ee
35
game/game.js
35
game/game.js
|
@ -8656,36 +8656,33 @@
|
|||
else src=`image/${type}/${subfolder}/${name}${ext}`;
|
||||
}
|
||||
else src=`image/${name}${ext}`;
|
||||
new Promise((resolve,reject)=>{
|
||||
const image=new Image();
|
||||
image.src=`${lib.assetURL}${src}`;
|
||||
image.onload=resolve;
|
||||
if(type=='character') image.onerror=reject;
|
||||
}).then(()=>{
|
||||
this.setBackgroundImage(src);
|
||||
this.style.backgroundPositionX='center';
|
||||
this.style.backgroundSize='cover';
|
||||
}).catch(()=>new Promise((resolve,reject)=>{
|
||||
if(type=='character'){
|
||||
new Promise((_,reject)=>{
|
||||
const image=new Image();
|
||||
image.src=`${lib.assetURL}${src}`;
|
||||
image.onerror=reject;
|
||||
}).catch(()=>new Promise((_,reject)=>{
|
||||
const nameinfo=get.character(name);
|
||||
if(!nameinfo) reject('noinfo');
|
||||
const sex=nameinfo[0];
|
||||
src=`image/character/default_silhouette_${sex}${ext}`;
|
||||
const image=new Image();
|
||||
image.src=`${lib.assetURL}${src}`;
|
||||
image.onload=()=>resolve(src);
|
||||
image.onerror=reject;
|
||||
}).catch(()=>new Promise((resolve,reject)=>{
|
||||
const nameinfo=get.character(name);
|
||||
const sex=nameinfo[0];
|
||||
image.onload=()=>this.setBackgroundImage(src);
|
||||
image.onerror=()=>reject(`sex:${sex}`);
|
||||
})).catch(reason=>{
|
||||
let sex;
|
||||
if(reason=='noinfo') sex='male';
|
||||
else sex=reason.slice(4);
|
||||
src=`image/character/default_silhouette_${sex=='female'?'female':'male'}${ext}`;
|
||||
const image=new Image();
|
||||
image.src=`${lib.assetURL}${src}`;
|
||||
image.onload=()=>resolve(src);
|
||||
image.onerror=reject;
|
||||
})).then((src)=>{
|
||||
this.setBackgroundImage(src);
|
||||
this.style.backgroundPositionX='center';
|
||||
this.style.backgroundSize='cover';
|
||||
}));
|
||||
image.onload=()=>this.setBackgroundImage(src);
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue