2808 lines
106 KiB
JavaScript
2808 lines
106 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'f6093RSz9hN1IYfxUP3t71f', 'cmp.battledrama.form');
|
|
// Scripts/mod/battle_drama/cmp/form/cmp.battledrama.form.js
|
|
|
|
"use strict";
|
|
|
|
var PathTool = require("pathtool");
|
|
var PartnerConst = require("partner_const");
|
|
var HeroConst = require("hero_const");
|
|
var HeroEvent = require("hero_event");
|
|
var PlanesafkController = require("planesafk_controller");
|
|
var HeavenEvent = require('heaven_event');
|
|
var PlanesafkEvent = require("planesafk_event");
|
|
var ElitematchEvent = require("elitematch_event");
|
|
var HeavenController = require("heaven_controller");
|
|
var ElitematchController = require("pvprank.mod");
|
|
var ElitematchConst = require("elitematch_const");
|
|
var GuildsecretareaController = require("guildsecretarea_controller");
|
|
var ElfinController = require("elfin_controller");
|
|
var ElfinEvent = require("elfin_event");
|
|
var HeroControl = require("hero_controller");
|
|
var BattleController = require("battle_controller");
|
|
var BCS = require("battle_const");
|
|
var ActEncounter = require("act.heronewchal.mod");
|
|
var GuildbossController = require("guildboss_controller");
|
|
var ElementController = require("element_controller");
|
|
var CampfightMod = require("campfight.mod");
|
|
var CampfightConst = require("campfight.const");
|
|
var GuildBatEvt = require("guildwar_event");
|
|
var StartowerController = require("startower.mod");
|
|
var BattleDramaController = require("battle_drama_controller");
|
|
var FxSVC = require("nx.fx.sv.expand");
|
|
// const BridgeWindow = require( "bridge.window" );
|
|
var FxTogs = require("nx.fx.togs");
|
|
var HCT = HeroConst.CampType;
|
|
var LadderController = require("ladder_controller");
|
|
var HeroVo = require("hero_vo");
|
|
var ArenaController = require("arena_controller");
|
|
var NxSpine = require("nx.fx.spine");
|
|
var BridgeComp = require("bridge.component");
|
|
var BattleDramaEvent = require("battle_drama_event");
|
|
cc.Class({
|
|
"extends": BridgeComp,
|
|
properties: {
|
|
togCamp: {
|
|
"default": null,
|
|
type: FxTogs,
|
|
displayName: "切换阵营英雄"
|
|
},
|
|
top_con: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
svcList: {
|
|
"default": null,
|
|
type: FxSVC
|
|
},
|
|
togArmy: {
|
|
"default": null,
|
|
type: FxTogs,
|
|
displayName: "切换战斗队伍"
|
|
},
|
|
togs: {
|
|
"default": [],
|
|
type: [cc.Node]
|
|
},
|
|
team_btns: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
hero_main: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
table_main: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
fabItemForm: {
|
|
"default": null,
|
|
type: cc.Prefab
|
|
},
|
|
select_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
elfin_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
fight_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
save_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
halo_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
formation_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
key_up_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
hallow_btn: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
hallows_icon: {
|
|
"default": null,
|
|
type: cc.Sprite
|
|
},
|
|
down_time: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
powerNd: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
fight_label: {
|
|
"default": null,
|
|
type: cc.Label
|
|
},
|
|
move_node: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
move_circle_sk: {
|
|
"default": null,
|
|
type: NxSpine
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
var _this$nine_position;
|
|
this.old_cfg = null;
|
|
this.partners = [];
|
|
this.cur_select_class = 0;
|
|
this.cur_tab_data = {};
|
|
//四個空白
|
|
this.four_blank_item_list = {};
|
|
|
|
//英雄對像位置的矩形區域
|
|
// this.pos_rect_list = {}
|
|
this.cur_power = 0;
|
|
//9個位置
|
|
this.all_pos_list = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
this.nine_position = (_this$nine_position = {}, _this$nine_position[1] = cc.v2(221, 130), _this$nine_position[2] = cc.v2(176, 0), _this$nine_position[3] = cc.v2(141, -130), _this$nine_position[4] = cc.v2(41, 130), _this$nine_position[5] = cc.v2(-4, 0), _this$nine_position[6] = cc.v2(-39, -130), _this$nine_position[7] = cc.v2(-139, 130), _this$nine_position[8] = cc.v2(-184, 0), _this$nine_position[9] = cc.v2(-219, -130), _this$nine_position);
|
|
//[[陣型位置
|
|
// 7 4 1
|
|
// 8 5 2
|
|
// 9 6 3
|
|
// ]]
|
|
|
|
//formations 是 25605 協議下 formations 的結構體.
|
|
//用於劇情保存陣容下 多隊伍的數據 this.dic_more_team_data[PartnerConst.Fun_Form.Drama] = formations (目前用到的是 跨服競技場,巔峰冠軍賽)
|
|
this.dic_more_team_data = {};
|
|
// 精靈
|
|
this.pos_name_list = {}; // 五个编队各自的站位类型
|
|
this.hero_item_list = {}; // 五个编队英雄Item
|
|
this.five_hero_vo = {}; // 五个编队英雄hero_vo
|
|
this.hava_drag_item = null; // 当前正在拖拽的五个item之一
|
|
|
|
this.cur_camp = 0;
|
|
// this.cur_role_list = null;
|
|
|
|
this.select_team_index = 1; //多只布阵团队的参数
|
|
this.team_select_team_index = 1;
|
|
this.team_five_hero_vo = {};
|
|
this.team_data_list = {};
|
|
//--精靈對應的隊伍信息
|
|
this.elfin_team_data_list = {};
|
|
//-- 精靈
|
|
this.elfin_item_list = {};
|
|
this.fun_form_type = PartnerConst.Fun_Form.Drama;
|
|
this.formation_type = 1; //默认阵法
|
|
this.formation_pos = game.configs.formation_data.data_form_data[this.formation_type]; //[序号 ,位置]
|
|
//if pos=1,4,7 select form_heros[0];if pos=2,5,8 select form_heros[1];if pos=3,6,9 select form_heros[2];
|
|
|
|
this.ctrl = HeroControl.getInstance();
|
|
this.model = this.ctrl.getModel();
|
|
|
|
//事件
|
|
this.bindGEvent(HeroEvent.Update_Save_Form, this.upSaveForm.bind(this));
|
|
this.bindGEvent(HeroEvent.Update_Fun_Form, this.upFunForm.bind(this));
|
|
this.bindGEvent(ElitematchEvent.Update_Elite_Fun_Form, this.upEliteFunForm.bind(this));
|
|
// this.bindGEvent( ElitematchEvent.Update_Elite_Fun_Form2, this.upEliteFunForm.bind( this ) );
|
|
this.bindGEvent(ElitematchEvent.Update_Elite_Save_Form, this.upEliteSaveForm.bind(this));
|
|
this.bindGEvent(ElfinEvent.Get_Elfin_Tree_Data_Event, this.getElfinTreeData.bind(this));
|
|
this.bindGEvent(ElfinEvent.Elfin_Plan_From_Info_Event, this.elfinPlanFormInfo.bind(this));
|
|
this.bindGEvent(HeavenEvent.Update_Heaven_Fun_Form, this.upHeavenFunForm.bind(this));
|
|
this.bindGEvent(HeavenEvent.Save_Heaven_Fun_Form, this.saveHeavenFunForm.bind(this));
|
|
this.bindGEvent(CampfightConst.EVT_CAMP_UPDATE_FORM, this.upCampFightForm.bind(this));
|
|
this.hero_main.on(cc.Node.EventType.TOUCH_START, this.onClickFightHeroNode, this);
|
|
this.hero_main.on(cc.Node.EventType.TOUCH_CANCEL, this.onClickFightHeroNode, this);
|
|
this.hero_main.on(cc.Node.EventType.TOUCH_MOVE, this.onClickFightHeroNode, this);
|
|
this.hero_main.on(cc.Node.EventType.TOUCH_END, this.onClickFightHeroNode, this);
|
|
},
|
|
//----------------------------消息
|
|
skipCheck: function skipCheck(t) {
|
|
// let txtNd = nx.gui.find( t.node, "txt" );
|
|
// if( t.isCkecked ) {
|
|
// txtNd.active = true;
|
|
// this.scheduleOnce( () => {
|
|
// txtNd.active = false;
|
|
// }, 2 );
|
|
// }
|
|
},
|
|
saveHeavenFunForm: function saveHeavenFunForm() {
|
|
var chapter_id = this.setting.chapter_id;
|
|
var customs_id = this.setting.customs_id;
|
|
if (this.form_show_type == HeroConst.FormShowType.eFormFight && chapter_id && customs_id) {
|
|
HeavenController.getInstance().sender25205(chapter_id, customs_id);
|
|
this.onClickCloseBtn();
|
|
}
|
|
},
|
|
upHeavenFunForm: function upHeavenFunForm(data) {
|
|
if (!this.team_data_list[this.fun_form_type]) {
|
|
this.team_data_list[this.fun_form_type] = {};
|
|
}
|
|
if (data.formations.length > 0) {
|
|
this.team_data_list[this.fun_form_type][1] = data.formations[0];
|
|
if (this.tab_list[0].is_multiple) {
|
|
if (!data.formations[1]) {
|
|
this.team_data_list[this.fun_form_type][2] = nx.dt.objClone(this.team_data_list[this.fun_form_type][1]);
|
|
this.team_data_list[this.fun_form_type][2].order = 2;
|
|
this.team_data_list[this.fun_form_type][2].hallows_id = 0;
|
|
this.team_data_list[this.fun_form_type][2].pos_info = [];
|
|
} else {
|
|
this.team_data_list[this.fun_form_type][2] = data.formations[1];
|
|
}
|
|
}
|
|
this.initFormInfo(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
this.updageFormType(this.team_data_list[this.fun_form_type][this.select_team_index].formation_type);
|
|
this.updateOtherFormation(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
} else {
|
|
this.setEliteMatchDefaultInfo(2);
|
|
}
|
|
},
|
|
elfinPlanFormInfo: function elfinPlanFormInfo(data) {
|
|
this.initEflinInfoList(data);
|
|
},
|
|
getElfinTreeData: function getElfinTreeData() {
|
|
if (this.save_elfin_data) {
|
|
this.updateElfinList(this.save_elfin_data);
|
|
}
|
|
},
|
|
upEliteSaveForm: function upEliteSaveForm(data) {
|
|
// if( this.fun_form_type == PartnerConst.Fun_Form.EliteMatch ) {
|
|
// // --說明是在劇情佈陣的 不用關閉
|
|
// // --默認 常規賽的 如有王者賽需要該表支持
|
|
// let match_type = match_type || ElitematchConst.MatchType.eNormalMatch;
|
|
// ElitematchController.getInstance().sender24920( match_type );
|
|
// } else {
|
|
this.onClickCloseBtn();
|
|
// }
|
|
},
|
|
upCampFightForm: function upCampFightForm(data) {
|
|
if (!this.team_data_list[this.fun_form_type]) {
|
|
this.team_data_list[this.fun_form_type] = {};
|
|
}
|
|
if (data) {
|
|
this.team_data_list[this.fun_form_type][this.select_team_index] = data;
|
|
this.initFormInfo(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
this.updageFormType(this.team_data_list[this.fun_form_type][this.select_team_index].formation_type);
|
|
this.updateOtherFormation(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
} else {
|
|
this.team_data_list[this.fun_form_type][this.select_team_index] = {};
|
|
this.team_data_list[this.fun_form_type][this.select_team_index].formation_type = 1;
|
|
this.team_data_list[this.fun_form_type][this.select_team_index].hallows_id = 0;
|
|
this.team_data_list[this.fun_form_type][this.select_team_index].pos_info = [];
|
|
}
|
|
},
|
|
upSaveForm: function upSaveForm(data) {
|
|
if (this.form_show_type == HeroConst.FormShowType.eFormFight) {
|
|
this.gotoFight();
|
|
} else {
|
|
nx.tbox("msg_saveForm");
|
|
// if( data && data.type != PartnerConst.Fun_Form.Drama && data.type != PartnerConst.Fun_Form.Arena && data.type != PartnerConst.Fun_Form.Plense ) {
|
|
// this.onClickCloseBtn()
|
|
// }
|
|
}
|
|
|
|
gcore.GlobalEvent.fire(GuildBatEvt.UpddateGuildBatForm, this.team_data_list[this.fun_form_type][1].pos_info);
|
|
},
|
|
upFunForm: function upFunForm(from_data) {
|
|
if (!from_data) return;
|
|
if (!this.team_data_list[this.fun_form_type]) {
|
|
this.team_data_list[this.fun_form_type] = {};
|
|
}
|
|
this.team_data_list[this.fun_form_type][this.select_team_index] = from_data;
|
|
this.updageFormType(from_data.formation_type);
|
|
this.updateOtherFormation(from_data);
|
|
},
|
|
upEliteFunForm: function upEliteFunForm(data) {
|
|
if (!data) return;
|
|
if (this.fun_form_type == 93 || this.fun_form_type == 99 || this.fun_form_type == 101 || this.fun_form_type == 102) {
|
|
// --常規賽 1 王者赛 2 防禦 3 王者防禦 4
|
|
var _type = null;
|
|
if (this.fun_form_type == 93) {
|
|
_type = PartnerConst.Fun_Form.EliteMatch;
|
|
} else if (this.fun_form_type == 99) {
|
|
_type = PartnerConst.Fun_Form.EliteKingMatch;
|
|
} else if (this.fun_form_type == 101) {
|
|
_type = PartnerConst.Fun_Form.EliteDefend;
|
|
} else if (this.fun_form_type == 102) {
|
|
_type = PartnerConst.Fun_Form.EliteKingDefend;
|
|
}
|
|
_type = this.fun_form_type;
|
|
if (!this.team_data_list[this.fun_form_type]) {
|
|
this.team_data_list[this.fun_form_type] = {};
|
|
}
|
|
this.setEliteMatchDefaultInfo(2);
|
|
if (data.formations.length > 0) {
|
|
for (var _i = 0; _i < data.formations.length; _i++) {
|
|
var v = data.formations[_i];
|
|
v.type = _type;
|
|
this.model.setFormList(v, v.order);
|
|
this.team_data_list[this.fun_form_type][_i + 1] = v;
|
|
}
|
|
if (this.team_data_list[this.fun_form_type] && this.team_data_list[this.fun_form_type][this.select_team_index]) {
|
|
this.updageFormType(this.team_data_list[this.fun_form_type][this.select_team_index].formation_type);
|
|
this.updateOtherFormation(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
}
|
|
// this.updateListSelectItem()
|
|
} else {
|
|
if (this.team_data_list[this.fun_form_type] && this.team_data_list[this.fun_form_type][this.select_team_index]) {
|
|
this.updageFormType(this.team_data_list[this.fun_form_type][this.select_team_index].formation_type);
|
|
this.updateOtherFormation(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
} else {
|
|
this.setEliteMatchDefaultInfo(2);
|
|
this.updageFormType(this.team_data_list[this.fun_form_type][this.select_team_index].formation_type);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
//----------------------------消息
|
|
start: function start() {},
|
|
//-------------------------战斗阵容切换
|
|
//0 pve 1 pvp
|
|
touchSelectClass: function touchSelectClass(_index) {
|
|
var cdn = this.select_btn.children;
|
|
var index = 0;
|
|
for (var _i2 in cdn) {
|
|
// if( !cdn[ i ].active ) {
|
|
index++;
|
|
cdn[_i2].getChildByName("on").active = true;
|
|
// }
|
|
}
|
|
|
|
//只有全部显示后才做选择
|
|
// if( index > 0 ) {
|
|
// return;
|
|
// }
|
|
|
|
this.cur_select_class = Number(_index) || 0;
|
|
for (var _i3 in cdn) {
|
|
if (_i3 != _index) {
|
|
cdn[_i3].getChildByName("on").active = false;
|
|
}
|
|
}
|
|
|
|
//刷新togs
|
|
this.freshTogs();
|
|
},
|
|
freshTogs: function freshTogs() {
|
|
var cfg = game.configs.partner_data.data_partner_form;
|
|
var tar = this.cur_select_class == 0 ? "PVE" : "PVP";
|
|
var togs_value = [];
|
|
for (var _i4 in cfg) {
|
|
if (cfg[_i4].group == tar) {
|
|
togs_value.push(cfg[_i4].form_type);
|
|
}
|
|
}
|
|
var index = togs_value.length;
|
|
for (var _i5 = 0; _i5 < this.togs.length; _i5++) {
|
|
if (index > 0) {
|
|
// this.togs[i].active = true;
|
|
//战斗类型配置
|
|
this.togs[_i5].fun_type = togs_value[_i5];
|
|
var txt = nx.gui.getComponent(this.togs[_i5], "txt", cc.Label);
|
|
var data = this.checkFromTypeData(togs_value[_i5]);
|
|
if (data) {
|
|
txt.string = data.name;
|
|
}
|
|
index--;
|
|
} else {
|
|
this.togs[_i5].fun_type = null;
|
|
}
|
|
}
|
|
|
|
//需要判断是否解锁
|
|
if (this.tab_list.length > 0) {
|
|
for (var _i6 = 0; _i6 < this.togs.length; _i6++) {
|
|
var tog = this.togs[_i6];
|
|
tog.active = false;
|
|
if (tog.fun_type != null) {
|
|
var is_use = false;
|
|
for (var j = 0; j < this.tab_list.length; j++) {
|
|
var _data2 = this.tab_list[j];
|
|
if (_data2.fun_form_type == tog.fun_type) {
|
|
is_use = true;
|
|
tog.active = !_data2.is_lock;
|
|
}
|
|
}
|
|
if (!is_use) {
|
|
tog.fun_type = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//设置首位展示
|
|
var order = 0;
|
|
for (var a = 0; a < this.togs.length; a++) {
|
|
if (this.togs[a].active) {
|
|
order = a;
|
|
break;
|
|
}
|
|
}
|
|
// this.togArmy.togTo( order, true );
|
|
this.onTogArmy(order);
|
|
},
|
|
checkFromTypeData: function checkFromTypeData(fun_form_type) {
|
|
var fight_list = game.configs.partner_data.data_partner_form;
|
|
for (var _i7 in fight_list) {
|
|
var fight_data = fight_list[_i7];
|
|
if (fight_data.form_type == fun_form_type) {
|
|
return fight_data;
|
|
}
|
|
}
|
|
return null;
|
|
},
|
|
clearOtherFocus: function clearOtherFocus() {
|
|
//是否需要清除原來的聚焦
|
|
if (this.team_data_list[this.fun_form_type] && this.cur_tab_data && !this.cur_tab_data.is_multiple) {
|
|
//只有一隊,需要清除聚焦
|
|
for (var k in this.five_hero_vo) {
|
|
var hero_vo = this.five_hero_vo[k];
|
|
hero_vo.is_ui_select = false;
|
|
}
|
|
this.svcList.cleanFocus();
|
|
}
|
|
},
|
|
onTogArmy: function onTogArmy(_index) {
|
|
var idx = parseInt(_index) || 0;
|
|
if (this.togs[idx].fun_type != null) {
|
|
this.clearOtherFocus();
|
|
this.fun_form_type = this.togs[idx].fun_type;
|
|
}
|
|
|
|
//显示多队伍按钮
|
|
var teams = PartnerConst.Get_Teams[this.fun_form_type];
|
|
var tog1 = this.team_btns.children[0];
|
|
tog1.getComponent(cc.Toggle).isChecked = true; //设置初始化选中
|
|
if (teams) {
|
|
this.team_btns.active = true;
|
|
for (var _i8 = 0; _i8 < this.team_btns.children.length; _i8++) {
|
|
if (_i8 < teams) {
|
|
this.team_btns.children[_i8].active = true;
|
|
} else {
|
|
this.team_btns.children[_i8].active = false;
|
|
}
|
|
}
|
|
} else {
|
|
this.team_btns.active = false;
|
|
}
|
|
this.freshList(); //刷新英雄列表
|
|
this.onTogTeam();
|
|
this.freshElfin();
|
|
},
|
|
freshElfin: function freshElfin() {
|
|
// --精靈佈陣的獲取
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
var match_type = this.setting.state || ElitematchConst.MatchType.eNormalMatch;
|
|
if (match_type == 1) {
|
|
ElfinController.getInstance().send26555(PartnerConst.Fun_Form.EliteMatch);
|
|
} else if (match_type == 2) {
|
|
ElfinController.getInstance().send26555(PartnerConst.Fun_Form.EliteKingMatch);
|
|
} else if (match_type == 3) {
|
|
ElfinController.getInstance().send26555(PartnerConst.Fun_Form.EliteDefend);
|
|
} else if (match_type == 4) {
|
|
ElfinController.getInstance().send26555(PartnerConst.Fun_Form.EliteKingDefend);
|
|
}
|
|
} else {
|
|
if (this.elfin_team_data_list[this.fun_form_type] && this.elfin_team_data_list[this.fun_form_type][this.select_team_index]) {
|
|
this.updateElfinList(this.elfin_team_data_list[this.fun_form_type][this.select_team_index]);
|
|
} else {
|
|
ElfinController.getInstance().send26555(this.fun_form_type);
|
|
}
|
|
}
|
|
},
|
|
onTogTeam: function onTogTeam(event) {
|
|
var idx = 1;
|
|
if (event) {
|
|
idx = event.checkEvents[0].customEventData;
|
|
}
|
|
this.onClickTeamTabBtn(Number(idx), true);
|
|
},
|
|
// 阵营切换
|
|
onTogCamp: function onTogCamp(_index) {
|
|
var idx = parseInt(_index) || 0;
|
|
if (this.cur_camp == idx) {
|
|
return;
|
|
}
|
|
nx.debug("[Hero]\u9635\u8425\u5207\u6362:" + this.cur_camp + " -> " + idx);
|
|
this.cur_camp = idx;
|
|
this.updateCamp();
|
|
// 整体刷新
|
|
this.freshList();
|
|
},
|
|
// 整体刷新
|
|
freshList: function freshList() {
|
|
var HC = HeroControl.getInstance();
|
|
var mod = HC.getModel();
|
|
if (!this.cur_role_list) {
|
|
return;
|
|
}
|
|
var role_list = [];
|
|
if (this.cur_camp == 0) {
|
|
// role_list = this.cur_role_list;
|
|
this.partners = this.cur_role_list;
|
|
} else {
|
|
// this.partners = [];
|
|
for (var _i9 in this.cur_role_list) {
|
|
if (this.cur_role_list[_i9].camp_type == this.cur_camp) {
|
|
role_list.push(this.cur_role_list[_i9]);
|
|
}
|
|
}
|
|
this.partners = role_list;
|
|
}
|
|
|
|
// role_list.sort( Utils.tableUpperSorter( [ "star", "lev", "flag" ] ) );
|
|
//上阵优先排序
|
|
this.fun_form_type == PartnerConst.Fun_Form.Planes ? this.partners.sort(Utils.tableUpperSorter(["star", "lev", "flag"])) : this.partners.sort(Utils.tableUpperSorter(["is_in_form", "quality", "lev"]));
|
|
nx.gui.setActive(this.svcList, "empty", nx.dt.arrEmpty(this.partners));
|
|
this.svcList.rebuild(this.partners);
|
|
this.updateListSelectItem();
|
|
},
|
|
// 选中切换
|
|
onFocusChanged: function onFocusChanged(_item) {
|
|
// 空
|
|
if (nx.dt.objEmpty(_item) || nx.dt.objEmpty(_item.mdata)) {
|
|
return;
|
|
}
|
|
nx.audio.playSFX("audios/effects/touchitem");
|
|
this.onClickHeroExhibiton(_item);
|
|
},
|
|
onEnable: function onEnable() {
|
|
if (this.old_cfg) {
|
|
this.initConfigs(this.old_cfg);
|
|
}
|
|
},
|
|
initConfigs: function initConfigs(params) {
|
|
var _this = this;
|
|
if (params.show_type && params.show_type == 3) {
|
|
this.old_cfg = params;
|
|
}
|
|
// let wdt = nx.gui.getComponent(this.node,"main",cc.Widget);
|
|
// if(params.show_type == 3 && wdt){
|
|
// wdt.left = 200;
|
|
// wdt.updateAlignment();
|
|
// }
|
|
|
|
var from_lock = true;
|
|
if (params.fun_form_type == null || params.fun_form_type == undefined) {
|
|
from_lock = false;
|
|
} else {
|
|
if (params.fun_form_type == PartnerConst.Fun_Form.Drama) {
|
|
from_lock = true;
|
|
} else if (params.fun_form_type == PartnerConst.Fun_Form.Arena) {
|
|
from_lock = true;
|
|
} else if (params.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
from_lock = true;
|
|
} else if (params.fun_form_type == 12 || params.fun_form_type == 13 || params.fun_form_type == 14 || params.fun_form_type == 15 || params.fun_form_type == 16) {
|
|
//元素神殿
|
|
from_lock = true;
|
|
} else if (params.fun_form_type == 99) {
|
|
from_lock = true;
|
|
} else if (params.fun_form_type == 93) {
|
|
from_lock = true;
|
|
if (params.setting && params.setting.state == 2) {
|
|
// this.fun_form_type = 99;
|
|
params.fun_form_type = 99;
|
|
} else if (params.setting.state == 3) {
|
|
params.fun_form_type = 101;
|
|
} else if (params.setting.state == 4) {
|
|
params.fun_form_type = 102;
|
|
}
|
|
}
|
|
}
|
|
this.from_lock = from_lock;
|
|
this.fun_form_type = params.fun_form_type || PartnerConst.Fun_Form.Drama;
|
|
this.form_show_type = params.show_type || HeroConst.FormShowType.eFormFight;
|
|
this.setting = params.setting || {};
|
|
if (this.tween) {
|
|
this.tween.stop();
|
|
}
|
|
this.svcList.cleanFocus();
|
|
//生成空白位置
|
|
//设置缓存池9
|
|
this.pool = nx.pools.getPool(this.fabItemForm.name, this.fabItemForm, 9);
|
|
for (var _i10 = 1; _i10 <= 9; _i10++) {
|
|
var item = this.pool ? this.pool.get() : cc.instantiate(this.fabItemForm);
|
|
item.parent = this.hero_main;
|
|
this.hero_item_list[_i10] = item.getComponent("cmp.item.battledrama.form");
|
|
if (this.hero_item_list[_i10].rebind) {
|
|
this.hero_item_list[_i10].rebind(_i10, {}, "");
|
|
}
|
|
}
|
|
// --先初始化按鈕
|
|
//不同类型的战斗,隐藏战斗页签,直接触发战斗布阵
|
|
if (this.form_show_type == HeroConst.FormShowType.eFormSave) {
|
|
this.top_con.active = true;
|
|
if (this.setting.need_hide_top) {
|
|
this.top_con.active = false;
|
|
}
|
|
} else if (this.form_show_type == HeroConst.FormShowType.eFormFormation) {
|
|
this.top_con.active = false;
|
|
} else {
|
|
this.top_con.active = false;
|
|
}
|
|
|
|
//是否开启僚机
|
|
var open_cfg = game.configs.source_data.data_source_data[38].lev_limit;
|
|
var ret = nx.bridge.checkConditions([open_cfg]);
|
|
if (!ret.val) {
|
|
this.elfin_btn.active = true;
|
|
} else {
|
|
this.elfin_btn.active = false;
|
|
}
|
|
|
|
// //--先初始化按鈕
|
|
this.initTabBtnList();
|
|
this.updateCamp(); //加载英雄列表
|
|
|
|
this.scheduleOnce(function () {
|
|
_this.togCamp.posTog = _this.onTogCamp.bind(_this);
|
|
_this.togArmy.posTog = _this.onTogArmy.bind(_this);
|
|
_this.freshTogs();
|
|
_this.freshList();
|
|
|
|
//指尖特效
|
|
var spine_path = PathTool.getSpinePath("E80009", "action", false);
|
|
if (_this.move_circle_sk) {
|
|
_this.move_circle_sk.load(spine_path);
|
|
}
|
|
}, 0.2);
|
|
},
|
|
onDisable: function onDisable() {
|
|
// 监听事件释放
|
|
this.unbindGEvents();
|
|
this.svcList.rebuild([]);
|
|
this.hero_main.off(cc.Node.EventType.TOUCH_START, this);
|
|
this.hero_main.off(cc.Node.EventType.TOUCH_CANCEL, this);
|
|
this.hero_main.off(cc.Node.EventType.TOUCH_MOVE, this);
|
|
this.hero_main.off(cc.Node.EventType.TOUCH_END, this);
|
|
|
|
// 节点回收
|
|
if (this.pool) {
|
|
for (var _i11 in this.hero_item_list) {
|
|
var node = this.hero_item_list[_i11];
|
|
if (node.svItem) {
|
|
this.pool.put(node.svItem.node);
|
|
}
|
|
}
|
|
}
|
|
var hero_list = this.model.getHeroList();
|
|
for (var k in hero_list) {
|
|
var hero_vo = hero_list[k];
|
|
hero_vo.is_ui_select = false;
|
|
}
|
|
this.showMoveSk(false);
|
|
this.hero_item_list = {};
|
|
nx.bridge.NodeChidrenDestroy(this.hero_main);
|
|
},
|
|
//--------------------旧版本代码-------------------------
|
|
onClickElfinBtn: function onClickElfinBtn() {
|
|
var self = this;
|
|
if (!self.elfin_team_data_list[this.fun_form_type][self.select_team_index]) return;
|
|
if (!self.cur_tab_data) return;
|
|
var elfin_tree_data = ElfinController.getInstance().getModel().getElfinTreeData();
|
|
// --古樹信息沒有回來不給點
|
|
if (elfin_tree_data == null) return;
|
|
var setting = {};
|
|
setting.fun_form_type = self.cur_tab_data.fun_form_type;
|
|
self.setPlanSettingInfo(setting);
|
|
ElfinController.getInstance().openElfinAdjustWindow(true, this.fun_form_type, setting.team_index, setting);
|
|
},
|
|
setPlanSettingInfo: function setPlanSettingInfo(setting) {
|
|
var self = this;
|
|
if (!setting) return;
|
|
// --team_list結構參考 26555協議team_list
|
|
var _teamFilterInfo = function _teamFilterInfo(team_list, filter_index) {
|
|
var dic_item_id = {};
|
|
for (var _i12 in team_list) {
|
|
var v = team_list[_i12];
|
|
if (filter_index != v.team) {
|
|
if (v.sprites) {
|
|
for (var j in v.sprites) {
|
|
var _sp = v.sprites[j];
|
|
if (dic_item_id[_sp.item_bid] == null) {
|
|
dic_item_id[_sp.item_bid] = 1;
|
|
} else {
|
|
dic_item_id[_sp.item_bid] = dic_item_id[_sp.item_bid] + 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return dic_item_id;
|
|
};
|
|
if (self.fun_form_type == PartnerConst.Fun_Form.Drama) {
|
|
setting.dic_filter_item_id = {};
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.team_index = 1;
|
|
} else {
|
|
if (self.fun_form_type == PartnerConst.Fun_Form.CrossArenaDef || self.fun_form_type == PartnerConst.Fun_Form.CrossArena || self.fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef) {
|
|
// --多隊伍 有總覽的 需要跳過總覽
|
|
setting.team_index = this.select_team_index;
|
|
setting.dic_filter_item_id = _teamFilterInfo(self.elfin_team_data_list[this.fun_form_type], setting.team_index);
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][setting.team_index];
|
|
setting.total_team_info = self.elfin_team_data_list[this.fun_form_type];
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.HeavenBoss || self.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch || self.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
//未处理
|
|
// --多隊伍沒有總覽的
|
|
setting.team_index = self.select_team_index;
|
|
setting.dic_filter_item_id = _teamFilterInfo(self.elfin_team_data_list[this.fun_form_type], setting.team_index);
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.total_team_info = self.elfin_team_data_list[this.fun_form_type];
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
//--段位賽
|
|
var match_type = self.setting.state || ElitematchConst.MatchType.eNormalMatch;
|
|
if (match_type == 1) {
|
|
//段位賽的
|
|
setting.dic_filter_item_id = {};
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.team_index = 1;
|
|
} else if (match_type == 2) {
|
|
//王者賽的
|
|
setting.team_index = self.select_team_index;
|
|
setting.dic_filter_item_id = _teamFilterInfo(self.elfin_team_data_list[this.fun_form_type], setting.team_index);
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.total_team_info = self.elfin_team_data_list[this.fun_form_type];
|
|
} else if (match_type == 3) {
|
|
setting.team_index = self.select_team_index;
|
|
setting.dic_filter_item_id = _teamFilterInfo(self.elfin_team_data_list[this.fun_form_type], setting.team_index);
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.total_team_info = self.elfin_team_data_list[this.fun_form_type];
|
|
} else if (match_type == 4) {
|
|
setting.team_index = self.select_team_index;
|
|
setting.dic_filter_item_id = _teamFilterInfo(self.elfin_team_data_list[this.fun_form_type], setting.team_index);
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.total_team_info = self.elfin_team_data_list[this.fun_form_type];
|
|
}
|
|
setting.match_type = match_type;
|
|
} else {
|
|
setting.dic_filter_item_id = {};
|
|
setting.cur_plan_data = self.elfin_team_data_list[this.fun_form_type][self.select_team_index];
|
|
setting.team_index = 1;
|
|
}
|
|
}
|
|
},
|
|
initEflinInfoList: function initEflinInfoList(data) {
|
|
// return;
|
|
var self = this;
|
|
if (!self.tab_list) return;
|
|
if (self.fun_form_type == PartnerConst.Fun_Form.Drama) {
|
|
for (var _i13 in self.tab_list) {
|
|
var v = this.tab_list[_i13];
|
|
if (v.fun_form_type == data.type) {
|
|
if (!this.elfin_team_data_list[v.fun_form_type]) {
|
|
self.elfin_team_data_list[v.fun_form_type] = {};
|
|
}
|
|
self.elfin_team_data_list[v.fun_form_type][v.index] = data.team_list[0];
|
|
if (self.select_team_index == v.index) {
|
|
self.updateElfinList(self.elfin_team_data_list[v.fun_form_type][v.index]);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
if (self.fun_form_type == data.type) {
|
|
var cur_index = self.select_team_index;
|
|
if (!this.elfin_team_data_list[this.fun_form_type]) {
|
|
this.elfin_team_data_list[this.fun_form_type] = {};
|
|
}
|
|
if (self.fun_form_type == PartnerConst.Fun_Form.CrossArenaDef ||
|
|
//未处理
|
|
self.fun_form_type == PartnerConst.Fun_Form.CrossArena ||
|
|
//未处理
|
|
self.fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef) {
|
|
//未处理
|
|
|
|
//先分配隊伍
|
|
for (var index in data.team_list) {
|
|
var mv = data.team_list[index];
|
|
self.elfin_team_data_list[this.fun_form_type][mv.team] = mv;
|
|
}
|
|
//如果仍然有空隊伍,則需要設置缺省隊伍
|
|
for (var i2 = 2; i2 <= 4; i2++) {
|
|
if (self.elfin_team_data_list[this.fun_form_type][i2] == null) {
|
|
self.elfin_team_data_list[this.fun_form_type][i2] = self.getDefaultTeamInfo(i2);
|
|
}
|
|
}
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.HeavenBoss || data.type == PartnerConst.Fun_Form.EliteKingMatch || data.type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
//天界副本 未处理
|
|
// --多隊伍沒有總覽的
|
|
for (var hea in data.team_list) {
|
|
var v1 = data.team_list[hea];
|
|
self.elfin_team_data_list[this.fun_form_type][v1.team] = v1;
|
|
}
|
|
for (var i3 = 1; i3 <= 2; i3++) {
|
|
if (self.elfin_team_data_list[this.fun_form_type][i3] == null) {
|
|
self.elfin_team_data_list[this.fun_form_type][i3] = self.getDefaultTeamInfo(i3);
|
|
}
|
|
}
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.EliteMatch || self.fun_form_type == PartnerConst.Fun_Form.EliteDefend) {
|
|
//段位賽
|
|
if (this.from_lock) {
|
|
cur_index = self.select_team_index;
|
|
}
|
|
var match_type = self.setting.state || ElitematchConst.MatchType.eNormalMatch;
|
|
if (match_type == 1) {
|
|
//段位賽的
|
|
if (this.from_lock) {
|
|
self.elfin_team_data_list[this.fun_form_type][this.select_team_index] = data.team_list[0];
|
|
} else {
|
|
self.elfin_team_data_list[this.fun_form_type][this.select_team_index] = data.team_list[0];
|
|
}
|
|
} else {
|
|
self.elfin_team_data_list[this.fun_form_type][this.select_team_index] = data.team_list[0];
|
|
}
|
|
} else {
|
|
self.elfin_team_data_list[this.fun_form_type][this.select_team_index] = data.team_list[0];
|
|
}
|
|
|
|
// --設置內容
|
|
for (var _i14 in self.tab_list) {
|
|
var v2 = this.tab_list[_i14];
|
|
if (v2.fun_form_type == this.fun_form_type) {
|
|
self.updateElfinList(self.elfin_team_data_list[v2.fun_form_type][cur_index]);
|
|
}
|
|
}
|
|
} else if (data.type == PartnerConst.Fun_Form.EliteKingMatch || data.type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
//王者賽..比較特殊 = =
|
|
var _match_type = self.setting.state || ElitematchConst.MatchType.eNormalMatch;
|
|
if (_match_type == 2 || _match_type == 4) {
|
|
for (var king in data.team_list) {
|
|
var v3 = data.team_list[king];
|
|
self.elfin_team_data_list[v3.fun_form_type][v3.team] = v3;
|
|
}
|
|
for (var i4 = 1; i4 <= 2; i4++) {
|
|
if (self.elfin_team_data_list[this.fun_form_type][i4] == null) {
|
|
self.elfin_team_data_list[this.fun_form_type][i4] = self.getDefaultTeamInfo(i4);
|
|
}
|
|
}
|
|
for (var _i15 in self.tab_list) {
|
|
var v4 = this.tab_list[_i15];
|
|
if (v4.index == this.select_team_index) {
|
|
self.updateElfinList(self.elfin_team_data_list[v4.fun_form_type][this.select_team_index]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
getDefaultTeamInfo: function getDefaultTeamInfo(team_index) {
|
|
var self = this;
|
|
var default_elfin_info = {};
|
|
default_elfin_info.sprites = [];
|
|
for (var _i16 = 1; _i16 <= 4; _i16++) {
|
|
var item_bid = ElfinController.getInstance().getModel().getElfinItemByPos(_i16);
|
|
if (item_bid) {
|
|
default_elfin_info.sprites.push({
|
|
pos: _i16,
|
|
item_bid: 0
|
|
});
|
|
}
|
|
}
|
|
default_elfin_info.plan_id = 0;
|
|
default_elfin_info.team = team_index;
|
|
return default_elfin_info;
|
|
},
|
|
// -- 更新精靈
|
|
updateElfinList: function updateElfinList(data) {
|
|
// return;
|
|
var self = this;
|
|
if (!data) return;
|
|
self.save_elfin_data = data; //保存一下 用於古樹信息返回處理用的..
|
|
var elfin_bid_list = data.sprites;
|
|
var getElfinBidByPos = function getElfinBidByPos(pos) {
|
|
var elfin_bid;
|
|
for (var k in elfin_bid_list) {
|
|
var v = elfin_bid_list[k];
|
|
if (v.pos == pos) {
|
|
elfin_bid = v.item_bid;
|
|
break;
|
|
}
|
|
}
|
|
return elfin_bid;
|
|
};
|
|
var is_play_effect = false;
|
|
for (var _i17 = 1; _i17 <= 4; _i17++) {
|
|
var elfin_bid = getElfinBidByPos(_i17);
|
|
var elfin_item = this.elfin_btn.getChildByName(String(_i17));
|
|
self.elfin_item_list[_i17] = elfin_item;
|
|
// let item_bid = ElfinController.getInstance().getModel().getElfinItemByPos( i );
|
|
if (elfin_bid > 0) {
|
|
// || ( this.fun_form_type == PartnerConst.Fun_Form.Heaven || this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss )
|
|
var bid = elfin_bid || 0;
|
|
var elfin_cfg = gdata("sprite_data", "data_elfin_data", bid);
|
|
elfin_item.active = true;
|
|
is_play_effect = true;
|
|
} else {
|
|
elfin_item.active = false;
|
|
}
|
|
}
|
|
this.updateElfinEffect(is_play_effect);
|
|
},
|
|
updateElfinEffect: function updateElfinEffect(is_play) {
|
|
var sps = nx.gui.getComponent(this.elfin_btn, "sp", sp.Skeleton);
|
|
if (!sps) return;
|
|
if (!is_play) {
|
|
sps.clearTracks();
|
|
sps.node.active = false;
|
|
} else {
|
|
sps.node.active = true;
|
|
var effect_path = PathTool.getSpinePath("E80006");
|
|
nx.res.loadRes(effect_path, sp.SkeletonData, function (_e, _p) {
|
|
if (_e) {
|
|
return;
|
|
}
|
|
if (sps && sps.skeletonData) {
|
|
sps.skeletonData = _p;
|
|
sps.setAnimation(0, "action", true);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
// --其他佈陣信息
|
|
initFormInfo: function initFormInfo(data) {
|
|
var self = this;
|
|
if (!data) return;
|
|
var formation_config = game.configs.formation_data.data_form_data[data.formation_type];
|
|
if (!formation_config) return;
|
|
// --是否佈陣網絡信息返回
|
|
self.is_form_back = true;
|
|
self.formation_type = data.formation_type;
|
|
self.hallows_id = data.hallows_id || 1;
|
|
},
|
|
// --劇情界面多隊伍的按鈕
|
|
onClickTeamTabBtn: function onClickTeamTabBtn(index, is_check) {
|
|
var self = this;
|
|
// if( self.select_team_index && self.select_team_index == index ) return;
|
|
if (!this.cur_tab_data) return;
|
|
|
|
// --標誌是否需要更新數據 從 index =1 變到index = 非1的
|
|
var is_change_data = false;
|
|
self.team_cur_tab = self.team_btns.children[index - 1];
|
|
// this.team_formation_data = dic_more_team_data[ index ];
|
|
self.select_team_index = index;
|
|
//多只队伍需要再次配置cur_tab_data
|
|
for (var _i18 in this.tab_list) {
|
|
var tab = this.tab_list[_i18];
|
|
if (index == tab.index) {
|
|
this.cur_tab_data = tab;
|
|
}
|
|
}
|
|
if (self.team_cur_tab != null) {
|
|
self.team_cur_tab.getComponent(cc.Toggle).isCheck = true;
|
|
}
|
|
|
|
// --這裡要處理 把 可能會修改的英雄數據 分
|
|
if (!this.team_data_list[this.fun_form_type]) {
|
|
this.initFormatInfo();
|
|
} else {
|
|
var dic_more_team_data = this.team_data_list[this.fun_form_type][index];
|
|
if (!dic_more_team_data) return;
|
|
// --說明切換頁簽了
|
|
if (this.team_data_list[this.fun_form_type][this.select_team_index]) {
|
|
this.updageFormType(this.team_data_list[this.fun_form_type][this.select_team_index].formation_type);
|
|
this.updateOtherFormation(this.team_data_list[this.fun_form_type][this.select_team_index]);
|
|
this.updateListSelectItem();
|
|
}
|
|
}
|
|
|
|
//刷新僚機
|
|
if (this.elfin_team_data_list[this.fun_form_type] && this.elfin_team_data_list[this.fun_form_type][index]) {
|
|
this.updateElfinList(this.elfin_team_data_list[this.fun_form_type][index]);
|
|
}
|
|
},
|
|
// --設置精英賽佈陣信息的缺省數據 目前王者賽、天界副本boss關用
|
|
setEliteMatchDefaultInfo: function setEliteMatchDefaultInfo(max_team_count) {
|
|
var self = this;
|
|
if (!max_team_count) return;
|
|
for (var _i19 = 1; _i19 <= max_team_count; _i19++) {
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch || self.fun_form_type == PartnerConst.Fun_Form.CrossArena || self.fun_form_type == PartnerConst.Fun_Form.CrossArenaDef || self.fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef || this.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
// --目前只有王者賽有兩個隊伍
|
|
if (self.team_data_list[this.fun_form_type][_i19] == null) {
|
|
var data = {};
|
|
data.formation_type = 1;
|
|
data.hallows_id = 0;
|
|
data.order = _i19;
|
|
data.pos_info = [];
|
|
data.type = this.fun_form_type;
|
|
self.team_data_list[this.fun_form_type][_i19] = data;
|
|
}
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.HeavenBoss) {
|
|
if (self.team_data_list[this.fun_form_type][_i19] == null) {
|
|
var _data3 = {};
|
|
_data3.formation_type = 1;
|
|
_data3.hallows_id = 0;
|
|
_data3.pos_info = [];
|
|
self.team_data_list[this.fun_form_type][_i19] = _data3;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
initTabBtnList: function initTabBtnList() {
|
|
var self = this;
|
|
self.tab_list = [];
|
|
if (self.fun_form_type == PartnerConst.Fun_Form.Drama) {
|
|
if (self.form_show_type == HeroConst.FormShowType.eFormFight) {
|
|
//出戰
|
|
self.setTabData(self.fun_form_type, "隊伍", 1);
|
|
} else {
|
|
//--劇情保存佈陣 要顯示好多
|
|
var config_list = game.configs.partner_data.data_partner_form;
|
|
for (var k in config_list) {
|
|
var config = config_list[k];
|
|
var team_cfg = PartnerConst.Get_Teams[config.form_type];
|
|
self.setTabData(config.form_type, config.name, config.index, 1, team_cfg ? true : false, true);
|
|
}
|
|
}
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
self.setTabData(self.fun_form_type, "隊伍一", 1);
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.EliteDefend) {
|
|
self.setTabData(self.fun_form_type, "隊伍一", 1);
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch) {
|
|
self.setTabData(self.fun_form_type, "隊伍一", 1, 1, true);
|
|
self.setTabData(self.fun_form_type, "隊伍二", 2, 2, true);
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
self.setTabData(self.fun_form_type, "隊伍一", 1, 1, true);
|
|
self.setTabData(self.fun_form_type, "隊伍二", 2, 2, true);
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.HeavenBoss) {
|
|
self.setTabData(self.fun_form_type, "隊伍一", 1, 1, true);
|
|
self.setTabData(self.fun_form_type, "隊伍二", 2, 2, true);
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.ArenaTeam) {
|
|
self.setTabData(self.fun_form_type, "隊伍一", 1, 1, true);
|
|
self.setTabData(self.fun_form_type, "隊伍二", 2, 2, true);
|
|
self.setTabData(self.fun_form_type, "隊伍二", 3, 2, true);
|
|
} else if (self.fun_form_type == PartnerConst.Fun_Form.CrossArena || self.fun_form_type == PartnerConst.Fun_Form.CrossArenaDef || self.fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef) {
|
|
self.setTabData(self.fun_form_type, "總覽", 1, 0, false);
|
|
self.setTabData(self.fun_form_type, "隊伍一", 2, 1, true);
|
|
self.setTabData(self.fun_form_type, "隊伍二", 3, 2, true);
|
|
self.setTabData(self.fun_form_type, "隊伍三", 4, 3, true);
|
|
} else {
|
|
self.setTabData(self.fun_form_type, "隊伍", 1);
|
|
}
|
|
var sort_func = Utils.tableLowerSorter(["sort_index"], ["index"]);
|
|
this.tab_list.sort(sort_func);
|
|
;
|
|
},
|
|
setTabData: function setTabData(fun_form_type, name, index, order, is_multiple, is_check) {
|
|
var self = this;
|
|
var tab_data = {};
|
|
tab_data.fun_form_type = fun_form_type; //陣法類型
|
|
tab_data.name = name; //--陣法名字
|
|
tab_data.index = index; //--陣法排序
|
|
tab_data.is_multiple = is_multiple || false; //是否會有多隊伍
|
|
tab_data.order = order || 1; //隊伍序號
|
|
// --是否要加一個需要加一個開啟顯示
|
|
if (is_check) {
|
|
tab_data.sort_index = 0;
|
|
tab_data.is_lock = false;
|
|
if (fun_form_type == PartnerConst.Fun_Form.Arena) {
|
|
//--競技場的 冠軍賽的開啟條件
|
|
var Arena_cfg = game.configs.source_data.data_source_data[42];
|
|
var obj = nx.bridge.checkConditions([Arena_cfg.lev_limit]);
|
|
tab_data.is_lock = obj.val ? true : false;
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.ArenaChampion) {
|
|
var Cham_cfg = game.configs.source_data.data_source_data[80];
|
|
var _obj = nx.bridge.checkConditions([Cham_cfg.lev_limit]);
|
|
tab_data.is_lock = _obj.val ? true : false;
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.Ladder) {
|
|
// --天梯
|
|
var Lad_cfg = game.configs.source_data.data_source_data[126];
|
|
var _obj2 = nx.bridge.checkConditions([Lad_cfg.lev_limit]);
|
|
tab_data.is_lock = _obj2.val ? true : false;
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.EliteMatch || fun_form_type == PartnerConst.Fun_Form.EliteKingMatch) {
|
|
// --精英賽
|
|
var Elt_cfg = game.configs.source_data.data_source_data[115];
|
|
var _obj3 = nx.bridge.checkConditions([Elt_cfg.lev_limit]);
|
|
tab_data.is_lock = _obj3.val ? true : false;
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.ArenaTeam) {
|
|
//組隊競技場
|
|
var Team_cfg = game.configs.source_data.data_source_data[123];
|
|
var _obj4 = nx.bridge.checkConditions([Team_cfg.lev_limit]);
|
|
tab_data.is_lock = _obj4.val ? true : false;
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.CrossArenaDef) {
|
|
//跨服競技場
|
|
var Cross_cfg = game.configs.source_data.data_source_data[120];
|
|
var _obj5 = nx.bridge.checkConditions([Cross_cfg.lev_limit]);
|
|
tab_data.is_lock = _obj5.val ? true : false;
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef) {
|
|
//巔峰冠軍賽
|
|
var Peak_cfg = game.configs.source_data.data_source_data[124];
|
|
var _obj6 = nx.bridge.checkConditions([Peak_cfg.lev_limit]);
|
|
tab_data.is_lock = _obj6.val ? true : false;
|
|
}
|
|
} else {
|
|
tab_data.sort_index = 0;
|
|
tab_data.is_lock = false;
|
|
}
|
|
this.tab_list.push(tab_data);
|
|
},
|
|
updateCamp: function updateCamp() {
|
|
// console.log( "当前的类型是--->>>>" + this.fun_form_type );
|
|
this.cur_role_list = []; //英雄列表
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Expedit_Fight) {} else if (this.fun_form_type == PartnerConst.Fun_Form.EndLess) {
|
|
this.cur_role_list = this.model.getRestHeroListByCamp(this.cur_camp || 0);
|
|
var list = this.setting.has_hire_list || {};
|
|
var partner_config = game.configs.partner_data.data_partner_base;
|
|
for (var i in list) {
|
|
var v = list[i];
|
|
var config = partner_config[v.bid];
|
|
if (this.cur_camp == 0 || this.cur_camp == config.camp_type) {
|
|
var vo = new HeroVo();
|
|
vo.bid = v.bid;
|
|
vo.partner_id = v.id + 100000; //因为援助id与自己英雄id会冲突,所以就行特殊处理
|
|
vo.star = v.star;
|
|
vo.power = v.power;
|
|
vo.camp_type = config.camp_type;
|
|
vo.rid = v.rid;
|
|
vo.srv_id = v.srv_id;
|
|
vo.is_used = v.is_used;
|
|
vo.lev = v.lev;
|
|
vo.ext_data = v.ext_data;
|
|
vo.is_employ = true;
|
|
vo.is_endless = true;
|
|
vo.pos_type = partner_config[v.bid].pos_type;
|
|
this.cur_role_list.unshift(vo);
|
|
}
|
|
}
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
var list = PlanesafkController.getInstance().getModel().getAllPlanesHeroData() || {};
|
|
var partner_config = game.configs.partner_data.data_partner_base;
|
|
for (var i in list) {
|
|
var v = list[i];
|
|
v.is_employ = v.flag == 1;
|
|
var config = partner_config[v.bid];
|
|
if (this.cur_camp == 0 || this.cur_camp == config.camp_type) {
|
|
v.camp_type = config.camp_type;
|
|
v.pos_type = config.pos_type;
|
|
this.cur_role_list.push(v);
|
|
}
|
|
}
|
|
if (this.cur_role_list.length > 0) {
|
|
this.cur_role_list.sort(Utils.tableUpperSorter(["star", "lev", "flag"]));
|
|
}
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.YearBoss || this.fun_form_type == PartnerConst.Fun_Form.YearCross || this.fun_form_type == PartnerConst.Fun_Form.YearDefend) {
|
|
var tag_camp = this.setting.period;
|
|
var all_heros = [];
|
|
if (tag_camp == 1) {
|
|
//三系
|
|
var alls = this.model.getRestHeroListByCamp(0 || this.cur_camp);
|
|
var temp = [];
|
|
for (var p in alls) {
|
|
if (alls[p].camp_type == 1 || alls[p].camp_type == 2 || alls[p].camp_type == 3) {
|
|
temp.push(alls[p]);
|
|
}
|
|
}
|
|
for (var t in temp) {
|
|
if (temp[t].camp_type == this.cur_camp || this.cur_camp == 0) {
|
|
all_heros.push(temp[t]);
|
|
}
|
|
}
|
|
} else if (tag_camp == 3) {
|
|
//光暗
|
|
var alls2 = this.model.getRestHeroListByCamp(0 || this.cur_camp);
|
|
var temp2 = [];
|
|
for (var p2 in alls2) {
|
|
if (alls2[p2].camp_type == 4 || alls2[p2].camp_type == 5) {
|
|
temp2.push(alls2[p2]);
|
|
}
|
|
}
|
|
for (var t2 in temp2) {
|
|
if (temp2[t2].camp_type == this.cur_camp || this.cur_camp == 0) {
|
|
all_heros.push(temp2[t2]);
|
|
}
|
|
}
|
|
} else {
|
|
all_heros = this.model.getRestHeroListByCamp(this.cur_camp || 0);
|
|
}
|
|
// this.model.getRestHeroListByCamp( this.cur_camp || 0 );
|
|
this.cur_role_list = all_heros;
|
|
} else {
|
|
this.cur_role_list = this.model.getRestHeroListByCamp(this.cur_camp || 0);
|
|
this.cur_role_list.sort(Utils.tableUpperSorter(["star", "power", "lev", "flag"]));
|
|
}
|
|
var boold_type = null;
|
|
var from_type = HeroConst.ExhibitionItemType.eFormFight;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Expedit_Fight) {
|
|
//远征
|
|
from_type = HeroConst.ExhibitionItemType.eExpeditFight;
|
|
boold_type = true;
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EndLess) {
|
|
//无尽试炼
|
|
from_type = HeroConst.ExhibitionItemType.eEndLessHero;
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
//位面
|
|
from_type = HeroConst.ExhibitionItemType.ePlanes;
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
//段位賽
|
|
from_type = HeroConst.ExhibitionItemType.ePlanes;
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch) {
|
|
//段位王者賽
|
|
from_type = HeroConst.ExhibitionItemType.ePlanes;
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteDefend) {
|
|
from_type = HeroConst.ExhibitionItemType.ePlanes;
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
from_type = HeroConst.ExhibitionItemType.ePlanes;
|
|
}
|
|
},
|
|
onClickHeroExhibiton: function onClickHeroExhibiton(click_item) {
|
|
if (!click_item) return;
|
|
if (this.is_play_item_action) return;
|
|
this.selectHero(click_item);
|
|
},
|
|
initFormatInfo: function initFormatInfo() {
|
|
// 视图类型
|
|
if (this.form_show_type == HeroConst.FormShowType.eFormSave || this.form_show_type == HeroConst.FormShowType.eFormFormation) {
|
|
this.key_up_btn.active = true;
|
|
this.save_btn.active = true;
|
|
this.fight_btn.active = false;
|
|
} else if (this.form_show_type == HeroConst.FormShowType.eFixedType) {
|
|
this.key_up_btn.active = false;
|
|
this.save_btn.active = false;
|
|
this.fight_btn.active = true;
|
|
this.hallow_btn.active = false;
|
|
// this.halo_btn.active = false;
|
|
this.elfin_btn.active = false;
|
|
this.powerNd.active = false;
|
|
this.formation_btn.active = false;
|
|
} else {
|
|
this.key_up_btn.active = true;
|
|
this.save_btn.active = false;
|
|
this.fight_btn.active = true;
|
|
}
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Drama) {
|
|
this.upateDramaFormation();
|
|
this.updateHallowsIcon();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
PlanesafkController.getInstance().sender28612();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
ElitematchController.getInstance().sender24920(1);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch) {
|
|
ElitematchController.getInstance().sender24920(2);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteDefend) {
|
|
ElitematchController.getInstance().sender24920(3);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
ElitematchController.getInstance().sender24920(4);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Heaven) {
|
|
HeavenController.getInstance().sender25210(1);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss) {
|
|
HeavenController.getInstance().sender25210(2);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.YearBoss || this.fun_form_type == PartnerConst.Fun_Form.YearCross || this.fun_form_type == PartnerConst.Fun_Form.YearDefend) {
|
|
CampfightMod.getInstance().reqForm(this.fun_form_type, this.setting.period);
|
|
} else {
|
|
// 其他的都根据协议获取阵容
|
|
this.ctrl.sender11211(this.fun_form_type);
|
|
}
|
|
},
|
|
// 更新剧情布阵
|
|
upateDramaFormation: function upateDramaFormation() {
|
|
this.is_form_back = true;
|
|
this.formation_type = this.model.use_formation_type;
|
|
this.hallows_id = this.model.use_hallows_id;
|
|
this.formation_config = game.configs.formation_data.data_form_data[this.formation_type];
|
|
var pos_list = this.model.getMyPosList();
|
|
if (!this.team_data_list[this.fun_form_type]) {
|
|
this.team_data_list[this.fun_form_type] = {};
|
|
}
|
|
this.team_data_list[this.fun_form_type][1] = {};
|
|
this.team_data_list[this.fun_form_type][1].hallows_id = this.hallows_id;
|
|
this.team_data_list[this.fun_form_type][1].pos_info = pos_list;
|
|
this.team_data_list[this.fun_form_type][1].formation_type = this.formation_type;
|
|
if (!this.formation_config) return;
|
|
this.updateFormationStation(this.formation_config);
|
|
this.updateFiveHeroItem(pos_list, this.formation_config);
|
|
},
|
|
updateOtherFormation: function updateOtherFormation(from_data) {
|
|
this.formation_type = from_data.formation_type;
|
|
this.hallows_id = from_data.hallows_id;
|
|
this.formation_config = game.configs.formation_data.data_form_data[this.formation_type];
|
|
this.updateFormationStation(this.formation_config);
|
|
var pos_info = {};
|
|
for (var _i20 in from_data.pos_info) {
|
|
pos_info[from_data.pos_info[_i20].pos] = from_data.pos_info[_i20];
|
|
}
|
|
this.updateFiveHeroItem(pos_info, this.formation_config);
|
|
this.updateHallowsIcon();
|
|
},
|
|
// 更新战位信息
|
|
updateFormationStation: function updateFormationStation(formation_config) {
|
|
// 显示所有背景框
|
|
var cdn = this.table_main.children;
|
|
for (var _i21 in cdn) {
|
|
if (cdn[_i21]) {
|
|
cdn[_i21].opacity = 255;
|
|
var e = cdn[_i21].getChildByName("effect");
|
|
e.getComponent(sp.Skeleton).clearTracks();
|
|
e.active = false;
|
|
}
|
|
}
|
|
var dic_pos_index = {};
|
|
var temp_five_heros = this.five_hero_vo; //保存的临时数据
|
|
this.five_hero_vo = {};
|
|
for (var _i22 in formation_config.pos) {
|
|
var v = formation_config.pos[_i22];
|
|
var _index2 = v[0];
|
|
var pos = v[1];
|
|
dic_pos_index[pos] = _index2;
|
|
// --更新位置
|
|
if (this.hero_item_list[_index2]) {
|
|
cdn[pos - 1].form_index = pos;
|
|
var effect = cdn[pos - 1].getChildByName("effect");
|
|
effect.active = true;
|
|
effect.getComponent(sp.Skeleton).setAnimation(0, "action", true);
|
|
this.hero_item_list[_index2].index = pos;
|
|
this.hero_item_list[_index2].is_use = true;
|
|
this.hero_item_list[_index2].node.zIndex = pos;
|
|
this.hero_item_list[_index2].node.position = this.nine_position[pos];
|
|
|
|
//换位之后需要重新设置key
|
|
if (!nx.dt.objEmpty(temp_five_heros)) {
|
|
for (var key in temp_five_heros) {
|
|
if (this.hero_item_list[_index2].mdata) {
|
|
if (this.hero_item_list[_index2].mdata.partner_id == temp_five_heros[key].partner_id) {
|
|
var obj = temp_five_heros[key];
|
|
this.five_hero_vo[pos] = obj;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (pos <= 3) {
|
|
//后 中 前
|
|
this.pos_name_list[_index2] = [1, pos]; //--位置 前
|
|
} else if (pos > 3 && pos <= 6) {
|
|
this.pos_name_list[_index2] = [2, pos]; //--位置 中
|
|
} else {
|
|
this.pos_name_list[_index2] = [3, pos]; //--位置 後
|
|
}
|
|
}
|
|
|
|
// --沒使用的要變灰變暗
|
|
var index = 6;
|
|
for (var _pos = 1; _pos <= 9; _pos++) {
|
|
if (dic_pos_index[_pos] == null) {
|
|
cdn[_pos - 1].opacity = 100;
|
|
index++;
|
|
if (index > 9) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
var index2 = 6;
|
|
for (var pos2 = 1; pos2 <= 9; pos2++) {
|
|
if (dic_pos_index[pos2] == null) {
|
|
cdn[pos2 - 1].form_index = pos2;
|
|
this.hero_item_list[index2].index = pos2;
|
|
this.hero_item_list[index2].is_use = false;
|
|
this.hero_item_list[index2].node.zIndex = pos2;
|
|
this.hero_item_list[index2].node.position = this.nine_position[pos2];
|
|
index2++;
|
|
if (index2 > 9) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.updateFormationIcon();
|
|
},
|
|
getHeroByIdPlane: function getHeroByIdPlane(id) {
|
|
if (!this.cur_role_list) return;
|
|
for (var _i23 in this.cur_role_list) {
|
|
if (id == this.cur_role_list[_i23].partner_id) {
|
|
return this.cur_role_list[_i23];
|
|
}
|
|
}
|
|
return {};
|
|
},
|
|
// 更新上阵英数据
|
|
updateFiveHeroItem: function updateFiveHeroItem(pos_info, formation_config) {
|
|
var hero_vo_list = {};
|
|
for (var pos_i in pos_info) {
|
|
var hero_vo = null;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
hero_vo = this.getHeroByIdPlane(pos_info[pos_i].id);
|
|
} else {
|
|
hero_vo = this.model.getHeroById(pos_info[pos_i].id);
|
|
}
|
|
var pos_key = null;
|
|
for (var _i24 in formation_config.pos) {
|
|
var v = formation_config.pos[_i24];
|
|
if (pos_i == v[0]) {
|
|
pos_key = v[1];
|
|
}
|
|
}
|
|
hero_vo_list[pos_key] = hero_vo;
|
|
}
|
|
|
|
// 更新英雄item数据
|
|
for (var item_i in this.hero_item_list) {
|
|
if (hero_vo_list[this.hero_item_list[item_i].index]) {
|
|
this.hero_item_list[item_i].rebind(this.hero_item_list[item_i].index, hero_vo_list[this.hero_item_list[item_i].index], "");
|
|
} else {
|
|
this.hero_item_list[item_i].rebind(this.hero_item_list[item_i].index, {}, "");
|
|
}
|
|
}
|
|
this.five_hero_vo = hero_vo_list;
|
|
//全部更新多隊伍設置
|
|
if (PartnerConst.Get_Teams[this.fun_form_type]) {
|
|
if (!this.team_five_hero_vo[this.fun_form_type]) {
|
|
this.team_five_hero_vo[this.fun_form_type] = {};
|
|
}
|
|
this.team_five_hero_vo[this.fun_form_type][this.select_team_index] = this.five_hero_vo;
|
|
}
|
|
this.updateListSelectItem();
|
|
this.updateFightPower(); // 更新战力
|
|
},
|
|
|
|
// 更新item_list信息
|
|
updateListSelectItem: function updateListSelectItem() {
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var list_index = this.getCurListIndexByParId(this.five_hero_vo[hero_i].partner_id);
|
|
if (list_index >= 0) {
|
|
this.partners[list_index].is_ui_select = true;
|
|
this.svcList.addFocus(list_index);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
// 更新战力
|
|
updateFightPower: function updateFightPower() {
|
|
var power = 0;
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) power = power + this.five_hero_vo[hero_i].power || 0;
|
|
}
|
|
this.fight_label.string = power;
|
|
this.calculateCampHaloType();
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss || this.fun_form_type == PartnerConst.Fun_Form.Heaven) {
|
|
this.setPosInfoData();
|
|
}
|
|
gcore.GlobalEvent.fire(HeroEvent.Update_Tag_Fun_Form, power);
|
|
},
|
|
// 更新阵法图标
|
|
updateFormationIcon: function updateFormationIcon() {
|
|
// var form_icon_path = PathTool.getIconPath("form", "form_icon_" + this.formation_config.type);
|
|
// this.loadRes(form_icon_path, function(form_sf) {
|
|
// this.form_icon_sp.spriteFrame =
|
|
;
|
|
// }.bind(this));
|
|
},
|
|
|
|
// 选择英雄
|
|
selectHero: function selectHero(click_item) {
|
|
if (this.running_move_act) return;
|
|
var select_hero_vo = click_item.mdata;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Expedit_Fight) {
|
|
var is_used = select_hero_vo.is_used || 0; //--expedit_model:getHireHeroIsUsed(select_hero_vo.partner_id, select_hero_vo.rid, select_hero_vo.srv_id)
|
|
if (is_used == 1) {
|
|
nx.tbox("lab_form_go_fight_window_tip1");
|
|
return;
|
|
}
|
|
}
|
|
|
|
// 英雄死亡就不可能点击
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Expedit_Fight) {
|
|
// var blood = HeroExpeditController.getInstance().getModel().getHeroBloodById( select_hero_vo.partner_id, select_hero_vo.rid, select_hero_vo.srv_id );
|
|
// if( blood <= 0 ) {
|
|
// return;
|
|
// }
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
// -- 位面
|
|
var hp_per = select_hero_vo.hp_per; //PlanesafkController.getInstance().getModel().getMyPlanesHeroHpPer(select_hero_vo.partner_id, select_hero_vo.flag)
|
|
if (hp_per <= 0) {
|
|
nx.tbox("lab_form_go_fight_window_tip2");
|
|
return;
|
|
}
|
|
}
|
|
|
|
// 是否已经选中
|
|
var select_index = -1;
|
|
for (var five_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[five_i] && this.five_hero_vo[five_i].partner_id === select_hero_vo.partner_id) {
|
|
select_index = five_i;
|
|
break;
|
|
}
|
|
}
|
|
if (select_index !== -1) {
|
|
// 已在选中队列则取消选中
|
|
select_hero_vo.is_ui_select = false;
|
|
// 播放下阵动画
|
|
for (var _i25 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i25].index == select_index && this.hero_item_list[_i25].is_use) {
|
|
this.hero_item_list[_i25].rebind(select_index, {}, "");
|
|
}
|
|
}
|
|
// this.hero_item_list[select_index].rebind(select_index,{},"");
|
|
delete this.five_hero_vo[select_index];
|
|
// --結束位置 设置下阵英雄
|
|
this.svcList.removeFocus(click_item.index);
|
|
this.updateFightPower();
|
|
} else {
|
|
// 分配战队位置
|
|
var have_num = 0;
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
if (select_hero_vo.bid == this.five_hero_vo[hero_i].bid) {
|
|
nx.tbox("tip_sameHero2");
|
|
return;
|
|
}
|
|
have_num++;
|
|
}
|
|
}
|
|
//基於多隊伍的是否選中
|
|
if (this.cur_tab_data && this.cur_tab_data.is_multiple) {
|
|
for (var teams in this.team_data_list[this.fun_form_type]) {
|
|
var team_partner = this.team_data_list[this.fun_form_type][teams];
|
|
for (var pid in team_partner.pos_info) {
|
|
if (select_hero_vo.partner_id == team_partner.pos_info[pid].id) {
|
|
nx.tbox("tip_sameHero2");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (have_num >= 5) {
|
|
nx.tbox("tip_fullPositions");
|
|
return;
|
|
}
|
|
|
|
// 同bid不能上阵
|
|
var best_index = this.getTheBestPos(select_hero_vo);
|
|
if (best_index < 0) {
|
|
// 没有上阵位置
|
|
nx.tbox("tip_noPosition");
|
|
return;
|
|
}
|
|
|
|
// 播放上阵动画
|
|
for (var _i26 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i26].index == best_index && this.hero_item_list[_i26].is_use) {
|
|
this.hero_item_list[_i26].rebind(best_index, select_hero_vo, "");
|
|
this.hero_item_list[_i26].circlePlay(3);
|
|
}
|
|
}
|
|
// this.hero_item_list[best_index].rebind(best_index,select_hero_vo,"");
|
|
this.five_hero_vo[best_index] = select_hero_vo;
|
|
select_hero_vo.is_ui_select = true;
|
|
this.svcList.addFocus(click_item.index);
|
|
this.updateFightPower();
|
|
}
|
|
this.upFunFormTeam();
|
|
},
|
|
upFunFormTeam: function upFunFormTeam() {
|
|
var formations = this.team_data_list[this.fun_form_type][this.select_team_index];
|
|
if (!formations || !formations.pos_info) {
|
|
return nx.tbox("lab_mainUI_controller_tip1");
|
|
}
|
|
var pos_info = nx.dt.objClone(formations.pos_info);
|
|
var newpos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i27 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i27][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i27][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
newpos_info.push(pos_item);
|
|
}
|
|
}
|
|
formations.pos_info = newpos_info;
|
|
},
|
|
// 获取最佳上阵位置
|
|
getTheBestPos: function getTheBestPos(hero_vo) {
|
|
for (var _i28 in this.pos_name_list) {
|
|
if (hero_vo.pos_type == this.pos_name_list[_i28][0]) {
|
|
if (!this.five_hero_vo[this.pos_name_list[_i28][1]]) {
|
|
return this.pos_name_list[_i28][1];
|
|
}
|
|
}
|
|
}
|
|
if (hero_vo.pos_type == 3) {
|
|
for (var i2 = 1; i2 <= 6; i2++) {
|
|
for (var j in this.pos_name_list) {
|
|
if (i2 == this.pos_name_list[j][1]) {
|
|
if (!this.five_hero_vo[i2]) {
|
|
return i2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (hero_vo.pos_type == 2) {
|
|
for (var i3 = 1; i3 <= 9; i3++) {
|
|
for (var _j in this.pos_name_list) {
|
|
if (i3 == this.pos_name_list[_j][1]) {
|
|
if (!this.five_hero_vo[i3]) {
|
|
return i3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (hero_vo.pos_type == 1) {
|
|
for (var i4 = 1; i4 <= 9; i4++) {
|
|
for (var _j2 in this.pos_name_list) {
|
|
if (i4 == this.pos_name_list[_j2][1]) {
|
|
if (!this.five_hero_vo[i4]) {
|
|
return i4;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 从1到3
|
|
return -1;
|
|
},
|
|
onClickSaveBtn: function onClickSaveBtn() {
|
|
this.onFightDrama();
|
|
},
|
|
//待定。。。。。。。。。。。。。。。。。。。。。
|
|
onClickKeyUpBtn: function onClickKeyUpBtn() {
|
|
if (this.running_move_act) return;
|
|
var hero_list;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
hero_list = PlanesafkController.getInstance().getModel().getAllPlanesHeroData();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.YearBoss || this.fun_form_type == PartnerConst.Fun_Form.YearCross || this.fun_form_type == PartnerConst.Fun_Form.YearDefend) {
|
|
var tag_camp = this.setting.period;
|
|
hero_list = [];
|
|
var alls = this.model.getDeepHeroListByCamp(HeroConst.CampType.eNone);
|
|
if (tag_camp == 1) {
|
|
//三系
|
|
var temp = [];
|
|
for (var p in alls) {
|
|
if (alls[p].camp_type == 1 || alls[p].camp_type == 2 || alls[p].camp_type == 3) {
|
|
temp.push(alls[p]);
|
|
}
|
|
}
|
|
for (var t in temp) {
|
|
if (temp[t].camp_type == this.cur_camp || this.cur_camp == 0) {
|
|
hero_list.push(temp[t]);
|
|
}
|
|
}
|
|
} else if (tag_camp == 3) {
|
|
//光暗
|
|
var temp2 = [];
|
|
for (var p2 in alls) {
|
|
if (alls[p2].camp_type == 4 || alls[p2].camp_type == 5) {
|
|
temp2.push(alls[p2]);
|
|
}
|
|
}
|
|
for (var t2 in temp2) {
|
|
if (temp2[t2].camp_type == this.cur_camp || this.cur_camp == 0) {
|
|
hero_list.push(temp2[t2]);
|
|
}
|
|
}
|
|
} else {
|
|
hero_list = alls;
|
|
}
|
|
} else {
|
|
hero_list = this.model.getDeepHeroListByCamp(HeroConst.CampType.eNone);
|
|
}
|
|
hero_list.sort(Utils.tableUpperSorter(["star", "power", "lev", "flag"]));
|
|
if (hero_list.length == 0) {
|
|
nx.tbox("tip_noHero");
|
|
return;
|
|
}
|
|
|
|
// 清空选中
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var list_index = this.getCurListIndexByParId(this.five_hero_vo[hero_i].partner_id);
|
|
if (list_index >= 0) {
|
|
this.partners[list_index].is_ui_select = false;
|
|
this.svcList.removeFocus(list_index);
|
|
// this.item_scrollview.updateItemData(list_index, this.cur_role_list[list_index]);
|
|
}
|
|
|
|
for (var _i29 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i29].index == hero_i && this.hero_item_list[_i29].is_use) {
|
|
this.hero_item_list[_i29].rebind(hero_i, {}, "");
|
|
}
|
|
}
|
|
|
|
// this.hero_item_list[hero_i].rebind(hero_i,{},"");
|
|
delete this.five_hero_vo[hero_i];
|
|
}
|
|
}
|
|
var up_num = 0;
|
|
var heor_i = 0;
|
|
while (up_num < 5) {
|
|
var hero_vo = hero_list[heor_i]; //这里做列表区分 不能用一个剧情的 待改
|
|
var hero_pos = this.allocateHeroPos(hero_vo);
|
|
if (hero_pos >= 0) {
|
|
up_num++;
|
|
}
|
|
heor_i++;
|
|
if (heor_i == hero_list.length) break;
|
|
}
|
|
this.updateFightPower();
|
|
this.upFunFormTeam();
|
|
},
|
|
allocateHeroPos: function allocateHeroPos(hero_vo) {
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
if (hero_vo.bid == this.five_hero_vo[hero_i].bid) {
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 同bid不能上阵
|
|
var best_index = this.getTheBestPos(hero_vo);
|
|
if (best_index < 0) {
|
|
// 没有上阵位置
|
|
return -1;
|
|
}
|
|
|
|
// 特殊英雄的判断
|
|
var more_team_data;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
more_team_data = PlanesafkController.getInstance().getModel().getAllPlanesHeroData();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.YearBoss || this.fun_form_type == PartnerConst.Fun_Form.YearCross || this.fun_form_type == PartnerConst.Fun_Form.YearDefend) {
|
|
var tag_camp = this.setting.period;
|
|
more_team_data = [];
|
|
var alls = this.model.getDeepHeroListByCamp(HeroConst.CampType.eNone);
|
|
if (tag_camp == 1) {
|
|
//三系
|
|
var temp = [];
|
|
for (var p in alls) {
|
|
if (alls[p].camp_type == 1 || alls[p].camp_type == 2 || alls[p].camp_type == 3) {
|
|
temp.push(alls[p]);
|
|
}
|
|
}
|
|
for (var t in temp) {
|
|
if (temp[t].camp_type == this.cur_camp || this.cur_camp == 0) {
|
|
more_team_data.push(temp[t]);
|
|
}
|
|
}
|
|
} else if (tag_camp == 3) {
|
|
//光暗
|
|
var temp2 = [];
|
|
for (var p2 in alls) {
|
|
if (alls[p2].camp_type == 4 || alls[p2].camp_type == 5) {
|
|
temp2.push(alls[p2]);
|
|
}
|
|
}
|
|
for (var t2 in temp2) {
|
|
if (temp2[t2].camp_type == this.cur_camp || this.cur_camp == 0) {
|
|
more_team_data.push(temp2[t2]);
|
|
}
|
|
}
|
|
} else {
|
|
more_team_data = alls;
|
|
}
|
|
} else {
|
|
more_team_data = this.model.getDeepHeroListByCamp(HeroConst.CampType.eNone);
|
|
}
|
|
var best = this.checkOtherCondition(hero_vo, this.fun_form_type, more_team_data);
|
|
if (!best) {
|
|
// 没有上阵位置
|
|
return -1;
|
|
}
|
|
this.five_hero_vo[best_index] = hero_vo;
|
|
for (var _i30 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i30].index == best_index && this.hero_item_list[_i30].is_use) {
|
|
this.hero_item_list[_i30].rebind(best_index, hero_vo, "");
|
|
}
|
|
}
|
|
// this.hero_item_list[best_index].rebind(best_index,hero_vo,"");
|
|
|
|
var list_index = this.getCurListIndexByParId(this.five_hero_vo[best_index].partner_id);
|
|
if (list_index >= 0) {
|
|
this.partners[list_index].is_ui_select = true;
|
|
this.svcList.addFocus(list_index);
|
|
// this.item_scrollview.updateItemData(list_index, this.cur_role_list[list_index]);
|
|
}
|
|
|
|
return best_index;
|
|
},
|
|
checkOtherCondition: function checkOtherCondition(check_hero_vo, _fun_form_type, more_team_data) {
|
|
if (!this.five_hero_vo) {
|
|
return;
|
|
}
|
|
var fun_form_type = _fun_form_type || this.fun_form_type;
|
|
if (fun_form_type == PartnerConst.Fun_Form.CrossArena || fun_form_type == PartnerConst.Fun_Form.CrossArenaDef || fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef) {
|
|
// 跨服竞技场,同类英雄在所有队伍中不能超过3个
|
|
var have_num = 0;
|
|
if (more_team_data) {
|
|
//剧情上面的多队伍
|
|
for (var k in more_team_data) {
|
|
var v = more_team_data[k];
|
|
var pos_info = v.pos_info || [];
|
|
for (var p in pos_info) {
|
|
var info = pos_info[p];
|
|
var hero_vo = this.model.getHeroById(info.id);
|
|
if (hero_vo) {
|
|
if (hero_vo.bid == check_hero_vo.bid) {
|
|
have_num = have_num + 1;
|
|
}
|
|
if (have_num >= 2) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
for (var i in this.five_hero_vo) {
|
|
var hero_datas = this.five_hero_vo[i];
|
|
for (var pos in hero_datas) {
|
|
var _hero_vo = hero_datas[pos];
|
|
if (_hero_vo.bid == check_hero_vo.bid) {
|
|
have_num = have_num + 1;
|
|
}
|
|
if (have_num >= 2) {
|
|
return false;
|
|
}
|
|
}
|
|
if (have_num >= 2) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.Adventure_Mine_Def) {
|
|
//秘矿冒险
|
|
if (this.dic_mine_hero_list && this.dic_mine_hero_list[check_hero_vo.id]) {
|
|
return false;
|
|
}
|
|
} else if (fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
//位面
|
|
var con_cfg = gdata("planes_data", "data_const", "planes_filter_condition"); //game.configs.PlanesData.data_const["planes_filter_condition"]
|
|
var hp_per = 100;
|
|
if (check_hero_vo.hp_per <= 0) {
|
|
//血量为0不可上阵
|
|
return false;
|
|
} else if (con_cfg && con_cfg.val[1] && check_hero_vo.lev < con_cfg.val[1]) {
|
|
// 等级小于配置等级不可上阵
|
|
return false;
|
|
}
|
|
}
|
|
if (fun_form_type == PartnerConst.Fun_Form.Drama) {
|
|
var tab_data = this.tab_list[this.fun_form_type];
|
|
if (check_hero_vo.checkResonateHeroByFormType && check_hero_vo.checkResonateHeroByFormType(tab_data.fun_form_type, true)) {
|
|
return false;
|
|
}
|
|
} else if (check_hero_vo.checkResonateHeroByFormType && check_hero_vo.checkResonateHeroByFormType(this.fun_form_type, true)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
},
|
|
// 保存上阵信息
|
|
saveForm: function saveForm() {
|
|
var pos_info = [];
|
|
var pos_n = 0;
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i31 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i31][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i31][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
pos_n++;
|
|
}
|
|
}
|
|
if (pos_n <= 0) nx.tbox("tip_minHeros");
|
|
this.ctrl.sender11212(this.fun_form_type, this.formation_type, pos_info, this.hallows_id);
|
|
},
|
|
getCurListIndexByParId: function getCurListIndexByParId(partner_id) {
|
|
for (var role_i in this.partners) {
|
|
if (this.partners[role_i].partner_id === partner_id) return role_i;
|
|
}
|
|
},
|
|
onClickChangeForm: function onClickChangeForm() {
|
|
this.ctrl.openFormationSelectPanel(true, this.formation_type, this.updageFormType.bind(this));
|
|
},
|
|
updageFormType: function updageFormType(form_type) {
|
|
this.formation_type = form_type;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss || this.fun_form_type == PartnerConst.Fun_Form.Heaven || this.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch || this.fun_form_type == PartnerConst.Fun_Form.EliteDefend || this.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend || this.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
this.team_data_list[this.fun_form_type][this.select_team_index].formation_type = this.formation_type;
|
|
}
|
|
this.formation_config = game.configs.formation_data.data_form_data[this.formation_type];
|
|
this.updateFormationStation(this.formation_config);
|
|
},
|
|
onClickFightHeroNode: function onClickFightHeroNode(event) {
|
|
var touch_pos = this.hero_main.convertToNodeSpaceAR(event.touch.getLocation());
|
|
if (!this.hava_drag_item) {
|
|
for (var _i32 in this.hero_item_list) {
|
|
var item = this.hero_item_list[_i32];
|
|
var node = item.node;
|
|
if (node) {
|
|
//只判断可用位置,不判断空白位置
|
|
//触摸屏幕获取到的是世界坐标,需要转换为局部坐标再判断
|
|
var n_rect = node.getBoundingBox();
|
|
if (n_rect.contains(touch_pos)) {
|
|
//找到后直接跳出循环
|
|
if (nx.dt.objEmpty(item.mdata)) {
|
|
break;
|
|
}
|
|
this.hava_drag_item = item;
|
|
this.hava_drag_data = item.mdata;
|
|
this.hava_drag_item.player.active = false;
|
|
// this.showMoveSk(true,this.hava_drag_data.camp_type);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (event.type == cc.Node.EventType.TOUCH_START) {
|
|
if (this.hava_drag_item) {
|
|
this.hava_drag_item.circlePlay(1);
|
|
}
|
|
} else if (event.type == cc.Node.EventType.TOUCH_CANCEL) {
|
|
// 如果取消,则下阵
|
|
var self = this;
|
|
if (self.hava_drag_item) {
|
|
this.showMoveSk(false);
|
|
//模型位置复原
|
|
var select_pos = null;
|
|
var cdn = this.table_main.children;
|
|
for (var _i33 in cdn) {
|
|
var _node = cdn[_i33];
|
|
if (_node) {
|
|
if (_node.getBoundingBox().contains(touch_pos)) {
|
|
//找到后直接跳出循环
|
|
select_pos = _node.form_index;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//不在规范区域内
|
|
if (!this.hero_main.getBoundingBox().contains(touch_pos) || select_pos == null) {
|
|
//模型位置复原
|
|
self.hava_drag_item.resetPlayerPos();
|
|
self.hava_drag_item = null;
|
|
self.hava_drag_data = null;
|
|
return;
|
|
}
|
|
if (select_pos == self.hava_drag_item.index) {
|
|
//没有找到需要交换的位置,英雄原位置下阵
|
|
self.selectStationHero(self.hava_drag_data);
|
|
} else {
|
|
if (self.hava_drag_item.index) {
|
|
self.selectStation(self.hava_drag_item.index, select_pos, self.hava_drag_data);
|
|
}
|
|
}
|
|
//模型位置复原
|
|
self.hava_drag_item.resetPlayerPos();
|
|
self.hava_drag_item = null;
|
|
self.hava_drag_data = null;
|
|
}
|
|
}
|
|
if (event.type === cc.Node.EventType.TOUCH_MOVE) {
|
|
//微缩模型跟随移动,最后只交换数据不交换位置
|
|
if (this.hava_drag_item) {
|
|
//先记录原来的位置
|
|
// let item_touch_pos = this.hava_drag_item.node.convertToNodeSpaceAR(event.touch.getLocation());
|
|
// let new_pos = cc.v2(item_touch_pos.x,item_touch_pos.y-30);
|
|
this.showMoveSk(true, this.hava_drag_data.camp_type, 2);
|
|
//控制边界
|
|
var new_pos = this.node.convertToNodeSpaceAR(event.touch.getLocation());
|
|
this.move_node.position = new_pos;
|
|
// this.hava_drag_item.player.position = new_pos;
|
|
}
|
|
}
|
|
|
|
if (event.type === cc.Node.EventType.TOUCH_END) {
|
|
// 如果结束则判断位置
|
|
var _self = this;
|
|
if (this.hava_drag_item) {
|
|
this.showMoveSk(false);
|
|
var _select_pos = null;
|
|
var _cdn = this.table_main.children;
|
|
for (var _i34 in _cdn) {
|
|
var _node2 = _cdn[_i34];
|
|
if (_node2) {
|
|
if (_node2.getBoundingBox().contains(touch_pos)) {
|
|
//找到后直接跳出循环
|
|
_select_pos = _node2.form_index;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//不在规范区域内
|
|
if (!this.hero_main.getBoundingBox().contains(touch_pos) || _select_pos == null) {
|
|
//模型位置复原
|
|
_self.hava_drag_item.resetPlayerPos();
|
|
_self.hava_drag_item = null;
|
|
_self.hava_drag_data = null;
|
|
return;
|
|
}
|
|
if (_select_pos == _self.hava_drag_item.index) {
|
|
//没有找到需要交换的位置,英雄原位置下阵
|
|
_self.selectStationHero(_self.hava_drag_data);
|
|
} else {
|
|
if (_self.hava_drag_item.index) {
|
|
_self.selectStation(_self.hava_drag_item.index, _select_pos, _self.hava_drag_data);
|
|
}
|
|
}
|
|
|
|
//模型位置复原
|
|
_self.hava_drag_item.resetPlayerPos();
|
|
_self.hava_drag_item = null;
|
|
_self.hava_drag_data = null;
|
|
}
|
|
}
|
|
},
|
|
showMoveSk: function showMoveSk(status, camp, type) {
|
|
if (status) {
|
|
if (this.move_effect_type == type) return;
|
|
this.move_effect_type = type;
|
|
this.move_node.active = true;
|
|
var effect_id = "blue";
|
|
if (camp == 2) {
|
|
effect_id = "red";
|
|
} else if (camp == 3) {
|
|
effect_id = "green";
|
|
} else if (camp == 4) {
|
|
effect_id = "yellow";
|
|
} else if (camp == 5) {
|
|
effect_id = "puple";
|
|
}
|
|
var action_str = cc.js.formatStr("action%s_%s", type, effect_id);
|
|
this.move_circle_sk.action(action_str, true);
|
|
} else {
|
|
this.move_effect_type = -1;
|
|
this.move_circle_sk.stop();
|
|
this.move_node.active = false;
|
|
this.move_node.position = cc.v2(-1000, -1000);
|
|
}
|
|
},
|
|
selectStation: function selectStation(cur_index, select_pos, hero_vo) {
|
|
// 确定该位置在五个位置中的索引
|
|
if (!select_pos) {
|
|
this.five_hero_vo[cur_index] = {};
|
|
for (var _i35 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i35].index == cur_index && this.hero_item_list[_i35].is_use) {
|
|
this.hero_item_list[_i35].rebind(cur_index, this.five_hero_vo[cur_index], "");
|
|
this.hero_item_list[_i35].circlePlay(3);
|
|
}
|
|
}
|
|
// this.hero_item_list[cur_index].rebind(cur_index,this.five_hero_vo[cur_index],"");
|
|
var list_index = this.getCurListIndexByParId(hero_vo.partner_id);
|
|
// this.cur_role_list[list_index].is_ui_select = false;
|
|
this.svcList.removeFocus(list_index);
|
|
return;
|
|
}
|
|
var five_index = null;
|
|
for (var pos_i in this.formation_config.pos) {
|
|
if (this.formation_config.pos[pos_i][1] == select_pos) {
|
|
five_index = this.formation_config.pos[pos_i][0];
|
|
break;
|
|
}
|
|
}
|
|
if (five_index !== null) {
|
|
// 选定合法战位
|
|
if (this.five_hero_vo[select_pos]) {
|
|
// 交换战位置 this.five_hero_vo[five_index]
|
|
// if(!this.five_hero_vo[five_index]){
|
|
// this.five_hero_vo[five_index] = {};
|
|
// }
|
|
this.five_hero_vo[cur_index] = this.five_hero_vo[select_pos];
|
|
this.five_hero_vo[select_pos] = hero_vo;
|
|
for (var _i36 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i36].index == cur_index && this.hero_item_list[_i36].is_use) {
|
|
this.hero_item_list[_i36].rebind(cur_index, this.five_hero_vo[cur_index], "");
|
|
}
|
|
}
|
|
this.hero_item_list[five_index].rebind(select_pos, this.five_hero_vo[select_pos], "");
|
|
this.hero_item_list[five_index].circlePlay(3);
|
|
} else {
|
|
// 空战位
|
|
delete this.five_hero_vo[cur_index];
|
|
// this.five_hero_vo[cur_index] = {};
|
|
this.five_hero_vo[select_pos] = hero_vo;
|
|
for (var _i37 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i37].index == cur_index && this.hero_item_list[_i37].is_use) {
|
|
this.hero_item_list[_i37].rebind(cur_index, this.five_hero_vo[cur_index], "");
|
|
}
|
|
}
|
|
// this.hero_item_list[cur_index].rebind(cur_index,this.five_hero_vo[cur_index],"");
|
|
this.hero_item_list[five_index].rebind(select_pos, this.five_hero_vo[select_pos], "");
|
|
this.hero_item_list[five_index].circlePlay(3);
|
|
}
|
|
} else {
|
|
this.five_hero_vo[cur_index] = hero_vo;
|
|
for (var _i38 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i38].index == cur_index && this.hero_item_list[_i38].is_use) {
|
|
this.hero_item_list[_i38].rebind(cur_index, this.five_hero_vo[cur_index], "");
|
|
this.hero_item_list[_i38].circlePlay(3);
|
|
}
|
|
}
|
|
// this.hero_item_list[cur_index].rebind(cur_index,this.five_hero_vo[cur_index],"");
|
|
}
|
|
|
|
this.upFunFormTeam();
|
|
},
|
|
selectStationHero: function selectStationHero(hero_vo, star_pos, end_pos) {
|
|
// 是否已经选中
|
|
var select_index = -1;
|
|
for (var five_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[five_i] && this.five_hero_vo[five_i].partner_id === hero_vo.partner_id) select_index = five_i;
|
|
}
|
|
if (select_index !== -1) {
|
|
// 已在选中队列则取消选中
|
|
// 播放下阵动画
|
|
var list_index = this.getCurListIndexByParId(this.five_hero_vo[select_index].partner_id);
|
|
var cur_list_item = this.hava_drag_item;
|
|
if (list_index >= 0) {
|
|
this.partners[list_index].is_ui_select = false;
|
|
}
|
|
this.svcList.removeFocus(list_index);
|
|
for (var _i39 in this.hero_item_list) {
|
|
if (this.hero_item_list[_i39].index == select_index && this.hero_item_list[_i39].is_use) {
|
|
this.hero_item_list[_i39].circlePlay(1);
|
|
this.hero_item_list[_i39].rebind(select_index, {}, "");
|
|
}
|
|
}
|
|
// this.hero_item_list[select_index].rebind(select_index,{},"");
|
|
delete this.five_hero_vo[select_index];
|
|
this.updateFightPower();
|
|
this.upFunFormTeam();
|
|
}
|
|
},
|
|
// 计算光环类型
|
|
calculateCampHaloType: function calculateCampHaloType() {
|
|
var dic_camp = {};
|
|
for (var heor_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[heor_i]) {
|
|
if (!dic_camp[this.five_hero_vo[heor_i].camp_type]) {
|
|
if (!this.five_hero_vo[heor_i].camp_type) {
|
|
dic_camp[0] = 1;
|
|
} else {
|
|
dic_camp[this.five_hero_vo[heor_i].camp_type] = 1;
|
|
}
|
|
} else {
|
|
dic_camp[this.five_hero_vo[heor_i].camp_type]++;
|
|
}
|
|
}
|
|
}
|
|
var form_id_list = BattleController.getInstance().getModel().getFormIdListByCamp(dic_camp);
|
|
var halo_icon_config = BattleController.getInstance().getModel().getCampIconConfigByIds(form_id_list);
|
|
this.halo_form_id = form_id_list;
|
|
var halo_icon_path = null;
|
|
|
|
//重置状态
|
|
for (var ord = 1; ord <= 5; ord++) {
|
|
nx.gui.setActive(this.halo_btn, String(ord), false);
|
|
}
|
|
var num = 0;
|
|
for (var camp in dic_camp) {
|
|
var pnum = dic_camp[camp];
|
|
for (var _i40 = 1 + num; _i40 <= pnum + num; _i40++) {
|
|
if (camp != 0) {
|
|
var resPath = cc.path.join("prefab/battle/battledrama/star", cc.js.formatStr("%s_%s", camp, _i40));
|
|
nx.gui.setSpriteFrame(this.halo_btn, String(_i40), resPath);
|
|
}
|
|
nx.gui.setActive(this.halo_btn, String(_i40), true);
|
|
}
|
|
num += pnum;
|
|
}
|
|
},
|
|
updateHaloEffect: function updateHaloEffect(status, icon_sf) {
|
|
var sps = nx.gui.getComponent(this.halo_btn, "sp", sp.Skeleton);
|
|
if (status) {
|
|
sps.node.active = true;
|
|
var effect_path = PathTool.getSpinePath("E80005", "action", false);
|
|
nx.res.loadRes(effect_path, sp.SkeletonData, function (_e, _p) {
|
|
if (_e) {
|
|
return;
|
|
}
|
|
if (sps) {
|
|
sps.skeletonData = res;
|
|
sps.setAnimation(0, "action", true);
|
|
}
|
|
});
|
|
} else {
|
|
if (sps) {
|
|
sps.node.active = false;
|
|
sps.clearTracks();
|
|
}
|
|
}
|
|
},
|
|
onClickHallowsBtn: function onClickHallowsBtn() {
|
|
this.ctrl.openFormHallowsSelectPanel(true, this.hallows_id, this.updateHallow.bind(this));
|
|
},
|
|
updateHallow: function updateHallow(hallow_vo) {
|
|
if (!!hallow_vo) {
|
|
// 装配
|
|
this.hallows_id = hallow_vo.id;
|
|
} else {
|
|
// 取消装配
|
|
this.hallows_id = 0;
|
|
}
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss || this.fun_form_type == PartnerConst.Fun_Form.Heaven || this.fun_form_type == PartnerConst.Fun_Form.EliteMatch || this.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend || this.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch || this.fun_form_type == PartnerConst.Fun_Form.EliteDefend) {
|
|
for (var _i41 in this.team_data_list) {
|
|
var list = this.team_data_list[_i41];
|
|
if (_i41 == this.fun_form_type) {
|
|
for (var l in list) {
|
|
var show = list[l];
|
|
show.hallows_id = this.hallows_id;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.updateHallowsIcon();
|
|
},
|
|
updateHallowsIcon: function updateHallowsIcon() {
|
|
var sps = nx.gui.getComponent(this.hallows_icon.node.parent, "sp", sp.Skeleton);
|
|
if (!sps) return;
|
|
if (this.hallows_id === 0) {
|
|
sps.node.active = false;
|
|
sps.clearTracks();
|
|
var empty_icon = "60001";
|
|
var res_path = PathTool.queryIconPath(empty_icon);
|
|
nx.gui.setSpriteFrame(this.hallows_icon, "", res_path);
|
|
} else {
|
|
sps.node.active = true;
|
|
var hallow_cfg = game.configs.hallows_data.data_base[this.hallows_id];
|
|
if (hallow_cfg) {
|
|
var _res_path = PathTool.queryIconPath(hallow_cfg.item_id);
|
|
nx.gui.setSpriteFrame(this.hallows_icon, "", _res_path);
|
|
}
|
|
var effect_path = PathTool.getSpinePath("E80006");
|
|
cc.loader.loadRes(effect_path, sp.SkeletonData, function (err, res) {
|
|
if (err) {
|
|
return;
|
|
}
|
|
if (sps) {
|
|
sps.skeletonData = res;
|
|
sps.setAnimation(0, "action", true);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
onClickFightBtn: function onClickFightBtn() {
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i42 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i42][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i42][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Expedit_Fight) {
|
|
// 远征
|
|
this.onFightExpedit();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EndLess) {
|
|
// 无尽试炼
|
|
this.onFightEndLess();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.GuildDun_AD) {
|
|
// 联盟副本
|
|
this.onFightGuildDun(pos_info);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.LimitExercise) {
|
|
// 试炼之境
|
|
this.onFightLimitExercise();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Arena) {
|
|
// 试炼之境
|
|
this.onFightArena(pos_info);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Ladder) {
|
|
// 试炼之境
|
|
this.onFightLadder(pos_info);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.GuildSecretArea) {
|
|
// 试炼之境
|
|
this.onFightGuildSecretArea();
|
|
} else if (this.fun_form_type == 12 || this.fun_form_type == 13 || this.fun_form_type == 14 || this.fun_form_type == 15 || this.fun_form_type == 16) {
|
|
this.onFightElement();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Heaven || this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss) {
|
|
// 天界副本
|
|
this.team_data_list[this.fun_form_type][this.select_team_index].pos_info = pos_info;
|
|
this.onFightHeaven();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Encounter) {
|
|
this.onFightEncounter();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.YearCross) {
|
|
this.goCampfightCross();
|
|
} else {
|
|
// 默认剧情通关
|
|
this.onFightDrama(pos_info);
|
|
}
|
|
},
|
|
goCampfightCross: function goCampfightCross() {
|
|
var _this2 = this;
|
|
// let self = this;
|
|
if (!this.team_data_list[this.fun_form_type] || !this.team_data_list[this.fun_form_type][1]) return;
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i43 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i43][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i43][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
|
|
//pvp直接挑战
|
|
BattleController.getInstance().requestOpenBattleRelevanceWindow(BCS.Fight_Type.newYearCross, null, function (_data) {
|
|
if (_data) {
|
|
CampfightMod.getInstance().reqBat(_this2.formation_type, _this2.setting.period, pos_info, _this2.hallows_id, _this2.setting.bat_data.rid, _this2.setting.bat_data.srv_id);
|
|
// self.delayClose();
|
|
gcore.GlobalEvent.fire(BattleDramaEvent.AbnormalShutDownForm);
|
|
}
|
|
});
|
|
|
|
// CampfightMod.getInstance().reqBat(this.formation_type,this.setting.period,pos_info,this.hallows_id,this.setting.bat_data.rid,this.setting.bat_data.srv_id);
|
|
},
|
|
onFightEncounter: function onFightEncounter() {
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i44 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i44][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i44][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
this.cbClose = null;
|
|
ActEncounter.getInstance().send31001({
|
|
id: this.setting.id,
|
|
formation_type: this.formation_type,
|
|
pos_info: pos_info,
|
|
hallows_id: this.hallows_id
|
|
}, function (_data) {});
|
|
},
|
|
gotoFight: function gotoFight() {
|
|
if (this.fun_form_type != PartnerConst.Fun_Form.LimitExercise) {
|
|
this.onClickCloseBtn();
|
|
}
|
|
if (this.fun_form_type === PartnerConst.Fun_Form.Drama) {
|
|
BattleDramaController.getInstance().send13003(0);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.Startower) {
|
|
// 试练塔 --星命塔
|
|
this.onFightStarTower();
|
|
}
|
|
},
|
|
onFightExpedit: function onFightExpedit() {
|
|
// var pos_info = [];
|
|
// for( var i in this.five_hero_vo ) {
|
|
// if( this.five_hero_vo[ i ] ) {
|
|
// var tab = {};
|
|
// tab.pos = i;
|
|
// tab.owner_id = this.five_hero_vo[ i ].rid;
|
|
// tab.owner_srv_id = this.five_hero_vo[ i ].srv_id;
|
|
|
|
// if( this.five_hero_vo[ i ].partner_id > 100000 ) {
|
|
// tab.id = this.five_hero_vo[ i ].partner_id - 100000;
|
|
// } else {
|
|
// tab.id = this.five_hero_vo[ i ].partner_id;
|
|
// }
|
|
// pos_info.push( tab );
|
|
// }
|
|
// }
|
|
// HeroExpeditController.getInstance().sender24403( this.formation_type, pos_info, this.hallows_id )
|
|
// this.onClickCloseBtn()
|
|
},
|
|
onFightEndLess: function onFightEndLess() {
|
|
var pos_info = [];
|
|
var pos_dir = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i45 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i45][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i45][0];
|
|
}
|
|
}
|
|
// pos_item.pos = hero_i;
|
|
if (this.five_hero_vo[hero_i].partner_id > 100000) {
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id - 100000;
|
|
} else {
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
}
|
|
pos_item.owner_id = this.five_hero_vo[hero_i].rid;
|
|
pos_item.owner_srv_id = this.five_hero_vo[hero_i].srv_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
for (var i = 0; i < pos_info.length; i++) {
|
|
pos_dir[i] = pos_info[i];
|
|
}
|
|
var EndlessTrailController = require("endless_trail_controller");
|
|
EndlessTrailController.getInstance().send23901(this.formation_type, pos_dir, this.hallows_id);
|
|
this.onClickCloseBtn();
|
|
},
|
|
// 发送试练塔
|
|
onFightStarTower: function onFightStarTower() {
|
|
var tower = this.setting.tower_lev || 0;
|
|
// let is_vip_skip = nx.storage.get( "vip_skip" );
|
|
// let auto = Number( is_vip_skip ) || 0;
|
|
StartowerController.getInstance().sender11322(tower, 0);
|
|
},
|
|
onFightGuildDun: function onFightGuildDun(pos_info) {
|
|
var boss_id = this.setting.boss_id;
|
|
GuildbossController.getInstance().send21308(boss_id, this.formation_type, pos_info, this.hallows_id);
|
|
this.onClickCloseBtn();
|
|
},
|
|
onFightArena: function onFightArena(pos_info) {
|
|
var AC = ArenaController.getInstance();
|
|
var rid = this.setting.fight.rid;
|
|
var srv_id = this.setting.fight.srv_id;
|
|
this.ctrl.sender11212(this.fun_form_type, this.formation_type, pos_info, this.hallows_id);
|
|
AC.sender20203(rid, srv_id);
|
|
this.onClickCloseBtn();
|
|
},
|
|
onFightLadder: function onFightLadder(pos_info) {
|
|
var LC = LadderController.getInstance();
|
|
var rid = this.setting.fight.rid;
|
|
var srv_id = this.setting.fight.srv_id;
|
|
this.ctrl.sender11212(this.fun_form_type, this.formation_type, pos_info, this.hallows_id);
|
|
LC.requestChallengeEnemy(rid, srv_id);
|
|
this.onClickCloseBtn();
|
|
},
|
|
onFightDrama: function onFightDrama() {
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i46 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i46][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i46][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
// -- 位面(雇佣的英雄也要加入阵容)
|
|
pos_item.flag = this.five_hero_vo[hero_i].flag || 0;
|
|
}
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Planes) {
|
|
// 位面
|
|
var planes_pos_info = [];
|
|
for (var i in this.five_hero_vo) {
|
|
var v = this.five_hero_vo[i];
|
|
var d = {};
|
|
for (var j in this.formation_config.pos) {
|
|
if (i == this.formation_config.pos[j][1]) {
|
|
d.pos = this.formation_config.pos[j][0];
|
|
}
|
|
}
|
|
|
|
// d.pos = i
|
|
d.id = v.partner_id;
|
|
if (v.flag && v.flag == 1) {
|
|
d.data = v;
|
|
}
|
|
planes_pos_info.push(d);
|
|
}
|
|
// 更新守卫界面数据
|
|
gcore.GlobalEvent.fire(PlanesafkEvent.Update_Form_Data_Event, this.formation_type, planes_pos_info);
|
|
PlanesafkController.getInstance().sender28611(this.formation_type, pos_info, this.hallows_id);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.YearBoss || this.fun_form_type == PartnerConst.Fun_Form.YearCross || this.fun_form_type == PartnerConst.Fun_Form.YearDefend) {
|
|
//阵营大战
|
|
this.onFightCampfight();
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteMatch) {
|
|
this.onFightEliteMatch(1);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingMatch) {
|
|
this.onFightEliteMatch(2);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteDefend) {
|
|
this.onFightEliteMatch(3);
|
|
} else if (this.fun_form_type == PartnerConst.Fun_Form.EliteKingDefend) {
|
|
this.onFightEliteMatch(4);
|
|
} else {
|
|
this.ctrl.sender11212(this.fun_form_type, this.formation_type, pos_info, this.hallows_id);
|
|
}
|
|
},
|
|
onFightCampfight: function onFightCampfight() {
|
|
if (!this.team_data_list[this.fun_form_type] || !this.team_data_list[this.fun_form_type][1]) return;
|
|
var pos_info = [];
|
|
var form_data = this.team_data_list[this.fun_form_type][1];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i47 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i47][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i47][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
//即时保存队伍信息
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.YearDefend) {
|
|
CampfightMod.getInstance().setDefendForm(this.formation_type, this.setting.period, pos_info, this.hallows_id);
|
|
} else {
|
|
CampfightMod.getInstance().sendForm(this.formation_type, this.setting.period, pos_info, this.hallows_id);
|
|
}
|
|
},
|
|
// --發送精英賽
|
|
onFightEliteMatch: function onFightEliteMatch(match_type) {
|
|
var self = this;
|
|
// if( (match_type == 2 || match_type == 4) && !this.team_five_hero_vo[ this.fun_form_type ] ) return;
|
|
var _type = match_type || self.setting.state;
|
|
var formations = [];
|
|
var team_lists = this.team_data_list[this.fun_form_type];
|
|
for (var _i48 in team_lists) {
|
|
var team = team_lists[_i48];
|
|
var data = {};
|
|
data.order = team.order;
|
|
data.formation_type = team.formation_type;
|
|
data.hallows_id = team.hallows_id;
|
|
data.pos_info = team.pos_info;
|
|
formations.push(data);
|
|
}
|
|
if (_type == ElitematchConst.MatchType.eKingMatch || _type == 4) {
|
|
// --表示王者賽
|
|
var is_tips = false;
|
|
if (!formations[1]) {
|
|
is_tips = true;
|
|
}
|
|
for (i in formations) {
|
|
var v = formations[i];
|
|
if (v.pos_info.length <= 0) {
|
|
is_tips = true;
|
|
break;
|
|
}
|
|
}
|
|
if (is_tips) {
|
|
// --第二隊伍未空.需要提示
|
|
var str = nx.text.getKey("tip_minHeros");
|
|
nx.mbox(str, ["cancel", "confirm", function (_key, _box) {
|
|
if (_key == "confirm") {
|
|
ElitematchController.getInstance().sender24921(_type, formations);
|
|
}
|
|
}]);
|
|
} else {
|
|
ElitematchController.getInstance().sender24921(_type, formations);
|
|
}
|
|
} else {
|
|
console.log("當前的隊伍信息" + JSON.stringify(formations));
|
|
ElitematchController.getInstance().sender24921(_type, formations);
|
|
}
|
|
},
|
|
//试炼之境的出战
|
|
onFightLimitExercise: function onFightLimitExercise() {
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i49 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i49][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i49][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
this.ctrl.sender11212(PartnerConst.Fun_Form.LimitExercise, this.formation_type, pos_info, this.hallows_id);
|
|
},
|
|
onFightElement: function onFightElement() {
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
for (var _i50 in this.formation_config.pos) {
|
|
if (hero_i == this.formation_config.pos[_i50][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i50][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
//即时保存队伍信息
|
|
this.saveForm();
|
|
ElementController.getInstance().checkJoinHeavenBattle(this.setting.ele_type, this.setting.customs_id, this.formation_type, pos_info, this.hallows_id);
|
|
},
|
|
//發送公會秘境boss
|
|
onFightGuildSecretArea: function onFightGuildSecretArea() {
|
|
var pos_info = [];
|
|
for (var hero_i in this.five_hero_vo) {
|
|
if (this.five_hero_vo[hero_i]) {
|
|
var pos_item = {};
|
|
pos_item.pos = hero_i;
|
|
pos_item.id = this.five_hero_vo[hero_i].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
}
|
|
if (pos_info.length <= 0) {
|
|
nx.tbox("tip_minHeros");
|
|
return;
|
|
}
|
|
var boss_id = this.setting.boss_id;
|
|
GuildsecretareaController.getInstance().sender26802(boss_id, this.formation_type, pos_info, this.hallows_id);
|
|
this.onClickCloseBtn();
|
|
},
|
|
// 天界副本
|
|
onFightHeaven: function onFightHeaven() {
|
|
if (!this.team_data_list[this.fun_form_type][this.select_team_index]) {
|
|
return;
|
|
}
|
|
var _type = 1;
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.HeavenBoss) {
|
|
_type = 2;
|
|
}
|
|
var tab_data = this.tab_list[this.select_team_index - 1];
|
|
var dic_team_data = this.getDicTeamData(tab_data);
|
|
var formations = [];
|
|
for (var _i51 in dic_team_data) {
|
|
var team_data = dic_team_data[_i51];
|
|
var data = {};
|
|
data.order = team_data.order;
|
|
var pos_info = team_data.pos_info;
|
|
data.formation_type = team_data.formation_type;
|
|
data.hallows_id = team_data.hallows_id;
|
|
data.pos_info = pos_info;
|
|
Utils.tableInsert(formations, data);
|
|
}
|
|
var have_hero = false;
|
|
for (var _i52 in formations) {
|
|
var v = formations[_i52];
|
|
if (v.pos_info.length > 0) {
|
|
have_hero = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!have_hero) {
|
|
nx.tbox("DispatchMemeberEmpty");
|
|
return;
|
|
}
|
|
if (_type == 2) {
|
|
// boss關
|
|
var is_tips = false;
|
|
if (!formations[1]) {
|
|
is_tips = true;
|
|
}
|
|
for (var _i53 in formations) {
|
|
var _v = formations[_i53];
|
|
if (_v.pos_info.length == 0) {
|
|
is_tips = true;
|
|
break;
|
|
}
|
|
}
|
|
if (is_tips) {
|
|
var str = nx.text.getKey("lab_formTeamTips");
|
|
nx.mbox(str, ["cancel", "confirm"], function (_key, _box) {
|
|
_box.close();
|
|
if (_key == "confirm") {
|
|
HeavenController.getInstance().checkJoinHeavenBattle(_type, formations);
|
|
}
|
|
});
|
|
} else {
|
|
HeavenController.getInstance().checkJoinHeavenBattle(_type, formations);
|
|
}
|
|
} else {
|
|
HeavenController.getInstance().checkJoinHeavenBattle(_type, formations);
|
|
}
|
|
},
|
|
getDicTeamData: function getDicTeamData(tab_data) {
|
|
if (!tab_data) {
|
|
return {};
|
|
}
|
|
var dic_team_data = {};
|
|
var more_team_data = null;
|
|
if (tab_data.is_multiple) {
|
|
for (var _i54 in this.tab_list) {
|
|
var v = this.tab_list[_i54];
|
|
if (tab_data.fun_form_type == v.fun_form_type) dic_team_data[Number(_i54)] = this.team_data_list[tab_data.fun_form_type][Number(_i54) + 1];
|
|
}
|
|
} else {
|
|
dic_team_data[this.select_team_index] = this.team_data_list[tab_data.fun_form_type][this.select_team_index];
|
|
if (this.fun_form_type == PartnerConst.Fun_Form.Drama && (tab_data.fun_form_type == PartnerConst.Fun_Form.CrossArenaDef || tab_data.fun_form_type == PartnerConst.Fun_Form.ArenapeakchampionDef))
|
|
//剧情布阵 多队伍之跨服竞技场 巅峰冠军赛
|
|
more_team_data = this.dic_more_team_data[tab_data.fun_form_type];
|
|
}
|
|
return dic_team_data;
|
|
},
|
|
setPosInfoData: function setPosInfoData() {
|
|
if (this.team_data_list[this.select_team_index - 1]) {
|
|
var pos_info = [];
|
|
for (var j in this.five_hero_vo) {
|
|
var pos_item = {};
|
|
for (var _i55 in this.formation_config.pos) {
|
|
if (j == this.formation_config.pos[_i55][1]) {
|
|
pos_item.pos = this.formation_config.pos[_i55][0];
|
|
}
|
|
}
|
|
pos_item.id = this.five_hero_vo[j].partner_id;
|
|
pos_info.push(pos_item);
|
|
}
|
|
this.team_data_list[this.select_team_index - 1].pos_info = pos_info;
|
|
}
|
|
},
|
|
onClickCloseBtn: function onClickCloseBtn() {
|
|
this.ctrl.openFormGoFightPanel(false);
|
|
},
|
|
// onClickElfin:function(){
|
|
// ElfinController.getInstance().send26556();
|
|
// ElfinController.getInstance().openElfinAdjustWindow( true, 2, 1);
|
|
// },
|
|
onClickHaloView: function onClickHaloView() {
|
|
BattleController.getInstance().openBattleCampView(true, this.halo_form_id);
|
|
},
|
|
onTouchSkip: function onTouchSkip() {
|
|
if (this.tween) {
|
|
this.tween.stop();
|
|
}
|
|
var nod = nx.gui.find(this.skip_tog, "txt");
|
|
nod.scale = 0;
|
|
nx.gui.setActive(nod, "", true);
|
|
this.tween = cc.tween(nod).to(0.3, {
|
|
scaleX: -1,
|
|
scaleY: 1
|
|
}).delay(3).to(0.3, {
|
|
scale: 0
|
|
}).call(function () {
|
|
nx.gui.setActive(nod, "", false);
|
|
}).start();
|
|
},
|
|
onTouchRecommend: function onTouchRecommend() {
|
|
nx.bridge.createPanel("WndPopRecommend");
|
|
}
|
|
|
|
// EncounterPlotCells(){
|
|
// let children = this.svcList.bindSCV.content.children;
|
|
// //需要引導的英雄
|
|
// let heros = game.configs.fake_battle_data.data_const.guide_partner.val;
|
|
// for(let i=0;i<heros.length;i++){
|
|
// let id = heros[i];
|
|
// if(id){
|
|
// for(let c in children){
|
|
// let partner = children[c];
|
|
// if(partner.svItem && partner.svItem.mdata.partner_id == id){
|
|
// let plot = nx.gui.ge tComponent(partner.children[0],"plot","cmp.plot.trigger");
|
|
// if(plot){
|
|
// plot.pID = "fake_" + id;
|
|
// plot.regist();
|
|
// break;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
});
|
|
|
|
cc._RF.pop(); |