47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '1e44aWErZBDKLK2gb2JPdvI', 'cmp.guildbat.item.rank');
|
||
|
|
// Scripts/mod/guild/guildbat/cmp/cmp.guildbat.item.rank.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("nx.fx.sv.expand.item");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
tagHead: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
fabHead: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Prefab
|
||
|
|
}
|
||
|
|
},
|
||
|
|
rebind: function rebind(_index, _data, _key) {
|
||
|
|
this._super(_index, _data, _key);
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
setData: function setData(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var selfhead = cc.instantiate(this.fabHead);
|
||
|
|
selfhead.parent = this.tagHead;
|
||
|
|
var cmp = nx.gui.getComponent(selfhead, "", "cmp.common.header");
|
||
|
|
if (cmp) {
|
||
|
|
cmp.setData(data);
|
||
|
|
}
|
||
|
|
nx.gui.setString(this.node, "name", data.name);
|
||
|
|
nx.gui.setString(this.node, "stars", data.star);
|
||
|
|
nx.gui.setString(this.node, "achi", data.war_score);
|
||
|
|
if (data.rank < 4) {
|
||
|
|
nx.gui.setActive(this.node, String(data.rank), true);
|
||
|
|
} else {
|
||
|
|
var nod = nx.gui.find(this.node, "4");
|
||
|
|
nx.gui.setActive(nod, "", true);
|
||
|
|
nx.gui.setString(nod, "num", data.rank);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|