72 lines
1.6 KiB
JavaScript
72 lines
1.6 KiB
JavaScript
|
class GameRes {
|
||
|
constructor() {
|
||
|
this.reslist = {};
|
||
|
this.mapResList = {};
|
||
|
this.roleResList = {};
|
||
|
this.petResList = {};
|
||
|
this.partnerResList = {};
|
||
|
this.roleHeadAtlas = null;
|
||
|
this.petHeadAtlas = null;
|
||
|
this.huobanHeadAtlas = null;
|
||
|
this.emojiAtlas = null;
|
||
|
this.itemIconAtlas = null;
|
||
|
this.skillIconAtlas = null;
|
||
|
this.buffIconAtlas = null;
|
||
|
|
||
|
this.m_mapEffectRes = {};
|
||
|
|
||
|
this.m_mapPrefab = {};
|
||
|
this.m_ChatEmojiAtlas = null;
|
||
|
}
|
||
|
|
||
|
setMapRes(mapid, sRes) {
|
||
|
this.mapResList[mapid] = sRes;
|
||
|
}
|
||
|
|
||
|
setRoleRes(resid, sRes) {
|
||
|
this.roleResList[resid] = sRes;
|
||
|
}
|
||
|
|
||
|
getRoleRes(resid) {
|
||
|
return this.roleResList[resid];
|
||
|
}
|
||
|
|
||
|
setPetAtlas(resid, atlas) {
|
||
|
this.petResList[resid] = atlas;
|
||
|
}
|
||
|
|
||
|
getPetRes(resid) {
|
||
|
return this.petResList[resid];
|
||
|
}
|
||
|
|
||
|
setPartnerAtlas(resid, atlas) {
|
||
|
this.partnerResList[resid] = atlas;
|
||
|
}
|
||
|
|
||
|
getPartnerRes(resid) {
|
||
|
return this.partnerResList[resid];
|
||
|
}
|
||
|
|
||
|
GetClipFromAtlas(strAtlas) {
|
||
|
let vecFrame = [];
|
||
|
|
||
|
for (let i = 1;; i++) {
|
||
|
let stFrame = this.m_mapEffectRes[strAtlas].getSpriteFrame(i);
|
||
|
if (null == stFrame)
|
||
|
break;
|
||
|
|
||
|
vecFrame.push(stFrame);
|
||
|
}
|
||
|
|
||
|
let curClip = cc.AnimationClip.createWithSpriteFrames(vecFrame, 15);
|
||
|
return curClip;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let gameres = null;
|
||
|
module.exports = (() => {
|
||
|
if (gameres == null) {
|
||
|
gameres = new GameRes();
|
||
|
}
|
||
|
return gameres;
|
||
|
})();
|