81 lines
2.1 KiB
JavaScript
81 lines
2.1 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '80d9bp+vC9AG4UffCp0W09U', 'cmp.holy.eqm.item');
|
|
// Scripts/mod/pray/cmp/cmp.holy.eqm.item.js
|
|
|
|
"use strict";
|
|
|
|
var ItemBase = require("cmp.item.base");
|
|
cc.Class({
|
|
"extends": ItemBase,
|
|
properties: {
|
|
nodAdd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
canDele: false
|
|
},
|
|
// 重载:刷新
|
|
rebind: function rebind(_idx, _data, _key) {
|
|
this.mdata = _data;
|
|
this.index = _idx;
|
|
if (!this.mdata || nx.dt.objEmpty(this.mdata)) {
|
|
this.setEmpty();
|
|
return;
|
|
}
|
|
this.focus = false;
|
|
// 等级刷新
|
|
var txt = nx.text.getKey(this.mdata.name);
|
|
if (this.lenName > 0) {
|
|
txt = nx.dt.strCut(txt, this.lenName);
|
|
}
|
|
this.nodName.string = txt;
|
|
var qa = null;
|
|
if (nx.dt.numPositive(this.mdata.quality)) {
|
|
qa = cc.path.join("coms/images", "bg_qa" + this.mdata.quality);
|
|
}
|
|
var set = parseInt(this.mdata.group_id / 100);
|
|
var path = cc.path.join("coms/images/eqm_set" + set);
|
|
nx.gui.setSpriteFrame(this.imgLT, "", path);
|
|
nx.gui.setSpriteFrame(this.nodBG, "", qa);
|
|
nx.bridge.setIcon(this.nodIcon, "", this.mdata.icon);
|
|
if (this.nodAdd) {
|
|
nx.gui.setActive(this.nodAdd, "", !this.mdata.icon);
|
|
}
|
|
if (this.canDele) {
|
|
if (this.mdata.inTeam != 0) {
|
|
this.setFocus();
|
|
} else {
|
|
this.outFocus();
|
|
}
|
|
}
|
|
if (this.index == 0) {
|
|
var cmp = nx.gui.getComponent(this, "", "cmp.plot.trigger");
|
|
if (cmp) {
|
|
cmp.pID = "holy_select";
|
|
cmp.regist();
|
|
}
|
|
}
|
|
// this.outFocus();
|
|
},
|
|
|
|
setEmpty: function setEmpty() {
|
|
this.nodName.string = "";
|
|
nx.gui.setSpriteFrame(this.nodBG, "", "prefab/pray/ui/png_pray_3");
|
|
nx.gui.setSpriteFrame(this.nodIcon, "", "");
|
|
nx.gui.setSpriteFrame(this.imgLT, "", "");
|
|
if (this.canDele) {
|
|
this.outFocus();
|
|
}
|
|
nx.gui.setActive(this.nodAdd, "", true);
|
|
},
|
|
setFocus: function setFocus() {
|
|
this.focus = true;
|
|
nx.gui.setActive(this.nodFocus.node, "", true);
|
|
},
|
|
outFocus: function outFocus() {
|
|
this.focus = false;
|
|
nx.gui.setActive(this.nodFocus.node, "", false);
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |