103 lines
2.7 KiB
JavaScript
103 lines
2.7 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '4ed79XLXlhCAIFB/lychvbA', 'cmp.act.stepup.rank.item');
|
||
|
|
// Scripts/mod/acts/stepup/cmp/cmp.act.stepup.rank.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
||
|
|
*
|
||
|
|
* StepUp排行项
|
||
|
|
*
|
||
|
|
* 2018.05.18
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var SVCItem = require("nx.fx.sv.expand.item");
|
||
|
|
var ItemLayout = require("cmp.item.layout");
|
||
|
|
cc.Class({
|
||
|
|
"extends": SVCItem,
|
||
|
|
properties: {
|
||
|
|
nodRank: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodBP: {
|
||
|
|
"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) {
|
||
|
|
// 排行
|
||
|
|
var bg = "rank_26";
|
||
|
|
var img = "rank_12";
|
||
|
|
if (_data.idx < 4) {
|
||
|
|
nx.gui.setActive(this, "rank_" + _data.idx, true);
|
||
|
|
}
|
||
|
|
this.nodRank = nx.gui.find(this, "rank_4");
|
||
|
|
// switch( _data.idx ) {
|
||
|
|
// case 1: { } break;
|
||
|
|
// case 2: { nx.gui.setActive( this, "rank_" + _data.idx , true ); } break;
|
||
|
|
// case 3: { nx.gui.setActive( this, "rank_" + _data.idx , true ); } break;
|
||
|
|
// default: break;
|
||
|
|
// }
|
||
|
|
// bg = cc.path.join( "prefab/rank/ui", bg );
|
||
|
|
// img = cc.path.join( "prefab/rank/ui", img );
|
||
|
|
// nx.gui.setSpriteFrame( this.nodRank, "", bg );
|
||
|
|
// nx.gui.setSpriteFrame( this.nodRank, "img", img );
|
||
|
|
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 || "");
|
||
|
|
|
||
|
|
// BP
|
||
|
|
nx.gui.setString(this.nodBP, "", _data.val1 || "");
|
||
|
|
|
||
|
|
// 奖励
|
||
|
|
var rewards = [];
|
||
|
|
var DATA = game.configs.step_up_recruit_data.data_awards;
|
||
|
|
if (nx.dt.arrNEmpty(DATA)) {
|
||
|
|
var idx = _data.idx;
|
||
|
|
for (var i = 0; i < DATA.length; ++i) {
|
||
|
|
if (idx >= DATA[i].min && idx <= DATA[i].max) {
|
||
|
|
rewards = DATA[i].items;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
this.nodRewards.rebuild(rewards);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|