源战役客户端
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.

691 lines
26 KiB

  1. require("game.common.CommonModel")
  2. --require("game.common.InstructionView")
  3. require("game.common.InstructionView2")
  4. require("game.common.ComposeInstructionView")
  5. --require("game.common.InstructionItem")
  6. require("game.common.InstructionItem2")
  7. require("game.common.InstructionSmallView")
  8. require("game.common.InstructionSmallItem")
  9. require("game.common.CalculatorView")
  10. require("game.common.RoleLevelItem")
  11. require("game.common.UpSuccessView")
  12. require("game.common.UpSuccessAttrItem")
  13. require("game.common.PropItem")
  14. require("game.common.CommonHuntResultView")
  15. require("game.common.CommonHuntResultView2")
  16. require("game.common.uiComToggleTipView")--通用提示消耗界面
  17. require("game.common.AddTimeView")--通用续费界面
  18. require("game.common.SpecialTipView")--通用特殊提醒界面
  19. require("game.common.SpecialTipViewTwo")--通用特殊提醒界面
  20. require("game.common.SceneSpecialTipView")--场景内美术字显示: 升级 /接受任务/完成任务 的美术字
  21. require("game.common.SceneSpecialBuffTipView")
  22. require("game.common.EncourageTips")--通用鼓舞界面
  23. require("game.common.ComAwardResultView")--通用奖励结算界面
  24. require("game.common.BeenAttackTips")--通用受击tip界面
  25. require("game.common.BuyTimeTips")--通用购买次数界面(和vip挂钩)
  26. require("game.common.CommonSkillTips")--通用技能tips
  27. require("game.common.CommonSkillTipsDesItem")--通用技能tips描述节点
  28. require("game.common.ComDialogueShowView")--通用对话功能界面
  29. require("game.common.CommonActivityIconTipView")--通用小提示界面(首充用过)
  30. require("game.common.RechargeTipView")--通用充值提醒(带快速充值)
  31. require("game.common.ActivityTipView")--活动提示界面
  32. require("game.common.ExitTimeTip")--退出场景倒计时
  33. require("game.common.StartTimeTip")--活动开始321倒计时
  34. require("game.common.BossAlertView") -- 通用boss预警动画界面
  35. require("game.common.CommonMultiKillCon")--通用连杀节点
  36. require("game.common.CommonAwardFlyView")--通用奖励飞行界面(参考装备精炼)
  37. require("game.common.CommonInviteTipView")--通用邀请tip界面
  38. require("game.common.ExitConView")--右上角按钮容器界面
  39. require("game.common.ComSpecialTaskRewardView") -- 奖励展示界面(华丽)
  40. require("game.common.ComSpecialTaskRewardItem") -- 奖励展示item
  41. require("game.common.CommonActTipView") -- 通用活动特殊提示弹窗
  42. require("game.common.ExitBtnView") --通用退出按钮界面
  43. require("game.common.GotoComponent") --副本箭头
  44. require("game.common.SpercificSceneActivityTipView") --特殊场景活动tips弹窗
  45. require("game.common.PsionicArmorCircleItem") -- 圣物特殊处理的圆形awardItem
  46. require("game.common.ComActRemindTipView") --
  47. require("game.common.CommonAuctionTips")--拍卖行竞价被超过的提示
  48. require("game.common.CommonAlertInviteTipView") -- 组队提示二级弹窗
  49. CommonController = CommonController or BaseClass(BaseController)
  50. function CommonController:__init()
  51. CommonController.Instance = self
  52. self.model = CommonModel:getInstance()
  53. self:InitEvent()
  54. end
  55. function CommonController:InitEvent()
  56. local function on_game_start()
  57. self.model:Reset()
  58. end
  59. GlobalEventSystem:Bind(EventName.GAME_START, on_game_start)
  60. local function chnage_day_func(type)
  61. if type == SettingModel.CHANGE_DAY.HOUR_0 then -- 跨0点
  62. self.model.event_invite_cache = {} -- 清空活动邀请缓存
  63. end
  64. end
  65. GlobalEventSystem:Bind(EventName.CHANE_DAY, chnage_day_func)
  66. local onCommonAwardFlyView = function(show, data)--通用奖励飞行界面
  67. data = data or {}
  68. self:OpenView("CommonAwardFlyView", show, data)
  69. end
  70. GlobalEventSystem:Bind(EventName.OPEN_COM_AWARD_FLY_VIEW, onCommonAwardFlyView)
  71. local onOpenRechargeTipView = function(show, data)
  72. data = data or {}
  73. -- 如果外部有直接传足够彩钻的回调时,在这里一起判断了,不够再走通用的快充界面流程
  74. if show and data.price and data.enough_callback then
  75. if GoodsModel:getInstance():IsJinEnough(data.price) then
  76. data.enough_callback()
  77. return
  78. end
  79. end
  80. self:OpenView("RechargeTipView", show, data)
  81. end
  82. GlobalEventSystem:Bind(EventName.OPEN_RECHARGE_TIP_VIEW, onOpenRechargeTipView)
  83. local onOpenuiComToggleTipView = function (data)--通用提示消耗界面--no_cost代表不是消耗钻石 是充值钻石提示(充值提示就不需要再弹一个这个了)
  84. -- 对于钻石消耗类型,做一个拦截,钻石不够,直接打开快速充值界面
  85. if data and not data.no_cost and (not data.gold_res or data.gold_res == "ui_momey_icon_1") then
  86. local jin = RoleManager.Instance.mainRoleInfo.jin
  87. if jin < data.price then -- 彩钻不足,拦截提示消耗界面,打开快速充值界面
  88. local rc_data = {
  89. price = data.price,
  90. qc_type = data.qc_type or 0,
  91. close_callback = data.jump_recharge_callback,
  92. }
  93. onOpenRechargeTipView(true, rc_data)
  94. return
  95. end
  96. end
  97. -- 正常的通用提示消耗界面
  98. if self.uiComToggleTipView == nil then
  99. self.uiComToggleTipView = uiComToggleTipView.New()
  100. end
  101. if self.uiComToggleTipView:HasOpen() then
  102. self.uiComToggleTipView:UpdateView(data)
  103. else
  104. self.uiComToggleTipView:Open(data)
  105. end
  106. end
  107. GlobalEventSystem:Bind(EventName.OPEN_COM_TOGGLE_TIP_VIEW, onOpenuiComToggleTipView)
  108. local onOpenComAwardResultView = function (data)--通用奖励结算界面
  109. -- data = {
  110. -- award = {{100,230001,1},{100,230001,1},},
  111. -- title_ab_name = "common_asset",
  112. -- title_res = "com_award_result_title",
  113. -- }
  114. GiftModel:getInstance():Fire(GiftModel.CLOSE_NORMAL_VIEW)
  115. if self.ComAwardResultView == nil then
  116. self.ComAwardResultView = ComAwardResultView.New()
  117. end
  118. if self.ComAwardResultView:HasOpen() then
  119. self.ComAwardResultView:UpdateView(data)
  120. else
  121. self.ComAwardResultView:Open(data)
  122. end
  123. end
  124. GlobalEventSystem:Bind(EventName.OPEN_COM_AWARD_RESULT_VIEW, onOpenComAwardResultView)
  125. --关闭普通奖励界面
  126. local function closeNormalView()
  127. if self.ComAwardResultView and self.ComAwardResultView:HasOpen() then
  128. self.ComAwardResultView:Close()
  129. end
  130. self.ComAwardResultView = nil
  131. end
  132. GlobalEventSystem:Bind(EventName.CLOSE_COM_AWARD_RESULT_VIEW, closeNormalView)
  133. -- 比通用的奖励展示 华丽一点的奖励展示界面
  134. local onOpenComSpecialTaskRewardView = function (data)--通用奖励结算界面
  135. local data = data or {
  136. award = {{100,230001,1},{100,230001,1},},
  137. title_ab_name = "common_asset",
  138. title_res = "com_award_result_title",
  139. }
  140. GiftModel:getInstance():Fire(GiftModel.CLOSE_NORMAL_VIEW)
  141. if self.ComSpecialTaskRewardView == nil then
  142. self.ComSpecialTaskRewardView = ComSpecialTaskRewardView.New()
  143. end
  144. if self.ComSpecialTaskRewardView:HasOpen() then
  145. self.ComSpecialTaskRewardView:UpdateView(data)
  146. else
  147. self.ComSpecialTaskRewardView:Open(data)
  148. end
  149. end
  150. GlobalEventSystem:Bind(EventName.OPEN_SPECIAL_AWARD_RESULT_VIEW, onOpenComSpecialTaskRewardView)
  151. local function onOpenInstructionView(index,extra)
  152. if self.instruction_view == nil then
  153. self.instruction_view = InstructionView.New()
  154. end
  155. if not self.instruction_view:HasOpen() then
  156. self.instruction_view:Open(index,extra)
  157. else
  158. self.instruction_view:Close()
  159. end
  160. end
  161. self:Bind(EventName.OPEN_INSTRUCTION_VIEW,onOpenInstructionView)
  162. local function onOpenInstructionView2(index)
  163. do return end
  164. if self.instruction_view2 == nil then
  165. self.instruction_view2 = InstructionView2.New()
  166. end
  167. if not self.instruction_view2:HasOpen() then
  168. self.instruction_view2:Open(index)
  169. else
  170. self.instruction_view2:Close()
  171. end
  172. end
  173. self:Bind(EventName.OPEN_INSTRUCTION_VIEW_2,onOpenInstructionView2)
  174. local function onOpenComposeInstructionView(data)
  175. if self.compose_instruction_view == nil then
  176. self.compose_instruction_view = ComposeInstructionView.New()
  177. end
  178. if not self.compose_instruction_view:HasOpen() then
  179. self.compose_instruction_view:Open(data)
  180. else
  181. self.compose_instruction_view:Close()
  182. end
  183. end
  184. self:Bind(EventName.OPEN_COMPOSE_INSTRUCTION_VIEW, onOpenComposeInstructionView)
  185. local function onOpenInstructionSmallView(index,x,y)
  186. if self.instruction_small_view == nil then
  187. self.instruction_small_view = InstructionSmallView.New()
  188. end
  189. if not self.instruction_small_view:HasOpen() then
  190. self.instruction_small_view:Open(index,x,y)
  191. else
  192. self.instruction_small_view:Close()
  193. end
  194. end
  195. self:Bind(EventName.OPEN_INSTRUCTION_SMALL_VIEW,onOpenInstructionSmallView)
  196. local function onOpenCalculatorView(max_count,call_back,pos,type, min_price)
  197. if self.CalculatorView == nil then
  198. self.CalculatorView = CalculatorView.New()
  199. end
  200. if pos then
  201. self.CalculatorView.localPos = pos
  202. end
  203. if not self.CalculatorView:HasOpen() then
  204. self.CalculatorView:Open(max_count,call_back,type, min_price)
  205. else
  206. self.CalculatorView:Close()
  207. end
  208. end
  209. self:Bind(EventName.OPEN_CALCULATOR_VIEW,onOpenCalculatorView)
  210. local function onOpenUpSuccessView(data)
  211. if not data then return end
  212. if self.upsuccessview == nil then
  213. self.upsuccessview = UpSuccessView.New()
  214. end
  215. if not self.upsuccessview:HasOpen() then
  216. self.upsuccessview:Open(data)
  217. else
  218. self.upsuccessview:Close()
  219. end
  220. end
  221. self:Bind(EventName.OPEN_UPGRADE_SHOW_VIEW,onOpenUpSuccessView)
  222. local function onOpenCommonHuntResultView(target_list, close_call, btn1_call, btn2_call, maskBtn_call, animEnd_call, parm_list)
  223. if self.CommonHuntResultView == nil then
  224. self.CommonHuntResultView = CommonHuntResultView.New()
  225. end
  226. if not self.CommonHuntResultView:HasOpen() then
  227. self.CommonHuntResultView:Open(target_list, close_call, btn1_call, btn2_call, maskBtn_call, animEnd_call, parm_list)
  228. else
  229. self.CommonHuntResultView:Close()
  230. end
  231. end
  232. self:Bind(EventName.OPEN_HUNT_RESULT_VIEW, onOpenCommonHuntResultView)
  233. local function onOpenCommonHuntResultView2(target_list, close_call, btn1_call, btn2_call, maskBtn_call, animEnd_call, parm_list)
  234. if self.CommonHuntResultView2 == nil then
  235. self.CommonHuntResultView2 = CommonHuntResultView2.New()
  236. end
  237. if not self.CommonHuntResultView2:HasOpen() then
  238. self.CommonHuntResultView2:Open(target_list, close_call, btn1_call, btn2_call, maskBtn_call, animEnd_call, parm_list)
  239. else
  240. self.CommonHuntResultView2:Close()
  241. end
  242. end
  243. self:Bind(EventName.OPEN_HUNT_RESULT_VIEW2, onOpenCommonHuntResultView2)
  244. local function on_open_add_time_view( data )
  245. if self.AddTimeView == nil then
  246. self.AddTimeView = AddTimeView.New()
  247. end
  248. self.AddTimeView:Open(data)
  249. end
  250. GlobalEventSystem:Bind(EventName.OPEN_ADD_TIME_VIEW, on_open_add_time_view)
  251. local function OPEN_SPECIALTIPVIEW(data,layout_file_type, layer_name)
  252. data = data or false
  253. if data == false then
  254. if self.special_tip_view ~= nil and self.special_tip_view:HasOpen() then
  255. self.special_tip_view:Close()
  256. end
  257. return
  258. end
  259. local layout_file_type = layout_file_type or 1 --默认为1
  260. local layer_name = layer_name or "Main"
  261. data.type = data.type or SpecialTipType.Normal
  262. if self.special_tip_view == nil then
  263. self.special_tip_view = SpecialTipView.New(layout_file_type,layer_name)
  264. end
  265. if not self.special_tip_view:HasOpen() then
  266. self.special_tip_view:Open(data,layout_file_type,layer_name)
  267. else
  268. self.special_tip_view:UpdateTips(data,layout_file_type,layer_name)
  269. end
  270. end
  271. self:Bind(EventName.OPEN_SPECIALTIPVIEW, OPEN_SPECIALTIPVIEW)
  272. local function CLOSE_SPECIALTIPVIEW()
  273. if self.special_tip_view then
  274. self.special_tip_view:Close()
  275. self.special_tip_view = nil
  276. end
  277. end
  278. self:Bind(EventName.CLOSE_SPECIALTIPVIEW, CLOSE_SPECIALTIPVIEW)
  279. local function ON_OPEN_SPECIALTIPVIEW_TWO(data)
  280. if self.special_tip_view2 == nil then
  281. self.special_tip_view2 = SpecialTipViewTwo.New()
  282. end
  283. if not self.special_tip_view2:HasOpen() then
  284. self.special_tip_view2:Open(data)
  285. else
  286. self.special_tip_view2:UpdateTips(data)
  287. end
  288. end
  289. self:Bind(EventName.OPEN_SPECIALTIPVIEW_TWO, ON_OPEN_SPECIALTIPVIEW_TWO)
  290. local function ON_CLOSE_SPECIALTIPVIEW_TWO()
  291. if self.special_tip_view2 then
  292. self.special_tip_view2:Close()
  293. self.special_tip_view2 = nil
  294. end
  295. end
  296. self:Bind(EventName.CLOSE_SPECIALTIPVIEW_TWO, ON_CLOSE_SPECIALTIPVIEW_TWO)
  297. --场景表现/场景内美术字.psd :升级 /接受任务/完成任务 的美术字
  298. local function func_OPEN_SCENESPECIALTIPVIEW(data)
  299. if self.scene_special_tip_view == nil then
  300. self.scene_special_tip_view = SceneSpecialTipView.New()
  301. end
  302. if not self.scene_special_tip_view:HasOpen() then
  303. self.scene_special_tip_view:Open(data)
  304. else
  305. self.scene_special_tip_view:UpdateTips(data)
  306. end
  307. end
  308. self:Bind(EventName.OPEN_SCENESPECIALTIPVIEW, func_OPEN_SCENESPECIALTIPVIEW)
  309. local function CLOSE_SCENESPECIALTIPVIEW()
  310. if self.scene_special_tip_view then
  311. self.scene_special_tip_view:Close()
  312. self.scene_special_tip_view = nil
  313. end
  314. end
  315. self:Bind(EventName.CLOSE_SCENESPECIALTIPVIEW, CLOSE_SCENESPECIALTIPVIEW)
  316. local function func_OPEN_SCENESPECIALBUFFTIPVIEW(data)
  317. if self.scene_special_buff_tip_view == nil then
  318. self.scene_special_buff_tip_view = SceneSpecialBuffTipView.New()
  319. end
  320. if not self.scene_special_buff_tip_view:HasOpen() then
  321. self.scene_special_buff_tip_view:Open(data)
  322. else
  323. self.scene_special_buff_tip_view:UpdateTips(data)
  324. end
  325. end
  326. self:Bind(EventName.OPEN_SCENESPECIALBUFFTIPVIEW, func_OPEN_SCENESPECIALBUFFTIPVIEW)
  327. local function CLOSE_SCENESPECIALBUFFTIPVIEW()
  328. if self.scene_special_buff_tip_view then
  329. self.scene_special_buff_tip_view:Close()
  330. self.scene_special_buff_tip_view = nil
  331. end
  332. end
  333. self:Bind(EventName.CLOSE_SCENESPECIALBUFFTIPVIEW, CLOSE_SCENESPECIALBUFFTIPVIEW)
  334. --通用鼓舞界面
  335. local function SHOW_ENCOURAGE_TIPS(show_type,data,encourageType,extra_param_list)
  336. show_type = show_type or EncourageTips.ShowType.Open
  337. -------------------------
  338. if show_type == EncourageTips.ShowType.Close then
  339. if self.encourage_tips then
  340. self.encourage_tips:Close()
  341. self.encourage_tips = nil
  342. end
  343. else
  344. if self.encourage_tips == nil then
  345. if show_type == EncourageTips.ShowType.Update then
  346. return
  347. end
  348. self.encourage_tips = EncourageTips.New(encourageType)
  349. end
  350. if not self.encourage_tips:HasOpen() then
  351. self.encourage_tips:Open(data)
  352. else
  353. self.encourage_tips:UpdateTips(data,extra_param_list)
  354. end
  355. end
  356. end
  357. self:Bind(EventName.SHOW_ENCOURAGE_TIPS, SHOW_ENCOURAGE_TIPS)
  358. local function loadComplete()
  359. local is_show = SceneManager:getInstance():IsShowBeenAttackTips( )
  360. if is_show then
  361. self.beenattacktips = self.beenattacktips or BeenAttackTips.New()
  362. if not self.beenattacktips:HasOpen() then
  363. self.beenattacktips:Open()
  364. end
  365. else
  366. if self.beenattacktips then
  367. self.beenattacktips:Close()
  368. end
  369. end
  370. end
  371. GlobalEventSystem:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE, loadComplete)
  372. local function OPEN_BUY_TIME_TIPS(show_data)
  373. if not show_data then return end
  374. -------------------------
  375. self.buytimetips = self.buytimetips or BuyTimeTips.New()
  376. if not self.buytimetips:HasOpen() then
  377. self.buytimetips:Open(show_data)
  378. else
  379. self.buytimetips:SetShow(show_data)
  380. end
  381. end
  382. self:Bind(EventName.OPEN_BUY_TIME_TIPS, OPEN_BUY_TIME_TIPS)
  383. --通用技能tips
  384. local function OPEN_COMMON_SKILL_TIPS(show_data)
  385. -- self.data = {
  386. -- skill_id = 0,--(必填)
  387. -- skill_lv = 1,
  388. -- title_name = "界面标题",--界面标题
  389. -- skill_name = "技能名",
  390. -- active_des = "激活状态",
  391. -- name_extra = "技能名下面那里的描述",
  392. -- -------------------------
  393. -- tab_title_1 = "技能效果",
  394. -- tab_title_2 = "内容标题栏2(激活条件)",
  395. -- content_1 = "技能描述1(技能效果描述)",
  396. -- content_2 = "技能描述2(技能激活条件)",
  397. -- }
  398. if not show_data then return end
  399. -------------------------
  400. self.commonskilltips = self.commonskilltips or CommonSkillTips.New()
  401. if not self.commonskilltips:HasOpen() then
  402. self.commonskilltips:Open(show_data)
  403. else
  404. self.commonskilltips:SetShow(show_data)
  405. end
  406. end
  407. self:Bind(EventName.OPEN_COMMON_SKILL_TIPS, OPEN_COMMON_SKILL_TIPS)
  408. local function onOpenActivityIconTipView(str,x,y)
  409. if self.common_activity_icon_tip_view == nil then
  410. self.common_activity_icon_tip_view = CommonActivityIconTipView.New()
  411. end
  412. if not self.common_activity_icon_tip_view:HasOpen() then
  413. self.common_activity_icon_tip_view:Open(str,x,y)
  414. else
  415. self.common_activity_icon_tip_view:UpdateView(str,x,y)
  416. end
  417. end
  418. self:Bind(EventName.OPEN_ACTIVITY_ICON_TIP_VIEW, onOpenActivityIconTipView)
  419. local function CLOSE_ACITVITY_TIP( module_id,sub_id )
  420. sub_id = sub_id or 0
  421. --关闭活动提示界面
  422. -------------------------
  423. --把缓存列表的拿出来
  424. self.model:GetActivityNotictOneInfo(module_id,sub_id)
  425. if self.ActivityTipView and (self.ActivityTipView.module_id == module_id) and (self.ActivityTipView.sub_id == sub_id) then
  426. self.ActivityTipView:CloseBtnCall()
  427. end
  428. end
  429. self:Bind(EventName.CLOSE_ACITVITY_TIP, CLOSE_ACITVITY_TIP)
  430. local function openAcitvityTipCall( module_id,sub_id,need_clock,fixed_str,is_loading, open_from_click )
  431. sub_id = sub_id or 0
  432. --open_from_click 防止自己点图标被下面过滤不弹的情况
  433. if (not open_from_click) and self.model:MaskOpenActTip( module_id,sub_id ) then
  434. CLOSE_ACITVITY_TIP(module_id,sub_id)
  435. return
  436. end
  437. --module_id,sub_id对应活动日历表Config.Ac,sub_id不传会默认设为0
  438. --need_clock,只有活动已经开启的自动弹窗需要传true,显示10秒倒计时进入玩法
  439. --fixed_str,在ActivityIcon的点击回调要传值,传值参考温泉418,用来显示按钮文本例如:18:00开启
  440. --is_loading,场景加载检查用的,被迫加了个参数,这个参数外部调用不需要处理传值
  441. -------------------------
  442. local data = ActivityTipView.Data[module_id .. "@" .. sub_id]
  443. if data and data.open_module then
  444. if not GetModuleIsOpen(data.open_module[1],data.open_module[2]) then
  445. --活动未开放
  446. return
  447. end
  448. end
  449. -------------------------
  450. local is_loading = is_loading or (not Scene.Instance:IsProgressLoadFinish())--0说明是刚上线
  451. local function open_call( module_id,sub_id,need_clock,fixed_str )
  452. if not self.ActivityTipView then
  453. self.ActivityTipView = ActivityTipView.New()
  454. self.ActivityTipView:Open( module_id,sub_id,need_clock,fixed_str )
  455. AdvertisementModel:getInstance():AddConflictViewState( AdvertisementModel.CONFLICT_VIEW.BEACH, true )
  456. else
  457. --如果已经开了一个界面,那就继续存着先
  458. self.model:AddActivityNotice(module_id,sub_id,need_clock,fixed_str,is_loading)
  459. end
  460. end
  461. -------------------------
  462. if Scene.Instance:IsProgressLoadFinish() and (SceneManager:getInstance():IsMainCityAndFieldScene() or (not need_clock)) then
  463. --主城或者野外
  464. --只有活动开启弹出的要检查场景,其它都是玩家自己点击弹的
  465. open_call(module_id,sub_id,need_clock,fixed_str)
  466. else
  467. self.model:AddActivityNotice(module_id,sub_id,need_clock,fixed_str,is_loading)
  468. end
  469. end
  470. self:Bind(EventName.OPEN_ACITVITY_TIP,openAcitvityTipCall)
  471. local function scene_start_func( )
  472. --切场景检查一下要不要提示活动信息
  473. if SceneManager:getInstance():IsMainCityAndFieldScene() then
  474. local notice_info = self.model:GetActivityNotictOneInfo()
  475. if notice_info then
  476. --如果玩法开启时玩家不处于大世界,待回到大世界同样需要自动弹出玩法界面,但无需倒计时
  477. if SceneManager:getInstance():GetLastSceneId() ~= 0 then
  478. --普通切场景的触发,就不需要倒计时了
  479. openAcitvityTipCall(notice_info.module_id,notice_info.sub_id, nil,nil,notice_info.is_loading)
  480. else
  481. --断线重连或者刚登陆的情况要倒计时
  482. openAcitvityTipCall(notice_info.module_id,notice_info.sub_id, notice_info.is_loading,nil,notice_info.is_loading)
  483. end
  484. end
  485. end
  486. end
  487. GlobalEventSystem:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE, scene_start_func)
  488. local function onOpenExitTipView(data,show)
  489. if show == nil then
  490. show = true
  491. end
  492. self:OpenView("ExitTimeTip", show, data)
  493. end
  494. self:Bind(EventName.OPEN_EXIT_TIME_TIP, onOpenExitTipView)
  495. -- local function onOpenExitBtnView(show,data)
  496. -- if show == nil then
  497. -- show = true
  498. -- end
  499. -- self:OpenView("ExitBtnView", show, data)
  500. -- end
  501. -- self:Bind(EventName.OPEN_EXIT_BTN_VIEW, onOpenExitBtnView)
  502. local function onOpenStartTipView(data,show)
  503. if show == nil then
  504. show = true
  505. end
  506. self:OpenView("StartTimeTip", show, data)
  507. end
  508. self:Bind(EventName.OPEN_START_TIME_TIP, onOpenStartTipView)
  509. -- 打开boss预警动画界面
  510. local function open_boss_alert_view(show, sub_res, time_data)
  511. self:OpenView("BossAlertView", show, sub_res, time_data)
  512. end
  513. self:Bind(EventName.OPEN_BOSS_ALERT_VIEW, open_boss_alert_view)
  514. local function openCommonInviteTipView(data)
  515. if data then
  516. self.model:PushInviteDataCache(data)
  517. end
  518. if self.CommonActTipView and self.CommonActTipView:HasOpen() then--活动tips存在则关掉活动tips
  519. GlobalEventSystem:Fire(EventName.CLOSE_COMMON_ACT_TIPS)
  520. return
  521. end
  522. -- 缓存需数量大于0
  523. local cache_count = self.model:GetInviteDataCacheCount()
  524. if cache_count > 0 then
  525. local pop_data = self.model:PopInviteDataCache(true)
  526. local temp_layer_name = pop_data.layer_name or "Main"
  527. -- 存在界面且层级不同且等待中时,需要立即关闭一次界面并重新创建
  528. if self.CommonInviteTipView and self.CommonInviteTipView.waiting and self.CommonInviteTipView.layer_name ~= temp_layer_name then
  529. self.CommonInviteTipView:Close()
  530. self.CommonInviteTipView = nil
  531. end
  532. if not self.CommonInviteTipView then
  533. self.CommonInviteTipView = CommonInviteTipView.New()
  534. end
  535. if pop_data.invite_type == CommonModel.InviteTipsType.Team and
  536. SceneManager:getInstance():IsBossMoneyScene() then -- 商品幻魔中的组队邀请tip需要特殊二级界面
  537. self:OpenAlertInviteTipView()
  538. return
  539. end
  540. if not self.CommonInviteTipView:HasOpen() then
  541. self.CommonInviteTipView:Open(self.model:PopInviteDataCache())
  542. elseif self.CommonInviteTipView.waiting then
  543. self.CommonInviteTipView:ReOpen(self.model:PopInviteDataCache())
  544. end
  545. else
  546. local cache_count = self.model:GetActTipDataCacheCount()
  547. if cache_count > 0 then
  548. GlobalEventSystem:Fire(EventName.SHOW_COMMON_ACT_TIPS)
  549. end
  550. end
  551. end
  552. self:Bind(EventName.SHOW_COMMON_INVITE_TIPS, openCommonInviteTipView)
  553. local function openCommonActTipView(data)--通用活动特殊提示弹窗
  554. if data then
  555. self.model:PushActTipDataCache(data)
  556. end
  557. if self.CommonInviteTipView and self.CommonInviteTipView:HasOpen() then--如果邀请界面正在持续中 这个就不要再弹了
  558. return
  559. end
  560. local cache_count = self.model:GetActTipDataCacheCount()
  561. if cache_count > 0 then
  562. if not self.CommonActTipView then
  563. self.CommonActTipView = CommonActTipView.New()
  564. end
  565. if not self.CommonActTipView:HasOpen() then
  566. self.CommonActTipView:Open(self.model:PopActTipDataCache())
  567. end
  568. end
  569. end
  570. self:Bind(EventName.SHOW_COMMON_ACT_TIPS, openCommonActTipView)
  571. local function openComActRemindTipView(data)--通用活动特殊提醒小弹窗
  572. if data then
  573. self.model:PushActRemindTipDataCache(data)
  574. end
  575. if self.ComActRemindTipView and self.ComActRemindTipView:HasOpen() then--如果邀请界面正在持续中 这个就不要再弹了
  576. return
  577. end
  578. local cache_count = self.model:GetActRemindTipDataCacheCount()
  579. if cache_count > 0 then
  580. if not self.ComActRemindTipView then
  581. self.ComActRemindTipView = ComActRemindTipView.New()
  582. end
  583. if not self.ComActRemindTipView:HasOpen() then
  584. self.ComActRemindTipView:Open()
  585. end
  586. end
  587. end
  588. self:Bind(EventName.SHOW_COMMON_ACT_REMIND_TIPS, openComActRemindTipView)
  589. local function MOVE_NODE_EXIT_CON( node,parent_node,tag_str,op_type,off_x,off_y )
  590. -- node 传入的节点
  591. -- parent_node 节点来源界面
  592. -- tag_str 标记字符串
  593. -- op_type 操作类型1:添加,2移除
  594. -- off_x 偏移,可不传
  595. -- off_y 偏移,可不传
  596. if (not tag_str) or (not node) then return end
  597. if tag_str == 1 and (not parent_node) then return end
  598. if not self.ExitConView then
  599. self.ExitConView = ExitConView.New()
  600. self.ExitConView:Open()
  601. end
  602. if op_type == 1 then
  603. self.ExitConView:AddNode(node,parent_node,tag_str,off_x,off_y)
  604. else
  605. self.ExitConView:RemoveNode(node,tag_str)
  606. end
  607. end
  608. self:Bind(EventName.MOVE_NODE_EXIT_CON, MOVE_NODE_EXIT_CON)
  609. local function open_spercific_scene_act_tipview(show, ac_data)
  610. if (show and ac_data) or not show then
  611. self:OpenView("SpercificSceneActivityTipView", show, ac_data)
  612. end
  613. end
  614. self.model:Bind(EventName.OPEN_SPERCIFIC_SCENE_ACT_TIPVIEW, open_spercific_scene_act_tipview)
  615. local function onOpenCommonAuctionTips(data)
  616. if data and data.goods_id and GoodsModel:getInstance():GetGoodsBasicByTypeId(data.goods_id) ~= nil then--有数据才可以进行操作
  617. if not self.CommonAuctionTips then
  618. self.CommonAuctionTips = CommonAuctionTips.New()
  619. end
  620. if not self.CommonAuctionTips:HasOpen() then
  621. self.CommonAuctionTips:Open(data)
  622. else
  623. self.CommonAuctionTips:ReOpen(data)
  624. end
  625. end
  626. end
  627. GlobalEventSystem:Bind(EventName.OPEN_COMMON_AUCTION_VIEW, onOpenCommonAuctionTips)
  628. end
  629. function CommonController:OpenAlertInviteTipView()
  630. if not self.CommonAlertInviteTipView then
  631. self.CommonAlertInviteTipView = CommonAlertInviteTipView.New()
  632. end
  633. if not self.CommonAlertInviteTipView:HasOpen() then
  634. self.CommonAlertInviteTipView:Open(self.model:PopInviteDataCache())
  635. else
  636. self.CommonAlertInviteTipView:ReOpen(self.model:PopInviteDataCache())
  637. end
  638. end