74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
|
|
const 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( _idx, _data, _key ) {
|
||
|
|
|
||
|
|
this._super( _idx, _data, _key );
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData(_data)
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// update (dt) {},
|
||
|
|
setData(data){
|
||
|
|
if(nx.dt.objEmpty(data)){
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
var self = this
|
||
|
|
self.data = data || {}
|
||
|
|
// -- 图标
|
||
|
|
let buff_path = PathTool.queryIconPath(data.res_id)
|
||
|
|
if(buff_path){
|
||
|
|
nx.gui.setSpriteFrame(self.buff_icon,"",buff_path);
|
||
|
|
}
|
||
|
|
|
||
|
|
// -- 名称
|
||
|
|
let 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
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
});
|