|
|
require("game.proto.102.Require102")
|
|
require("game.setting.SettingModel")
|
|
SettingController = SettingController or BaseClass(BaseController)
|
|
function SettingController:__init()
|
|
SettingController.Instance = self
|
|
self.model = SettingModel:getInstance()
|
|
|
|
self:RegisterProtocals()
|
|
self:InitEvent()
|
|
|
|
end
|
|
|
|
function SettingController:RegisterProtocals()
|
|
self:RegisterProtocal(10202,"on10202")
|
|
self:RegisterProtocal(10203,"on10203")
|
|
self:RegisterProtocal(10204,"on10204")
|
|
self:RegisterProtocal(10205,"on10205")
|
|
self:RegisterProtocal(10207,"on10207") --服务器跨天
|
|
self:RegisterProtocal(10208,"on10208") --战场信息:连杀信息
|
|
self:RegisterProtocal(10209,"on10209") --战场信息-击杀推送
|
|
end
|
|
|
|
function SettingController:on10204()
|
|
local vo = SCMD10204.New(true)
|
|
if vo.error_code ~= 1 then
|
|
ErrorCodeShow(vo.error_code)
|
|
end
|
|
end
|
|
|
|
--大类型数据返回
|
|
function SettingController:on10202()
|
|
local vo = SCMD10202.New(true)
|
|
self.model:SetTotalSettingInfo(vo)
|
|
if vo.type == 1 then --只需要请求一次
|
|
ChatModel:getInstance().require_11010_times = 3
|
|
ChatModel:getInstance():Fire(ChatModel.REQUEST_CACHE_EVENT, ChatModel.CHANNEL_WORLD)
|
|
ChatModel:getInstance():Fire(ChatModel.REQUEST_CACHE_EVENT, ChatModel.CHANNEL_CECRET)
|
|
ChatModel:getInstance():Fire(ChatModel.REQUEST_CACHE_EVENT, ChatModel.CHANNEL_CROSS)
|
|
ChatModel:getInstance():Fire(ChatModel.REQUEST_CACHE_EVENT, ChatModel.CHANNEL_COUNTRY)
|
|
local guild_id = RoleManager.Instance:GetMainRoleVo().guild_id
|
|
if guild_id and guild_id ~=0 then
|
|
ChatModel:getInstance().require_11010_times = 4
|
|
ChatModel:getInstance():Fire(ChatModel.REQUEST_CACHE_EVENT, ChatModel.CHANNEL_GUILD)
|
|
end
|
|
end
|
|
end
|
|
|
|
function SettingController:on10205()
|
|
local vo = SCMD10205.New(true)
|
|
ErrorCodeShow(vo.error_code, vo.args)
|
|
--重置寻宝状态
|
|
if vo.error_code == 1020002 then
|
|
TreasureHuntModel:getInstance():ChangeVar("bool_hunting", false)
|
|
end
|
|
end
|
|
|
|
function SettingController:on10207()
|
|
local vo = SCMD10207.New(true)
|
|
GlobalEventSystem:Fire(EventName.CHANE_DAY, vo.type)
|
|
end
|
|
|
|
--设置小类型返回
|
|
function SettingController:on10203()
|
|
local vo = SCMD10203.New(true)
|
|
if vo then
|
|
if vo.error_code == 1 then -- 1 表示成功
|
|
self.model:SetSettingInfo(vo.type,vo.subtype,vo.is_open)
|
|
SettingModel:getInstance():Fire(SettingModel.BROADCAST_SETTING_CHANGE)
|
|
else
|
|
ErrorCodeShow(vo.error_code)
|
|
end
|
|
end
|
|
end
|
|
|
|
function SettingController:InitEvent()
|
|
|
|
local engine_ver = EnglineVersion and tonumber(AppConst.EnglineVer) or 10000
|
|
|
|
--游戏登陆发送聊天设置请求
|
|
local game_start = function ()
|
|
self:SendFmtToGame(10202,"c",1)
|
|
self:SendFmtToGame(10202,"c",2)
|
|
self:SendFmtToGame(10204, "l", engine_ver)
|
|
end
|
|
|
|
GlobalEventSystem:Bind(EventName.GAME_START, game_start)
|
|
|
|
--请求所有设置信息
|
|
local function onRequestTotalSetting(type)
|
|
self:SendFmtToGame(10202,"c", type)
|
|
end
|
|
GlobalEventSystem:Bind(EventName.REQUEST_TOTAL_TYPE_SETTING,onRequestTotalSetting)
|
|
|
|
--请求所有设置信息
|
|
local function onRequestSetSubType(type,subtype,is_open)
|
|
self:SendFmtToGame(10203, "ccc", type,subtype,is_open)
|
|
end
|
|
self.model:Bind(SettingModel.RequestSetSubtype,onRequestSetSubType)
|
|
end
|
|
|
|
function SettingController:on10208()
|
|
local vo = SCMD10208.New(true)
|
|
local data =
|
|
{
|
|
num = vo.kill,
|
|
pos_x = -100,
|
|
pos_y = 0,
|
|
}
|
|
GlobalEventSystem:Fire(EventName.SHOW_DYNAMIC_FIGHT_KILL_COMBO_TIP, false, true, data)
|
|
end
|
|
|
|
function SettingController:on10209()
|
|
local vo = {
|
|
killer = {},
|
|
deader = {},
|
|
}
|
|
PictureProtoVo.ReadFmt(vo.killer)
|
|
PictureProtoVo.ReadFmt(vo.deader)
|
|
local kill_type = vo.type == 1 and 2 or 1
|
|
local data = {
|
|
role_vo_1 = vo.killer, --我方
|
|
role_vo_2 = vo.deader, --敌方
|
|
type = kill_type, --UI类型 2是击杀 1是终结
|
|
desc = "",
|
|
is_break = 1,
|
|
max_num = 2,
|
|
need_cut_str = true,
|
|
}
|
|
GlobalEventSystem:Fire(EventName.SHOW_DYNAMIC_FIGHT_TIP, data)
|
|
end
|