59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '39b52r9Yg9ESaRi3vHOncBp', 'battle_role_mgr');
|
||
|
|
// Scripts/mod/battle/act/battle_role_mgr.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var BatRoleMgr = cc.Class({
|
||
|
|
properties: {},
|
||
|
|
initConfig: function initConfig() {
|
||
|
|
this.role_path = "prefab/battle/battle_real_role";
|
||
|
|
this.role_res_assets = {};
|
||
|
|
},
|
||
|
|
loadFab: function loadFab() {
|
||
|
|
var _this = this;
|
||
|
|
nx.res.loadPrefab(this.role_path, function (_err, _fab) {
|
||
|
|
// 载入错误
|
||
|
|
if (_err) {
|
||
|
|
console.log("effect模型节点加载失败");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
_this.fabRole = _fab;
|
||
|
|
});
|
||
|
|
},
|
||
|
|
createRole: function createRole(parent, battle_role_data, play_enter, talk_back, is_real, finish_cb) {
|
||
|
|
if (!this.fabRole) return;
|
||
|
|
var node = cc.instantiate(this.fabRole);
|
||
|
|
var cmp = nx.gui.getComponent(node, "", "new_battle_role");
|
||
|
|
if (cmp) {
|
||
|
|
cmp.init();
|
||
|
|
cmp.createRole(parent, battle_role_data, play_enter, talk_back, is_real, finish_cb);
|
||
|
|
return cmp;
|
||
|
|
} else {
|
||
|
|
console.log("角色组件获取失败");
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setResAssets: function setResAssets(res_path, _ref) {
|
||
|
|
// let res = this.role_res_assets[res_path];
|
||
|
|
// if(res)return;
|
||
|
|
// console.log("===========>sd",res_path,_ref);
|
||
|
|
// this.role_res_assets[res_path] = _ref;
|
||
|
|
},
|
||
|
|
releaseResAssets: function releaseResAssets() {
|
||
|
|
// console.log("============>",this.role_res_assets);
|
||
|
|
// for(let i in this.role_res_assets){
|
||
|
|
// if(this.role_res_assets[i] == 0){
|
||
|
|
// cc.loader.releaseRes(i,sp.SkeletonData);
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// this.role_res_assets = {};
|
||
|
|
},
|
||
|
|
reset: function reset() {
|
||
|
|
if (this.fabRole && this.fabRole.destroy) {
|
||
|
|
this.fabRole.destroy();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
module.exports = BatRoleMgr;
|
||
|
|
|
||
|
|
cc._RF.pop();
|