源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

580 lines
23 KiB

  1. require("game.proto.173.Require173")
  2. require("game.god.GodModel")
  3. require("game.god.GodConst")
  4. require("game.god.view.GodBaseView")
  5. require("game.god.view.GodSubView")
  6. require("game.god.view.GodEquipBaseView")
  7. require("game.god.view.GodEquipTipView")
  8. require("game.god.view.GodAttrItem")
  9. require("game.god.view.GodBagView")
  10. require("game.god.view.GodBookTabItem")
  11. require("game.god.view.GodBookView")
  12. require("game.god.view.GodEquipAwrdItem")
  13. require("game.god.view.GodEquipItem")
  14. require("game.god.view.GodGoFightView")
  15. require("game.god.view.GodGuardTabItem")
  16. require("game.god.view.GodGuardView")
  17. require("game.god.view.GodIconItem")
  18. require("game.god.view.GodInfoItemSquare")
  19. require("game.god.view.GodSelectView")
  20. require("game.god.view.GodSkillItem")
  21. require("game.god.view.GodSuitBookItem")
  22. require("game.god.view.GodTabItem")
  23. require("game.god.view.GodUnlockPosView")
  24. require("game.god.view.GodInfoShowView")--神座展示界面
  25. require("game.god.view.GodAttrThreeItem")
  26. require("game.god.view.GodAttrFourItem")
  27. require("game.god.view.GodGoFightModelItem")
  28. require("game.god.view.GodStarUpgradeView") -- 升星界面
  29. require("game.GodActivity.GodActivityBaseView")
  30. require("game.GodActivity.GodActivityCommonView")
  31. require("game.GodActivity.GodActivityLimitView")
  32. require("game.GodActivity.GodActivityRewardItem")
  33. require("game.GodActivity.GodActivityResultView")
  34. require("game.GodActivity.GodActivityEffectView")
  35. -------------------------
  36. require("game.god.view.GodEquipSubView")--神座装备页签
  37. require("game.god.view.GodActiveView")--新神座激活界面
  38. require("game.god.view.GodSkillUpGradeView")--神座技能升级界面
  39. require("game.god.view.GodSuccessView")--升星成功界面
  40. require("game.god.view.GodAttrSixItem")--神座属性条目
  41. require("game.god.view.GodFightGuardView")--神座上阵以及护佑界面
  42. require("game.god.view.GodEquipUpgradeView")--神座装备升级界面
  43. require("game.god.view.GodEquipSuitItem")--神座装备套装条目
  44. require("game.god.view.GodEquipSuitItemTwo")--神座装备套装条目2
  45. require("game.god.view.GodAttrEightItem")
  46. require("game.god.view.GodPreviewView") -- 奖励详情
  47. require("game.god.view.GodPreviewItem") --奖励详情
  48. -------------------------
  49. GodController = GodController or BaseClass(BaseController, true)
  50. local GodController = GodController
  51. function GodController:__init()
  52. GodController.Instance = self
  53. self.model = GodModel:getInstance()
  54. self:AddEvents()
  55. self:RegisterAllProtocal()
  56. end
  57. function GodController:__delete()
  58. end
  59. function GodController:RegisterAllProtocal( )
  60. local register_cfg = {
  61. [17301] = {-- 神座信息
  62. req_event_data = {GodConst.REQ_BASE_INFO},req_func = false,
  63. handler = function(self,scmd)
  64. self.model:SetGodBaseData(scmd)
  65. self.model:SetSlotUnlockInfo(scmd.unlock)
  66. self:GodCheckRedDot()
  67. self.model:Fire(GodConst.ANS_BASE_INFO)
  68. end,
  69. },
  70. [17302] = {-- 神座信息:单条刷新
  71. req_event_data = {GodConst.REQ_ONE_GOD_INFO,"h"},req_func = false,
  72. handler = function(self,scmd)
  73. self.model:SetOneGodData(scmd)
  74. self:GodCheckRedDot()
  75. self.model:Fire(GodConst.ANS_ONE_GOD_INFO, scmd.id, scmd.pos)
  76. if self.need_show_star_up_success then
  77. self.model:Fire(GodConst.OPEN_UP_SUCCESS_VIEW, scmd.id, scmd.star, scmd.lv)
  78. self.need_show_star_up_success = nil
  79. end
  80. if self.need_show_active_success then
  81. self.model:Fire(GodConst.OPEN_ACTIVE_VIEW, scmd.id, scmd.star, scmd.lv)
  82. self.need_show_active_success = nil
  83. end
  84. end,
  85. },
  86. [17303] = {-- 神座操作:激活
  87. req_event_data = {GodConst.REQ_GOD_ACITVE, "h"},req_func = false,
  88. handler = function(self,scmd)
  89. if scmd.res == 1 then
  90. Message.show("激活成功")
  91. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  92. -------------------------
  93. self.need_show_active_success = true
  94. self.model:Fire(GodConst.REQ_ONE_GOD_INFO,scmd.id)
  95. else
  96. ErrorCodeShow(scmd.res)
  97. end
  98. end,
  99. },
  100. [17304] = {-- 神座操作:升星
  101. req_event_data = {GodConst.REQ_GOD_UP_STAR,"h"},req_func = false,
  102. handler = function(self,scmd)
  103. if scmd.res == 1 then
  104. Message.show("升星成功")
  105. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  106. -------------------------
  107. self.need_show_star_up_success = true
  108. self.model:Fire(GodConst.REQ_ONE_GOD_INFO,scmd.id)
  109. elseif scmd.res == 1730004 then
  110. local _,_,need_lv = self.model:IsGodCanUpStar( scmd.id )
  111. if need_lv then
  112. lua_soundM:PlayEffect(LuaSoundManager:getInstance(), "fault", false, LuaSoundManager.SOUND_TYPE.UI)
  113. Message.show(string.format("需要神座等级达到 %d 级",need_lv))
  114. else
  115. ErrorCodeShow(scmd.res)
  116. end
  117. else
  118. ErrorCodeShow(scmd.res)
  119. end
  120. end,
  121. },
  122. [17305] = {-- 神座操作:升级
  123. req_event_data = {GodConst.REQ_GOD_UP_LV,"hcii"},req_func = false,
  124. handler = function(self,scmd)
  125. if scmd.res == 1 then
  126. Message.show("升级成功")
  127. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  128. -------------------------
  129. local temp = self.model:GetGodInfoById(scmd.id)
  130. if temp then
  131. temp.lv = scmd.lv
  132. temp.exp = scmd.exp
  133. end
  134. self:GodCheckRedDot()
  135. self.model:Fire(GodConst.ANS_GOD_UP_LV, scmd.id, scmd.is_up_lv)
  136. else
  137. ErrorCodeShow(scmd.res)
  138. end
  139. end,
  140. },
  141. [17306] = {--神座操作:技能升级
  142. req_event_data = {GodConst.REQ_GOD_UP_SKILL, "hi"},req_func = false,
  143. handler = function(self,scmd)
  144. if scmd.res == 1 then
  145. Message.show("升级成功")
  146. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  147. -------------------------
  148. local temp = self.model:GetGodInfoById(scmd.id)
  149. if temp then
  150. for k,v in pairs(temp.skill) do
  151. if v.skill_id == scmd.skill_id then
  152. v.skill_lv = scmd.skill_lv
  153. break
  154. end
  155. end
  156. end
  157. self:GodCheckRedDot()
  158. self.model:Fire(GodConst.ANS_GOD_UP_SKILL, scmd.id)
  159. self.model:Fire(GodConst.OPEN_SKILL_UP_SUCCESS, scmd.id, scmd.skill_id, scmd.skill_lv)
  160. else
  161. ErrorCodeShow(scmd.res)
  162. end
  163. end,
  164. },
  165. [17307] = {--神座操作:穿戴装备
  166. req_event_data = {GodConst.REQ_GOD_DRESS_EQUIP, "hcl"},req_func = false,
  167. handler = function(self,scmd)
  168. if scmd.res == 1 then
  169. Message.show("穿戴成功")
  170. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  171. -------------------------
  172. self.model:Fire(GodConst.ANS_GOD_DRESS_EQUIP)
  173. self.model:Fire(GodConst.BOARD_EFFECT_EVENT,"up_equip",scmd.pos)
  174. else
  175. ErrorCodeShow(scmd.res)
  176. end
  177. end,
  178. },
  179. [17308] = {--神座操作:装备卸下
  180. req_event_data = {GodConst.REQ_GOD_DOWN_EQUIP, "hc"},req_func = false,
  181. handler = function(self,scmd)
  182. if scmd.res == 1 then
  183. Message.show("操作成功")
  184. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  185. -------------------------
  186. self.model:Fire(GodConst.ANS_GOD_DOWN_EQUIP)
  187. else
  188. ErrorCodeShow(scmd.res)
  189. end
  190. end,
  191. },
  192. [17309] = {--神座操作:装备升级
  193. req_event_data = {GodConst.REQ_STREN_EQUIP}, req_func = function(self,goods_id,cost_list)
  194. self:WriteBegin(17309)
  195. self:WriteFMT("l", goods_id)
  196. self:WriteFMT("h", #cost_list)
  197. for k, v in pairs(cost_list) do
  198. self:WriteFMT("l", v.goods_id)
  199. self:WriteFMT("h", 1)
  200. end
  201. self:SendToGame()
  202. end,
  203. handler = function(self,scmd)
  204. if scmd.res == 1 then
  205. Message.show("升级成功")
  206. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  207. -------------------------
  208. self.model:Fire(GodConst.ANS_STREN_EQUIP)
  209. self.model:Fire(GodConst.BOARD_EFFECT_EVENT,"stren_equip")
  210. else
  211. ErrorCodeShow(scmd.res)
  212. end
  213. end,
  214. },
  215. [17310] = {--神座操作:解锁位置
  216. req_event_data = {GodConst.REQ_UNLOCK_POS, "h"},req_func = false,
  217. handler = function(self,scmd)
  218. if scmd.res == 1 then
  219. Message.show("解锁成功")
  220. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  221. -------------------------
  222. self.model:Fire(GodConst.REQ_BASE_INFO)
  223. else
  224. ErrorCodeShow(scmd.res)
  225. end
  226. end,
  227. },
  228. [17311] = {--神座操作:上阵
  229. req_event_data = {GodConst.REQ_INFO_FIGHT, "hh"},req_func = false,
  230. handler = function(self,scmd)
  231. if scmd.res == 1 then
  232. Message.show("上阵成功")
  233. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  234. -------------------------
  235. self.model:Fire(GodConst.REQ_BASE_INFO)
  236. self.model:Fire(GodConst.BOARD_EFFECT_EVENT,"up_fight",scmd.pos)
  237. else
  238. ErrorCodeShow(scmd.res)
  239. end
  240. end,
  241. },
  242. [17312] = {--神座信息:上次召唤时间戳
  243. req_event_data = {GodConst.REQ_LAST_USE_TIME},req_func = false,
  244. handler = function(self,scmd)
  245. -- self.model:SetBecomeGodTime(scmd.time)
  246. -- self.model:SetCanBecomeGodTime(scmd.time + self.model:GetBecomeGodCD())
  247. self.model:SetBecomeGodTime(scmd.summon_list)
  248. self.model:Fire(GodConst.ANS_LAST_USE_TIME)
  249. print('=======Msh:GodController.lua[265] ===TABLE====')
  250. PrintTable(scmd)
  251. end,
  252. },
  253. [17313] = {--神座操作:召唤出战/重复点击切换下一个
  254. req_event_data = {GodConst.REQ_CALL_GOD, "h"},req_func = false,
  255. handler = function(self,scmd)
  256. print('=======Msh:GodController.lua[272] ===TABLE====', scmd.res, scmd.god_id)
  257. if scmd.res ~= 1 then
  258. ErrorCodeShow(scmd.res)
  259. else
  260. self.model:Fire(GodConst.ANS_CALL_GOD)
  261. end
  262. end,
  263. },
  264. --[[ [17314] = {--普通抽奖信息
  265. req_event_data = {GodConst.REQ_ACTIVITY_COMMON_INFO},req_func = false,
  266. handler = function(self,scmd)
  267. self.model:SetActivityCommonInfo(scmd)
  268. self.model:Fire(GodConst.ANS_ACTIVITY_COMMON_INFO)
  269. self:GodCheckRedDot()
  270. end,
  271. },--]]
  272. [17315] = {--限时抽奖信息
  273. req_event_data = {GodConst.REQ_ACTIVITY_LIMIT_INFO},req_func = false,
  274. handler = function(self,scmd)
  275. self.model:SetActivityLimitInfo(scmd)
  276. self.model:Fire(GodConst.ANS_ACTIVITY_LIMIT_INFO)
  277. self:GodCheckRedDot()
  278. end,
  279. },
  280. [17316] = {--抽奖
  281. req_event_data = {GodConst.REQ_ACTIVITY_PLAY,"cc"},req_func = false,
  282. handler = function(self,scmd)
  283. if scmd.res == 1 then
  284. if scmd.pool_type == GodConst.ActivityType.Common then
  285. -- self.model:Fire(GodConst.REQ_ACTIVITY_COMMON_INFO)
  286. else
  287. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  288. end
  289. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  290. -------------------------
  291. local data = {}
  292. data.pool_type = GodConst.ActivityType.Limit -- 只有限时抽奖了
  293. data.type = scmd.type
  294. data.award = {}
  295. data.col_num = 5
  296. for k, v in pairs(scmd.award_list) do
  297. data.award[#data.award+1] = {0,v.goods_id,v.goods_num}
  298. end
  299. -- GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_ACT_GOODS_VIEW, data.award)
  300. self.model:Fire(GodConst.ANS_ACTIVITY_PLAY, data.pool_type, scmd.type, data)
  301. else
  302. if scmd.res == 1001 then
  303. GlobalEventSystem:Fire(EventName.OPEN_RECHARGE_TIP_VIEW, true)
  304. else
  305. ErrorCodeShow(scmd.res)
  306. end
  307. end
  308. end,
  309. },
  310. [17317] = {--领取保底奖励
  311. req_event_data = {GodConst.REQ_ACTIVITY_GET_MIN_AWARD,"c"},req_func = false,
  312. handler = function(self,scmd)
  313. if scmd.res == 1 then
  314. Message.show("领取成功!")
  315. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  316. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  317. else
  318. ErrorCodeShow(scmd.res)
  319. end
  320. end,
  321. },
  322. [17318] = {--领取累计奖励
  323. req_event_data = {GodConst.REQ_ACTIVITY_GET_NUM_AWARD,"c"},req_func = false,
  324. handler = function(self,scmd)
  325. if scmd.res == 1 then
  326. Message.show("领取成功!")
  327. if scmd.pool_type == GodConst.ActivityType.Common then
  328. -- self.model:Fire(GodConst.REQ_ACTIVITY_COMMON_INFO)
  329. else
  330. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  331. end
  332. GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
  333. else
  334. ErrorCodeShow(scmd.res)
  335. end
  336. end,
  337. },
  338. [17319] = {--神座操作:变身广播
  339. handler = function(self,scmd)
  340. Scene:getInstance():GodChange(scmd)
  341. print('=======Msh:GodController.lua[359] ===TABLE=玩家god_id变更==17319=', scmd.role_id, scmd.god_id)
  342. -- PrintTable(scmd)
  343. end,
  344. },
  345. [17320] = {--抽奖活动状态变更
  346. handler = function(self,scmd)
  347. if scmd.type == GodConst.ActivityType.Common then
  348. -- self.model:Fire(GodConst.REQ_ACTIVITY_COMMON_INFO)
  349. elseif scmd.type == GodConst.ActivityType.Limit then
  350. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  351. end
  352. end,
  353. },
  354. [17321] = {--抽奖每日免费剩余次数
  355. req_event_data = {GodConst.REQ_GOD_LEFT_FREE_DRAW},req_func = false,
  356. handler = function(self,scmd)
  357. self.model:SetGodLeftFreeDrawTimes(scmd)
  358. self:GodCheckRedDot()
  359. end,
  360. },
  361. }
  362. self:RegisterProtocalByCFG(register_cfg)
  363. end
  364. function GodController:AddEvents()
  365. local function on_game_start()
  366. self.model:Reset()
  367. local function delay( )
  368. if GetModuleIsOpen(173,1) then
  369. self.model:Fire(GodConst.REQ_BASE_INFO)
  370. -- self.model:Fire(GodConst.REQ_ACTIVITY_COMMON_INFO)
  371. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  372. self.model:Fire(GodConst.REQ_GOD_LEFT_FREE_DRAW)
  373. end
  374. -- if GetModuleIsOpen(173,4) then
  375. -- end
  376. end
  377. setTimeout(delay,2)
  378. end
  379. GlobalEventSystem:Bind(EventName.GAME_START, on_game_start)
  380. local function onLevelChange( level )
  381. local lv = GetModuleOpenLevel( 173,1,true)
  382. if lv == level then
  383. self.model:Fire(GodConst.REQ_BASE_INFO)
  384. -- self.model:Fire(GodConst.REQ_ACTIVITY_COMMON_INFO)
  385. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  386. self.model:Fire(GodConst.REQ_GOD_LEFT_FREE_DRAW)
  387. end
  388. -------------------------
  389. -- local lv = GetModuleOpenLevel( 173,4,true)
  390. -- if lv == level then
  391. -- end
  392. end
  393. RoleManager:getInstance().mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelChange)
  394. --任务完成检测神座开启
  395. local function onTaskFinishHandler(taskId)
  396. local god_task_id = self.model:GetOpenTask(nil,true)
  397. if taskId then
  398. if god_task_id ~= 0 and taskId == god_task_id then
  399. self.model:Fire(GodConst.REQ_BASE_INFO)
  400. -- self.model:Fire(GodConst.REQ_ACTIVITY_COMMON_INFO)
  401. self.model:Fire(GodConst.REQ_ACTIVITY_LIMIT_INFO)
  402. end
  403. end
  404. end
  405. GlobalEventSystem:Bind(TaskEventType.TASK_SUCCESS, onTaskFinishHandler)
  406. local function OPEN_BASE_VIEW( main_id,sub_id )
  407. self.godbaseview = self.godbaseview or GodBaseView.New()
  408. if self.godbaseview:HasOpen() then
  409. self.godbaseview:ReOpen(main_id,sub_id)
  410. else
  411. self.godbaseview:Open(main_id,sub_id)
  412. end
  413. end
  414. self.model:Bind(GodConst.OPEN_BASE_VIEW,OPEN_BASE_VIEW)
  415. local function OPEN_ACTIVITY_EFFECT_VIEW( data )
  416. if not self.godactivityeffectview then
  417. self.godactivityeffectview = self.godactivityeffectview or GodActivityEffectView.New()
  418. self.godactivityeffectview:Open(data)
  419. end
  420. end
  421. self.model:Bind(GodConst.OPEN_ACTIVITY_EFFECT_VIEW,OPEN_ACTIVITY_EFFECT_VIEW)
  422. local function OPEN_ACTIVITY_RESULT_VIEW( result_data )
  423. self.godactivityresultview = self.godactivityresultview or GodActivityResultView.New()
  424. -- if self.godactivityresultview:HasOpen() then
  425. -- self.godactivityresultview:ReOpen(main_id,sub_id)
  426. -- else
  427. self.godactivityresultview:Open(result_data)
  428. -- end
  429. end
  430. self.model:Bind(GodConst.OPEN_ACTIVITY_RESULT_VIEW,OPEN_ACTIVITY_RESULT_VIEW)
  431. local function OpenEquipTipView( data_1,data_2,tag )
  432. --要传入背包的信息!!!!
  433. if not data_1 and not data_2 then return end
  434. if not self.godequipbaseview then
  435. self.godequipbaseview = GodEquipBaseView.New()
  436. self.godequipbaseview:Open(data_1,data_2,tag)
  437. end
  438. end
  439. self.model:Bind(GodConst.OpenEquipTipView,OpenEquipTipView)
  440. local function CloseEquipTipView( )
  441. if self.godequipbaseview then
  442. self.godequipbaseview:Close()
  443. end
  444. end
  445. self.model:Bind(GodConst.CloseEquipTipView,CloseEquipTipView)
  446. local function OPEN_GOD_INFO_VIEW( god_id )
  447. if not god_id then return end
  448. if not self.godinfoshowview then
  449. self.godinfoshowview = GodInfoShowView.New()
  450. self.godinfoshowview:Open(god_id)
  451. end
  452. end
  453. self.model:Bind(GodConst.OPEN_GOD_INFO_VIEW,OPEN_GOD_INFO_VIEW)
  454. local function OPEN_UP_SUCCESS_VIEW( god_id, star, lv )
  455. if (not god_id) or (not star) or (not lv) then return end
  456. if not self.godsuccessview then
  457. self.godsuccessview = GodSuccessView.New()
  458. self.godsuccessview:Open( god_id, star, lv )
  459. end
  460. end
  461. self.model:Bind(GodConst.OPEN_UP_SUCCESS_VIEW,OPEN_UP_SUCCESS_VIEW)
  462. local function OPEN_ACTIVE_VIEW( god_id, star, lv )
  463. if (not god_id) or (not star) or (not lv) then return end
  464. if not self.godactiveview then
  465. self.godactiveview = GodActiveView.New()
  466. self.godactiveview:Open( god_id, star, lv )
  467. end
  468. end
  469. self.model:Bind(GodConst.OPEN_ACTIVE_VIEW,OPEN_ACTIVE_VIEW)
  470. local function OPEN_SKILL_UP_SUCCESS( god_id, skill_id, skill_lv )
  471. if (not god_id) or (not skill_id) or (not skill_lv) then return end
  472. if not self.godskillupgradeview then
  473. self.godskillupgradeview = GodSkillUpGradeView.New()
  474. self.godskillupgradeview:Open( god_id, skill_id, skill_lv )
  475. end
  476. end
  477. self.model:Bind(GodConst.OPEN_SKILL_UP_SUCCESS,OPEN_SKILL_UP_SUCCESS)
  478. local function OPEN_FIGHT_AND_GUARD_VIEW( pos,sub_pos,is_close )
  479. if is_close then
  480. if self.godfightguardview then
  481. self.godfightguardview:Close()
  482. end
  483. return
  484. end
  485. pos = pos or 1
  486. if not self.godfightguardview then
  487. self.godfightguardview = GodFightGuardView.New()
  488. self.godfightguardview:Open( pos )
  489. end
  490. end
  491. self.model:Bind(GodConst.OPEN_FIGHT_AND_GUARD_VIEW,OPEN_FIGHT_AND_GUARD_VIEW)
  492. local function OPEN_EQUIP_UPGRADE_VIEW( goods_vo )
  493. if not goods_vo then return end
  494. if not self.godequipupgradeview then
  495. self.godequipupgradeview = GodEquipUpgradeView.New()
  496. self.godequipupgradeview:Open( goods_vo )
  497. end
  498. end
  499. self.model:Bind(GodConst.OPEN_EQUIP_UPGRADE_VIEW,OPEN_EQUIP_UPGRADE_VIEW)
  500. local function OPEN_STAR_UPGRADE_VIEW( god_id )
  501. if not god_id then return end
  502. if not self.godstarupgradeview then
  503. self.godstarupgradeview = GodStarUpgradeView.New()
  504. self.godstarupgradeview:Open( god_id )
  505. end
  506. end
  507. self.model:Bind(GodConst.OPEN_STAR_UPGRADE_VIEW, OPEN_STAR_UPGRADE_VIEW)
  508. self.model:Bind(GodConst.UpdateGodEquipBagListChange, function()
  509. self:GodCheckRedDot()
  510. end)
  511. -- 如果激活了神座免费抽奖相关的宠物生活技能,则需要主动请求17321
  512. local function on_pet_life_skill_actived(skill_id)
  513. if skill_id == PetConst.LifeSkill.GalaxyFreeSummon then
  514. self.model:Fire(GodConst.REQ_GOD_LEFT_FREE_DRAW)
  515. end
  516. end
  517. PetModel:getInstance():Bind(PetConst.PET_LIFE_SKILL_ACTIVED, on_pet_life_skill_actived)
  518. local function chnage_day_func(type)
  519. if type == SettingModel.CHANGE_DAY.HOUR_0 then -- 跨0点
  520. self.model:Fire(GodConst.REQ_GOD_LEFT_FREE_DRAW)
  521. end
  522. end
  523. GlobalEventSystem:Bind(EventName.CHANE_DAY, chnage_day_func)
  524. local function openPerviewView(show)
  525. if show then
  526. self:OpenView("GodPreviewView", show)
  527. end
  528. end
  529. self.model:Bind(GodConst.OPEN_PREVIEW_VIEW, openPerviewView)
  530. end
  531. function GodController:GodCheckRedDot( )
  532. local function call_backack( )
  533. local need_red = self.model:IsNeedRedAll()
  534. GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 173, need_red)
  535. self.model:Fire(GodConst.UpdateRedDot)
  536. end
  537. TimeManager.GetInstance():StartTime("GodController_GodCheckRedDot", 0.25, call_backack)
  538. end