"use strict"; cc._RF.push(module, '90444utGNxKT4sJcPlAAOUJ', 'cmp.act.stepup.rank.wnd'); // Scripts/mod/acts/stepup/cmp/cmp.act.stepup.rank.wnd.js "use strict"; /****************************************************************** * * STEPUP 排行榜界面 * ******************************************************************/ var BridgeWindow = require("bridge.window"); var CmpRank = require("cmp.act.stepup.rank"); var STModel = require("act.stepup.mod"); cc.Class({ "extends": BridgeWindow, properties: { cmpRank: { "default": null, type: CmpRank } }, // 展示 onEnable: function onEnable() { var _this = this; nx.gui.setActive(this.nodEmpty, "", false); nx.gui.setActive(this.svcList, "", true); nx.gui.setActive(this.nodSelf, "", true); STModel.getInstance().reqRankList(function (_ret, _data) { if (!_ret) { _this.setEmpty(); return; } _this.freshRank(_data); }); }, // 置空 setEmpty: function setEmpty() { // 制作演示数据 var DATA = game.configs.step_up_recruit_data.data_awards; if (nx.dt.arrEmpty(DATA)) { nx.gui.setActive(this.nodEmpty, "", true); nx.gui.setActive(this.svcList, "", false); nx.gui.setActive(this.nodSelf, "", false); return; } var args = []; var push = function push(_idx) { var t = { idx: _idx, face_id: 0, rewards: [] }; for (var i = 0; i < DATA.length; ++i) { if (_idx >= DATA[i].min && _idx <= DATA[i].max) { t.rewards = DATA[i].items; break; } } args.push(t); }; for (var i = 1; i <= 10; ++i) { push(i); } this.cmpRank.freshRank({ my_idx: 0, fact_id: 0, rank_list: args, tip: "StepUpRankWait" }); }, // 刷新排行榜 freshRank: function freshRank(_data) { if (nx.dt.objEmpty(_data) || nx.dt.arrEmpty(_data.rank_list)) { this.setEmpty(); return; } this.cmpRank.freshRank(_data); } }); cc._RF.pop();