Files
fc/dev/project/library/imports/a1/a1aa66e8-22d5-42f3-817c-3215ea1c67bb.js
2026-05-24 10:21:26 +08:00

103 lines
2.9 KiB
JavaScript

"use strict";
cc._RF.push(module, 'a1aa6boItVC84F8MhXqHGe7', 'battle_role_pool');
// Scripts/mod/battle/act/battle_role_pool.js
"use strict";
// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
// 战斗中需要的对象的对象池,区分真假战斗
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var BridgeClass = require("bridge.class");
var BattleRolePool = cc.Class({
"extends": BridgeClass,
statics: {
instance: null
},
initConfig: function initConfig() {
// this.realPools = new cc.NodePool(); // 战斗对象的预制体缓存对象池
// this.effectPools = new cc.NodePool(); // 战斗特效缓存对象池
this.fontPools = new cc.NodePool(); // 战斗中的程序字缓存,主要是被动或者buff播报
// this.buffpools = new cc.NodePool(); // 战斗中的buff图标缓存
this.dmgPoolsList = {}; // 战斗中伤害具体区分的对象池
},
// 返回这个对象池
// getRealPools:function(){
// return this.realPools;
// },
// // 战斗对象丢到对象池中
// pushBackRole:function(role){
// this.realPools.put(role);
// },
// // 获取特效对象池
// getEffectPools:function(){
// return this.effectPools;
// },
// // 回收特效对象池
// pushBackEffect:function(effect){
// this.effectPools.put(effect);
// },
// 返回文字对象
getFontPools: function getFontPools() {
return this.fontPools;
},
// 回收文字对象
pushBackFont: function pushBackFont(font) {
this.fontPools.put(font);
},
// bufficon对象
// getBuffPools:function(){
// return this.buffpools;
// },
// // 回收buff对象
// pushBackBuffPools:function(buff){
// this.buffpools.put(buff);
// },
// 战斗治疗和伤害数字节点对象池
getDmgPools: function getDmgPools(type) {
var pool = this.dmgPoolsList[type];
if (pool == null) {
pool = new cc.NodePool();
this.dmgPoolsList[type] = pool;
}
return pool;
},
// 回收伤害数字
pushBackDmgPools: function pushBackDmgPools(type, dmg) {
var pool = this.dmgPoolsList[type];
if (pool == null) {
pool = new cc.NodePool();
this.dmgPoolsList[type] = pool;
}
pool.put(dmg);
},
clearCachePool: function clearCachePool() {
// this.realPools.clear();
// this.effectPools.clear();
// this.fontPools.clear();
// this.buffpools.clear();
for (var i in this.dmgPoolsList) {
this.dmgPoolsList[i].clear();
}
}
});
BattleRolePool.getInstance = function () {
if (!BattleRolePool.instance) {
BattleRolePool.instance = new BattleRolePool();
BattleRolePool.instance.initConfig();
}
return BattleRolePool.instance;
};
module.exports = BattleRolePool;
cc._RF.pop();