98 lines
2.4 KiB
JavaScript
98 lines
2.4 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '5fc92xzzhJMDJwBN7QQvmy3', 'cmp.act.stepup.rank');
|
|
// Scripts/mod/acts/stepup/cmp/cmp.act.stepup.rank.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
|
*
|
|
* STEP-UP 排行页
|
|
*
|
|
******************************************************************/
|
|
|
|
var BridgeComponent = require("bridge.component");
|
|
var FxSVC = require("nx.fx.sv.expand");
|
|
var STModel = require("act.stepup.mod");
|
|
var TDefine = require("trace.define");
|
|
var TTT = TDefine.TraceType;
|
|
cc.Class({
|
|
"extends": BridgeComponent,
|
|
properties: {
|
|
autoReq: {
|
|
"default": true
|
|
},
|
|
svcList: {
|
|
"default": null,
|
|
type: FxSVC
|
|
},
|
|
nodSelf: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodEmpty: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 显示
|
|
onEnable: function onEnable() {
|
|
var _this = this;
|
|
if (!this.autoReq) {
|
|
return;
|
|
}
|
|
STModel.getInstance().reqRankList(function (_ret, _data) {
|
|
if (!_ret) {
|
|
nx.tbox(_data);
|
|
_this.setEmpty();
|
|
return;
|
|
}
|
|
_this.freshRank(_data);
|
|
});
|
|
|
|
// 埋点
|
|
if (nx.mTrace) {
|
|
nx.mTrace.trace(TTT.actCampOpened, STModel.getInstance().data.camp_id, 1);
|
|
}
|
|
},
|
|
// 关闭
|
|
onDisable: function onDisable() {},
|
|
// 置空
|
|
setEmpty: function setEmpty() {
|
|
nx.gui.setActive(this.svcList, "", false);
|
|
nx.gui.setActive(this.nodSelf, "", false);
|
|
nx.gui.setActive(this.nodEmpty, "", true);
|
|
},
|
|
// 刷新排行榜
|
|
freshRank: function freshRank(_data) {
|
|
if (nx.dt.objEmpty(_data) || nx.dt.arrEmpty(_data.rank_list)) {
|
|
this.setEmpty();
|
|
return;
|
|
}
|
|
nx.gui.setActive(this.nodEmpty, "", false);
|
|
|
|
// 列表
|
|
nx.gui.setActive(this.svcList, "", true);
|
|
this.svcList.rebuild(_data.rank_list);
|
|
var node = nx.gui.setActive(this.nodSelf, "", true);
|
|
if (_data.my_idx == 0) {
|
|
nx.gui.setActive(node, "empty", true);
|
|
nx.gui.setActive(node, "normal", false);
|
|
nx.gui.setString(node, "empty/tip", nx.text.getKey(_data.tip || "StepUpNoRank"));
|
|
return;
|
|
}
|
|
nx.gui.setActive(node, "empty", false);
|
|
nx.gui.setActive(node, "normal", true);
|
|
var cmp = nx.gui.getComponent(node, "normal", "cmp.act.stepup.rank.item");
|
|
if (cmp) {
|
|
cmp.setData({
|
|
idx: _data.my_idx,
|
|
face_id: _data.face_id,
|
|
name: _data.name,
|
|
val1: _data.my_val1
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |