286 lines
9.2 KiB
JavaScript
286 lines
9.2 KiB
JavaScript
const MenuPage = require( "cmp.com.menu.page" );
|
|
const CrossChampionController = require("crosschampion_controller");
|
|
const ArenaEvent = require( "arena_event" );
|
|
const RoleController = require( "role_controller" );
|
|
const ArenaConst = require( "arena_const" );
|
|
|
|
|
|
cc.Class({
|
|
|
|
extends: MenuPage,
|
|
|
|
properties: {
|
|
|
|
nodPlst: { default: null, type: cc.Node, displayName: "晉級信息相關" },
|
|
nodGroup : { default: null, type: cc.Node, displayName: "組別信息" },
|
|
nodLooks : { default: null, type: cc.Node, displayName: "查看回放" },
|
|
nodFab: { default: null, type: cc.Prefab, displayName: "頭像顯示" },
|
|
nodRace: { default: null, type: cc.Node, displayName: "比賽相關數據" },
|
|
},
|
|
|
|
onLoad: function(){
|
|
|
|
let cct = CrossChampionController.getInstance();
|
|
let model = cct.getModel();
|
|
let race = model.getBaseInfo();
|
|
let info = race.step != ArenaConst.champion_step.match_8 ? ArenaConst.CrosschampionConstDefine : ArenaConst.CrosschampionEConstDefine ;
|
|
for (let i = 0; i < this.nodPlst.children.length; i++) {
|
|
let item = info[i];
|
|
let nod = this.nodPlst.children[i];
|
|
let nodPre = cc.instantiate( this.nodFab );
|
|
nodPre.parent = nod;
|
|
nodPre.position = cc.Vec2.ZERO;
|
|
|
|
if( item ){
|
|
let cmp = nx.gui.getComponent( nod, "matchInfo", "cmp.cchampion.match.item" );
|
|
if( cmp ){
|
|
cmp.setEmpty( item );
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nx.gui.setString( this, "sfbg/change/txt", nx.text.format( "Match64Desc", 8 ) );
|
|
nx.gui.setString( this, "sfbg/back/txt", nx.text.format( "Match64Desc", 64 ) );
|
|
nx.gui.setActive( this, "sfbg/change", false );
|
|
nx.gui.setActive( this, "sfbg/back", false );
|
|
nx.gui.setActive( this.nodRace, "", false );
|
|
},
|
|
|
|
onEnable: function() {
|
|
|
|
|
|
// 视图监听
|
|
this.vbind( [
|
|
[ "CChampion", this.freshMyRace.bind( this ) ]
|
|
] );
|
|
|
|
|
|
this.bindGEvent( ArenaEvent.UpdateTop32InfoEvent, this.freshMatch.bind( this ) );
|
|
this.bindGEvent( ArenaEvent.UpdateTop4InfoEvent,this.freshMatchE.bind( this ) );
|
|
this.bindGEvent( ArenaEvent.UpdateTop324GroupPosEvent, this.setRaceReplay.bind( this ) );
|
|
// this.nodMenus.posTog = this.onTogMenu.bind( this );
|
|
|
|
this.setEmpty();
|
|
|
|
},
|
|
|
|
// 隐藏
|
|
onDisable: function() {
|
|
|
|
// 视图监听解除
|
|
this.vunbind();
|
|
// 事件监听释放
|
|
this.unbindGEvents();
|
|
|
|
// nx.gui.setActive( this.nodEmpty, "", false );
|
|
// nx.gui.setActive( this.nodRace, "", false );
|
|
},
|
|
|
|
setEmpty: function(){
|
|
|
|
|
|
let cct = CrossChampionController.getInstance();
|
|
|
|
cct.sender26209();
|
|
if( this.race && this.race.step == ArenaConst.champion_step.match_8 ){
|
|
nx.gui.setActive( this, "sfbg/change", true );
|
|
nx.gui.setActive( this, "sfbg/back", false );
|
|
}
|
|
|
|
|
|
},
|
|
|
|
freshMyRace: function( _race ){
|
|
|
|
this.race = _race;
|
|
nx.gui.setActive( this, "sfbg/change", _race.step == ArenaConst.champion_step.match_8 );
|
|
|
|
},
|
|
|
|
freshMatch: function( _matchInfo ){
|
|
|
|
//
|
|
this.matchlist = _matchInfo;
|
|
this.group = 0;
|
|
this.dealShow();
|
|
|
|
let self = this;
|
|
let dealShow = function( _num ){
|
|
|
|
|
|
let chd = self.nodLooks.children;
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let nod = chd[i];
|
|
nx.gui.setActive( nod, "", i < _num );
|
|
|
|
}
|
|
}
|
|
|
|
if( this.race.step == ArenaConst.champion_step.match_8 ){
|
|
if( this.race.round == 1 ){
|
|
dealShow( parseInt( this.race.step / 2 ) );
|
|
}else if( this.race.round == 0 ){
|
|
dealShow( parseInt( this.race.step ) );
|
|
}
|
|
}
|
|
|
|
if( this.race.step == ArenaConst.champion_step.match_64 ){
|
|
if( this.race.round == 1 ){
|
|
dealShow( parseInt( this.race.step / 8 ) );
|
|
}else if( this.race.round == 2 ){
|
|
dealShow( parseInt( ( this.race.step / 4 ) - 2 ) );
|
|
}
|
|
else{
|
|
dealShow( parseInt( this.race.step / 4 ) );
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
|
|
freshMatchE: function( _matchInfo ){
|
|
|
|
//
|
|
this.matchlistE = _matchInfo;
|
|
this.dealShowE();
|
|
|
|
|
|
},
|
|
|
|
onTouchAdd: function(){
|
|
|
|
if( this.group == 0 || this.group < this.matchlist.length ){
|
|
this.group ++;
|
|
}
|
|
|
|
if( this.group >= this.matchlist.length ){
|
|
this.group = 0;
|
|
}
|
|
// console.log( "當前的數字顯示" + this.group );
|
|
this.dealShow();
|
|
},
|
|
|
|
onTouchDel: function(){
|
|
|
|
if( this.group == 0 ){
|
|
this.group = this.matchlist.length;
|
|
|
|
}
|
|
|
|
if( this.group > 0 || this.group <= this.matchlist.length ){
|
|
this.group --;
|
|
}
|
|
// console.log( "當前的數字顯示減" + this.group );
|
|
this.dealShow();
|
|
},
|
|
|
|
dealShow: function( ){
|
|
|
|
let desc = ArenaConst.getGroup( this.group + 1 );
|
|
// console.log( "當前的組別" + desc );
|
|
nx.gui.setString( this.nodGroup, "group", nx.text.format( "Group", desc ) );
|
|
let role = RoleController.getInstance().getRoleVo();
|
|
let chd = this.nodPlst.children;
|
|
let groupInfo = this.matchlist[this.group].pos_list;
|
|
groupInfo.sort( ( a,b ) =>{
|
|
return a.pos - b.pos;
|
|
} )
|
|
|
|
|
|
for (let i = 0; i < groupInfo.length; i++) {
|
|
let info = groupInfo[i];
|
|
let nod = chd[i];
|
|
if( info ){
|
|
|
|
let cmp = nx.gui.getComponent( nod, "matchInfo", "cmp.cchampion.match.item" );
|
|
|
|
if( cmp ){
|
|
cmp.setData( {
|
|
face : info.face,
|
|
avatar : 1000
|
|
} )
|
|
cmp.setInfo( info );
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
nx.gui.setActive( this.nodGroup, "", true );
|
|
|
|
},
|
|
|
|
dealShowE: function( ){
|
|
|
|
// {"pos_list":[{"pos":8,"rid":61,"srv_id":"","name":"代雲紫安","face":24100,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":7,"rid":15,"srv_id":"","name":"懷蝶幼蓉","face":26202,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":6,"rid":5,"srv_id":"","name":"傲芙含卉","face":26400,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":5,"rid":6,"srv_id":"","name":"從蓉曉綠","face":28408,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":4,"rid":28,"srv_id":"","name":"憐夢夜安","face":24202,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":3,"rid":21,"srv_id":"","name":"尋真淩瑤","face":24201,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":2,"rid":38,"srv_id":"","name":"書蕾之山","face":26204,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""},{"pos":1,"rid":11,"srv_id":"","name":"訪蕊雅陽","face":28403,"ret":0,"replay_id":0,"face_update_time":0,"face_file":""}]}
|
|
this.group = -1;
|
|
nx.gui.setActive( this.nodGroup, "", false );
|
|
let role = RoleController.getInstance().getRoleVo();
|
|
let chd = this.nodPlst.children;
|
|
let groupInfo = this.matchlistE;
|
|
if( groupInfo ){
|
|
groupInfo.sort( ( a,b ) =>{
|
|
return a.pos - b.pos;
|
|
} )
|
|
for (let i = 0; i < chd.length; i++) {
|
|
let info = nx.dt.objClone( groupInfo[i] ) ;
|
|
|
|
let nod = chd[i];
|
|
let cmp = nx.gui.getComponent( nod, "matchInfo", "cmp.cchampion.match.item" );
|
|
if( info ){
|
|
// nx.gui.setSpriteFrame( )
|
|
if( cmp ){
|
|
|
|
cmp.setData( {
|
|
face : info.face,
|
|
avatar : 1000
|
|
} )
|
|
cmp.setInfo( info, 8 );
|
|
}
|
|
}else{
|
|
let info = ArenaConst.CrosschampionEConstDefine[i];
|
|
if( cmp ){
|
|
cmp.setEmpty( info );
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onTouchChangeToEight: function(){
|
|
|
|
let cct = CrossChampionController.getInstance();
|
|
|
|
cct.sender26210();
|
|
nx.gui.setActive( this, "sfbg/change", false );
|
|
nx.gui.setActive( this, "sfbg/back", true );
|
|
},
|
|
|
|
onTouchLook: function( _index ){
|
|
|
|
let pos = parseInt( _index );
|
|
let cct = CrossChampionController.getInstance();
|
|
let group = this.group >= 0 ? this.group + 1 : 0;
|
|
cct.sender26212( group, pos );
|
|
|
|
},
|
|
|
|
setRaceReplay: function( _info ){
|
|
|
|
this.nodRace.getComponent( "cmp.cchampion.race.info" ).setRaceInfo( _info );
|
|
nx.gui.setActive( this.nodRace, "", true );
|
|
nx.gui.setActive( this, "sfbg", false );
|
|
},
|
|
|
|
onTouchClose: function(){
|
|
nx.gui.setActive( this.nodRace, "", false );
|
|
nx.gui.setActive( this, "sfbg", true );
|
|
},
|
|
|
|
});
|