148 lines
3.7 KiB
JavaScript
148 lines
3.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '8ebafzkkQtDqpcPHCUdNNRg', 'cmp.pvprank.reward.wnd');
|
|
// Scripts/mod/pvp/rank/cmp/cmp.pvprank.reward.wnd.js
|
|
|
|
"use strict";
|
|
|
|
var BridgeWindow = require("bridge.window");
|
|
var ArenaEvent = require("arena_event");
|
|
var FxSVC = require("nx.fx.sv.expand");
|
|
var ArenaController = require("arena_controller");
|
|
var FxTogs = require("nx.fx.togs");
|
|
var RoleEvent = require("role_event");
|
|
var LadderEvent = require("ladder_event");
|
|
var RoleController = require("role_controller");
|
|
var defaultList = 3;
|
|
|
|
// 标签页对应关系
|
|
var TabPage = [{
|
|
key: "RankNow",
|
|
"goto": 0
|
|
}, {
|
|
key: "DailyAwards" || "RankAwards",
|
|
"goto": 1
|
|
}, {
|
|
key: "SeasonAwards",
|
|
"goto": 2
|
|
}];
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {
|
|
nodOps: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
nodToggle: {
|
|
"default": null,
|
|
type: FxTogs
|
|
},
|
|
nodLst: {
|
|
"default": null,
|
|
type: FxSVC
|
|
},
|
|
fabItemFirst: {
|
|
"default": null,
|
|
type: cc.Prefab
|
|
}
|
|
},
|
|
onLoad: function onLoad() {
|
|
// Tog监听
|
|
this.nodToggle.posTog = this.onTogMenu.bind(this);
|
|
this.loadPrefab();
|
|
},
|
|
loadPrefab: function loadPrefab() {
|
|
if (nx.gui.find(this, "templates").children.length == 0) {
|
|
var itemfnod = cc.instantiate(this.fabItemFirst);
|
|
itemfnod.parent = nx.gui.find(this, "templates");
|
|
}
|
|
},
|
|
onOpenConfigs: function onOpenConfigs(_params) {
|
|
this.dfg = _params.dfg;
|
|
this.sfg = _params.sfg;
|
|
this.cb = _params.cb;
|
|
this.show = _params.show;
|
|
var ops = _params.ops;
|
|
var chd = this.nodOps.children;
|
|
this.defaultDesc = _params.desc;
|
|
var len = _params.len ? _params.len : defaultList;
|
|
nx.gui.gocChildren(this.nodOps, "", len);
|
|
var tcmp = nx.gui.getComponent(this.nodOps, "", "nx.fx.togs");
|
|
if (tcmp) {
|
|
// 重建标签结构
|
|
tcmp.rebuildTogs();
|
|
|
|
// 标签显示切换
|
|
tcmp._freshTogShow();
|
|
}
|
|
var _goto = 0;
|
|
for (var i = 0; i < chd.length; i++) {
|
|
var op = ops[i];
|
|
if (!op || nx.dt.strEmpty(op)) {
|
|
nx.gui.setActive(chd[i], "", false);
|
|
continue;
|
|
}
|
|
if (this.show == op) {
|
|
_goto = i;
|
|
}
|
|
nx.gui.setActive(chd[i], "", true);
|
|
nx.gui.setString(chd[i], "on/txt", nx.text.getKey(op));
|
|
nx.gui.setString(chd[i], "off/txt", nx.text.getKey(op));
|
|
}
|
|
|
|
// TabPage.forEach( _tab => {
|
|
// if( this.show == _tab.key ){
|
|
// goto = _tab.goto;
|
|
// }
|
|
// } )
|
|
|
|
this.nodToggle.togTo(_goto);
|
|
this.activeMenu(_goto + 1);
|
|
// this.freshData();
|
|
},
|
|
|
|
// 激活菜单
|
|
activeMenu: function activeMenu(_bagCode) {
|
|
// console.log( "背包切换:", _bagCode );
|
|
if (this.curType == _bagCode) {
|
|
return;
|
|
}
|
|
this.curType = _bagCode;
|
|
if (_bagCode == 1) {}
|
|
if (_bagCode == 2) {}
|
|
if (_bagCode == 3) {}
|
|
if (_bagCode == 4) {
|
|
var T = nx.gui.find(this.node, "templates/faward");
|
|
// widget.bottom = 20.70;
|
|
// widget.updateAlignment();
|
|
this.nodLst.tmpItem = T;
|
|
this.freshData(this.dfg);
|
|
}
|
|
if (_bagCode == 5) {
|
|
var _T = nx.gui.find(this.node, "templates/faward");
|
|
// widget.bottom = 20.70;
|
|
// widget.updateAlignment();
|
|
this.nodLst.tmpItem = _T;
|
|
this.freshData(this.sfg);
|
|
}
|
|
},
|
|
// 切换
|
|
onTogMenu: function onTogMenu(_index) {
|
|
this.activeMenu(parseInt(_index) + 1);
|
|
},
|
|
freshData: function freshData(_data) {
|
|
nx.gui.setActive(this.nodLst, "empty", nx.dt.arrEmpty(_data));
|
|
this.nodLst.rebuild(_data);
|
|
},
|
|
// 重载:关闭前
|
|
onPreClosed: function onPreClosed() {
|
|
var tnod = nx.gui.find(this, "templates");
|
|
for (var i = 0; i < tnod.children.length; i++) {
|
|
var ttnod = tnod.children[i];
|
|
if (ttnod) {
|
|
ttnod.destroy();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |