源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

798 行
25 KiB

  1. require("game.proto.601.Require601")
  2. require("game.CSGWar.CSGWarModel")
  3. require("game.CSGWar.CSGWarConst")
  4. require("game.CSGWar.CSGWarSubShowItem")--城区展示item
  5. require("game.CSGWar.CSGWarSubSignItem")--报名阶段item
  6. require("game.CSGWar.CSGWarSubView")--国战活动页签
  7. require("game.CSGWar.CSGWarSceneView")--国战场景内界面
  8. require("game.CSGWar.CSGWarCityItem")--国战场景内城市item
  9. require("game.CSGWar.CSGWarSubPlayerItem")--报名玩家
  10. require("game.CSGWar.CSGWarOrderItem")--号令item
  11. require("game.CSGWar.CSGWarResultView")--国战结算界面
  12. require("game.CSGWar.CSGWarSupportView")--国战应援界面
  13. require("game.CSGWar.CSGWarSupportItem")--国战应援界面item
  14. require("game.CSGWar.CSGWarRecordView")--国战日志界面
  15. require("game.CSGWar.CSGWarRecordItem")--国战日志界面item
  16. require("game.CSGWar.CSGWarRecordSmallItem")--国战日志界面item
  17. require("game.CSGWar.CSGWarRewardItem")--国战奖励界面item
  18. require("game.CSGWar.CSGWarRewardView")--国战奖励界面
  19. require("game.CSGWar.CSGWarInstructionView")--国战玩法教学界面
  20. require("game.CSGWar.CSGWarBaseView")--国战主界面
  21. require("game.CSGWar.CSGWarOverlordView")--霸主限购主界面
  22. require("game.CSGWar.CSGWarBuffItem")--国战场景buffitem
  23. require("game.CSGWar.CSGWarShowView")--国战公示界面
  24. require("game.CSGWar.CSGWarShowItem")--国战公示item
  25. require("game.CSGWar.CSGWarResultCityItem")-- 结算界面领地霸主item
  26. CSGWarController = CSGWarController or BaseClass(BaseController)
  27. function CSGWarController:__init()
  28. CSGWarController.Instance = self
  29. self.model = CSGWarModel:getInstance()
  30. self.is_first_login = true
  31. self:InitEvent()
  32. self:registerAllProtocals()
  33. end
  34. function CSGWarController:getInstance()
  35. if CSGWarController.Instance == nil then
  36. CSGWarController.New()
  37. end
  38. return CSGWarController.Instance
  39. end
  40. function CSGWarController:registerAllProtocals( )
  41. self:RegisterProtocal(60100,"Handle60100") -- 活动状态
  42. self:RegisterProtocal(60101,"Handle60101") -- 上次活动中城池占领信息-只有活动结算后才刷新的
  43. self:RegisterProtocal(60102,"Handle60102") -- 帮战参赛信息-报名阶段和活动进行中
  44. self:RegisterProtocal(60103,"Handle60103") -- 应援列表
  45. self:RegisterProtocal(60104,"Handle60104") -- 应援帮派
  46. self:RegisterProtocal(60105,"Handle60105") -- 报名榜
  47. self:RegisterProtocal(60106,"Handle60106") -- 报名
  48. self:RegisterProtocal(60107,"Handle60107") -- 领取占领城池奖励
  49. self:RegisterProtocal(60108,"Handle60108") -- 进入场景
  50. self:RegisterProtocal(60109,"Handle60109") -- 退出场景
  51. self:RegisterProtocal(60110,"Handle60110") -- 场景信息
  52. self:RegisterProtocal(60111,"Handle60111") -- 帮派分组
  53. self:RegisterProtocal(60112,"Handle60112") -- 号令
  54. self:RegisterProtocal(60113,"Handle60113") -- 广播号令
  55. self:RegisterProtocal(60114,"Handle60114") -- 结算
  56. self:RegisterProtocal(60115,"Handle60115") -- 战场日志
  57. self:RegisterProtocal(60116,"Handle60116") -- 占领推送
  58. self:RegisterProtocal(60117,"Handle60117") -- 被淘汰通知
  59. self:RegisterProtocal(60118,"Handle60118") -- 偷袭tips
  60. self:RegisterProtocal(60119,"Handle60119") -- 占领tips
  61. self:RegisterProtocal(60120,"Handle60120") -- 霸主特权-禁言
  62. self:RegisterProtocal(60121,"Handle60121") -- 霸主特权-国家改名
  63. self:RegisterProtocal(60122,"Handle60122") -- 霸主限购-物品信息
  64. self:RegisterProtocal(60123,"Handle60123") -- 霸主购买
  65. self:RegisterProtocal(60124,"Handle60124") -- 霸主身份变更
  66. end
  67. function CSGWarController:InitEvent()
  68. local function onRequestHandler(...)
  69. local args = {...}
  70. if args[1] == 60105 or args[1] == 60112 or args[1] == 60107 or args[1] == 60106 then
  71. self:SendFmtToGame(args[1], "c", args[2])
  72. elseif args[1] == 60104 then
  73. self:SendFmtToGame(args[1], "ll", args[2], args[3])
  74. elseif args[1] == 60120 then
  75. self:SendFmtToGame(args[1], "l", args[2])
  76. elseif args[1] == 60121 then
  77. self:SendFmtToGame(args[1], "cs", args[2], args[3])
  78. else
  79. self:SendFmtToGame(args[1])
  80. end
  81. end
  82. self.model:Bind(CSGWarConst.REQ_CSGWAR_SCMD, onRequestHandler)
  83. local function scene_start_func ()
  84. self:ChangeScene()
  85. end
  86. GlobalEventSystem:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE, scene_start_func)
  87. local onGameStartHandler = function ()
  88. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60100)
  89. -- local is_overlord = RoleManager.Instance.mainRoleInfo.is_overlord
  90. -- if is_overlord == 1 then--是霸主就要拿霸主限购信息
  91. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60122)
  92. -- end
  93. end
  94. self:Bind(EventName.GAME_START, onGameStartHandler)
  95. local function on_open_CSGWar_base_view( ... )
  96. if self.CSGWarBaseView == nil then
  97. self.CSGWarBaseView = CSGWarBaseView.New()
  98. end
  99. if not self.CSGWarBaseView:HasOpen() then
  100. self.CSGWarBaseView:Open()
  101. end
  102. end
  103. self.model:Bind(CSGWarConst.OPEN_CSGWAR_MAIN_VIEW, on_open_CSGWar_base_view)
  104. local function on_open_CSGWar_result_view( )
  105. if self.CSGWarResultView == nil then
  106. self.CSGWarResultView = CSGWarResultView.New()
  107. end
  108. if not self.CSGWarResultView:HasOpen() then
  109. self.CSGWarResultView:Open()
  110. end
  111. end
  112. self.model:Bind(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW, on_open_CSGWar_result_view)
  113. local function on_open_CSGWar_support_view( )
  114. if self.CSGWarSupportView == nil then
  115. self.CSGWarSupportView = CSGWarSupportView.New()
  116. end
  117. if not self.CSGWarSupportView:HasOpen() then
  118. self.CSGWarSupportView:Open()
  119. end
  120. end
  121. self.model:Bind(CSGWarConst.OPEN_CSGWAR_SUPPORT_VIEW, on_open_CSGWar_support_view)
  122. local function on_open_CSGWar_record_view( )
  123. if self.CSGWarRecordView == nil then
  124. self.CSGWarRecordView = CSGWarRecordView.New()
  125. end
  126. if not self.CSGWarRecordView:HasOpen() then
  127. self.CSGWarRecordView:Open()
  128. end
  129. end
  130. self.model:Bind(CSGWarConst.OPEN_CSGWAR_RECORD_VIEW, on_open_CSGWar_record_view)
  131. local function on_open_CSGWar_reward_view( )
  132. if self.CSGWarRewardView == nil then
  133. self.CSGWarRewardView = CSGWarRewardView.New()
  134. end
  135. if not self.CSGWarRewardView:HasOpen() then
  136. self.CSGWarRewardView:Open()
  137. end
  138. end
  139. self.model:Bind(CSGWarConst.OPEN_CSGWAR_REWARD_VIEW, on_open_CSGWar_reward_view)
  140. local function on_open_CSGWar_instruction_view(need_auto_close)
  141. if self.CSGWarInstructionView == nil then
  142. self.CSGWarInstructionView = CSGWarInstructionView.New()
  143. end
  144. if not self.CSGWarInstructionView:HasOpen() then
  145. self.CSGWarInstructionView:Open(need_auto_close)
  146. end
  147. end
  148. self.model:Bind(CSGWarConst.OPEN_CSGWAR_INSTRUCTION_VIEW, on_open_CSGWar_instruction_view)
  149. local function on_open_CSGWar_overlord_view()
  150. if self.CSGWarOverlordView == nil then
  151. self.CSGWarOverlordView = CSGWarOverlordView.New()
  152. end
  153. if not self.CSGWarOverlordView:HasOpen() then
  154. self.CSGWarOverlordView:Open()
  155. end
  156. end
  157. self.model:Bind(CSGWarConst.OPEN_CSGWAR_OVERLORD_VIEW, on_open_CSGWar_overlord_view)
  158. --阵营返回的时候 刷新一下数据
  159. local function on_request_info( ... )
  160. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60100)
  161. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60101)
  162. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60102)
  163. end
  164. KfWorldModel:GetInstance():Bind(KfWorldConst.UPDATA_KfWorld_MAIN_INFO, on_request_info)
  165. local function on_update_red( ... )
  166. local function call_back( ... )
  167. local bool = self.model:IsCSGWarNeedRed()
  168. end
  169. TimeManager.GetInstance():StartTime("CSGWarController:on_update_red", 0.5, call_back)
  170. end
  171. self.model:Bind(CSGWarConst.UPDATE_CSGWAR_RED, on_update_red)
  172. local function on_open_csgwar_show_view( )
  173. if self.CSGWarShowView == nil then
  174. self.CSGWarShowView = CSGWarShowView.New()
  175. end
  176. if not self.CSGWarShowView:HasOpen() then
  177. self.CSGWarShowView:Open()
  178. end
  179. end
  180. self.model:Bind(CSGWarConst.OPEN_CSGWAR_SHOW_VIEW, on_open_csgwar_show_view)
  181. end
  182. function CSGWarController:ChangeScene( )
  183. local scene_mgr = SceneManager.Instance
  184. if scene_mgr:IsCSGWarScene() then
  185. if self.CSGWarSceneView == nil then
  186. self.CSGWarSceneView = CSGWarSceneView.New()
  187. end
  188. if not self.CSGWarSceneView:HasOpen() then
  189. self.CSGWarSceneView:Open()
  190. end
  191. self:SetMainUIVisible(false)
  192. elseif scene_mgr:IsCSGWarScene(scene_mgr:GetLastSceneId()) then
  193. if self.CSGWarSceneView then
  194. self.CSGWarSceneView:Close()
  195. end
  196. self:SetMainUIVisible(true)
  197. if self.can_show_result then
  198. self.model:Fire(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW)
  199. self.can_show_result = false
  200. end
  201. else
  202. if self.CSGWarSceneView then
  203. self.CSGWarSceneView:Close()
  204. end
  205. end
  206. end
  207. function CSGWarController:SetMainUIVisible(value)
  208. self:Fire(EventName.HIDE_TASK_TEAM_VIEW, not value, MainUIModel.ACTIVITY_MODE)--任务栏
  209. GlobalEventSystem:Fire(EventName.CHANGE_RIGHT_TIP_ICON, not value, MainUIModel.ACTIVITY_MODE) --菜单伸展
  210. GlobalEventSystem:Fire(EventName.SHOW_MAIN_TASK_ANNOUNCE_ROOT, not value, MainUIModel.ACTIVITY_MODE) --功能预告
  211. end
  212. -- ########### 活动时间 ##############
  213. -- protocol=60100
  214. -- {
  215. -- c2s{
  216. -- }
  217. -- s2c{
  218. -- switch:int8 //活动开关0开不了1能开
  219. -- state:int8 //状态 0准备 1报名 2应援 3开打 4结束
  220. -- etime:int32 //状态结束时间
  221. -- }
  222. -- }
  223. function CSGWarController:Handle60100( )
  224. local vo = SCMD60100.New(true)
  225. --print("==WQ==:SCMD60100 [start:227] vo:", vo)
  226. --PrintTable(vo)
  227. --print("==WQ==:CSGWarController [end]")
  228. if vo.state == CSGWarConst.CSGWAR_STATE.SIGN then
  229. self.model.has_open_csgwar_view = false
  230. end
  231. if vo.switch == 1 and vo.state ~= CSGWarConst.CSGWAR_STATE.IDLE and vo.state ~= CSGWarConst.CSGWAR_STATE.END then
  232. ActivityIconManager:getInstance():addIcon(601, math.max(0,vo.etime - TimeUtil:getServerTime()))
  233. else
  234. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60101)
  235. end
  236. self.model:SetCSGWarBaseInfo(vo)
  237. self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
  238. if vo.switch == 1 then
  239. if vo.state == CSGWarConst.CSGWAR_STATE.SIGN then--报名阶段就不管了 直接弹
  240. if not self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SIGN] then
  241. GuildModel.getInstance():SetWarActiveRedDot(601, 1, true)
  242. GlobalEventSystem:Fire(EventName.OPEN_ACITVITY_TIP,601,nil,true)
  243. self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SIGN] = true
  244. end
  245. elseif vo.state == CSGWarConst.CSGWAR_STATE.SUPPORT then--应援阶段就不管了 直接弹
  246. if not self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SUPPORT] then
  247. GuildModel.getInstance():SetWarActiveRedDot(601, 1, true)
  248. GlobalEventSystem:Fire(EventName.OPEN_ACITVITY_TIP,601,nil,true)
  249. self.model.CSGWar_activity_tip_open_data[CSGWarConst.CSGWAR_STATE.SUPPORT] = true
  250. end
  251. elseif vo.state == CSGWarConst.CSGWAR_STATE.START then--如果开打了 就要看情况了 如果是刚上线的 就要凑齐数据才能确定谈不谈
  252. if self.is_first_login then--第一次上线等一下协议
  253. if vo.state == CSGWarConst.CSGWAR_STATE.START then
  254. self.model:SetCSGWarWaitInfo(60100)
  255. end
  256. else
  257. self.model:CheckCanOpenCSGWarTip()
  258. end
  259. GuildModel.getInstance():SetWarActiveRedDot(601, 1, false)
  260. elseif vo.state == CSGWarConst.CSGWAR_STATE.END then
  261. self.model.CSGWar_activity_tip_open_data = {}--活动结束了就置空邀请函缓存
  262. GuildModel.getInstance():SetWarActiveRedDot(601, 1, false)
  263. end
  264. elseif vo.switch == 0 then
  265. self.model.CSGWar_activity_tip_open_data = {}--活动结束了就置空邀请函缓存
  266. GuildModel.getInstance():SetWarActiveRedDot(601, 1, false)
  267. end
  268. self.is_first_login = false
  269. end
  270. -- ########### 上次活动中城池占领信息-只有活动结算后才刷新的 ##############
  271. -- protocol=60101
  272. -- {
  273. -- c2s{
  274. -- }
  275. -- s2c{
  276. -- city_list:array{
  277. -- city_id:int8 // 城池id(主城是1 剩下2345)
  278. -- server_id:int16 // 服务器编号
  279. -- server_num:int16 // 服务器显示用的编号
  280. -- guild_id:int64 // 占领帮派id
  281. -- guild_name:string // 占领帮派名
  282. -- guild_power:int64 // 占领帮派战力
  283. -- guild_boss_id:int64 //占领主城的帮派老大id
  284. -- guild_boss_name:string //占领主城的帮派老大名称
  285. -- guild_boss_power:int32 //占领主城的帮派老大战斗力
  286. -- is_received_reward:int8 //是否已领取奖励 0未领取 1已领取
  287. -- }
  288. -- }
  289. -- }
  290. function CSGWarController:Handle60101( )
  291. local vo = SCMD60101.New(true)
  292. -- print("HWR:CSGWarController [start:139] vo:", vo)
  293. -- PrintTable(vo)
  294. -- print("HWR:CSGWarController [end]")
  295. self.model:SetCSGWarOccupyInfo(vo)
  296. self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
  297. local need_show_act, end_show_time = self.model:NeedShowCSGWarResult()
  298. if need_show_act and end_show_time then
  299. ActivityIconManager:getInstance():addIcon(60101, math.max(0, end_show_time - TimeUtil:getServerTime()))
  300. self.model:UpdateShowIconRed()
  301. else
  302. ActivityIconManager:getInstance():deleteIcon(60101)
  303. end
  304. end
  305. --[[########### 帮战参赛信息-报名阶段和活动进行中 ##############
  306. protocol=60102
  307. {
  308. c2s{
  309. }
  310. s2c{
  311. is_sign_up:int8 // 0 1
  312. last_sign:int32 //
  313. guild_list:array{
  314. server_id:int16 //
  315. server_num:int16 //
  316. fact_id:int16 //
  317. guild_id:int64 //id
  318. guild_name:string//
  319. guild_power:int64 //
  320. chief_name:string
  321. }
  322. }
  323. }--]]
  324. function CSGWarController:Handle60102( )
  325. local vo = SCMD60102.New(true)
  326. -- print("HWR:CSGWarController [start:168] vo:", vo)
  327. -- PrintTable(vo)
  328. -- print("HWR:CSGWarController [end]")
  329. self.model:SetCSGWarSignInfo(vo)
  330. self.model:SetCSGWarWaitInfo(60102)
  331. self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
  332. end
  333. -- ########### 应援列表 ##############
  334. -- protocol=60103
  335. -- {
  336. -- c2s{
  337. -- room_id:int8 //哪个房间
  338. -- }
  339. -- s2c{
  340. -- room_id:int8 //哪个房间
  341. -- free_help_num:int8 //剩余免费应援次数
  342. -- cur_help_num:int16 //已应援次数
  343. -- help_list:array{
  344. -- server_id:int64 // 服务器编号
  345. -- server_num:int16 // 服务器显示用的编号
  346. -- fact_id:int16 // 阵营
  347. -- guild_id:int64 //帮派id
  348. -- guild_name:string//帮派名
  349. -- guild_boss_name:string //帮派老大名称
  350. -- help_num:int16 //被应援次数
  351. -- my_help_num:int16 //我应援该帮派的次数
  352. -- }
  353. -- }
  354. -- }
  355. function CSGWarController:Handle60103( )
  356. local vo = SCMD60103.New(true)
  357. -- print("HWR:CSGWarController [start:197] vo:", vo)
  358. -- PrintTable(vo)
  359. -- print("HWR:CSGWarController [end]")
  360. self.model:SetCSGWarSupportInfo(vo)
  361. self.model:Fire(CSGWarConst.UPDATE_CSGWAR_RED)
  362. end
  363. -- ########### 应援帮派 ##############
  364. -- protocol=60104
  365. -- {
  366. -- c2s{
  367. -- server_id:int64 // 服务器编号
  368. -- guild_id:int64 //帮派id
  369. -- }
  370. -- s2c{
  371. -- result:int32 //返回码
  372. -- guild_id:int64 //帮派id
  373. -- room:int8 //所在战区
  374. -- }
  375. -- }
  376. function CSGWarController:Handle60104( )
  377. local vo = SCMD60104.New(true)
  378. if vo.result == 1 then
  379. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60103)
  380. Message.show("应援成功","success")
  381. else
  382. ErrorCodeShow(vo.result)
  383. end
  384. end
  385. -- ########### 报名榜 ##############
  386. -- protocol=60105
  387. -- {
  388. -- c2s{
  389. -- opty:int8 //0社团1外援
  390. -- room_id:int8 //哪个房间
  391. -- }
  392. -- s2c{
  393. -- opty:int8 //0社团1外援
  394. -- room_id:int8 //哪个房间
  395. -- rank_list:array{
  396. -- role_name:string //角色名
  397. -- role_power:int64 //战力
  398. -- lv:int16 //等级
  399. -- vip_flag:int8 //vip
  400. -- position:int8 //职位
  401. -- }
  402. -- }
  403. -- }
  404. function CSGWarController:Handle60105( )
  405. local vo = SCMD60105.New(true)
  406. local function sortfunction( a,b )
  407. return a.role_power > b.role_power
  408. end
  409. table.sort( vo.rank_list, sortfunction )
  410. for i,v in ipairs(vo.rank_list) do
  411. v.rank = i
  412. end
  413. print("HWR:CSGWarController [start:245] vo:", vo)
  414. PrintTable(vo)
  415. print("HWR:CSGWarController [end]")
  416. if vo.opty == 0 then
  417. self.model:SetCSGWarGuildSignList(vo)
  418. else
  419. self.model:SetCSGWarSupportSignList(vo)
  420. end
  421. end
  422. --[[########### 报名 ##############
  423. protocol=60106
  424. {
  425. c2s{
  426. opty:int8 //0
  427. }
  428. s2c{
  429. result:int32 //
  430. opty:int8 //0
  431. help:int8 //
  432. }
  433. }--]]
  434. function CSGWarController:Handle60106( )
  435. local vo = SCMD60106.New(true)
  436. --print('=======Msh:CSGWarController.lua[457] ===TABLE====')
  437. --PrintTable(vo)
  438. if vo.result == 1 then
  439. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60105, vo.help, vo.room)
  440. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60102)
  441. if vo.opty == 0 then
  442. Message.show("您已成功取消报名","success")
  443. else
  444. Message.show("您已成功报名","success")
  445. end
  446. else
  447. ErrorCodeShow(vo.result)
  448. end
  449. end
  450. -- ########### 领取占领城池奖励 ##############
  451. -- protocol=60107
  452. -- {
  453. -- c2s{
  454. -- room_id:int8 //哪个房间
  455. -- city_id:int8 //哪个城池
  456. -- }
  457. -- s2c{
  458. -- room_id:int8 //哪个房间
  459. -- city_id:int8 //哪个城池
  460. -- result:int32 //返回码
  461. -- }
  462. -- }
  463. function CSGWarController:Handle60107( )
  464. local vo = SCMD60107.New(true)
  465. if vo.result == 1 then
  466. Message.show("您已成功领取奖励","success")
  467. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60101)
  468. else
  469. ErrorCodeShow(vo.result)
  470. end
  471. end
  472. -- ########### 进入场景 ##############
  473. -- protocol=60108
  474. -- {
  475. -- c2s{
  476. -- }
  477. -- s2c{
  478. -- result:int32 //返回码
  479. -- }
  480. -- }
  481. function CSGWarController:Handle60108( )
  482. local vo = SCMD60108.New(true)
  483. if vo.result == 1 then
  484. Message.show("进入跨国团战","success")
  485. else
  486. ErrorCodeShow(vo.result)
  487. end
  488. end
  489. -- ########### 退出场景 ##############
  490. -- protocol=60109
  491. -- {
  492. -- c2s{
  493. -- }
  494. -- s2c{
  495. -- result:int32 //返回码
  496. -- }
  497. -- }
  498. function CSGWarController:Handle60109( )
  499. local vo = SCMD60109.New(true)
  500. if vo.result == 1 then
  501. else
  502. ErrorCodeShow(vo.result)
  503. end
  504. end
  505. -- ########### 场景信息 ##############
  506. -- protocol=60110
  507. -- {
  508. -- c2s{
  509. -- }
  510. -- s2c{
  511. -- city_info:array{
  512. -- city_id:int8 //城池id
  513. -- blood:int64 //血量
  514. -- max_blood:int64 //总血量
  515. -- guild_id:int64 //占领帮派id
  516. -- group:int8 //分组
  517. -- guild_name:string //占领帮派名称
  518. -- guard_num:int8 //守护兽数量
  519. -- }
  520. -- }
  521. -- }
  522. function CSGWarController:Handle60110( )
  523. local vo = SCMD60110.New(true)
  524. -- print("HWR:CSGWarController [start:352] vo:", vo)
  525. -- PrintTable(vo)
  526. -- print("HWR:CSGWarController [end]")
  527. self.model:SetCSGWarCityInfo(vo.city_info)
  528. end
  529. -- ########### 帮派分组 ##############
  530. -- protocol=60111
  531. -- {
  532. -- s2c{
  533. -- guild_info:array{
  534. -- guild_id:int64 //帮派Id
  535. -- group:int16 //战斗分组
  536. -- }
  537. -- }
  538. -- }
  539. function CSGWarController:Handle60111( )
  540. local vo = SCMD60111.New(true)
  541. -- print("HWR:CSGWarController [start:390] vo:", vo)
  542. -- PrintTable(vo)
  543. -- print("HWR:CSGWarController [end]")
  544. self.model:SetCSGWarCountryInfo(vo.guild_info)
  545. end
  546. -- ########### 号令 ##############
  547. -- protocol=60112
  548. -- {
  549. -- c2s{
  550. -- city_id:int8 //城池id
  551. -- }
  552. -- s2c{
  553. -- result:int32 //返回码
  554. -- }
  555. -- }
  556. function CSGWarController:Handle60112( )
  557. local vo = SCMD60112.New(true)
  558. if vo.result == 1 then
  559. Message.show("团长令发布成功","success")
  560. else
  561. ErrorCodeShow(vo.result)
  562. end
  563. end
  564. -- ########### 广播号令 ##############
  565. -- protocol=60113
  566. -- {
  567. -- s2c{
  568. -- city_id:int8 //城池id
  569. -- }
  570. -- }
  571. function CSGWarController:Handle60113( )
  572. local vo = SCMD60113.New(true)
  573. self.model:Fire(CSGWarConst.SHOW_CSGWAR_COMMAND, vo.city_id)
  574. end
  575. --[[########### 结算 ##############
  576. protocol=60114
  577. {
  578. s2c{
  579. occupy_city:array{
  580. city_id:int8 //id
  581. }
  582. city_list:array{
  583. city_id:int8 // id
  584. server_num:int16 //
  585. guild_name:string //
  586. chief_name:string //
  587. chief_info:rec_picture //
  588. }
  589. }
  590. }--]]
  591. function CSGWarController:Handle60114( )
  592. local vo = SCMD60114.New(true)
  593. print("HWR:CSGWarController [start:419] vo:", vo)
  594. PrintTable(vo)
  595. print("HWR:CSGWarController [end]")
  596. self.model:SetCSGWarResultInfo(vo)
  597. local scene_mgr = SceneManager.Instance
  598. if not scene_mgr:IsCSGWarScene() then--收到协议的时候不是在国战场景 就直接弹
  599. self.model:Fire(CSGWarConst.OPEN_CSGWAR_RESULT_VIEW)
  600. else
  601. self.can_show_result = true
  602. end
  603. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60122)
  604. end
  605. -- ########### 战场日志 ##############
  606. -- protocol=60115
  607. -- {
  608. -- c2s{
  609. -- }
  610. -- s2c{
  611. -- logs:array{
  612. -- time:int32
  613. -- city_list:array{
  614. -- city_id:int8 // 城池id
  615. -- server_num:int16 // 服务器显示用的编号
  616. -- guild_name:string // 占领帮派名
  617. -- chief_name:string // 占领主城的帮派老大名称
  618. -- chief_info:rec_picture // 帮派老大信息
  619. -- }
  620. -- }
  621. -- }
  622. -- }
  623. function CSGWarController:Handle60115( )
  624. local vo = SCMD60115.New(true)
  625. print("HWR:CSGWarController [start:524] vo:", vo)
  626. PrintTable(vo)
  627. print("HWR:CSGWarController [end]")
  628. self.model:SetCSGWarRecordInfo(vo)
  629. end
  630. -- #######占领推送############
  631. -- protocol=60116
  632. -- {
  633. -- s2c{
  634. -- fact_id:int8
  635. -- server_num:int16
  636. -- name:string
  637. -- city:int8
  638. -- }
  639. -- }
  640. function CSGWarController:Handle60116( )
  641. local vo = SCMD60116.New(true)
  642. local cfg = Config.Crossguildwarscene[vo.city]
  643. local guild_name = GetCSLongName(vo.name, vo.server_num)
  644. local country_name = KfWorldModel:GetInstance():GetContrayNameById(vo.fact_id)
  645. local str = string.format("%s的%s成功占领了%s", country_name, guild_name, cfg.name)
  646. local special_tip_data = {
  647. type = SpecialTipType.Middle,
  648. sepeical_str = str,
  649. need_flash = false,
  650. show_time = 5,
  651. }
  652. CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data)
  653. end
  654. -- #########淘汰通知#############
  655. -- protocol=60117
  656. -- {
  657. -- s2c{
  658. -- room:int8 //所在战区
  659. -- help:int8 //是否外援
  660. -- }
  661. -- }
  662. function CSGWarController:Handle60117( )
  663. local vo = SCMD60117.New(true)
  664. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60102)
  665. end
  666. function CSGWarController:Handle60118( )
  667. local vo = SCMD60118.New(true)
  668. if not SceneManager:getInstance():IsCSGWarScene() then return end
  669. local str = string.format("糟了!有人偷袭了我方占领的%s!", vo.city_name)
  670. local temp_head_name = RoleManager.Instance.mainRoleInfo.name
  671. local data = {
  672. head_type = 1004,
  673. desc = str,
  674. head_name = temp_head_name or "",
  675. hide_time = 15,
  676. dalay_time = 1,
  677. is_task_type = true,
  678. pos = Vector3(230,0,0),
  679. }
  680. GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW,data)
  681. end
  682. function CSGWarController:Handle60119( )
  683. local vo = SCMD60119.New(true)
  684. if not SceneManager:getInstance():IsCSGWarScene() then return end
  685. local str = string.format("%s社团已经快马加鞭占领了%s,我们也要稳住!", vo.guild_name,vo.city_name)
  686. local temp_head_name = RoleManager.Instance.mainRoleInfo.name
  687. local data = {
  688. head_type = 1004,
  689. desc = str,
  690. head_name = temp_head_name or "",
  691. hide_time = 15,
  692. dalay_time = 1,
  693. is_task_type = true,
  694. pos = Vector3(230,0,0),
  695. }
  696. GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW,data)
  697. end
  698. function CSGWarController:Handle60120( )
  699. local vo = SCMD60120.New(true)
  700. if vo.result == 1 then
  701. Message.show("禁言成功")
  702. else
  703. ErrorCodeShow(vo.result)
  704. end
  705. end
  706. function CSGWarController:Handle60121( )
  707. local vo = SCMD60121.New(true)
  708. if vo.result == 1 then
  709. Message.show("改名成功", "success")
  710. GlobalEventSystem:Fire(EventName.OPEN_RENAME_VIEW, false, true, self.index)
  711. KfWorldModel:GetInstance():UpdateFactionName(vo.fact_id, vo.name)
  712. else
  713. ErrorCodeShow(vo.result)
  714. end
  715. end
  716. function CSGWarController:Handle60122( )
  717. local vo = SCMD60122.New(true)
  718. print("HWR:CSGWarController [start:712] vo:", vo)
  719. PrintTable(vo)
  720. print("HWR:CSGWarController [end]")
  721. if vo.is_buy == 1 and RoleManager.Instance.mainRoleInfo.is_overlord == 1 and vo.result == 1 then
  722. ActivityIconManager:getInstance():addIcon(60100, -1)
  723. else
  724. ActivityIconManager:getInstance():deleteIcon(60100)
  725. end
  726. self.model:SetCSGWarOverlordInfo(vo)
  727. end
  728. function CSGWarController:Handle60123( )
  729. local vo = SCMD60123.New(true)
  730. if vo.result == 1 then
  731. Message.show("购买成功", "success")
  732. ActivityIconManager:getInstance():deleteIcon(60100)
  733. else
  734. ErrorCodeShow(vo.result)
  735. end
  736. end
  737. function CSGWarController:Handle60124( )
  738. local vo = SCMD60124.New(true)
  739. self.model:Fire(CSGWarConst.REQ_CSGWAR_SCMD, 60122)
  740. RoleManager.Instance.mainRoleInfo:ChangeVar("is_overlord", vo.is_overlord)
  741. end