171 lines
5.5 KiB
JavaScript
171 lines
5.5 KiB
JavaScript
const NxSpine = require( "nx.fx.spine" );
|
|
const SVCItem = require( "nx.fx.sv.expand.item" );
|
|
const LadderController = require( "ladder_controller" );
|
|
|
|
cc.Class( {
|
|
|
|
extends: SVCItem,
|
|
|
|
properties: {
|
|
|
|
nodLev: { default: null, type: cc.Node },
|
|
nodDesc: { default: null, type: cc.Node },
|
|
nodOp: { default: null, type: cc.Node },
|
|
nodRole: { default: null, type: NxSpine },
|
|
nodEffect: { default: null, type: NxSpine },
|
|
|
|
},
|
|
|
|
// 数据重置
|
|
rebind: function( _idx, _data, _key ) {
|
|
|
|
this._super( _idx, _data, _key );
|
|
|
|
// 刷新
|
|
this.setData( _data );
|
|
|
|
},
|
|
|
|
// 重置
|
|
setData: function( _data, _count ) {
|
|
/***
|
|
* // -->{"_evt_idx":0,"_evt_list":{},"idx":1,"rid":1,"srv_id":"","name":"Youadsha","lev":92,"sex":0,"face":20301,"power":6941,"score":1000,"get_score":22,"status":0,
|
|
* "p_list":[{"pos":1,"bid":30301,"lev":1,"star":3,"break_lev":0,"use_skin":0,"resonate_lev":0},
|
|
* {"pos":2,"bid":10305,"lev":1,"star":3,"break_lev":0,"use_skin":0,"resonate_lev":0},
|
|
* {"pos":3,"bid":20301,"lev":1,"star":3,"break_lev":0,"use_skin":0,"resonate_lev":0},
|
|
* {"pos":4,"bid":10304,"lev":1,"star":3,"break_lev":0,"use_skin":0,"resonate_lev":0},
|
|
* {"pos":5,"bid":20304,"lev":1,"star":3,"break_lev":0,"use_skin":0,"resonate_lev":0}],
|
|
* "face_update_time":0,"face_file":"","gid":0,"gsrv_id":"","gname":""}
|
|
*/
|
|
|
|
this.mdata = _data;
|
|
if( !this.mdata ){
|
|
return;
|
|
}
|
|
|
|
this.freshAll();
|
|
},
|
|
|
|
freshAll: function(){
|
|
|
|
|
|
// this.freshHeader();
|
|
this.freshDesc();
|
|
this.freshOp();
|
|
|
|
this.freshPartnerRole();
|
|
},
|
|
|
|
freshHeader: function(){
|
|
|
|
this.nodHead.setData( this.mdata );
|
|
|
|
},
|
|
|
|
|
|
freshDesc: function(){
|
|
|
|
nx.gui.setActive( this.nodDesc, "", false );
|
|
nx.gui.setActive( this.nodOp, "", false );
|
|
nx.gui.setActive( this.nodLev, "", false );
|
|
let rank = this.mdata.rank == 0 ? nx.text.getKey( "RankEmpty" ) : "No." + this.mdata.rank;
|
|
let desc = game.configs.sky_ladder_data.data_const.close_text;
|
|
nx.gui.setString( this.nodLev, "p/power", this.mdata.power );
|
|
nx.gui.setString( this.nodDesc, "name", this.mdata.name );
|
|
let sid = this.mdata.srv_id.split( "_" );
|
|
let servers = nx.bridge.vget( "allServers" );
|
|
|
|
let servver = nx.dt.randomRange( 1, Object.keys( servers[1] ).length );
|
|
nx.gui.setString( this.nodDesc, "sid", this.mdata.srv_id == "robot" ? "[" + nx.text.format( "Srever", servver ) + "]" : "[" + nx.text.format( "Srever", sid[1] ) + "]" );
|
|
nx.gui.setString( this.nodDesc, "rank", rank );
|
|
nx.gui.setString( this.nodLev, "empty/txt", nx.text.getKey( "RankEmpty" ) );
|
|
|
|
|
|
nx.gui.setActive( this.nodLev, "p", this.mdata.power != 0 );
|
|
nx.gui.setActive( this.nodDesc, "rank", this.mdata.rank != 0 );
|
|
nx.gui.setActive( this.nodDesc, "sid", nx.dt.strNEmpty( this.mdata.srv_id ) );
|
|
nx.gui.setActive( this.nodLev, "empty", this.mdata.power == 0 );
|
|
// nx.gui.setActive( this.nodLev, "", this.mdata.rank != 0 ); // 若未开启 则隐藏该节点
|
|
|
|
},
|
|
|
|
freshOp: function( ){
|
|
|
|
nx.gui.setActive( this.nodOp, "on", this.mdata.rank != 0 );
|
|
nx.gui.setActive( this.nodOp, "off", this.mdata.rank == 0 );
|
|
|
|
},
|
|
|
|
freshPartnerRole: function(){
|
|
|
|
nx.gui.setActive( this.nodRole, "", false );
|
|
let ufg = game.configs.looks_data.data_data[this.mdata.look];
|
|
let model = "";
|
|
if( ufg ){
|
|
model = PathTool.getSpinePath( ufg.model, ufg.model, false );
|
|
}
|
|
|
|
let anim = "action1_blue";
|
|
if( this.nodEffect ){
|
|
this.nodEffect.action( anim, false, ( _key, _name ) => {
|
|
|
|
if( _key == "complete" ) {
|
|
if( this.nodRole ){
|
|
nx.gui.setActive( this.nodRole, "", true );
|
|
// 战斗迷你
|
|
this.nodRole.load( model, ( _e ) => {
|
|
if( !_e ) {
|
|
|
|
this.nodRole.action( "stand2", true );
|
|
|
|
} else {
|
|
this.nodRole.stop();
|
|
}
|
|
} );
|
|
}
|
|
|
|
nx.gui.setActive( this.nodDesc, "", true );
|
|
nx.tween.fadeIn( this.nodDesc, "", 0.2 );
|
|
nx.gui.setActive( this.nodOp, "", true );
|
|
nx.tween.fadeIn( this.nodOp, "", 0.2 );
|
|
nx.gui.setActive( this.nodLev, "", true );
|
|
nx.tween.fadeIn( this.nodLev, "", 0.2 );
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onTouchChallenge: function(){
|
|
|
|
let LC = LadderController.getInstance();
|
|
LC.requestLadderEnemyData( this.mdata.rid, this.mdata.srv_id );
|
|
// nx.bridge.closePanel( "WndArenaLoopChallenge" );
|
|
// const PVP = PVPMod.getInstance();
|
|
// if( PVP ) {
|
|
// PVP.openPVPWindow( false );
|
|
// }
|
|
},
|
|
|
|
|
|
|
|
onTouchIcon: function(){
|
|
|
|
// let AC = ArenaController.getInstance();
|
|
// AC.requestLoopChallengeRoleInfo( this.mdata.rid, this.mdata.srv_id );
|
|
// // nx.bridge.closePanel( "WndArenaLoopChallenge" );
|
|
// // const PVP = PVPMod.getInstance();
|
|
// // if( PVP ) {
|
|
// // PVP.openPVPWindow( false );
|
|
// // }
|
|
},
|
|
|
|
|
|
|
|
} );
|