const BridgeWindow = require("bridge.window");
const PathTool = require("pathtool");
const BattleConst = require("battle_const");
const BattleEvent = require("battle_event");
const EndlessEvent = require("endless_trail_event");
const RoleController = require( "role_controller" );
const ELC = require("endless_trail_controller");
const BTC = require("battle_controller");
const BDC = require("battle_drama_controller");
const STARC = require("startower.mod");
const NxSpine = require("nx.fx.spine");
const NxBGM = require("nx.fx.BGM");
cc.Class({
extends: BridgeWindow,
properties: {
uiNd:{//ui层
default:null,
type:cc.Node
},
camSp:{//演示的特效
default:null,
type:NxSpine
},
left_name:{
default:null,
type:cc.Label
},
right_name:{
default:null,
type:cc.Label
},
hero_info_list:{
default:null,
type:cc.Node
},
round:{
default:null,
type:cc.RichText
},
speed_txt:{
default:null,
type:cc.Label
},
total_hurt:{
default:null,
type:cc.RichText
},
pass_btn:{
default:null,
type:cc.Node
},
exit_btn:{
default:null,
type:cc.Node
},
out_btn:{
default:null,
type:cc.Node
},
result_btn:{
default:null,
type:cc.Node
},
//技能演出
LBSkill:{
default:null,
type:NxSpine
},
Lrole_sp:{
default:null,
type:cc.Node
},
Lbig:{
default:null,
type:cc.Node
},
LSmall:{
default:null,
type:cc.Node
},
RBSkill:{
default:null,
type:NxSpine
},
Rrole_sp:{
default:null,
type:cc.Node
},
Rbig:{
default:null,
type:cc.Node
},
RSmall:{
default:null,
type:cc.Node
},
fabHeroView:{
default:null,
type:cc.Prefab
},
skill_view:{
default:null,
type:cc.Node
},
LeftSkill:{
default:null,
type:NxSpine
},
LRole:{
default:null,
type:cc.Node
},
LName:{
default:null,
type:cc.Node
},
RightSkill:{
default:null,
type:NxSpine
},
RRole:{
default:null,
type:cc.Node
},
RName:{
default:null,
type:cc.Node
},
endlessInfo:{
default:null,
type:cc.Node
},
LHallow:{
default:null,
type:cc.Node
},
RHallow:{
default:null,
type:cc.Node
},
bgnCmp:{
default:null,
type:NxBGM
}
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.skill_speed = {
[1]:3,
[2]:6,
[3]:9
};
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_SETSPEED, this.setSpeed.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_UPROUND, this.updateRound.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_TOTALHURT, this.addTotalHurt.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_UPNEXTMON, this.updateBaseInfo.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_SHOWSKILL, this.showActiveSkillName.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_GUILDBOSS, this.addTotalHurt.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_SELFDMG, this.showSelfDmgEff.bind( this ) );
// this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_UPBUFF, this.updateSelfBuff.bind( this ) );
this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_HALLOW, this.upHallowStatus.bind(this) );
// this.bindGEvent( BattleEvent.BATTLE_FORM_VIEW_CLOSE, this.goClose.bind( this ) );
//无尽试炼相关信息更新
this.bindGEvent( EndlessEvent.UPDATA_ENDLESSBATTLE_DATA, this.upEndlessInfo.bind( this ) );
},
upHallowStatus( is_open, attacker,is_friend ,val ,max ){
if(!attacker.role_data || attacker.role_data.object_type != BattleConst.Unit_Type.Hallows)return;
if(is_open){//打開星艦
if(is_friend){
this.LHallow.active = true;
nx.gui.setSpriteFrame(this.LHallow,"sp",cc.js.formatStr("prefab/battle/ui/plane0%s",attacker.role_data.object_bid));
}else{
this.RHallow.active = true;
nx.gui.setSpriteFrame(this.RHallow,"sp",cc.js.formatStr("prefab/battle/ui/plane0%s",attacker.role_data.object_bid));
}
}
if(is_friend){
let LBar = nx.gui.getComponent(this.LHallow,"",cc.ProgressBar);
if(val == 0 || val == null){
LBar.progress = 0;
}else{
if (max == 0 || max == null){
max = 3;
}
var per1 = Math.min(1, Math.max(val / max))
LBar.progress = per1;
}
}else{
let RBar = nx.gui.getComponent(this.RHallow,"",cc.ProgressBar);
if(val == 0 || val == null){
RBar.progress = 0;
}else{
if (max == 0 || max == null){
max = 3;
}
var per2 = Math.min(1, Math.max(val / max))
RBar.progress = per2;
}
}
},
//------------无尽试炼相关
upEndlessInfo(data){
this.endlessInfo.active = true;
let final_data = data || ELC.getInstance().getModel().getEndlessBattleData();
if( !nx.dt.objEmpty(final_data) ){
var str = cc.js.formatStr(nx.text.getKey("lab_endless_trail_battle_node_num"),final_data.round)
var str_2 = nx.text.getKey("lab_endless_trail_battle_buff");
if(final_data.buff_list && Utils.next(final_data.buff_list || {}) != null){
for(var i in final_data.buff_list){
var v = final_data.buff_list[i];
if(game.configs.endless_data.data_buff_data[v.group_id] && game.configs.endless_data.data_buff_data[v.group_id][v.id]){
var config = game.configs.endless_data.data_buff_data[v.group_id][v.id];
if(config){
str_2 = str_2 + config.battle_desc;
}
}
}
}else{
str_2 = str_2+nx.text.getKey("lab_endless_trail_battle_no_data");
}
nx.gui.setString(this.endlessInfo,"lev",str);
nx.gui.setString(this.endlessInfo,"buff/desc",str_2);
}
},
openEndlessBuffDesc(){
if(this.is_endbuff_show)return;
this.is_endbuff_show = true;
nx.gui.setActive(this.endlessInfo,"buff",true);
this.scheduleOnce(()=>{
this.is_endbuff_show = false;
nx.gui.setActive(this.endlessInfo,"buff",false);
},3);
},
//------------无尽试炼相关
goClose(){
nx.bridge.vset("BatBreak",false);
this.close();
},
updateSelfBuff(object_bid,buff_list){
this.clearFriendBuff(object_bid);
this.addFriendBuff(object_bid,buff_list);
},
start() {
},
onOpenConfigs(params) {
//ui启动完成,通知真战斗开始
if(params.finish_cb){
nx.dt.fnInvoke( params.finish_cb );
}
let combat_type = params.combat_type;
this.combat_type = params.combat_type;
this.arena_notice_num = 0; // 竞技场挑战次数达到才可以跳过
this.my_hero_list = {};
this.total_my_hurt = 0;
this.bind_attack_num = 0;
// 更新回合数
if (this.update_round_num){
this.updateRound(this.update_round_num);
this.update_round_num = null;
}
// 重置一些特殊显示
this.initExtendShowStatus();
// 区分观战以及战斗状态等
if (!BTC.getInstance().getWatchReplayStatus()){
if (combat_type == BattleConst.Fight_Type.GuildDun){
this.addTotalHurt(0,true);
} else if (combat_type == BattleConst.Fight_Type.PK || combat_type == BattleConst.Fight_Type.HeroTestWar) {
this.result_btn.active = true;
} else if (combat_type == BattleConst.Fight_Type.Endless){
ELC.getInstance().send23902();
this.addExitBtnUI();
this.out_btn.active = true;
}else if (combat_type == BattleConst.Fight_Type.Default){
if( nx.bridge.plot && !nx.bridge.plot.isDoing() ) {
this.addExitBtnUI();
}
}else if(combat_type == BattleConst.Fight_Type.newRole){
let show_id = BTC.getInstance().getShowBatID();
if(show_id && show_id > 1){
this.uiNd.active = true;
this.hero_info_list.active = true;
}else{
this.uiNd.active = false;
this.setCamEft();
}
}else if(combat_type == BattleConst.Fight_Type.newHeroUse){
this.result_btn.active = true;
}
else if(combat_type == BattleConst.Fight_Type.StarTower){
let switch_star = game.configs.star_tower_data.data_tower_const.quit_switch;
let max_tower = STARC.getInstance().getNowTowerId();
if(max_tower >= switch_star.val[1]){
this.addExitBtnUI();
}
}else if(combat_type == BattleConst.Fight_Type.Darma){
let switch_info = game.configs.dungeon_data.data_drama_const.quit_switch;
let drama_data = BDC.getInstance().getModel().getDramaData();
if(drama_data.dun_id >= switch_info.val[1]){
this.addExitBtnUI();
}
}
}else{
this.out_btn.active = true;
}
// 设置跳过按钮状态
this.updatePassBtnStatus(combat_type);
// 初始化显示,包括名字,阵容等数据,这个中途不会变化只做一次判断
this.hero_info_list.active = (combat_type != 44);
this.updateBaseInfo();
// 显示初始速率
var speed = BTC.getInstance().getModel().getSpeed();
this.setSpeed(speed);
this.changeBattleMusic(combat_type);
},
setCamEft(){
this.scheduleOnce(()=>{
this.camSp.node.active = true;
this.hero_info_list.active = true;
let res_path = PathTool.getSpinePath( "E80053","action", false );
this.camSp.load( res_path, ( _e ) => {
if( !_e ) {
this.camSp.action( "action", true );
} else {
this.camSp.stop();
}
} );
},3);
},
onPreClosed() {
nx.bridge.NodeChidrenDestroy(this.hero_info_list);
this.my_hero_list = {};
let ChatController = require("chat_controller")
ChatController.getInstance().closeChatPanel()
gcore.GlobalEvent.fire(BattleEvent.EXIT_FIGHT);
},
changeBattleMusic(combat_type){
let base_config = game.configs.battle_bg_data.data_info[ combat_type ];
if( combat_type != 3) {
base_config = game.configs.battle_bg_data.data_info[ BattleConst.Fight_Type.Default ];
}else{
let chapterId = BDC.getInstance().getModel().getDramaData().chapter_id;
if(chapterId){
let cfgs = game.configs.battle_bg_data.data_info2[ combat_type ];
base_config = cfgs[chapterId];
}
if(base_config == null){
base_config = game.configs.battle_bg_data.data_info[ BattleConst.Fight_Type.Default ];
}
}
this.scheduleOnce( () => {
let res_key = cc.path.join("audios/bgms",base_config.bg_music);
this.bgnCmp.bgmRK = res_key;
this.bgnCmp.reActive();
}, 0.5 );
},
// 改变速率
setSpeed: function (speed) {
if (speed == null) {
speed = 1;
}
let role = RoleController.getInstance().getRoleVo();
let touch = nx.storage.get( "touch" + role.rid );
if( !touch || touch == 0 ){
nx.gui.setActive( this.speed_txt.node.parent, "sp", speed == 1 );
}else{
nx.gui.setActive( this.speed_txt.node.parent, "sp", false );
}
this.speed_txt.string = "X" + speed;
// 设置场景上的模型和特效的速率
if(speed == 2){
BTC.getInstance().getModel().setBattleTimeScale(false);
nx.storage.set( "touch" + role.rid, speed );
}else if(speed == 3){
BTC.getInstance().getModel().setBattleTimeScale(false);
nx.storage.set( "touch" + role.rid, speed );
}else {
BTC.getInstance().getModel().setBattleTimeScale(true);
}
this.LeftSkill.setTimeScale(this.skill_speed[speed]);
this.RightSkill.setTimeScale(this.skill_speed[speed]);
this.LBSkill.setTimeScale(this.skill_speed[speed]);
this.RBSkill.setTimeScale(this.skill_speed[speed]);
},
onClickOpenbuffView(){
let battle_data = BTC.getInstance().getModel().getCurBattleData();
let left_name = battle_data.actor_role_name;
let right_name = battle_data.target_role_name;
let group = BTC.getInstance().getModel().getGroup();
if(group == BattleConst.BattleGroupTypeConf.TYPE_GROUP_ENEMY && !BTC.getInstance().getWatchReplayStatus()){
left_name = data.target_role_name;
right_name = data.actor_role_name;
}
BTC.getInstance().openBattleBuffInfoView(true, left_name, right_name);
},
// 初始化一些特殊战斗需要显示的东西
initExtendShowStatus:function(){
this.exit_btn.active = false;
},
// 当前回合数
updateRound: function (round) {
// if (this.round_label1 == null){
this.update_round_num = round;
// }else{
let combat_type = BTC.getInstance().getModel().getCombatType();
if(combat_type == null || combat_type == BattleConst.Fight_Type.Nil) return;
let config = game.configs.combat_type_data.data_fight_list[combat_type];
if (!config) return;
let total_round = config.max_action_count;
this.round.string = cc.js.formatStr("%s/%s",round,total_round);
gcore.GlobalEvent.fire(BattleEvent.UPDATE_ROUND_NUM);
// }
},
//更新基础数据,不过在无尽试炼的时候需要额外调用一次 每波可能都不一样
updateBaseInfo:function(){
var battle_data = BTC.getInstance().getModel().getCurBattleData();
if (!battle_data) return;
// if (battle_data.formation){ //更新左右阵法
// this.updateFormIcon(battle_data.formation);
// }
if( battle_data.extra_args && nx.dt.arrNEmpty( battle_data.extra_args ) ){
let dungen = battle_data.extra_args[0].param;
let dfg = game.configs.dungeon_data.data_drama_dungeon_info[dungen];
if( dfg ){
nx.gui.setString( this.endlessInfo.parent, "nowdungon", dfg.name );
}
}
nx.gui.setActive( this.endlessInfo, "", BTC.getInstance().getModel().combat_type == BattleConst.Fight_Type.Endless );
nx.gui.setActive( this.endlessInfo.parent, "nowdungon", battle_data.extra_args && nx.dt.arrNEmpty( battle_data.extra_args ) );
if (battle_data.halo_list){ // 更新左右阵营
this.updateHaloIcon(battle_data.halo_list);
}
if(battle_data.fight_object_list){ //更新英雄响应序列
let my_list = [];
for(let i in battle_data.fight_object_list){
if(battle_data.fight_object_list[i].group == 1){
my_list.push(battle_data.fight_object_list[i]);
}
}
this.scheduleOnce(()=>{
this.initMyHeroList(my_list);
},1);
}
// 判断左边是不是队友
var left_is_friend = BTC.getInstance().getModel().isFriend(BattleConst.Group_Type.Friend)
if (left_is_friend == true) {
this.left_name.string = battle_data.actor_role_name;
this.right_name.string = battle_data.target_role_name;
}else{
this.left_name.string = battle_data.target_role_name;
this.right_name.string = battle_data.actor_role_name;
}
// this.buff_btn.opacity = 0;
// this.buff_btn.runAction(cc.fadeIn(0.7))
},
initMyHeroList: function(data){
if(!data)return;
nx.bridge.NodeChidrenDestroy(this.hero_info_list);
for(let i=0;i= 10000){
let left_1 = Math.floor(left_camp/10000);
let left_2 = Math.floor(left_camp/100)%100;
let left_3 = left_camp%100;
if(left_1 > 0){
left_halo_id_list.push(left_1)
}
if(left_2 > 0){
left_halo_id_list.push(left_2)
}
if(left_3 > 0){
left_halo_id_list.push(left_3)
}
}else{
let left_id_1 = Math.floor(left_camp/100)
let left_id_2 = left_camp%100
if(left_id_1 > 0){
left_halo_id_list.push(left_id_1)
}
if(left_id_2 > 0){
left_halo_id_list.push(left_id_2)
}
}
}
left_halo_id_list.sort((a,b)=>{
return a= 10000){
let right_1 = Math.floor(right_camp/10000);
let right_2 = Math.floor(right_camp/100)%100;
let right_3 = right_camp%100;
if(right_1 > 0){
right_halo_id_list.push(right_1)
}
if(right_2 > 0){
right_halo_id_list.push(right_2)
}
if(right_3 > 0){
right_halo_id_list.push(right_3)
}
}else{
let right_id_1 = Math.floor(right_camp/100)
let right_id_2 = right_camp%100
if(right_id_1 > 0){
right_halo_id_list.push(right_id_1)
}
if(right_id_2 > 0){
right_halo_id_list.push(right_id_2)
}
}
}
right_halo_id_list.sort((a,b)=>{
return a", desc)
}
this.total_hurt.string = total_str;
}
},
// 观战等退出
addExitBtnUI: function () {
this.exit_btn.active = true;
},
// 跳过按钮状态
updatePassBtnStatus:function(combat_type){
this.arena_notice_num = 0;
if (combat_type == null || BTC.getInstance().getWatchReplayStatus()) {
this.pass_btn.active = false;
return;
}
let _config = game.configs.combat_type_data.data_fight_list[combat_type];
if (_config == null || _config.is_skip != "true") {
this.pass_btn.active = false;
return;
}
// 如果是竞技场,则判断次数
if (combat_type == BattleConst.Fight_Type.Arena){
var count = require("arena_controller").getInstance().getModel().getHadCombatNum(); // 当前已经挑战过的次数
var arena_config = game.configs.arena_data.data_const.arena_skip_count;
if (arena_config == null) {
this.pass_btn.active = false;
return;
}else{
if (count < arena_config.val) { // 这种情况下也需要显示,但是保留计算判断
this.arena_notice_num = arena_config.val
}
}
}
this.pass_btn.active = true;
},
//小技能播报
setSelfSkillItem(is_friend,name,cfg,end_call){
if(is_friend){
if( this.LeftSkill.node ) {
this.LeftSkill.node.x = -cc.winSize.width/2 + 20;
this.LeftSkill.node.active = true;
nx.gui.setString(this.LName,"",name);
let Partner_res = PathTool.getIconPath("models/"+cfg.res_id+"/play","action");
nx.gui.setSpriteFrame(this.LRole,"",Partner_res);
this.LeftSkill.action("action1",false,(_key,_name)=>{
if(_key == "done"){
this.LeftSkill.node.active = false;
return end_call();
}
});
}
}else{
if( this.RightSkill.node ){
this.RightSkill.node.x = cc.winSize.width/2 - 20;
this.RightSkill.node.active = true;
nx.gui.setString(this.RName,"",name);
let Partner_res = PathTool.getIconPath("models/"+cfg.res_id+"/play","action");
nx.gui.setSpriteFrame(this.RRole,"",Partner_res);
this.RightSkill.action("action2",false,(_key,_name)=>{
if(_key == "done"){
this.RightSkill.node.active = false;
return end_call();
}
});
}
}
},
// 单位主动技能喊招
showActiveSkillName:function(attacker, callback){
let self = this;
// if (callback) {
// callback();
// }
if (attacker == null || !attacker.isValid || attacker.skill_data == null){
if (callback) {
callback();
}
return;
}
var battle_role = attacker.getRoleData();
if (battle_role == null){
if (callback) {
callback();
}
return;
}
if (attacker.temp_skill_bid != attacker.attacker_info.skill_bid){
attacker.temp_skill_bid = attacker.attacker_info.skill_bid
// 获取头像资源id,以及加载头像
var object_type = battle_role.object_type;
var object_bid = battle_role.object_bid;
var head_icon = battle_role.face_id;
if(battle_role.face_id == 0){
head_icon = battle_role.object_bid;
}
let key;
let is_useskin = false;
let skin_id = 0;
if(object_type == BattleConst.Unit_Type.Monster){
var config = Utils.getUnitConfig(object_bid);
if (config){
head_icon = config.head_icon;
let p_id = Number(config.head_icon);
let p_config = game.configs.partner_data.data_partner_base[p_id];
if(p_config){
key = p_config.bid + "_" + p_config.init_star;
}
}
}else{
key = object_bid + "_" + battle_role.star;
let extras = battle_role.extra_data;
for(let e in extras){
if(5 == extras[e].extra_key){//使用皮肤
skin_id = extras[e].extra_value;
if(skin_id != 0){
is_useskin = true;
}
}
}
}
let cfg = gdata("partner_data", "data_partner_star", key );
if(is_useskin){
cfg = game.configs.partner_skin_data.data_skin_info[skin_id];
}
if(!cfg.res_id){
cfg = {};
cfg.res_id = attacker.base_spine_name;
}
//大技能动画
let skill_func = ()=>{
if(attacker.is_friend){
let big_res = PathTool.getIconPath("models/"+cfg.res_id+"/play","b1");
nx.gui.setSpriteFrame(self.Lbig,"",big_res);
let role_res = cc.js.formatStr("resDB/models/%s/play/action1",cfg.res_id);
nx.gui.setSpriteFrame(this.Lrole_sp,"",role_res);
this.LBSkill.node.active = true;
this.LBSkill.node.x = -cc.winSize.width/2;
this.LBSkill.action("action1",false,(_key,_name)=>{
if(_key == "role_a"){
this.Lbig.opacity = 255;
this.LSmall.opacity = 255;
this.Lrole_sp.stopAllActions();
this.Lrole_sp.runAction(cc.fadeIn(0.16));
return;
}
if(_key == "role_b"){
this.Lrole_sp.stopAllActions();
this.Lrole_sp.runAction(cc.fadeOut(0.16))
return;
}
if(_key == "zi1"){
this.Lbig.stopAllActions();
this.Lbig.runAction(cc.fadeOut(0.2))
return;
}
if(_key == "zi2"){
this.LSmall.stopAllActions();
this.LSmall.runAction(cc.fadeOut(0.2))
return;
}
if(_key == "done"){
if (callback) {
callback();
}
return;
}
if(_key == "complete"){
this.LBSkill.node.active = false;
return;
}
});
}else{
let big_res = PathTool.getIconPath("models/"+cfg.res_id+"/play","b2");
nx.gui.setSpriteFrame(self.Rbig,"",big_res);
let role_res = cc.js.formatStr("resDB/models/%s/play/action1",cfg.res_id);
nx.gui.setSpriteFrame(this.Rrole_sp,"",role_res);
this.RBSkill.node.active = true;
this.RBSkill.node.x = cc.winSize.width/2;
this.RBSkill.action("action2",false,(_key,_name)=>{
if(_key == "role_a"){
this.Rbig.opacity = 255;
this.RSmall.opacity = 255;
this.Rrole_sp.stopAllActions();
this.Rrole_sp.runAction(cc.fadeIn(0.16));
return;
}
if(_key == "role_b"){
this.Rrole_sp.stopAllActions();
this.Rrole_sp.runAction(cc.fadeOut(0.16))
return;
}
if(_key == "zi1"){
this.Rbig.stopAllActions();
this.Rbig.runAction(cc.fadeOut(0.2))
return;
}
if(_key == "zi2"){
this.RSmall.stopAllActions();
this.RSmall.runAction(cc.fadeOut(0.2))
return;
}
if(_key == "done"){
if (callback) {
callback();
}
return;
}
if(_key == "complete"){
this.RBSkill.node.active = false;
return;
}
});
}
};
let end_call = cc.callFunc(()=>{
if(attacker.skill_data && attacker.skill_data.skill_cartoon == 1){
// 播放音效
if (attacker.skill_data.skill2_play_sound && attacker.skill_data.skill2_play_sound != "") {
nx.audio.playSFX("audios/combats/"+attacker.skill_data.skill2_play_sound,false,()=>{
skill_func();
});
}else{
skill_func();
}
// skill_func();
}else{//小技能动画
if(attacker && attacker.skill_data){
self.setSelfSkillItem(attacker.is_friend,attacker.skill_data.name,cfg,callback);
}else{
if (callback) {
callback();
}
}
}
});
if (attacker.is_friend){
//头像动作
let info_fun = ()=>{
let hero = self.my_hero_list[cfg.bid];
if(hero){
//英雄施法
let skill_delay = (attacker.skill_data.skill_cartoon == 1)?0.6:0.2;
hero.useSkill(end_call,skill_delay);
}else{
}
}
// 设置头像以及播放动作
info_fun();
}
else
{
// // 设置头像以及播放动作
// info_fun();
if(attacker.skill_data && attacker.skill_data.skill_cartoon == 1){
if(attacker.skill_data && attacker.skill_data.skill_cartoon == 1){
// 播放音效
if (attacker.skill_data.skill2_play_sound && attacker.skill_data.skill2_play_sound != "") {
nx.audio.playSFX("audios/combats/"+attacker.skill_data.skill2_play_sound,false,()=>{
skill_func();
});
}else{
skill_func();
}
}
}else{//小技能动画
// let call = cc.callFunc(()=>{
// if (callback) {
// callback();
// }
// });
if(attacker && attacker.skill_data){
this.setSelfSkillItem(attacker.is_friend,attacker.skill_data.name,cfg,callback);
}else{
if (callback) {
callback();
}
}
}
}
}else{
if(callback){
callback();
}
}
},
//播放受击特效
showSelfDmgEff(attacker){
let targets = attacker.attacker_info.target_list;
for(let i in targets){
let tar = targets[i];
for(let j in this.my_hero_list){
let my = this.my_hero_list[j].data;
if(tar.target == my.pos){
let hero = this.my_hero_list[j];
//受到攻击
hero.getEncountor();
}
}
}
},
onClickExit(){
BTC.getInstance().requestCutOutBattle((_data)=>{
if(_data){
BTC.getInstance().setUIFightType(0);
nx.bridge.cleanPanels();
}
});
},
onCclickR3esult(){
if(this.combat_type == BattleConst.Fight_Type.Endless){
let str = nx.text.getKey("msg_endless_trail_battle_tip1");
nx.mbox(str,["btn_endless_trail_battle_continue","btn_endless_trail_battle_out"],
(_key,_box)=>{
_box.close();
if(_key == "btn_endless_trail_battle_out"){
BTC.getInstance().csFightExit();
}
});
}else{
BTC.getInstance().csFightExit();
}
},
onClickOutResult(){
BTC.getInstance().OutResult();
},
onClickCamp(){
if(!this.right_halo_id)return;
BTC.getInstance().openBattleCampView(true,this.right_halo_id);
},
onClickSelfCamp(){
if(!this.left_halo_id)return;
BTC.getInstance().openBattleCampView(true,this.left_halo_id);
},
onClickPass(){
if (this.arena_notice_num == 0) {
BTC.getInstance().send20062();
if( nx.bridge.plot && nx.bridge.plot.isDoing() ){
nx.bridge.plot.next();
}
}else{
nx.tbox(cc.js.formatStr(nx.text.getKey("msg_battle_form_fight_num"), this.arena_notice_num));
}
},
onClickSpeed(){
if (BTC.getInstance().getModel().checkIsCanChangeBattleSpeed()){
BTC.getInstance().getModel().changeSpeed();
}
},
touchChat() {
let ChatCtrl = require("chat_controller");
ChatCtrl.getInstance().openChatPanel();
}
// update (dt) {},
});