849 lines
27 KiB
JavaScript
849 lines
27 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '0e85fbDfS5AzJYm0aX3wV3L', 'elfin_controller');
|
|
// Scripts/mod/partner/wings/elfin_controller.js
|
|
|
|
"use strict";
|
|
|
|
/*
|
|
這裡填寫簡要說明(必填),
|
|
|
|
@author: xxx@syg.com(必填, 創建模塊的人員)
|
|
@editor: xxx@syg.com(必填, 後續維護以及修改的人員)
|
|
@description:
|
|
這裡填寫詳細說明,主要填寫該模塊的功能簡要
|
|
<br/>Create: 2019-08-13
|
|
*/
|
|
|
|
var BridgeController = require("bridge.controller");
|
|
var ElfinEvent = require("elfin_event");
|
|
var BackPackConst = require("backpack_const");
|
|
var BackpackEvent = require("backpack_event");
|
|
var BackPackConst = require("backpack_const");
|
|
var PartnerConst = require("partner_const");
|
|
var RoleController = require("role_controller");
|
|
var RoleEvent = require("role_event");
|
|
var ElfinController = cc.Class({
|
|
"extends": BridgeController,
|
|
ctor: function ctor() {
|
|
var ElfinModel = require("elfin_model");
|
|
this.model = new ElfinModel(this);
|
|
this.model.initConfig();
|
|
this.elfin_awards = [];
|
|
},
|
|
initConfig: function initConfig() {},
|
|
getModel: function getModel() {
|
|
return this.model;
|
|
},
|
|
registerEvents: function registerEvents() {},
|
|
requestBaseQuestData: function requestBaseQuestData(_cb) {
|
|
// if( !this.getModel().checkElfinIsOpen( true ) ) return;
|
|
|
|
this.SendProtocal(26500, {}); //-- 精灵孵化器数据
|
|
|
|
this.SendProtocal(26550, {}); //-- 精灵召唤数据
|
|
this.SendProtocal(26510, {}, _cb); //-- 精灵古树数据
|
|
// if( this.attr_fun_list[ 6 ] ) {
|
|
// this.attr_fun_list[ 6 ].req_flag = true
|
|
// }
|
|
},
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(26500, this.handle26500); // 精靈孵化信息
|
|
this.RegisterProtocal(26501, this.handle26501); // 精靈孵化信息更新
|
|
this.RegisterProtocal(26502, this.handle26502); // 精靈孵化器升級
|
|
this.RegisterProtocal(26535, this.handle26535); // 精靈孵化器激活s
|
|
|
|
this.RegisterProtocal(26503, this.handle26503); // 請求孵化精靈
|
|
this.RegisterProtocal(26504, this.handle26504); // 請求加速孵化精靈
|
|
this.RegisterProtocal(26505, this.handle26505); // 停止孵化精靈
|
|
this.RegisterProtocal(26506, this.handle26506); // 領取孵化產物
|
|
this.RegisterProtocal(26507, this.handle26507); // 購買精靈道具
|
|
this.RegisterProtocal(26508, this.handle26508); // 精靈融合
|
|
this.RegisterProtocal(26509, this.handle26509); // 精靈圖鑒
|
|
|
|
this.RegisterProtocal(26510, this.handle26510); // 古樹信息
|
|
this.RegisterProtocal(26511, this.handle26511); // 古樹升級
|
|
this.RegisterProtocal(26512, this.handle26512); // 古樹進階
|
|
this.RegisterProtocal(26513, this.handle26513); // 古樹佈置精靈
|
|
this.RegisterProtocal(26514, this.handle26514); // 古樹批量佈置精靈
|
|
this.RegisterProtocal(26520, this.handle26520); // 推送新激活的精靈
|
|
|
|
this.RegisterProtocal(26550, this.handle26550); // 精靈召喚數據
|
|
this.RegisterProtocal(26551, this.handle26551); // 精靈召喚
|
|
this.RegisterProtocal(26552, this.handle26552); // 領取保底禮包
|
|
this.RegisterProtocal(26553, this.handle26553); // 精靈抽獎結果
|
|
this.RegisterProtocal(26554, this.handle26554); // 設置幸運精靈(成功推送26550)
|
|
|
|
this.RegisterProtocal(26555, this.handle26555); // 精靈佈陣信息
|
|
this.RegisterProtocal(26556, this.handle26556); // 精靈方案信息
|
|
this.RegisterProtocal(26557, this.handle26557); // 精靈方案保存
|
|
this.RegisterProtocal(26558, this.handle26558); // 精靈方案名字修改
|
|
this.RegisterProtocal(26559, this.handle26559); // 精靈方案信息(不能申請)
|
|
this.RegisterProtocal(26560, this.handle26560); // 精靈佈陣自主保存
|
|
this.RegisterProtocal(26561, this.handle26561); // 精靈佈陣使用方案保存
|
|
this.RegisterProtocal(26562, this.handle26562); // 購買精靈方案
|
|
this.RegisterProtocal(26563, this.handle26563); // 消耗精靈時是否需要彈提示框
|
|
this.RegisterProtocal(26564, this.handle26564); // 多隊伍保存精靈佈陣隊伍順序調整(跨服競技場、巔峰冠軍賽)
|
|
},
|
|
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
var cfgs = ["sprite_data", "holiday_sprite_lottery_data"];
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.requestBaseQuestData(_cb);
|
|
});
|
|
},
|
|
// 請求精靈孵化信息
|
|
sender26500: function sender26500() {
|
|
this.SendProtocal(26500, {});
|
|
},
|
|
handle26500: function handle26500(data) {
|
|
if (data.sprite_hatchs) {
|
|
this.model.setElfinHatchList(data.sprite_hatchs);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Get_Elfin_Hatch_Data_Event);
|
|
}
|
|
if (data.info) {
|
|
this.model.setElfinBuyInfo(data.info);
|
|
}
|
|
},
|
|
// 更新靈窩數據(也可能是新增)
|
|
handle26501: function handle26501(data) {
|
|
if (data.sprite_hatch) {
|
|
this.model.updateElfinHatchData(data.sprite_hatch);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Get_Elfin_Hatch_Data_Event);
|
|
}
|
|
},
|
|
// 請求孵化器升級
|
|
sender26502: function sender26502(id) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
this.SendProtocal(26502, protocal);
|
|
},
|
|
handle26502: function handle26502(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (data.result == 1) {
|
|
var new_data = {};
|
|
new_data.id = data.id;
|
|
new_data.lev = data.lev;
|
|
this.model.updateOneElfinHatchData(new_data);
|
|
}
|
|
},
|
|
// 請求開始孵化
|
|
sender26503: function sender26503(id, item_bid) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.item_bid = item_bid;
|
|
this.SendProtocal(26503, protocal);
|
|
},
|
|
handle26503: function handle26503(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
},
|
|
// 請求加速孵化
|
|
sender26504: function sender26504(id, item_bid, item_num, _type) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.item_bid = item_bid;
|
|
protocal.item_num = item_num;
|
|
protocal.type = _type || 0;
|
|
this.SendProtocal(26504, protocal);
|
|
},
|
|
handle26504: function handle26504(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
// 使用道具加速成功
|
|
if (data.result == 1) {
|
|
gcore.GlobalEvent.fire(ElfinEvent.Use_Item_Hatch_Event, data.id);
|
|
}
|
|
},
|
|
// 請求停止孵化精靈
|
|
sender26505: function sender26505(id) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
this.SendProtocal(26505, protocal);
|
|
},
|
|
handle26505: function handle26505(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
},
|
|
// 請求領取孵化產物
|
|
sender26506: function sender26506(id) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
this.SendProtocal(26506, protocal);
|
|
},
|
|
handle26506: function handle26506(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (data.result == 1 && data.awards) {
|
|
this.elfin_awards.push(data.awards);
|
|
var award = data.awards;
|
|
if (award) {
|
|
var awardss = [];
|
|
for (var i = 0; i < award.length; i++) {
|
|
var _data2 = award[i];
|
|
var dataa = {};
|
|
dataa.base_id = _data2.item_bid;
|
|
dataa.num = _data2.item_num;
|
|
awardss.push(dataa);
|
|
}
|
|
// [{"item_bid":10040,"item_num":6},{"item_bid":112004,"item_num":1}]}
|
|
}
|
|
|
|
this.openElfSGainLottery(true, award);
|
|
}
|
|
this.model.calculateTreePutElfinRedStatus();
|
|
},
|
|
// 精靈孵化器激活s
|
|
sender26535: function sender26535(id) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
this.SendProtocal(26535, protocal);
|
|
},
|
|
handle26535: function handle26535(data) {
|
|
if (data.flag == 1) {
|
|
this.openElfinHatchUnlockPanel(false);
|
|
}
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
},
|
|
// 請求購買精靈蛋/砸蛋道具
|
|
sender26507: function sender26507(_type, item_id, num, hatch_id) {
|
|
// 標識是否購買成功後直接孵化
|
|
if (hatch_id) {
|
|
this.hatch_egg_bid_flag = item_id;
|
|
this.hatch_id_flag = hatch_id;
|
|
}
|
|
var protocal = {};
|
|
protocal.type = _type;
|
|
protocal.item_id = item_id;
|
|
protocal.num = num;
|
|
this.SendProtocal(26507, protocal);
|
|
},
|
|
handle26507: function handle26507(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (data.result == 1 && data.count && data.item_id) {
|
|
this.model.updateElfinBuyInfoByBid(data.item_id, data.count);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Buy_Elfin_Item_Success_Event, data.item_id);
|
|
|
|
// 購買成功後直接開始孵化
|
|
if (this.hatch_id_flag && this.hatch_egg_bid_flag && this.hatch_egg_bid_flag == data.item_id) {
|
|
this.sender26503(this.hatch_id_flag, data.item_id);
|
|
this.hatch_egg_bid_flag = null;
|
|
this.hatch_id_flag = null;
|
|
this.openElfSelectItemWindow(false);
|
|
}
|
|
}
|
|
},
|
|
// 請求精靈融合
|
|
sender26508: function sender26508(item_bid, num, pos) {
|
|
var protocal = {};
|
|
protocal.item_bid = item_bid;
|
|
protocal.num = num;
|
|
protocal.pos = pos;
|
|
this.SendProtocal(26508, protocal);
|
|
},
|
|
handle26508: function handle26508(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
// 融合成功,關閉融合界面
|
|
if (data.result == 1 || data.result == 0) {
|
|
this.openElfinCompoundWindow(false);
|
|
this.openElfinEggSyntheticPanel(false);
|
|
if (data.result == 1) {
|
|
gcore.GlobalEvent.fire(ElfinEvent.Buy_Elfin_Item_Success_Event);
|
|
}
|
|
}
|
|
},
|
|
// 請求精靈圖鑒數據
|
|
sender26509: function sender26509() {
|
|
this.SendProtocal(26509, {});
|
|
},
|
|
handle26509: function handle26509(data) {
|
|
if (data.awards) {
|
|
this.model.setActivatedElfinList(data.awards);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Get_Activated_Elfin_Event);
|
|
}
|
|
},
|
|
// 請求古樹信息
|
|
sender26510: function sender26510() {
|
|
this.SendProtocal(26510, {});
|
|
},
|
|
handle26510: function handle26510(data) {
|
|
/***
|
|
* [26510]:{"lev":83,"break_lev":4,"atk":33350,"def_p":0,"def_s":0,"hp_max":133374,"speed":535,"hit_rate":9999,"dodge_rate":0,
|
|
* "crit_rate":2000,"crit_ratio":1200,"hit_magic":0,"dodge_magic":0,"def":1070,
|
|
* "sprites":[{"pos":4,"item_bid":111404},{"pos":3,"item_bid":113402},{"pos":2,"item_bid":113405},{"pos":1,"item_bid":113407}],"power":171642}
|
|
*/
|
|
|
|
this.model.setElfinTreeData({
|
|
type: 0,
|
|
data: data
|
|
});
|
|
gcore.GlobalEvent.fire(ElfinEvent.Get_Elfin_Tree_Data_Event, data);
|
|
},
|
|
// 請求古樹升級
|
|
sender26511: function sender26511() {
|
|
this.SendProtocal(26511, {});
|
|
},
|
|
handle26511: function handle26511(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
},
|
|
// 請求古樹進階
|
|
sender26512: function sender26512() {
|
|
this.SendProtocal(26512, {});
|
|
},
|
|
handle26512: function handle26512(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (data.result == 1) {
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Tree_Lv_Up_Event);
|
|
}
|
|
},
|
|
// 請求佈置精靈
|
|
sender26513: function sender26513(pos, item_bid) {
|
|
var protocal = {};
|
|
protocal.pos = pos;
|
|
protocal.item_bid = item_bid;
|
|
this.SendProtocal(26513, protocal);
|
|
},
|
|
handle26513: function handle26513(data) {
|
|
if (data.msg) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (data.result == 1) {
|
|
this.updateEflinDrama();
|
|
}
|
|
},
|
|
// 請求批量佈置精靈
|
|
//@only_save 是否僅是保存(從 26560過來的 ) {
|
|
sender26514: function sender26514(sprites, only_save) {
|
|
var protocal = {};
|
|
protocal.sprites = sprites;
|
|
this.SendProtocal(26514, protocal);
|
|
if (!only_save) {
|
|
this.can_save_drama = true;
|
|
}
|
|
},
|
|
handle26514: function handle26514(data) {
|
|
if (this.can_save_drama) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (!this.can_save_drama && !nx.dt.strEmpty(data.msg)) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
if (data.result == 1 && this.can_save_drama) {
|
|
this.can_save_drama = false;
|
|
this.updateEflinDrama();
|
|
}
|
|
},
|
|
//更新劇情佈陣
|
|
updateEflinDrama: function updateEflinDrama() {
|
|
var data = this.model.getElfinTreeData();
|
|
if (data && data.sprites) {
|
|
this.send26560(PartnerConst.Fun_Form.Drama, data.sprites, 1, 1, true);
|
|
}
|
|
},
|
|
// 推送新激活的精靈
|
|
handle26520: function handle26520(data) {
|
|
if (data.awards) {
|
|
this.model.calculateElfinActivateRedStatus(data.awards);
|
|
}
|
|
},
|
|
////////////////////////////////////精靈召喚協議////////////////////////////////////
|
|
// 請求精靈召喚數據
|
|
send26550: function send26550() {
|
|
var protocal = {};
|
|
this.SendProtocal(26550, protocal);
|
|
},
|
|
// 精靈召喚數據
|
|
handle26550: function handle26550(data) {
|
|
if (data) {
|
|
this.model.setElfinSummonData(data);
|
|
nx.mTip.openTip("partner.wing.purchase.free", data.free_time == 0);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Update_Elfin_Summon_Data_Event, data);
|
|
}
|
|
},
|
|
// 請求精靈召喚
|
|
send26551: function send26551(times, recruit_type, is_return_gain) {
|
|
this.is_return_gain = is_return_gain;
|
|
var protocal = {};
|
|
protocal.times = times;
|
|
protocal.recruit_type = recruit_type;
|
|
this.SendProtocal(26551, protocal);
|
|
},
|
|
// 精靈召喚獲得
|
|
handle26551: function handle26551(data) {
|
|
nx.tbox(data.msg);
|
|
},
|
|
// 請求領取禮包
|
|
send26552: function send26552(id) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
this.SendProtocal(26552, protocal);
|
|
},
|
|
// 領取保底禮包
|
|
handle26552: function handle26552(data) {
|
|
if (data.msg != "") {
|
|
nx.tbox(data.msg);
|
|
}
|
|
},
|
|
// 精靈抽獎結果 打开僚机召唤相关的面板
|
|
handle26553: function handle26553(data) {
|
|
this.openElfGainWindowLottery(true, data.rewards);
|
|
},
|
|
// 設置幸運精靈(成功推送26550)
|
|
send26554: function send26554(lucky_ids) {
|
|
var protocal = {};
|
|
protocal.lucky_ids = lucky_ids;
|
|
this.SendProtocal(26554, protocal);
|
|
},
|
|
// 設置幸運精靈
|
|
handle26554: function handle26554(data) {
|
|
if (!nx.dt.strEmpty(data.msg)) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
},
|
|
// 精靈佈陣信息
|
|
send26555: function send26555(type) {
|
|
var protocal = {};
|
|
protocal.type = type;
|
|
this.SendProtocal(26555, protocal);
|
|
},
|
|
// 精靈佈陣信息
|
|
handle26555: function handle26555(data) {
|
|
this.model.freshDefaultScheme(data);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_From_Info_Event, data);
|
|
},
|
|
// 精靈方案信息
|
|
send26556: function send26556() {
|
|
var protocal = {};
|
|
this.SendProtocal(26556, protocal);
|
|
},
|
|
// 精靈方案信息
|
|
handle26556: function handle26556(data) {
|
|
/***
|
|
* [26556]:{"plan_list":[
|
|
* {"id":8,"name":"霸王","plan_sprites":[]},
|
|
* {"id":7,"name":"霸气","plan_sprites":[]},
|
|
* {"id":6,"name":"八六","plan_sprites":[]},
|
|
* {"id":5,"name":"巴武","plan_sprites":[]},
|
|
* {"id":4,"name":"巴斯","plan_sprites":[]},
|
|
* {"id":1,"name":"464646","plan_sprites":[{"pos":4,"item_bid":0},{"pos":3,"item_bid":111405},{"pos":2,"item_bid":113408},{"pos":1,"item_bid":113401}]},
|
|
* {"id":2,"name":"测试换名23","plan_sprites":[{"pos":4,"item_bid":0},{"pos":3,"item_bid":0},{"pos":2,"item_bid":0},{"pos":1,"item_bid":113401}]},
|
|
* {"id":3,"name":"3333","plan_sprites":[{"pos":4,"item_bid":0},{"pos":3,"item_bid":0},{"pos":2,"item_bid":0},{"pos":1,"item_bid":0}]}]}
|
|
*/
|
|
|
|
this.model.setPlanData(data);
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_Info_Event, data);
|
|
},
|
|
// 精靈方案保存
|
|
send26557: function send26557(id, sprites, type, team) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.sprites = sprites;
|
|
protocal.type = type;
|
|
protocal.team = team || 1;
|
|
this.SendProtocal(26557, protocal);
|
|
},
|
|
// 精靈方案保存
|
|
handle26557: function handle26557(data) {
|
|
nx.tbox(data.msg);
|
|
},
|
|
// 精靈方案名字修改
|
|
send26558: function send26558(id, name) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.name = name;
|
|
this.SendProtocal(26558, protocal);
|
|
},
|
|
// 精靈方案名字修改
|
|
handle26558: function handle26558(data) {
|
|
nx.tbox(data.msg);
|
|
},
|
|
// 精靈方案信息(不能申請)
|
|
handle26559: function handle26559(data) {
|
|
/*******
|
|
* {"id":1,"name":"65656","plan_sprites":[{"pos":2,"item_bid":0},{"pos":1,"item_bid":0}]}
|
|
*/
|
|
this.model.setPlanData({
|
|
plan_list: [data]
|
|
});
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_Update_Event, data);
|
|
},
|
|
// 精靈佈陣自主保存
|
|
//@ only_save 從26514 過來的
|
|
send26560: function send26560(_type, sprites, team, flag, only_save) {
|
|
var protocal = {};
|
|
protocal.type = _type;
|
|
protocal.sprites = sprites;
|
|
protocal.team = team || 1;
|
|
protocal.flag = flag || 1;
|
|
this.SendProtocal(26560, protocal);
|
|
if (_type == PartnerConst.Fun_Form.Drama && !only_save) {
|
|
this.sprites_26560 = sprites;
|
|
}
|
|
},
|
|
// 精靈佈陣自主保存
|
|
handle26560: function handle26560(data) {
|
|
if (data.type == PartnerConst.Fun_Form.Drama) {
|
|
if (this.sprites_26560) {
|
|
//劇情陣容的
|
|
this.sender26514(this.sprites_26560, true);
|
|
this.sprites_26560 = null;
|
|
nx.tbox(data.msg);
|
|
}
|
|
} else {
|
|
if (this.sprites_26560 == null) {
|
|
nx.tbox(data.msg);
|
|
}
|
|
}
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_Save_From_Event, data);
|
|
},
|
|
// 精靈佈陣使用方案保存
|
|
send26561: function send26561(id, _type, team, sprites) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.type = _type;
|
|
protocal.team = team || 1;
|
|
this.SendProtocal(26561, protocal);
|
|
if (_type == PartnerConst.Fun_Form.Drama && sprites) {
|
|
this.sprites_26561 = sprites;
|
|
}
|
|
},
|
|
// 精靈佈陣使用方案保存
|
|
handle26561: function handle26561(data) {
|
|
nx.tbox(data.msg);
|
|
if (data.type == PartnerConst.Fun_Form.Drama && this.sprites_26561) {
|
|
this.sender26514(this.sprites_26561, true);
|
|
this.sprites_26561 = null;
|
|
}
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_Save_From_Event, data);
|
|
},
|
|
// 購買精靈方案
|
|
send26562: function send26562(id) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
this.SendProtocal(26562, protocal);
|
|
},
|
|
// 購買精靈方案
|
|
handle26562: function handle26562(data) {
|
|
nx.tbox(data.msg);
|
|
if (data.flag == 1) {
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_Buy_Event, data);
|
|
}
|
|
},
|
|
// 消耗精靈時是否需要彈提示框
|
|
send26563: function send26563(base_id, num) {
|
|
var protocal = {};
|
|
protocal.base_id = base_id;
|
|
protocal.num = num;
|
|
this.SendProtocal(26563, protocal);
|
|
},
|
|
// 購買精靈方案
|
|
handle26563: function handle26563(data) {
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Plan_Must_Tips_Event, data);
|
|
},
|
|
// 多隊伍保存精靈佈陣隊伍順序調整(跨服競技場、巔峰冠軍賽)
|
|
send26564: function send26564(_type, team_list) {
|
|
var protocal = {};
|
|
protocal.type = _type;
|
|
protocal.team_list = team_list;
|
|
this.SendProtocal(26564, protocal);
|
|
},
|
|
// 購買精靈方案
|
|
handle26564: function handle26564(data) {
|
|
nx.tbox(data.msg);
|
|
},
|
|
////////////// @ 紅點相關
|
|
// 監聽當前古樹升級、進階消耗的物品數量變化、精靈的數量變化
|
|
checkNeedUpdateRedStatus: function checkNeedUpdateRedStatus(item_list) {
|
|
if (item_list == null || Utils.next(item_list) == null) {
|
|
return;
|
|
}
|
|
var cost_bid_list = this.model.getElfinTreeCostBidList();
|
|
var com_cost_bid_list = this.model.getElfinCompoundCostBidList();
|
|
var is_check_uplv = false; // 是否更新古樹升級、進階的紅點
|
|
var is_check_elfin = false; // 是否要更新古樹放置精靈的紅點
|
|
var is_check_com = false; // 是否要更新上陣精靈合成的紅點
|
|
var is_check_egg = false; // 是否要更新可孵化的靈窩和蛋的紅點
|
|
for (var k in item_list) {
|
|
var v = item_list[k];
|
|
if (v.config) {
|
|
if (BackPackConst.checkIsElfin(v.config.type)) {
|
|
is_check_elfin = true;
|
|
}
|
|
if (BackPackConst.checkIsElfinEgg(v.config.type)) {
|
|
is_check_egg = true;
|
|
}
|
|
if (cost_bid_list && Utils.next(cost_bid_list) != null) {
|
|
for (var i in cost_bid_list) {
|
|
var id = cost_bid_list[i];
|
|
if (id == v.config.id) {
|
|
is_check_uplv = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (com_cost_bid_list && Utils.next(com_cost_bid_list) != null) {
|
|
for (var _i in com_cost_bid_list) {
|
|
var _id = com_cost_bid_list[_i];
|
|
if (_id == v.config.id) {
|
|
is_check_com = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (is_check_uplv && is_check_elfin && is_check_com && is_check_egg) {
|
|
break;
|
|
}
|
|
}
|
|
if (is_check_uplv) {
|
|
this.model.calculateTreeUplvRedStatus();
|
|
}
|
|
if (is_check_elfin) {
|
|
this.model.calculateTreePutElfinRedStatus();
|
|
this.model.calculateElfinHigherRedStatus();
|
|
}
|
|
if (is_check_com) {
|
|
this.model.calculateElfinCompoundRedStatus();
|
|
}
|
|
if (is_check_egg) {
|
|
this.model.calculateElfinHatchEggRedStatus();
|
|
}
|
|
},
|
|
// 使用钻石 换相关的材料方案等
|
|
openElfUseTipsWindow: function openElfUseTipsWindow(status, _desc, _mats, _counts, _cb) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndUseDiamondUseLottery", {
|
|
desc: _desc,
|
|
mats: _mats,
|
|
counts: _counts,
|
|
cb: _cb
|
|
});
|
|
} else {
|
|
nx.bridge.closePanel("WndUseDiamondUseLottery");
|
|
}
|
|
},
|
|
// 打開獲得精靈界面 僚机获取界面 抽奖获取
|
|
openElfSGainLottery: function openElfSGainLottery(status, list) {
|
|
if (!status) {
|
|
nx.bridge.closePanel("WndScientificReward");
|
|
return;
|
|
}
|
|
nx.bridge.createPanel("WndScientificReward", {
|
|
list: list
|
|
});
|
|
},
|
|
// 打開獲得精靈界面 僚机获取界面 抽奖获取
|
|
openElfGainWindowLottery: function openElfGainWindowLottery(status, list, params) {
|
|
if (!status) {
|
|
nx.bridge.closePanel("WndWingRewardShow");
|
|
return;
|
|
}
|
|
nx.bridge.createPanel("WndWingRewardShow", {
|
|
list: list,
|
|
params: params
|
|
});
|
|
},
|
|
// 打開精靈/錘子選擇界面 // 打开僚机选择研发目标
|
|
openElfSelectItemWindow: function openElfSelectItemWindow(status, setting) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinScientficItem", setting);
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinScientficItem");
|
|
}
|
|
},
|
|
// 引導需要
|
|
getElfinSelectRoot: function getElfinSelectRoot() {
|
|
if (this.elfin_select_item_wnd) {
|
|
return this.elfin_select_item_wnd.root_wnd;
|
|
}
|
|
},
|
|
// 檢測精靈蛋孵化獲得彈窗
|
|
checkElfinGain: function checkElfinGain() {
|
|
if (this.elfin_awards && Utils.next(this.elfin_awards || {}) != null) {
|
|
var awards = this.elfin_awards.shift();
|
|
if (awards) {
|
|
var awardss = [];
|
|
for (var i = 0; i < awards.length; i++) {
|
|
var data = {};
|
|
data.base_id = awards[i].item_bid;
|
|
data.num = awards[i].item_num;
|
|
awardss.push(data);
|
|
}
|
|
// [{"item_bid":111002,"item_num":1}]
|
|
|
|
this.openElfGainWindow(true, awardss);
|
|
}
|
|
}
|
|
},
|
|
// 特權靈窩提示彈窗
|
|
openElfinPrivilegeWindow: function openElfinPrivilegeWindow(status) {
|
|
if (status == true) {
|
|
if (!this.elfin_privilege_wnd) {
|
|
var ElfinPrivilegeWindow = require("elfin_privilege_window");
|
|
this.elfin_privilege_wnd = new ElfinPrivilegeWindow(this);
|
|
}
|
|
this.elfin_privilege_wnd.open();
|
|
} else {
|
|
if (this.elfin_privilege_wnd) {
|
|
this.elfin_privilege_wnd.close();
|
|
this.elfin_privilege_wnd = null;
|
|
}
|
|
}
|
|
},
|
|
// 打開精靈圖鑒 僚机预览
|
|
openElfinBookWindow: function openElfinBookWindow(status) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinPreview");
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinPreview");
|
|
}
|
|
},
|
|
// 打開精靈圖鑒 僚机科研
|
|
openWingScientfic: function openWingScientfic(status, _fromOther) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinScientfic", _fromOther);
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinScientfic");
|
|
}
|
|
},
|
|
// 打開召喚許願池 僚机 召唤采购主界面
|
|
openElfinWishWindow: function openElfinWishWindow(status, data) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinProcurement", data);
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinProcurement");
|
|
}
|
|
},
|
|
// 打開召喚許願池 僚机 许愿弹窗
|
|
openElfinWishTip: function openElfinWishTip(status, data) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinWishItem", data);
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinWishItem");
|
|
}
|
|
},
|
|
// 打開精靈蛋合成界面
|
|
openElfinEggSyntheticPanel: function openElfinEggSyntheticPanel(status, data) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndWingEggMerge", data);
|
|
} else {
|
|
nx.bridge.closePanel("WndWingEggMerge");
|
|
}
|
|
},
|
|
/**
|
|
* desc:购买僚机孵化
|
|
*/
|
|
openBuyPanel: function openBuyPanel(status, data, _type, _cb) {
|
|
if (status == false) {
|
|
nx.bridge.closePanel("WndOtherItemBuy");
|
|
} else {
|
|
nx.bridge.createPanel("WndOtherItemBuy", {
|
|
data: data,
|
|
type: _type,
|
|
cb: _cb
|
|
});
|
|
}
|
|
},
|
|
// 打開精靈窩解鎖s界面 解锁 僚机解锁
|
|
openElfinHatchUnlockPanel: function openElfinHatchUnlockPanel(status, data) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndUnlockedDesc", data);
|
|
} else {
|
|
nx.bridge.closePanel("WndUnlockedDesc");
|
|
}
|
|
},
|
|
// 打開精靈展示界面 僚机 科研获得
|
|
openElfinInfoWindow: function openElfinInfoWindow(status, data) {
|
|
if (status == true) {
|
|
if (!this.elfin_info_window) {
|
|
var ElfinInfoWindow = require("elfin_info_window");
|
|
this.elfin_info_window = new ElfinInfoWindow(this);
|
|
}
|
|
this.elfin_info_window.open(data);
|
|
} else {
|
|
if (this.elfin_info_window) {
|
|
this.elfin_info_window.close();
|
|
this.elfin_info_window = null;
|
|
}
|
|
gcore.GlobalEvent.fire(ElfinEvent.Elfin_Check_Show_Tips_Event); //檢測是否繼續彈tips
|
|
}
|
|
},
|
|
// 打開精靈古樹喚醒界面 进阶 堡垒
|
|
openElfinTreeStepWindow: function openElfinTreeStepWindow(status) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndWingUpgrade");
|
|
} else {
|
|
nx.bridge.closePanel("WndWingUpgrade");
|
|
}
|
|
},
|
|
// 打開精靈古樹喚醒成功界面
|
|
openElfinTreeRouseWindow: function openElfinTreeRouseWindow(status, old_data, new_data) {
|
|
if (status == true) {
|
|
if (!this.tree_rouse_wnd) {
|
|
var ElfinTreeRouseWindow = require("elfin_tree_rouse_window");
|
|
this.tree_rouse_wnd = new ElfinTreeRouseWindow(this);
|
|
}
|
|
this.tree_rouse_wnd.open({
|
|
old_data: old_data,
|
|
new_data: new_data
|
|
});
|
|
} else {
|
|
if (this.tree_rouse_wnd) {
|
|
this.tree_rouse_wnd.close();
|
|
this.tree_rouse_wnd = null;
|
|
}
|
|
}
|
|
},
|
|
// 打開精靈融合界面 升级僚机技能
|
|
openElfinCompoundWindow: function openElfinCompoundWindow(status, _item_bid, _sid, _pos, _from, _camp, _cb) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinUpSkill", {
|
|
item_bid: _item_bid,
|
|
skill_id: _sid,
|
|
pos: _pos,
|
|
from: _from,
|
|
camp: _camp || 0,
|
|
cb: _cb
|
|
});
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinUpSkill");
|
|
}
|
|
},
|
|
// 打開精靈調整界面 僚机 装配
|
|
openElfinAdjustWindow: function openElfinAdjustWindow(status, _type, _team, _setting) {
|
|
if (status == true) {
|
|
nx.bridge.createPanel("WndElfinAssemble", {
|
|
type: _type,
|
|
team: _team,
|
|
setting: _setting
|
|
});
|
|
} else {
|
|
nx.bridge.closePanel("WndElfinAssemble");
|
|
}
|
|
},
|
|
__delete: function __delete() {
|
|
if (this.model != null) {
|
|
this.model.deleteMe();
|
|
this.model = null;
|
|
}
|
|
}
|
|
});
|
|
module.exports = ElfinController;
|
|
|
|
cc._RF.pop(); |