169 lines
4.1 KiB
JavaScript
169 lines
4.1 KiB
JavaScript
|
|
const BridgeWindow = require("bridge.window");
|
||
|
|
const ArenaEvent = require("arena_event");
|
||
|
|
const FxSVC = require("nx.fx.sv.expand");
|
||
|
|
const ArenaController = require( "arena_controller" );
|
||
|
|
const FxTogs = require( "nx.fx.togs" );
|
||
|
|
const RoleEvent = require( "role_event" );
|
||
|
|
const LadderEvent = require( "ladder_event" );
|
||
|
|
const RoleController = require("role_controller");
|
||
|
|
const defaultList = 3;
|
||
|
|
|
||
|
|
// 标签页对应关系
|
||
|
|
const 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 () {
|
||
|
|
|
||
|
|
// Tog监听
|
||
|
|
this.nodToggle.posTog = this.onTogMenu.bind( this );
|
||
|
|
this.loadPrefab();
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
loadPrefab : function(){
|
||
|
|
if( nx.gui.find( this, "templates" ).children.length == 0 ){
|
||
|
|
let itemfnod = cc.instantiate( this.fabItemFirst );
|
||
|
|
itemfnod.parent = nx.gui.find( this, "templates" );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onOpenConfigs( _params ) {
|
||
|
|
|
||
|
|
this.dfg = _params.dfg;
|
||
|
|
this.sfg = _params.sfg;
|
||
|
|
this.cb = _params.cb;
|
||
|
|
this.show = _params.show;
|
||
|
|
let ops = _params.ops;
|
||
|
|
let chd = this.nodOps.children;
|
||
|
|
this.defaultDesc = _params.desc;
|
||
|
|
|
||
|
|
let len = _params.len ? _params.len : defaultList;
|
||
|
|
nx.gui.gocChildren( this.nodOps, "", len );
|
||
|
|
|
||
|
|
let tcmp = nx.gui.getComponent( this.nodOps, "", "nx.fx.togs" );
|
||
|
|
if( tcmp ){
|
||
|
|
// 重建标签结构
|
||
|
|
tcmp.rebuildTogs();
|
||
|
|
|
||
|
|
// 标签显示切换
|
||
|
|
tcmp._freshTogShow();
|
||
|
|
}
|
||
|
|
let goto = 0;
|
||
|
|
for (let i = 0; i < chd.length; i++) {
|
||
|
|
let 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( _bagCode ) {
|
||
|
|
|
||
|
|
// console.log( "背包切换:", _bagCode );
|
||
|
|
if( this.curType == _bagCode ) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.curType = _bagCode;
|
||
|
|
if( _bagCode == 1 ){
|
||
|
|
|
||
|
|
}
|
||
|
|
if( _bagCode == 2 ){
|
||
|
|
|
||
|
|
}
|
||
|
|
if( _bagCode == 3 ){
|
||
|
|
|
||
|
|
}
|
||
|
|
if( _bagCode == 4 ){
|
||
|
|
let 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 ){
|
||
|
|
let T = nx.gui.find( this.node, "templates/faward" );
|
||
|
|
// widget.bottom = 20.70;
|
||
|
|
// widget.updateAlignment();
|
||
|
|
this.nodLst.tmpItem = T;
|
||
|
|
this.freshData( this.sfg );
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
// 切换
|
||
|
|
onTogMenu: function( _index ) {
|
||
|
|
this.activeMenu( parseInt( _index ) + 1 );
|
||
|
|
},
|
||
|
|
|
||
|
|
freshData: function( _data ){
|
||
|
|
|
||
|
|
nx.gui.setActive( this.nodLst, "empty", nx.dt.arrEmpty( _data ) );
|
||
|
|
this.nodLst.rebuild( _data );
|
||
|
|
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// 重载:关闭前
|
||
|
|
onPreClosed: function () {
|
||
|
|
|
||
|
|
let tnod = nx.gui.find( this, "templates" );
|
||
|
|
for (let i = 0; i < tnod.children.length; i++) {
|
||
|
|
let ttnod = tnod.children[i];
|
||
|
|
|
||
|
|
if( ttnod ){
|
||
|
|
ttnod.destroy();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
});
|