266 lines
9.7 KiB
JavaScript
266 lines
9.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'c7ab5SXHiFLdLNyXNPBGu1t', 'guildsecretarea_controller');
|
|
// Scripts/mod/guild/secretarea/guildsecretarea_controller.js
|
|
|
|
"use strict";
|
|
|
|
// ////////////////////////////////////////////////////////////////////
|
|
// 這裡填寫簡要說明(必填),
|
|
// @author. lwc@syg.com(必填, 創建模塊的人員)
|
|
// @editor. xxx@syg.com(必填, 後續維護以及修改的人員)
|
|
// @description.
|
|
// 公會秘境 後端 國輝 策劃 松岳
|
|
// <br/>Create. 2019年9月11日
|
|
// ////////////////////////////////////////////////////////////////////
|
|
var BridgeController = require("bridge.controller");
|
|
var GuildsecretareaEvent = require("guildsecretarea_event");
|
|
var BattleController = require("battle_controller");
|
|
var GuildController = require("guild_controller");
|
|
var BattleConst = require("battle_const");
|
|
var GuildsecretareaController = cc.Class({
|
|
"extends": BridgeController,
|
|
ctor: function ctor() {},
|
|
initConfig: function initConfig() {
|
|
var GuildsecretareaModel = require("guildsecretarea_model");
|
|
this.model = new GuildsecretareaModel(this);
|
|
this.model.initConfig();
|
|
},
|
|
getModel: function getModel() {
|
|
return this.model;
|
|
},
|
|
registerEvents: function registerEvents() {},
|
|
// 从服务器初始化数据
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
var _this = this;
|
|
// 配置加载
|
|
var cfgs = ["guild_secret_area_data"];
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
|
_this.reqData(_cb);
|
|
});
|
|
},
|
|
reqData: function reqData(_cb) {
|
|
this.sender26800(_cb);
|
|
},
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(26800, this.handle26800.bind(this)); //公會秘境基礎信息
|
|
this.RegisterProtocal(26801, this.handle26801.bind(this)); //公會秘境設置Boss
|
|
this.RegisterProtocal(26802, this.handle26802.bind(this)); //挑戰公會秘境Boss
|
|
this.RegisterProtocal(26803, this.handle26803.bind(this)); //購買挑戰次數
|
|
this.RegisterProtocal(26804, this.handle26804.bind(this)); //領取階段獎勵
|
|
this.RegisterProtocal(26805, this.handle26805.bind(this)); //掃蕩公會秘境Boss
|
|
this.RegisterProtocal(26806, this.handle26806.bind(this)); //獲得秘境Boss排行榜
|
|
this.RegisterProtocal(26807, this.handle26807.bind(this)); //討伐開始彈窗
|
|
this.RegisterProtocal(26808, this.handle26808.bind(this)); //boss討伐成功或失敗界面
|
|
this.RegisterProtocal(26809, this.handle26809.bind(this)); //boss小結算界面
|
|
this.RegisterProtocal(26810, this.handle26810.bind(this)); //活躍度刷新
|
|
},
|
|
|
|
//公會秘境基礎信息
|
|
sender26800: function sender26800(_cb) {
|
|
var protocal = {};
|
|
this.SendProtocal(26800, protocal, _cb);
|
|
},
|
|
handle26800: function handle26800(data) {
|
|
this.model.updateSecretareaData(data);
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.GUILD_SECRET_AREA_MAIN_EVENT, data);
|
|
},
|
|
//公會秘境設置Boss
|
|
sender26801: function sender26801(boss_id) {
|
|
var protocal = {};
|
|
protocal.boss_id = boss_id;
|
|
this.SendProtocal(26801, protocal);
|
|
},
|
|
handle26801: function handle26801(data) {
|
|
//message(data.msg)
|
|
if (data.flag == true) {
|
|
// gcore.GlobalEvent.fire(GuildsecretareaEvent.TERM_BEGINS_BUY_COUNT_EVENT, data)
|
|
}
|
|
},
|
|
//挑戰公會秘境Boss
|
|
sender26802: function sender26802(boss_id, formation_type, pos_info, hallows_id) {
|
|
var protocal = {};
|
|
protocal.boss_id = boss_id;
|
|
protocal.formation_type = formation_type;
|
|
protocal.pos_info = pos_info;
|
|
protocal.hallows_id = hallows_id;
|
|
this.SendProtocal(26802, protocal);
|
|
},
|
|
handle26802: function handle26802(data) {
|
|
//message(data.msg)
|
|
},
|
|
//購買挑戰次數
|
|
sender26803: function sender26803(boss_id) {
|
|
var protocal = {};
|
|
protocal.boss_id = boss_id;
|
|
this.SendProtocal(26803, protocal);
|
|
},
|
|
handle26803: function handle26803(data) {
|
|
//message(data.msg)
|
|
if (data.flag == true) {
|
|
this.model.updateSecretareaBuyCount(data);
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.GUILD_SECRET_AREA_BUY_COUNT_EVENT, data);
|
|
}
|
|
},
|
|
//領取階段獎勵
|
|
sender26804: function sender26804(boss_id, number) {
|
|
var protocal = {};
|
|
protocal.boss_id = boss_id;
|
|
protocal.number = number;
|
|
this.SendProtocal(26804, protocal);
|
|
},
|
|
handle26804: function handle26804(data) {
|
|
//message(data.msg)
|
|
if (data.flag == true) {
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.TERM_BEGINS_RECEIVE_REWARD_EVENT, data);
|
|
}
|
|
},
|
|
//掃蕩公會秘境Boss
|
|
sender26805: function sender26805(boss_id) {
|
|
var protocal = {};
|
|
protocal.boss_id = boss_id;
|
|
this.SendProtocal(26805, protocal);
|
|
},
|
|
handle26805: function handle26805(data) {
|
|
//message(data.msg)
|
|
if (data.flag == true) {
|
|
this.sender26800();
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.GUILD_SECRET_AREA_REFRESH_RANK_EVENT);
|
|
}
|
|
},
|
|
//獲得秘境Boss排行榜
|
|
sender26806: function sender26806(boss_id, num) {
|
|
var protocal = {};
|
|
protocal.boss_id = boss_id;
|
|
protocal.num = num;
|
|
this.SendProtocal(26806, protocal);
|
|
},
|
|
handle26806: function handle26806(data) {
|
|
this.model.updateBossRankInfo(data);
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.GUILD_SECRET_AREA_RANK_COUNT_EVENT, data);
|
|
},
|
|
//討伐開始彈窗
|
|
sender26807: function sender26807() {
|
|
var protocal = {};
|
|
this.SendProtocal(26807, protocal);
|
|
},
|
|
handle26807: function handle26807(data) {
|
|
this.model.updateStartCrusadeInfo(data);
|
|
if (data.flag == 0 && data.end_time != 0) {
|
|
this.openGuildsecretareaStartCrusadePanel(true);
|
|
}
|
|
},
|
|
//boss討伐成功或失敗界面
|
|
sender26808: function sender26808() {
|
|
var protocal = {};
|
|
this.SendProtocal(26808, protocal);
|
|
},
|
|
//boss討伐成功或失敗界面(推送的)
|
|
handle26808: function handle26808(data) {
|
|
this.openGuildsecretareaEndCrusadePanel(true, data.flag, data);
|
|
},
|
|
//boss小結算界面
|
|
sender26809: function sender26809() {
|
|
var protocal = {};
|
|
this.SendProtocal(26809, protocal);
|
|
},
|
|
//boss小結算界面(推送)
|
|
handle26809: function handle26809(data) {
|
|
this.new_result_data = data;
|
|
return;
|
|
this.sender26800();
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.GUILD_SECRET_AREA_REFRESH_RANK_EVENT);
|
|
data.item_rewards = data.reward;
|
|
BattleController.getInstance().openFinishView(true, BattleConst.Fight_Type.GuildSecretArea, data);
|
|
},
|
|
newResultWin: function newResultWin() {
|
|
if (!this.new_result_data) return;
|
|
var data = this.new_result_data;
|
|
this.sender26800();
|
|
gcore.GlobalEvent.fire(GuildsecretareaEvent.GUILD_SECRET_AREA_REFRESH_RANK_EVENT);
|
|
data.item_rewards = data.reward;
|
|
BattleController.getInstance().openFinishView(true, BattleConst.Fight_Type.GuildSecretArea, data);
|
|
this.new_result_data = null;
|
|
},
|
|
//活躍度
|
|
sender26810: function sender26810() {
|
|
var protocal = {};
|
|
this.SendProtocal(26810, protocal);
|
|
},
|
|
//活躍度
|
|
handle26810: function handle26810(data) {
|
|
var my_guild_info = GuildController.getInstance().getModel().getMyGuildInfo();
|
|
if (my_guild_info) {
|
|
my_guild_info.setGuildAttribute("vitality", data.vitality);
|
|
}
|
|
},
|
|
//打開公會秘境
|
|
openGuildsecretareaMainWindow: function openGuildsecretareaMainWindow(status, setting) {
|
|
var RoleController = require("role_controller");
|
|
if (RoleController.getInstance().getRoleVo().isHasGuild() == false) {
|
|
//message(Utils.TI18N("您當前未加入任何公會,加入公會後才能參與該玩法!"))
|
|
return;
|
|
}
|
|
if (status == true) {
|
|
if (this.guildsecretarea_main_window == null) {
|
|
this.guildsecretarea_main_window = Utils.createClass("guildsecretarea_main_window");
|
|
}
|
|
this.guildsecretarea_main_window.open(setting);
|
|
} else {
|
|
if (this.guildsecretarea_main_window) {
|
|
this.guildsecretarea_main_window.close();
|
|
this.guildsecretarea_main_window = null;
|
|
}
|
|
}
|
|
},
|
|
//打開開始討伐彈窗
|
|
openGuildsecretareaStartCrusadePanel: function openGuildsecretareaStartCrusadePanel(status, setting) {
|
|
if (status == true) {
|
|
if (this.guildsecretarea_start_crusade_panel == null) {
|
|
this.guildsecretarea_start_crusade_panel = Utils.createClass("guildsecretarea_start_crusade_panel");
|
|
}
|
|
this.guildsecretarea_start_crusade_panel.open(setting);
|
|
} else {
|
|
if (this.guildsecretarea_start_crusade_panel) {
|
|
this.guildsecretarea_start_crusade_panel.close();
|
|
this.guildsecretarea_start_crusade_panel = null;
|
|
}
|
|
}
|
|
},
|
|
//打開討伐成功失敗界面
|
|
openGuildsecretareaEndCrusadePanel: function openGuildsecretareaEndCrusadePanel(status, result, setting) {
|
|
if (status == false) {
|
|
if (this.guildsecretarea_end_crusade_panel != null) {
|
|
this.guildsecretarea_end_crusade_panel.close();
|
|
this.guildsecretarea_end_crusade_panel = null;
|
|
}
|
|
} else {
|
|
if (this.guildsecretarea_end_crusade_panel == null) {
|
|
this.guildsecretarea_end_crusade_panel = GuildsecretareaEndCrusadePanel.New(result);
|
|
}
|
|
this.guildsecretarea_end_crusade_panel.open(setting);
|
|
}
|
|
},
|
|
//打開寶物獎勵展示界面
|
|
openGuildsecretareaRewardWindow: function openGuildsecretareaRewardWindow(status, boss_id) {
|
|
if (status == true) {
|
|
if (this.guildsecretarea_raward_window == null) {
|
|
this.guildsecretarea_raward_window = Utils.createClass("guildsecretarea_reward_window");
|
|
}
|
|
this.guildsecretarea_raward_window.open(boss_id);
|
|
} else {
|
|
if (this.guildsecretarea_raward_window) {
|
|
this.guildsecretarea_raward_window.close();
|
|
this.guildsecretarea_raward_window = null;
|
|
}
|
|
}
|
|
},
|
|
__delete: function __delete() {
|
|
if (this.model != null) {
|
|
this.model.DeleteMe();
|
|
this.model = null;
|
|
}
|
|
}
|
|
});
|
|
module.exports = GuildsecretareaController;
|
|
|
|
cc._RF.pop(); |