239 lines
12 KiB
JavaScript
239 lines
12 KiB
JavaScript
|
|
const BridgeWindow = require("bridge.window");
|
||
|
|
const ArenaController = require( "arena_controller" );
|
||
|
|
const RoleController = require( "role_controller" );
|
||
|
|
const BattleConst = require( "battle_const" );
|
||
|
|
const Header = require( "cmp.common.header" );
|
||
|
|
const FxSpine = require( "nx.fx.spine" );
|
||
|
|
const LadderController = require( "ladder_controller" );
|
||
|
|
const LadderEvent = require( "ladder_event" );
|
||
|
|
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
extends: BridgeWindow,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
|
||
|
|
spAnim: { default: null, type: FxSpine },
|
||
|
|
nodOther: { default: null, type : cc.Node },
|
||
|
|
nodLog: { default: null, type : cc.Node },
|
||
|
|
nodSelf: { default: null, type : cc.Node },
|
||
|
|
nodReward: { default: null, type : cc.Node },
|
||
|
|
nodBtom : { default: null, type : cc.Node },
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onOpenConfigs( _params ) {
|
||
|
|
|
||
|
|
this.ladderResult = false;
|
||
|
|
let result = nx.bridge.vget("ResultInfo");
|
||
|
|
|
||
|
|
/***{"result":1,"item_rewards":[],
|
||
|
|
* "show_panel_type":0,"current_time":0,
|
||
|
|
* "best_time":0,"combat_type":18,"target_role_name":"",
|
||
|
|
* "hurt_statistics":[],"adventure_end_hp":0,"room_id":0,"ext_list":[]}***/
|
||
|
|
|
||
|
|
|
||
|
|
if( result.combat_type == BattleConst.Fight_Type.LadderWar ){
|
||
|
|
this.ladderResult = true;
|
||
|
|
result = LadderController.getInstance().new_result_data;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/*** {"result":1,"rid":193,"srv_id":"robot","def_name":"從南平夏",
|
||
|
|
* "def_lev":59,"def_face":24100,"def_face_update_time":0,"def_face_file":"",
|
||
|
|
* "def_change_rank":-20,"def_rank":213,"is_change_best_rank":0,
|
||
|
|
* "atk_change_rank":20,"atk_rank":193,
|
||
|
|
* "reward":[{"bid":21,"num":50},{"bid":1,"num":30000}],
|
||
|
|
* "target_role_name":"從南平夏",
|
||
|
|
* "hurt_statistics":[{"type":2,
|
||
|
|
* "partner_hurts":[
|
||
|
|
* {"rid":193,"srvid":"robot","id":5,"bid":50502,"star":6,"lev":145,"camp_type":5,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":64494},
|
||
|
|
* {"rid":193,"srvid":"robot","id":4,"bid":40502,"star":6,"lev":145,"camp_type":4,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":82409},
|
||
|
|
* {"rid":193,"srvid":"robot","id":3,"bid":10507,"star":5,"lev":100,"camp_type":1,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":77801},
|
||
|
|
* {"rid":193,"srvid":"robot","id":2,"bid":30507,"star":5,"lev":100,"camp_type":3,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":61489},
|
||
|
|
* {"rid":193,"srvid":"robot","id":1,"bid":20504,"star":7,"lev":165,"camp_type":2,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":177502}]},
|
||
|
|
* {"type":1,"partner_hurts":[
|
||
|
|
* {"rid":146,"srvid":"fx_1","id":4,"bid":30510,"star":13,"lev":340,"camp_type":3,"dps":226812,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},
|
||
|
|
* {"rid":146,"srvid":"fx_1","id":78,"bid":10511,"star":13,"lev":340,"camp_type":1,"dps":38543,"cure":108480,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},
|
||
|
|
* {"rid":146,"srvid":"fx_1","id":6,"bid":50507,"star":13,"lev":340,"camp_type":5,"dps":146903,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},
|
||
|
|
* {"rid":146,"srvid":"fx_1","id":2,"bid":10502,"star":13,"lev":340,"camp_type":1,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},
|
||
|
|
* {"rid":146,"srvid":"fx_1","id":3,"bid":10507,"star":13,"lev":340,"camp_type":1,"dps":51437,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0}]}],
|
||
|
|
* "replay_id":10318} */
|
||
|
|
// console.log( "當前的結算數據" + JSON.stringify( result ) );
|
||
|
|
|
||
|
|
if( !result || nx.dt.objEmpty( result ) ){
|
||
|
|
this.close();
|
||
|
|
// nx.bridge.createPanel( "WndArenaLoopCWarLog" );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
let role = RoleController.getInstance().getRoleVo();
|
||
|
|
let type = result.result;
|
||
|
|
this.result = result.result;
|
||
|
|
let rewards = result.items || result.reward ;
|
||
|
|
let cmp = this.nodReward.getComponent( "cmp.item.layout" );
|
||
|
|
if( cmp ){
|
||
|
|
cmp.rebuild( rewards );
|
||
|
|
}
|
||
|
|
|
||
|
|
// let path = type == 1 ? cc.path.join( "prefab/pvp/arena/ui/arena_14" ) : cc.path.join( "prefab/pvp/arena/ui/arena_13" );
|
||
|
|
nx.gui.setActive( this.nodBtom, "awards", false );
|
||
|
|
|
||
|
|
nx.gui.hideAllChildren( this.nodReward );
|
||
|
|
// nx.gui.setSpriteFrame( this.nodLog, "", path );
|
||
|
|
|
||
|
|
// 基础信息设置
|
||
|
|
let tar_name = result.tar_name || result.def_name;
|
||
|
|
let tar_face = result.tar_face || result.def_face ;
|
||
|
|
nx.gui.setString( this.nodOther, "name", tar_name );
|
||
|
|
nx.gui.setString( this.nodSelf, "name", role.name );
|
||
|
|
let icon = nx.gui.getComponent( this.nodOther, "icon", Header );
|
||
|
|
if( icon ){
|
||
|
|
icon.setData( {
|
||
|
|
face : tar_face,
|
||
|
|
avatar: 1000,
|
||
|
|
} );
|
||
|
|
}
|
||
|
|
|
||
|
|
// 显示分数相关
|
||
|
|
nx.gui.setString( this.nodOther, "score", result.tar_score || result.def_rank );
|
||
|
|
nx.gui.setString( this.nodSelf, "score", result.score || result.atk_rank );
|
||
|
|
nx.gui.setString( this.nodSelf, "txt", result.get_score || result.atk_change_rank || 0 );
|
||
|
|
nx.gui.setString( this.nodOther, "txt", result.lose_score || result.def_change_rank || 0 );
|
||
|
|
|
||
|
|
// 根据升降分 显示相应的标识 以及升降分数的颜色设置
|
||
|
|
// let ico_path = "";
|
||
|
|
// // if( result.get_score != 0 ){
|
||
|
|
// ico_path = type == 1 ? cc.path.join( "prefab/pvp/arena/ui/arena_30" ) : cc.path.join( "prefab/pvp/arena/ui/arena_31" );
|
||
|
|
// // }
|
||
|
|
// // nx.gui.setSpriteFrame( this.nodSelf, "ico", ico_path );
|
||
|
|
// // nx.gui.setActive( this.nodSelf, "ico", result.get_score != 0 );
|
||
|
|
let color = ( result.get_score >= 0 || result.atk_change_rank >= 0 ) ? new cc.Color().fromHEX( "#3ae953" ) : new cc.Color().fromHEX( "#f32f09" );
|
||
|
|
let color_d = ( result.lose_score >= 0 || result.def_change_rank >= 0 ) ? new cc.Color().fromHEX( "#3ae953" ) : new cc.Color().fromHEX( "#f32f09" );
|
||
|
|
nx.gui.setColor( this.nodSelf, "txt", color );
|
||
|
|
nx.gui.setColor( this.nodOther, "txt", color_d );
|
||
|
|
// let ico_dpath = "";
|
||
|
|
// // if( result.lose_score != 0 ){
|
||
|
|
// ico_dpath = type == 2 && result.lose_score >= 0 ? cc.path.join( "prefab/pvp/arena/ui/arena_30" ) : cc.path.join( "prefab/pvp/arena/ui/arena_31" );
|
||
|
|
// // }
|
||
|
|
// // nx.gui.setSpriteFrame( this.nodOther, "ico", ico_dpath );
|
||
|
|
// // nx.gui.setActive( this.nodOther, "ico", result.lose_score != 0 );
|
||
|
|
|
||
|
|
nx.gui.setActive( this.nodSelf, "", false );
|
||
|
|
nx.gui.setActive( this.nodOther, "", false );
|
||
|
|
|
||
|
|
this.doAnimation();
|
||
|
|
},
|
||
|
|
|
||
|
|
// 动画流程
|
||
|
|
doAnimation: function() {
|
||
|
|
|
||
|
|
|
||
|
|
let anim = this.result == 1 ? "action11" : "action21"
|
||
|
|
|
||
|
|
let next_anim = this.result == 1 ? "action12" : "action22"
|
||
|
|
let self = this;
|
||
|
|
|
||
|
|
let audio = this.result == 1 ? "audios/effects/win" : "audios/effects/lose";
|
||
|
|
this.scheduleOnce(()=>{
|
||
|
|
nx.audio.playSFX( audio );
|
||
|
|
},0.1);
|
||
|
|
|
||
|
|
this.spAnim.action( anim, false, ( _key, _name ) => {
|
||
|
|
|
||
|
|
// console.log( _name + "spine相关节点" + _key );
|
||
|
|
if( _key == "start" ) {
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
nx.gui.setActive( this.nodSelf, "", true );
|
||
|
|
nx.tween.fadeIn( this.nodSelf, "", 0.2 );
|
||
|
|
|
||
|
|
nx.gui.setActive( this.nodOther, "", true );
|
||
|
|
nx.tween.fadeIn( this.nodOther, "", 0.2 );
|
||
|
|
}, 0.4 );
|
||
|
|
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( _key == "zi_jiangli" ) {
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
nx.gui.setActive( this.nodBtom, "awards", true );
|
||
|
|
nx.tween.fadeIn( this.nodBtom, "awards", 0.2 );
|
||
|
|
}, 0.2 );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( _key == "t1" ) {
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
let nod = this.nodReward.children[0];
|
||
|
|
if( nod ){
|
||
|
|
nod.active = true;
|
||
|
|
nx.tween.fadeIn( nod, "", 0.2 );
|
||
|
|
}
|
||
|
|
|
||
|
|
}, 0.2 );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( _key == "t2" ) {
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
let nod = this.nodReward.children[1];
|
||
|
|
if( nod ){
|
||
|
|
nod.active = true;
|
||
|
|
nx.tween.fadeIn( nod, "", 0.2 );
|
||
|
|
}
|
||
|
|
}, 0.2 );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( _key == "t3" ) {
|
||
|
|
let nod = this.nodReward.children[2];
|
||
|
|
if( nod ){
|
||
|
|
nod.active = true;
|
||
|
|
nx.tween.fadeIn( nod, "", 0.2 );
|
||
|
|
}
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 第二阶段
|
||
|
|
if( _key == "complete" ) {
|
||
|
|
this.spAnim.action( next_anim, true );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
} );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
// 重载:关闭前
|
||
|
|
onPreClosed: function () {
|
||
|
|
nx.bridge.vset("ResultInfo",{});
|
||
|
|
nx.storage.set( "battleArena", null );
|
||
|
|
if( this.ladderResult ){
|
||
|
|
gcore.GlobalEvent.fire(LadderEvent.UpdateAllLadderEnemyList);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
touchDetail: function(){
|
||
|
|
let result = nx.bridge.vget("ResultInfo");
|
||
|
|
|
||
|
|
if( result.combat_type == BattleConst.Fight_Type.LadderWar ){
|
||
|
|
result = LadderController.getInstance().new_result_data;
|
||
|
|
|
||
|
|
}
|
||
|
|
nx.bridge.createPanel( "WndArenaLoopCDetail", {
|
||
|
|
demage: result
|
||
|
|
} )
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
/******{"result":1,"score":1758,"get_score":8,
|
||
|
|
* "items":[{"bid":22,"num":8000}],
|
||
|
|
* "tar_name":"Wenenanz","tar_lev":100,"tar_face":25300,"face_update_time":0,"face_file":""
|
||
|
|
* ,"tar_score":929,"lose_score":-3,
|
||
|
|
* "target_role_name":"Wenenanz",
|
||
|
|
* "hurt_statistics":[{"type":2,"partner_hurts":[{"rid":258,"srvid":"fx_1","id":3,"bid":10502,"star":5,"lev":1,"camp_type":1,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":155930},{"rid":258,"srvid":"fx_1","id":5,"bid":30510,"star":5,"lev":1,"camp_type":3,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":156654},{"rid":258,"srvid":"fx_1","id":6,"bid":40404,"star":4,"lev":1,"camp_type":4,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":123810},
|
||
|
|
* {"rid":258,"srvid":"fx_1","id":7,"bid":50507,"star":5,"lev":1,"camp_type":5,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":120587},{"rid":258,"srvid":"fx_1","id":4,"bid":10507,"star":5,"lev":1,"camp_type":1,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":151662}]},{"type":1,
|
||
|
|
* "partner_hurts":[{"rid":281,"srvid":"fx_1","id":1,"bid":10502,"star":13,"lev":340,"camp_type":1,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},{"rid":281,"srvid":"fx_1","id":5,"bid":50507,"star":13,"lev":340,"camp_type":5,"dps":312584,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},{"rid":281,"srvid":"fx_1","id":4,"bid":40404,"star":5,"lev":100,"camp_type":4,"dps":0,"cure":0,
|
||
|
|
* "ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},{"rid":281,"srvid":"fx_1","id":3,"bid":30510,"star":13,"lev":340,"camp_type":3,"dps":396059,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0},{"rid":281,"srvid":"fx_1","id":2,"bid":10507,"star":13,"lev":340,"camp_type":1,"dps":0,"cure":0,"ext_data":[{"key":5,"val":0},{"key":11,"val":0}],"be_hurt":0}]}],"replay_id":2516}***/
|