96 lines
2.3 KiB
JavaScript
96 lines
2.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '54a67itoG1MWo0kfj8ep5m/', 'cmp.act.elite.rank.item');
|
||
|
|
// Scripts/mod/acts/elite/cmps/cmp.act.elite.rank.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
||
|
|
*
|
||
|
|
* 精英召唤排行项
|
||
|
|
*
|
||
|
|
* 2018.05.18
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
var ItemLayout = require("cmp.item.layout");
|
||
|
|
var EliteRank = require("cmp.act.elite.rank.wnd");
|
||
|
|
cc.Class({
|
||
|
|
"extends": SVCItem,
|
||
|
|
properties: {
|
||
|
|
rankWnd: {
|
||
|
|
"default": null,
|
||
|
|
type: EliteRank
|
||
|
|
},
|
||
|
|
nodRank: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodTimes: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodAvatar: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodName: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodRewards: {
|
||
|
|
"default": null,
|
||
|
|
type: ItemLayout
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 数据重置
|
||
|
|
rebind: function rebind(_idx, _data, _key) {
|
||
|
|
this._super(_idx, _data, _key);
|
||
|
|
if (nx.dt.objEmpty(_data)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 设置
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
// 设置
|
||
|
|
setData: function setData(_data) {
|
||
|
|
// 排行
|
||
|
|
if (_data.idx < 4) {
|
||
|
|
nx.gui.setActive(this, "rank_" + _data.idx, true);
|
||
|
|
}
|
||
|
|
this.nodRank = nx.gui.find(this, "rank_4");
|
||
|
|
nx.gui.setString(this.nodRank, "txt", _data.idx > 3 ? _data.idx : "");
|
||
|
|
nx.gui.setActive(this.nodRank, "", _data.idx >= 4);
|
||
|
|
|
||
|
|
// 头像
|
||
|
|
if (nx.dt.numPositive(_data.face_id, false)) {
|
||
|
|
this.nodAvatar.active = true;
|
||
|
|
nx.bridge.setAvatarByFaceId(this.nodAvatar, "mask/img", _data.face_id);
|
||
|
|
} else {
|
||
|
|
this.nodAvatar.active = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 名字
|
||
|
|
nx.gui.setString(this.nodName, "", _data.name || "");
|
||
|
|
|
||
|
|
// 次数
|
||
|
|
nx.gui.setString(this.nodTimes, "", _data.val1 || "");
|
||
|
|
|
||
|
|
// 奖励
|
||
|
|
var rewards = [];
|
||
|
|
var list = this.rankWnd ? this.rankWnd.getRewards() : [];
|
||
|
|
if (nx.dt.arrNEmpty(list)) {
|
||
|
|
var idx = _data.idx;
|
||
|
|
for (var i = 0; i < list.length; ++i) {
|
||
|
|
if (idx >= list[i].min && idx <= list[i].max) {
|
||
|
|
rewards = list[i].items;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
this.nodRewards.rebuild(rewards);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|