|
|
- require("game.proto.601.Require601")
- require("game.CSGWar.CSGWarModel")
- require("game.CSGWar.CSGWarConst")
- require("game.CSGWar.CSGWarSubShowItem")--城区展示item
- require("game.CSGWar.CSGWarSubSignItem")--报名阶段item
- require("game.CSGWar.CSGWarSubView")--国战活动页签
- require("game.CSGWar.CSGWarSceneView")--国战场景内界面
- require("game.CSGWar.CSGWarCityItem")--国战场景内城市item
- require("game.CSGWar.CSGWarSubPlayerItem")--报名玩家
- require("game.CSGWar.CSGWarOrderItem")--号令item
- require("game.CSGWar.CSGWarResultView")--国战结算界面
- require("game.CSGWar.CSGWarSupportView")--国战应援界面
- require("game.CSGWar.CSGWarSupportItem")--国战应援界面item
- require("game.CSGWar.CSGWarRecordView")--国战日志界面
- require("game.CSGWar.CSGWarRecordItem")--国战日志界面item
- require("game.CSGWar.CSGWarRecordSmallItem")--国战日志界面item
- require("game.CSGWar.CSGWarRewardItem")--国战奖励界面item
- require("game.CSGWar.CSGWarRewardView")--国战奖励界面
- require("game.CSGWar.CSGWarInstructionView")--国战玩法教学界面
- require("game.CSGWar.CSGWarBaseView")--国战主界面
- require("game.CSGWar.CSGWarOverlordView")--霸主限购主界面
- require("game.CSGWar.CSGWarBuffItem")--国战场景buffitem
- require("game.CSGWar.CSGWarShowView")--国战公示界面
- require("game.CSGWar.CSGWarShowItem")--国战公示item
- require("game.CSGWar.CSGWarResultCityItem")-- 结算界面领地霸主item
-
- CSGWarController = CSGWarController or BaseClass(BaseController)
- function CSGWarController:__init()
- CSGWarController.Instance = self
- self.model = CSGWarModel:getInstance()
- self.is_first_login = true
- self:InitEvent()
- self:registerAllProtocals()
- end
-
- function CSGWarController:getInstance()
- if CSGWarController.Instance == nil then
- CSGWarController.New()
- end
- return CSGWarController.Instance
- end
-
- function CSGWarController:registerAllProtocals( )
- self:RegisterProtocal(60100,"Handle60100") -- 活动状态
- self:RegisterProtocal(60101,"Handle60101") -- 上次活动中城池占领信息-只有活动结算后才刷新的
- self:RegisterProtocal(60102,"Handle60102") -- 帮战参赛信息-报名阶段和活动进行中
- self:RegisterProtocal(60103,"Handle60103") -- 应援列表
- self:RegisterProtocal(60104,"Handle60104") -- 应援帮派
- self:RegisterProtocal(60105,"Handle60105") -- 报名榜
- self:RegisterProtocal(60106,"Handle60106") -- 报名
- self:RegisterProtocal(60107,"Handle60107") -- 领取占领城池奖励
- self:RegisterProtocal(60108,"Handle60108") -- 进入场景
- self:RegisterProtocal(60109,"Handle60109") -- 退出场景
- self:RegisterProtocal(60110,"Handle60110") -- 场景信息
- self:RegisterProtocal(60111,"Handle60111") -- 帮派分组
- self:RegisterProtocal(60112,"Handle60112") -- 号令
- self:RegisterProtocal(60113,"Handle60113") -- 广播号令
- self:RegisterProtocal(60114,"Handle60114") -- 结算
- self:RegisterProtocal(60115,"Handle60115") -- 战场日志
- self:RegisterProtocal(60116,"Handle60116") -- 占领推送
- self:RegisterProtocal(60117,"Handle60117") -- 被淘汰通知
- self:RegisterProtocal(60118,"Handle60118") -- 偷袭tips
- self:RegisterProtocal(60119,"Handle60119") -- 占领tips
- self:RegisterProtocal(60120,"Handle60120") -- 霸主特权-禁言
- self:RegisterProtocal(60121,"Handle60121") -- 霸主特权-国家改名
- self:RegisterProtocal(60122,"Handle60122") -- 霸主限购-物品信息
- self:RegisterProtocal(60123,"Handle60123") -- 霸主购买
- self:RegisterProtocal(60124,"Handle60124") -- 霸主身份变更
- end
-
- function CSGWarController:InitEvent()
- local function onRequestHandler(...)
- local args = {...}
- if args[1] == 60105 or args[1] == 60112 or args[1] == 60107 or args[1] == 60106 then
- self:SendFmtToGame(args[1], "c", args[2])
- elseif args[1] == 60104 then
- self:SendFmtToGame(args[1], "ll", args[2], args[3])
- elseif args[1] == 60120 then
- self:SendFmtToGame(args[1], "l", args[2])
- elseif args[1] == 60121 then
- self:SendFmtToGame(args[1], "cs", args[2], args[3])
- else
- self:SendFmtToGame(args[1])
- end
- end
- self.model:Bind(CSGWarConst.REQ_CSGWAR_SCMD, onRequestHandler)
- local function scene_start_func ()
- self:ChangeScene()
- end
- GlobalEventSystem:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE, scene_start_func)
- local onGameStartHandler = function ()
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60100)
- -- local is_overlord = RoleManager.Instance.mainRoleInfo.is_overlord
- -- if is_overlord == 1 then--是霸主就要拿霸主限购信息
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60122)
- -- end
- end
- self:Bind(EventName.GAME_START, onGameStartHandler)
-
- local function on_open_CSGWar_base_view( ... )
- if self.CSGWarBaseView == nil then
- self.CSGWarBaseView = CSGWarBaseView.New()
- end
- if not self.CSGWarBaseView:HasOpen() then
- self.CSGWarBaseView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_MAIN_VIEW, on_open_CSGWar_base_view)
-
-
- local function on_open_CSGWar_result_view( )
- if self.CSGWarResultView == nil then
- self.CSGWarResultView = CSGWarResultView.New()
- end
- if not self.CSGWarResultView:HasOpen() then
- self.CSGWarResultView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW, on_open_CSGWar_result_view)
- local function on_open_CSGWar_support_view( )
- if self.CSGWarSupportView == nil then
- self.CSGWarSupportView = CSGWarSupportView.New()
- end
- if not self.CSGWarSupportView:HasOpen() then
- self.CSGWarSupportView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_SUPPORT_VIEW, on_open_CSGWar_support_view)
- local function on_open_CSGWar_record_view( )
- if self.CSGWarRecordView == nil then
- self.CSGWarRecordView = CSGWarRecordView.New()
- end
- if not self.CSGWarRecordView:HasOpen() then
- self.CSGWarRecordView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_RECORD_VIEW, on_open_CSGWar_record_view)
-
- local function on_open_CSGWar_reward_view( )
- if self.CSGWarRewardView == nil then
- self.CSGWarRewardView = CSGWarRewardView.New()
- end
- if not self.CSGWarRewardView:HasOpen() then
- self.CSGWarRewardView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_REWARD_VIEW, on_open_CSGWar_reward_view)
-
- local function on_open_CSGWar_instruction_view(need_auto_close)
- if self.CSGWarInstructionView == nil then
- self.CSGWarInstructionView = CSGWarInstructionView.New()
- end
- if not self.CSGWarInstructionView:HasOpen() then
- self.CSGWarInstructionView:Open(need_auto_close)
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_INSTRUCTION_VIEW, on_open_CSGWar_instruction_view)
-
- local function on_open_CSGWar_overlord_view()
- if self.CSGWarOverlordView == nil then
- self.CSGWarOverlordView = CSGWarOverlordView.New()
- end
- if not self.CSGWarOverlordView:HasOpen() then
- self.CSGWarOverlordView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_OVERLORD_VIEW, on_open_CSGWar_overlord_view)
-
- --阵营返回的时候 刷新一下数据
- local function on_request_info( ... )
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60100)
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60101)
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60102)
- end
- KfWorldModel:GetInstance():Bind(KfWorldConst.UPDATA_KfWorld_MAIN_INFO, on_request_info)
- local function on_update_red( ... )
- local function call_back( ... )
- local bool = self.model:IsCSGWarNeedRed()
- end
- TimeManager.GetInstance():StartTime("CSGWarController:on_update_red", 0.5, call_back)
- end
- self.model:Bind(CSGWarConst.UPDATE_CSGWAR_RED, on_update_red)
-
- local function on_open_csgwar_show_view( )
- if self.CSGWarShowView == nil then
- self.CSGWarShowView = CSGWarShowView.New()
- end
- if not self.CSGWarShowView:HasOpen() then
- self.CSGWarShowView:Open()
- end
- end
- self.model:Bind(CSGWarConst.OPEN_CSGWAR_SHOW_VIEW, on_open_csgwar_show_view)
- end
-
- function CSGWarController:ChangeScene( )
- local scene_mgr = SceneManager.Instance
- if scene_mgr:IsCSGWarScene() then
- if self.CSGWarSceneView == nil then
- self.CSGWarSceneView = CSGWarSceneView.New()
- end
- if not self.CSGWarSceneView:HasOpen() then
- self.CSGWarSceneView:Open()
- end
- self:SetMainUIVisible(false)
- elseif scene_mgr:IsCSGWarScene(scene_mgr:GetLastSceneId()) then
- if self.CSGWarSceneView then
- self.CSGWarSceneView:Close()
- end
- self:SetMainUIVisible(true)
- if self.can_show_result then
- self.model:Fire(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW)
- self.can_show_result = false
- end
- else
- if self.CSGWarSceneView then
- self.CSGWarSceneView:Close()
- end
- end
- end
-
- function CSGWarController:SetMainUIVisible(value)
- self:Fire(EventName.HIDE_TASK_TEAM_VIEW, not value, MainUIModel.ACTIVITY_MODE)--任务栏
- GlobalEventSystem:Fire(EventName.CHANGE_RIGHT_TIP_ICON, not value, MainUIModel.ACTIVITY_MODE) --菜单伸展
- GlobalEventSystem:Fire(EventName.SHOW_MAIN_TASK_ANNOUNCE_ROOT, not value, MainUIModel.ACTIVITY_MODE) --功能预告
- end
-
- -- ########### 活动时间 ##############
- -- protocol=60100
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- switch:int8 //活动开关0开不了1能开
- -- state:int8 //状态 0准备 1报名 2应援 3开打 4结束
- -- etime:int32 //状态结束时间
- -- }
- -- }
-
- function CSGWarController:Handle60100( )
- local vo = SCMD60100.New(true)
- --print("==WQ==:SCMD60100 [start:227] vo:", vo)
- --PrintTable(vo)
- --print("==WQ==:CSGWarController [end]")
- if vo.state == CSGWarConst.CSGWAR_STATE.SIGN then
- self.model.has_open_csgwar_view = false
- end
-
- if vo.switch == 1 and vo.state ~= CSGWarConst.CSGWAR_STATE.IDLE and vo.state ~= CSGWarConst.CSGWAR_STATE.END then
- ActivityIconManager:getInstance():addIcon(601, math.max(0,vo.etime - TimeUtil:getServerTime()))
- else
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60101)
- end
-
- self.model:SetCSGWarBaseInfo(vo)
- self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
-
- if vo.switch == 1 then
- if vo.state == CSGWarConst.CSGWAR_STATE.SIGN then--报名阶段就不管了 直接弹
- if not self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SIGN] then
- GuildModel.getInstance():SetWarActiveRedDot(601, 1, true)
- GlobalEventSystem:Fire(EventName.OPEN_ACITVITY_TIP,601,nil,true)
- self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SIGN] = true
- end
- elseif vo.state == CSGWarConst.CSGWAR_STATE.SUPPORT then--应援阶段就不管了 直接弹
- if not self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SUPPORT] then
- GuildModel.getInstance():SetWarActiveRedDot(601, 1, true)
- GlobalEventSystem:Fire(EventName.OPEN_ACITVITY_TIP,601,nil,true)
- self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SUPPORT] = true
- end
- elseif vo.state == CSGWarConst.CSGWAR_STATE.START then--如果开打了 就要看情况了 如果是刚上线的 就要凑齐数据才能确定谈不谈
- if self.is_first_login then--第一次上线等一下协议
- if vo.state == CSGWarConst.CSGWAR_STATE.START then
- self.model:SetCSGWarWaitInfo(60100)
- end
- else
- self.model:CheckCanOpenCSGWarTip()
- end
- GuildModel.getInstance():SetWarActiveRedDot(601, 1, false)
- elseif vo.state == CSGWarConst.CSGWAR_STATE.END then
- self.model.CSGWar_activity_tip_open_data = {}--活动结束了就置空邀请函缓存
- GuildModel.getInstance():SetWarActiveRedDot(601, 1, false)
- end
- elseif vo.switch == 0 then
- self.model.CSGWar_activity_tip_open_data = {}--活动结束了就置空邀请函缓存
- GuildModel.getInstance():SetWarActiveRedDot(601, 1, false)
- end
-
- self.is_first_login = false
- end
-
-
-
- -- ########### 上次活动中城池占领信息-只有活动结算后才刷新的 ##############
- -- protocol=60101
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- city_list:array{
- -- city_id:int8 // 城池id(主城是1 剩下2345)
- -- server_id:int16 // 服务器编号
- -- server_num:int16 // 服务器显示用的编号
- -- guild_id:int64 // 占领帮派id
- -- guild_name:string // 占领帮派名
- -- guild_power:int64 // 占领帮派战力
- -- guild_boss_id:int64 //占领主城的帮派老大id
- -- guild_boss_name:string //占领主城的帮派老大名称
- -- guild_boss_power:int32 //占领主城的帮派老大战斗力
- -- is_received_reward:int8 //是否已领取奖励 0未领取 1已领取
- -- }
- -- }
- -- }
-
- function CSGWarController:Handle60101( )
- local vo = SCMD60101.New(true)
- -- print("HWR:CSGWarController [start:139] vo:", vo)
- -- PrintTable(vo)
- -- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarOccupyInfo(vo)
- self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
-
- local need_show_act, end_show_time = self.model:NeedShowCSGWarResult()
- if need_show_act and end_show_time then
- ActivityIconManager:getInstance():addIcon(60101, math.max(0, end_show_time - TimeUtil:getServerTime()))
- self.model:UpdateShowIconRed()
- else
- ActivityIconManager:getInstance():deleteIcon(60101)
- end
- end
-
- --[[########### 帮战参赛信息-报名阶段和活动进行中 ##############
- protocol=60102
- {
- c2s{
- }
- s2c{
- is_sign_up:int8 //是否已报名 0未报名 1已报名
- last_sign:int32 //上次报名取消时间
- guild_list:array{
- server_id:int16 // 服务器编号
- server_num:int16 // 服务器显示用的编号
- fact_id:int16 // 阵营
- guild_id:int64 //帮派id
- guild_name:string//帮派名
- guild_power:int64 //占领帮派战力
- chief_name:string
- }
- }
- }--]]
- function CSGWarController:Handle60102( )
- local vo = SCMD60102.New(true)
- -- print("HWR:CSGWarController [start:168] vo:", vo)
- -- PrintTable(vo)
- -- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarSignInfo(vo)
- self.model:SetCSGWarWaitInfo(60102)
- self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
- end
-
- -- ########### 应援列表 ##############
- -- protocol=60103
- -- {
- -- c2s{
- -- room_id:int8 //哪个房间
- -- }
- -- s2c{
- -- room_id:int8 //哪个房间
- -- free_help_num:int8 //剩余免费应援次数
- -- cur_help_num:int16 //已应援次数
- -- help_list:array{
- -- server_id:int64 // 服务器编号
- -- server_num:int16 // 服务器显示用的编号
- -- fact_id:int16 // 阵营
- -- guild_id:int64 //帮派id
- -- guild_name:string//帮派名
- -- guild_boss_name:string //帮派老大名称
- -- help_num:int16 //被应援次数
- -- my_help_num:int16 //我应援该帮派的次数
- -- }
- -- }
- -- }
- function CSGWarController:Handle60103( )
- local vo = SCMD60103.New(true)
- -- print("HWR:CSGWarController [start:197] vo:", vo)
- -- PrintTable(vo)
- -- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarSupportInfo(vo)
- self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
- end
-
- -- ########### 应援帮派 ##############
- -- protocol=60104
- -- {
- -- c2s{
- -- server_id:int64 // 服务器编号
- -- guild_id:int64 //帮派id
- -- }
- -- s2c{
- -- result:int32 //返回码
- -- guild_id:int64 //帮派id
- -- room:int8 //所在战区
- -- }
- -- }
-
- function CSGWarController:Handle60104( )
- local vo = SCMD60104.New(true)
- if vo.result == 1 then
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60103)
- Message.show("应援成功","success")
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- -- ########### 报名榜 ##############
- -- protocol=60105
- -- {
- -- c2s{
- -- opty:int8 //0社团1外援
- -- room_id:int8 //哪个房间
- -- }
- -- s2c{
- -- opty:int8 //0社团1外援
- -- room_id:int8 //哪个房间
- -- rank_list:array{
- -- role_name:string //角色名
- -- role_power:int64 //战力
- -- lv:int16 //等级
- -- vip_flag:int8 //vip
- -- position:int8 //职位
- -- }
- -- }
- -- }
- function CSGWarController:Handle60105( )
- local vo = SCMD60105.New(true)
- local function sortfunction( a,b )
- return a.role_power > b.role_power
- end
- table.sort( vo.rank_list, sortfunction )
- for i,v in ipairs(vo.rank_list) do
- v.rank = i
- end
- print("HWR:CSGWarController [start:245] vo:", vo)
- PrintTable(vo)
- print("HWR:CSGWarController [end]")
- if vo.opty == 0 then
- self.model:SetCSGWarGuildSignList(vo)
- else
- self.model:SetCSGWarSupportSignList(vo)
- end
- end
-
- --[[########### 报名 ##############
- protocol=60106
- {
- c2s{
- opty:int8 //0取消
- }
- s2c{
- result:int32 //返回码
- opty:int8 //0取消
- help:int8 //是否外援
- }
- }--]]
- function CSGWarController:Handle60106( )
- local vo = SCMD60106.New(true)
- --print('=======Msh:CSGWarController.lua[457] ===TABLE====')
- --PrintTable(vo)
- if vo.result == 1 then
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60105, vo.help, vo.room)
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60102)
- if vo.opty == 0 then
- Message.show("您已成功取消报名","success")
- else
- Message.show("您已成功报名","success")
- end
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- -- ########### 领取占领城池奖励 ##############
- -- protocol=60107
- -- {
- -- c2s{
- -- room_id:int8 //哪个房间
- -- city_id:int8 //哪个城池
- -- }
- -- s2c{
- -- room_id:int8 //哪个房间
- -- city_id:int8 //哪个城池
- -- result:int32 //返回码
- -- }
- -- }
-
- function CSGWarController:Handle60107( )
- local vo = SCMD60107.New(true)
- if vo.result == 1 then
- Message.show("您已成功领取奖励","success")
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60101)
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- -- ########### 进入场景 ##############
- -- protocol=60108
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- result:int32 //返回码
- -- }
- -- }
-
- function CSGWarController:Handle60108( )
- local vo = SCMD60108.New(true)
- if vo.result == 1 then
- Message.show("进入跨国团战","success")
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- -- ########### 退出场景 ##############
- -- protocol=60109
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- result:int32 //返回码
- -- }
- -- }
-
- function CSGWarController:Handle60109( )
- local vo = SCMD60109.New(true)
- if vo.result == 1 then
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- -- ########### 场景信息 ##############
- -- protocol=60110
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- city_info:array{
- -- city_id:int8 //城池id
- -- blood:int64 //血量
- -- max_blood:int64 //总血量
- -- guild_id:int64 //占领帮派id
- -- group:int8 //分组
- -- guild_name:string //占领帮派名称
- -- guard_num:int8 //守护兽数量
- -- }
- -- }
- -- }
-
- function CSGWarController:Handle60110( )
- local vo = SCMD60110.New(true)
- -- print("HWR:CSGWarController [start:352] vo:", vo)
- -- PrintTable(vo)
- -- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarCityInfo(vo.city_info)
- end
-
- -- ########### 帮派分组 ##############
- -- protocol=60111
- -- {
- -- s2c{
- -- guild_info:array{
- -- guild_id:int64 //帮派Id
- -- group:int16 //战斗分组
- -- }
- -- }
- -- }
-
- function CSGWarController:Handle60111( )
- local vo = SCMD60111.New(true)
- -- print("HWR:CSGWarController [start:390] vo:", vo)
- -- PrintTable(vo)
- -- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarCountryInfo(vo.guild_info)
- end
-
- -- ########### 号令 ##############
- -- protocol=60112
- -- {
- -- c2s{
- -- city_id:int8 //城池id
- -- }
- -- s2c{
- -- result:int32 //返回码
- -- }
- -- }
-
- function CSGWarController:Handle60112( )
- local vo = SCMD60112.New(true)
- if vo.result == 1 then
- Message.show("团长令发布成功","success")
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- -- ########### 广播号令 ##############
- -- protocol=60113
- -- {
- -- s2c{
- -- city_id:int8 //城池id
- -- }
- -- }
-
- function CSGWarController:Handle60113( )
- local vo = SCMD60113.New(true)
- self.model:Fire(CSGWarConst.SHOW_CSGWAR_COMMAND, vo.city_id)
- end
-
- --[[########### 结算 ##############
- protocol=60114
- {
- s2c{
- occupy_city:array{
- city_id:int8 //城池id
- }
- city_list:array{
- city_id:int8 // 城池id
- server_num:int16 // 服务器显示用的编号
- guild_name:string // 占领帮派名
- chief_name:string // 占领主城的帮派老大名称
- chief_info:rec_picture // 帮派老大信息
- }
- }
- }--]]
- function CSGWarController:Handle60114( )
- local vo = SCMD60114.New(true)
- print("HWR:CSGWarController [start:419] vo:", vo)
- PrintTable(vo)
- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarResultInfo(vo)
- local scene_mgr = SceneManager.Instance
- if not scene_mgr:IsCSGWarScene() then--收到协议的时候不是在国战场景 就直接弹
- self.model:Fire(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW)
- else
- self.can_show_result = true
- end
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60122)
- end
-
- -- ########### 战场日志 ##############
- -- protocol=60115
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- logs:array{
- -- time:int32
- -- city_list:array{
- -- city_id:int8 // 城池id
- -- server_num:int16 // 服务器显示用的编号
- -- guild_name:string // 占领帮派名
- -- chief_name:string // 占领主城的帮派老大名称
- -- chief_info:rec_picture // 帮派老大信息
- -- }
-
- -- }
- -- }
- -- }
- function CSGWarController:Handle60115( )
- local vo = SCMD60115.New(true)
- print("HWR:CSGWarController [start:524] vo:", vo)
- PrintTable(vo)
- print("HWR:CSGWarController [end]")
- self.model:SetCSGWarRecordInfo(vo)
- end
-
- -- #######占领推送############
- -- protocol=60116
- -- {
- -- s2c{
- -- fact_id:int8
- -- server_num:int16
- -- name:string
- -- city:int8
- -- }
- -- }
- function CSGWarController:Handle60116( )
- local vo = SCMD60116.New(true)
- local cfg = Config.Crossguildwarscene[vo.city]
- local guild_name = GetCSLongName(vo.name, vo.server_num)
- local country_name = KfWorldModel:GetInstance():GetContrayNameById(vo.fact_id)
- local str = string.format("%s的%s成功占领了%s", country_name, guild_name, cfg.name)
- local special_tip_data = {
- type = SpecialTipType.Middle,
- sepeical_str = str,
- need_flash = false,
- show_time = 5,
- }
- CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data)
- end
-
- -- #########淘汰通知#############
- -- protocol=60117
- -- {
- -- s2c{
- -- room:int8 //所在战区
- -- help:int8 //是否外援
- -- }
- -- }
-
- function CSGWarController:Handle60117( )
- local vo = SCMD60117.New(true)
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60102)
- end
-
- function CSGWarController:Handle60118( )
- local vo = SCMD60118.New(true)
- if not SceneManager:getInstance():IsCSGWarScene() then return end
- local str = string.format("糟了!有人偷袭了我方占领的%s!", vo.city_name)
- local temp_head_name = RoleManager.Instance.mainRoleInfo.name
- local data = {
- head_type = 1004,
- desc = str,
- head_name = temp_head_name or "",
- hide_time = 15,
- dalay_time = 1,
- is_task_type = true,
- pos = Vector3(230,0,0),
- }
- GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW,data)
- end
-
- function CSGWarController:Handle60119( )
- local vo = SCMD60119.New(true)
- if not SceneManager:getInstance():IsCSGWarScene() then return end
- local str = string.format("%s社团已经快马加鞭占领了%s,我们也要稳住!", vo.guild_name,vo.city_name)
- local temp_head_name = RoleManager.Instance.mainRoleInfo.name
- local data = {
- head_type = 1004,
- desc = str,
- head_name = temp_head_name or "",
- hide_time = 15,
- dalay_time = 1,
- is_task_type = true,
- pos = Vector3(230,0,0),
- }
- GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW,data)
- end
-
- function CSGWarController:Handle60120( )
- local vo = SCMD60120.New(true)
- if vo.result == 1 then
- Message.show("禁言成功")
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- function CSGWarController:Handle60121( )
- local vo = SCMD60121.New(true)
- if vo.result == 1 then
- Message.show("改名成功", "success")
- GlobalEventSystem:Fire(EventName.OPEN_RENAME_VIEW, false, true, self.index)
- KfWorldModel:GetInstance():UpdateFactionName(vo.fact_id, vo.name)
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- function CSGWarController:Handle60122( )
- local vo = SCMD60122.New(true)
- print("HWR:CSGWarController [start:712] vo:", vo)
- PrintTable(vo)
- print("HWR:CSGWarController [end]")
- if vo.is_buy == 1 and RoleManager.Instance.mainRoleInfo.is_overlord == 1 and vo.result == 1 then
- ActivityIconManager:getInstance():addIcon(60100, -1)
- else
- ActivityIconManager:getInstance():deleteIcon(60100)
- end
- self.model:SetCSGWarOverlordInfo(vo)
- end
-
- function CSGWarController:Handle60123( )
- local vo = SCMD60123.New(true)
- if vo.result == 1 then
- Message.show("购买成功", "success")
- ActivityIconManager:getInstance():deleteIcon(60100)
- else
- ErrorCodeShow(vo.result)
- end
- end
-
- function CSGWarController:Handle60124( )
- local vo = SCMD60124.New(true)
- self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60122)
- RoleManager.Instance.mainRoleInfo:ChangeVar("is_overlord", vo.is_overlord)
- end
|