Files
fc/dev/project/library/imports/d6/d6b18106-7226-4db6-a19c-826a685449e5.js
2026-05-24 10:21:26 +08:00

232 lines
11 KiB
JavaScript

"use strict";
cc._RF.push(module, 'd6b18EGciZNtqGcgmpoVEnl', 'cmp.arena.loopc.result.wnd');
// Scripts/mod/pvp/arena/cmp/cmp.arena.loopc.result.wnd.js
"use strict";
var BridgeWindow = require("bridge.window");
var ArenaController = require("arena_controller");
var RoleController = require("role_controller");
var BattleConst = require("battle_const");
var Header = require("cmp.common.header");
var FxSpine = require("nx.fx.spine");
var LadderController = require("ladder_controller");
var 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: function onOpenConfigs(_params) {
this.ladderResult = false;
var 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;
}
var role = RoleController.getInstance().getRoleVo();
var type = result.result;
this.result = result.result;
var rewards = result.items || result.reward;
var 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 );
// 基础信息设置
var tar_name = result.tar_name || result.def_name;
var tar_face = result.tar_face || result.def_face;
nx.gui.setString(this.nodOther, "name", tar_name);
nx.gui.setString(this.nodSelf, "name", role.name);
var 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 );
var color = result.get_score >= 0 || result.atk_change_rank >= 0 ? new cc.Color().fromHEX("#3ae953") : new cc.Color().fromHEX("#f32f09");
var 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 doAnimation() {
var _this = this;
var anim = this.result == 1 ? "action11" : "action21";
var next_anim = this.result == 1 ? "action12" : "action22";
var self = this;
var audio = this.result == 1 ? "audios/effects/win" : "audios/effects/lose";
this.scheduleOnce(function () {
nx.audio.playSFX(audio);
}, 0.1);
this.spAnim.action(anim, false, function (_key, _name) {
// console.log( _name + "spine相关节点" + _key );
if (_key == "start") {
_this.scheduleOnce(function () {
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(function () {
nx.gui.setActive(_this.nodBtom, "awards", true);
nx.tween.fadeIn(_this.nodBtom, "awards", 0.2);
}, 0.2);
return;
}
if (_key == "t1") {
_this.scheduleOnce(function () {
var nod = _this.nodReward.children[0];
if (nod) {
nod.active = true;
nx.tween.fadeIn(nod, "", 0.2);
}
}, 0.2);
return;
}
if (_key == "t2") {
_this.scheduleOnce(function () {
var nod = _this.nodReward.children[1];
if (nod) {
nod.active = true;
nx.tween.fadeIn(nod, "", 0.2);
}
}, 0.2);
return;
}
if (_key == "t3") {
var 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 onPreClosed() {
nx.bridge.vset("ResultInfo", {});
nx.storage.set("battleArena", null);
if (this.ladderResult) {
gcore.GlobalEvent.fire(LadderEvent.UpdateAllLadderEnemyList);
}
},
touchDetail: function touchDetail() {
var 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}***/
cc._RF.pop();