74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '86277Z3RwJI9oVg0IZSDren', 'cmp.item.battle.buff');
|
|
// Scripts/mod/battle/cmp/cmp.item.battle.buff.js
|
|
|
|
"use strict";
|
|
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
|
cc.Class({
|
|
"extends": SVCItem,
|
|
properties: {
|
|
buff_icon: {
|
|
"default": null,
|
|
type: cc.Sprite
|
|
},
|
|
name_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
round_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
buff_desc_lb: {
|
|
"default": null,
|
|
type: cc.Label
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {},
|
|
// 数据重置
|
|
rebind: function rebind(_idx, _data, _key) {
|
|
this._super(_idx, _data, _key);
|
|
|
|
// 刷新
|
|
this.setData(_data);
|
|
},
|
|
// update (dt) {},
|
|
setData: function setData(data) {
|
|
if (nx.dt.objEmpty(data)) {
|
|
return;
|
|
}
|
|
var self = this;
|
|
self.data = data || {};
|
|
// -- 图标
|
|
var buff_path = PathTool.queryIconPath(data.res_id);
|
|
if (buff_path) {
|
|
nx.gui.setSpriteFrame(self.buff_icon, "", buff_path);
|
|
}
|
|
|
|
// -- 名称
|
|
var name_str = "[ " + (data.name || "") + " ]" + "*" + (data.num || 1);
|
|
self.name_label.string = name_str;
|
|
|
|
// -- 失效回合(大于30回合表示永久,则不显示)
|
|
if (!data.remain_round || data.remain_round > 30) {
|
|
self.round_label.node.active = false;
|
|
} else {
|
|
self.round_label.node.active = true;
|
|
self.round_label.string = cc.js.formatStr(nx.text.getKey("battle_str1"), data.remain_round);
|
|
}
|
|
|
|
// -- 描述
|
|
self.buff_desc_lb.string = data.desc || "";
|
|
|
|
// if(data.index){
|
|
// self.line.active = true
|
|
// }else{
|
|
// self.line.active = false
|
|
// }
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |