Files
fc/dev/project/library/imports/0e/0e181818-7037-4f3f-a629-10a2fe589b18.js
2026-05-24 10:21:26 +08:00

85 lines
2.5 KiB
JavaScript

"use strict";
cc._RF.push(module, '0e181gYcDdPP6YpEKL+WJsY', 'cmp.battle.bufflist');
// Scripts/mod/battle/cmp/cmp.battle.bufflist.js
"use strict";
var BattleController = require("battle_controller");
var BattleEvent = require("battle_event");
var BridgeWindow = require("bridge.window");
var FxSVC = require("nx.fx.sv.expand");
cc.Class({
"extends": BridgeWindow,
properties: {
list_panel: {
"default": null,
type: FxSVC
}
},
// LIFE-CYCLE CALLBACKS:
onLoad: function onLoad() {
this.ctrl = BattleController.getInstance();
this.model = this.ctrl.getModel();
},
start: function start() {},
// 重载:关闭前
onPreClosed: function onPreClosed() {
this.list_panel.rebuild([]);
},
onOpenConfigs: function onOpenConfigs(params) {
this.group = params.group;
this.partner_bid = params.partner_bid;
this.setData(params.data);
},
setData: function setData(data) {
this.data = data || [];
var temp_data = {};
for (var i = 0; i < this.data.length; ++i) {
var b_info = this.data[i];
for (var j = 0; j < b_info.buff_infos.length; ++j) {
var v = b_info.buff_infos[j];
var buff_id = v.buff_id;
var remain_round = v.remain_round || b_info.remain_round;
var buff_config = gskilldata('data_get_buff', buff_id); //game.configs.skill_data.data_get_buff[buff_id]
if (buff_config) {
if (temp_data[buff_id] == null) {
temp_data[buff_id] = {
res_id: b_info.res_id,
num: 0,
name: buff_config.name,
remain_round: remain_round,
desc: buff_config.desc,
buff_id: buff_id
};
}
temp_data[buff_id].num = temp_data[buff_id].num + 1;
}
}
}
var buff_data = [];
for (var k in temp_data) {
var _v = nx.dt.objClone(temp_data[k]);
buff_data.push(_v);
}
buff_data.sort(function (a, b) {
if (a.res_id == b.res_id) {
return a.buff_id - b.buff_id;
} else {
return a.res_id - b.res_id;
}
});
for (var _i = 0; _i < buff_data.length; ++_i) {
buff_data[_i].index = _i;
}
this.list_panel.rebuild(buff_data);
},
// -- 用于每回合更新数据时检测是否为选中的英雄buff列表
checkIsChosedBuffList: function checkIsChosedBuffList(group, partner_bid) {
if (this.group == group && this.partner_bid == partner_bid) {
return true;
}
return false;
} // update (dt) {},
});
cc._RF.pop();