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

1741 regels
81 KiB

1 maand geleden
  1. GuildSceneView = GuildSceneView or BaseClass(BaseView)
  2. local GuildSceneView = GuildSceneView
  3. local LuaSoundManager = LuaSoundManager
  4. function GuildSceneView:__init()
  5. self.base_file = "guildScene"
  6. self.layout_file = "GuildSceneView"
  7. self.layer_name = "Main"
  8. self.destroy_imm = true
  9. self.change_scene_close = false
  10. self.append_to_ctl_queue = false --是否要添加进界面堆栈
  11. self.need_show_money = false --是否要显示顶部的金钱栏
  12. self.auto_change_party_music = false
  13. self.req_roll_data = false -- 是否请求了roll点信息
  14. self.auto_change_boss_music = false
  15. self.model = GuildModel:getInstance()
  16. self.scene_mgr = SceneManager:getInstance()
  17. self.init_exit_btn = false
  18. self.right_top_visible = true -- 当前右上角界面显示flag
  19. self.right_tab_index = 1 -- 右侧信息显示index 1 = 活动, 2 = 组队
  20. self.rightIcon_tween = {}--右上角缓动动画列表
  21. self.need_reset_scene_bgm = false -- 是否需要重置背景音乐
  22. self.cur_guildboss_type = GuildEventType.GuildBossNoon -- 确定本次社团boss的boss类型,默认午间boss类型
  23. self.cur_guildboss_act_type = 1 -- 社团boss的活动子类型,默认午间boss类型
  24. self.guildboss_tabIndex = 1 -- 社团boss排行榜tabindex
  25. self.guildboss_ranktype = GuildBossRankType.Guild -- 当前查看的社团排行类型
  26. self.guildboss_sub_rank_item = nil -- 社团boss个体排行item
  27. self.guild_boss_alert_cache = {} -- 社团boss预警状态缓存标志量
  28. self.is_gboss_encourage_clicked = false
  29. self.show_guildTv_tips = false -- 是否展示过跑马的specialTip
  30. -- self.main_ui_right_top_hide = true -- 主界面右上角按钮是否处于收起状态
  31. self.main_vo = RoleManager.Instance.mainRoleInfo
  32. self.dance_last_status = -1 -- 上次缓存的社团热舞坐标配置index,默认-1激活静默挂机的计时器
  33. self.last_use_skill_time = Status.NowTime -- 上次使用技能的时间
  34. self.is_moving_to_dance = false -- 是否正在寻路前往热舞
  35. self.collect_stay_time = self.model:GetGuildEventStayTime(GuildModel.GuildCollectModuleId,0) --整个持续时间
  36. self.tip_show_type = nil -- 已经展示过了的tips类型缓存
  37. self.fun_icon_cache = {} -- 社团内功能按钮缓存
  38. self.fun_icon_list = {} -- 社团内功能按钮列表
  39. self.guild_auction_item = false --社团拍卖提示界面
  40. GuildTVModel:getInstance():Fire(GuildTVConst.REQ_GTV_SCMD, 14215)
  41. self.guild_collect_support_tip_item_list = {}--社团协助右侧协助tips
  42. self.load_callback = function ()
  43. self:LoadSuccess()
  44. self:AddEvent()
  45. end
  46. self.open_callback = function ( )
  47. self:UpdateView()
  48. end
  49. self.destroy_callback = function ( )
  50. self:DestroySuccess()
  51. end
  52. end
  53. function GuildSceneView:Open( )
  54. BaseView.Open(self)
  55. end
  56. function GuildSceneView:LoadSuccess()
  57. local nodes = {
  58. -- 界面隐藏按钮和子节点容器相关
  59. "hide_btn:obj", "hide_btn/hide_arrow",
  60. "right_info_con:obj",
  61. "right_info_con/btn_con",
  62. "right_info_con/btn_con/img_event:img", "right_info_con/btn_con/img_team:img",
  63. "right_info_con/btn_con/btn_team:obj", "right_info_con/btn_con/btn_event:obj",
  64. "right_info_con/data_con:obj", "right_info_con/team_con:obj",
  65. -- 社团采集活动相关
  66. "right_info_con/data_con/collect_info_con:obj",--午间采集玩法右上角信息栏
  67. "right_info_con/data_con/collect_info_con/leftTime:tmp",--活动时间倒计时
  68. "right_info_con/data_con/collect_info_con/activityTimes:tmp",--今天活动参与次数
  69. "right_info_con/data_con/collect_info_con/sealTimes:tmp",--本次活动封印次数
  70. "right_info_con/data_con/collect_info_con/reward_scroll_collect/Viewport/reward_con_collect", --展示奖励
  71. "right_info_con/data_con/collect_info_con/reward_scroll_collect",
  72. "rightIconCon/guildCollectRewardBtn:obj", --封印裂隙奖励预览按钮
  73. "guild_collect_left_con:obj:img", --左上角封印裂隙信息栏
  74. "guild_collect_left_con/left_collect_mon_label:tmp", --剩余采集怪数量
  75. "guild_collect_left_con/next_collect_wave_label:tmp", --下一波倒计时
  76. "right_info_con/data_con/collect_info_con/collect_info_bg:img",
  77. "guild_help_con:obj", --社团协助栏父容器
  78. "guild_support_tip_con:obj", --封印裂隙侧边协助tips
  79. "guild_support_tip_con/check_more_support_label:obj", --查看更多协助
  80. -- 右上角退出按钮
  81. "rightIconCon:obj",
  82. -- "rightIconCon/exitBtn:obj",
  83. "rightIconCon/inspireBtn:obj",
  84. "rightIconCon/inspireBtn/inspireBtn_effect",
  85. "rightIconCon/inspireBtn/inspire_btn_red:obj",
  86. "rightIconCon/inspireBtn/inspire_btn_red/inspire_btn_red_lb:tmp",
  87. "rightIconCon/inspireBtn/inspire_lb:tmp",
  88. "rightIconCon/guild_boss_pv_btn:obj",
  89. -- 右上角按钮tips节点
  90. "rightIconCon/tip_timer_bg:obj", "rightIconCon/tip_timer_bg/tip_timer:tmp",
  91. -- 社团boss相关
  92. "right_info_con/data_con/boss_rank:obj",
  93. "right_info_con/data_con/boss_rank/boss_tab_selected",
  94. "right_info_con/data_con/boss_rank/boss_my_rank_bg",
  95. "right_info_con/data_con/boss_rank/boss_rank_scroll",
  96. "right_info_con/data_con/boss_rank/boss_rank_scroll/Viewport/boss_rank_con",
  97. "right_info_con/data_con/boss_rank/boss_tab1:obj:tmp",
  98. "right_info_con/data_con/boss_rank/boss_tab2:obj:tmp",
  99. "right_info_con/data_con/boss_rank/right_boss_percentage:tmp",
  100. "right_info_con/data_con/boss_rank/right_boss_hp_fill:img",
  101. "right_info_con/data_con/boss_rank/right_boss_head:obj",
  102. "right_info_con/data_con/boss_rank/right_boss_name:tmp",
  103. -- 社团派对相关(晚间派对)
  104. "right_info_con/data_con/party_con:obj:img",
  105. "right_info_con/data_con/party_con/party_ques:obj",
  106. "right_info_con/data_con/party_con/party_timer:tmp",
  107. "right_info_con/data_con/party_con/party_exp:tmp",
  108. "right_info_con/data_con/party_con/party_buff:tmp",
  109. "right_info_con/data_con/party_con/chosen_con/party_btn2/party_btn2_chosen:obj",
  110. "right_info_con/data_con/party_con/chosen_con/party_btn1/party_btn1_chosen:obj",
  111. "right_info_con/data_con/party_con/chosen_con/party_btn2:obj",
  112. "right_info_con/data_con/party_con/chosen_con/party_btn1:obj",
  113. -- 社团派对经验效率节点
  114. "dance_eff_con:obj:cg",
  115. "dance_eff_con/dance_exp_eff:tmp",
  116. "dance_eff_con/dance_eff_lb:tmp",
  117. "dance_eff_con/dance_mem_num:tmp",
  118. "dance_eff_con/dance_ques_btn:obj",
  119. "dance_eff_con/dance_mem_eff_con:obj",
  120. -- 社团活动预告界面(无当前进行中活动时展示)
  121. "right_info_con/data_con/trailer_con:obj:img",
  122. "right_info_con/data_con/trailer_con/trailer_event_iconBg/trailer_event_icon:img",
  123. "right_info_con/data_con/trailer_con/trailer_countdown:tmp",
  124. "right_info_con/data_con/trailer_con/trailer_start_time:tmp",
  125. "right_info_con/data_con/trailer_con/trailer_reward_scroll",
  126. "right_info_con/data_con/trailer_con/trailer_reward_scroll/Viewport/trailer_reward_con",
  127. -- 空预告界面
  128. "right_info_con/data_con/trailer_empty:obj:img",
  129. "right_info_con/data_con/trailer_empty/trailer_empty_lb:tmp",
  130. -- 社团界面内功能按钮容器
  131. "func_btn_con:obj",
  132. -- 社团boss采集表现界面容器
  133. "boos_collect_con",
  134. --社团拍卖提示
  135. "guild_aucion_con",
  136. --社团材料提交BUFF相关
  137. "right_info_con/data_con/party_con/buffBtn:obj:img",
  138. }
  139. self:GetChildren(nodes)
  140. --组队页签透明度
  141. self.hide_btn_cg = self:GetChild("hide_btn"):GetComponent("CanvasGroup")
  142. self.right_info_con_cg = self:GetChild("right_info_con"):GetComponent("CanvasGroup")
  143. -- 获取社团晚间派对效率阶段节点
  144. self.dance_eff_num_list = {}
  145. self.dance_eff_val_list = {}
  146. for i = 1, 3 do
  147. self.dance_eff_num_list[i] = {}
  148. self.dance_eff_num_list[i].txt = self:GetChild("dance_eff_con/dance_mem_eff_con/d_m_num_" .. i):GetComponent("TextMeshProUGUI")
  149. self.dance_eff_val_list[i] = {}
  150. self.dance_eff_val_list[i].txt = self:GetChild("dance_eff_con/dance_mem_eff_con/d_m_val_" .. i):GetComponent("TextMeshProUGUI")
  151. end
  152. --设置sceneView的自适应
  153. self.transform.sizeDelta = Vector2(0,0)
  154. self.transform.localPosition = Vector3(0,0,0)
  155. -- if ClientConfig.iphone_x_model then
  156. -- self.transform.offsetMin = Vector2(ClientConfig.iphone_x_offset_left,0)
  157. -- self.transform.offsetMax = Vector2(-ClientConfig.iphone_x_offset_right,0)
  158. -- end
  159. self.tip_timer_bg_canvas = self.tip_timer_bg:GetComponent("CanvasGroup")
  160. local posX, posY = GetAnchoredPosition(self.right_info_con)
  161. self.origin_pos_x = posX
  162. self.origin_pos_y = posY
  163. self.right_info_con_width = GetSizeDeltaX(self.right_info_con)
  164. -- 加载组队节点
  165. self.team_view = self.team_view or TeamView.New(self.team_con)
  166. self:AutoDelete(self.team_view)
  167. self.team_view:SetData()
  168. self.team_view:SetAnchoredPosition(0,0)
  169. -- 创建采集节点
  170. self.collect_view = GuildSceneCollectView.New(self.boos_collect_con)
  171. self.collect_view:SetVisible(false)
  172. -- 先隐藏派对经验挂机效率节点
  173. self.dance_eff_con_obj:SetActive(false)
  174. --看看是否需要显示跑马界面
  175. if GuildTVModel:getInstance():IsGuildTVOpen() then
  176. local function delay_method( )
  177. GlobalEventSystem:Fire(GuildTVConst.OPEN_GUILDTV_MAIN_VIEW)
  178. end
  179. setTimeout(delay_method, 1)
  180. end
  181. --封印裂隙社团协助栏
  182. self.guild_collect_help_view = self:CreateItem(GuildCollectHelpRankView, self.guild_help_con, self.layer_name)
  183. SetAnchoredPositionY(self.guild_help_con,-240)
  184. -- 拍卖节点固定到界面正中心
  185. self.guild_aucion_con_posx = -ScreenWidth / 2 + 110
  186. SetAnchoredPosition(self.guild_aucion_con, self.guild_aucion_con_posx, 0)
  187. lua_resM:setOutsideImageSprite(self, self.collect_info_bg_img, GameResPath.GetViewBigBg("common_right_top_img2"))
  188. lua_resM:setOutsideImageSprite(self, self.party_con_img, GameResPath.GetViewBigBg("common_right_top_img2"))
  189. lua_resM:setOutsideImageSprite(self, self.trailer_con_img, GameResPath.GetViewBigBg("common_right_top_img2"))
  190. -- 新版 通用退出按钮
  191. if not self.init_exit_btn then
  192. self.init_exit_btn = true
  193. local function call_back( ... )
  194. local function exit_scene()
  195. CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW)
  196. self.model:Fire(GuildModel.LEAVE_GUILD_BASE)
  197. end
  198. Alert.show("您确定退出社团驻地吗?", Alert.Type.Two, exit_scene)
  199. end
  200. local data = {call_back = call_back, pos = {x = 243, y = 311}}
  201. GlobalEventSystem:Fire(EventName.SHOW_EXIT_BTN_STATE, data)
  202. end
  203. self:InitLittleMove()
  204. end
  205. function GuildSceneView:InitLittleMove( )
  206. self.rightIconCon.anchoredPosition = Vector2(-164 - ClientConfig.iphone_x_offset_right, 0)
  207. -- self.right_info_con.anchoredPosition = Vector2(1 + ClientConfig.iphone_x_offset_left, -163)
  208. -- self.hide_btn.anchoredPosition = Vector2(18 + ClientConfig.iphone_x_offset_left, -246)
  209. -- self.dance_eff_con.anchoredPosition = Vector2(0 - ClientConfig.iphone_x_offset_right, -71.5)
  210. -- self.guild_help_con.anchoredPosition = Vector2(0 - ClientConfig.iphone_x_offset_right, -148)
  211. -- self.guild_collect_left_con.anchoredPosition = Vector2(0 - ClientConfig.iphone_x_offset_right, -64)
  212. self:BindLittleMove(self.rightIconCon, BaseView.LittleMoveDir.Top, 0)
  213. self:BindLittleMove(self.func_btn_con, BaseView.LittleMoveDir.Bottom, 143.5)
  214. -- BindLittleMove 里会算offset,但是我们已经算过了,所以得把它抵消 by msh
  215. local offset_temp = 0
  216. self:BindLittleMove(self.hide_btn, BaseView.LittleMoveDir.Left, 1 + offset_temp)
  217. self:BindLittleMove(self.right_info_con, BaseView.LittleMoveDir.Left, 1 + offset_temp)
  218. local offset_temp_r = 0
  219. self:BindLittleMove(self.dance_eff_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r)
  220. self:BindLittleMove(self.guild_collect_left_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r)
  221. self:BindLittleMove(self.guild_help_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r)
  222. self:BindLittleMove(self.guild_support_tip_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r)
  223. self:BindLittleMove(self.guild_aucion_con, BaseView.LittleMoveDir.Right, self.guild_aucion_con_posx + offset_temp_r)
  224. end
  225. function GuildSceneView:AddEvent()
  226. local on_click = function ( click_obj )
  227. if self.hide_btn_obj == click_obj then --隐藏/显示右侧信息按钮
  228. self:SwitchInfoVisible(not self.right_top_visible)
  229. elseif self.btn_team_obj == click_obj then -- 切换到组队页签
  230. self:SwitchInfoTab(2)
  231. elseif self.btn_event_obj == click_obj then -- 切换到活动页签
  232. self:SwitchInfoTab(1)
  233. -- elseif self.exitBtn_obj == click_obj then --退出按钮
  234. -- local function exit_scene()
  235. -- CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW)
  236. -- self.model:Fire(GuildModel.LEAVE_GUILD_BASE)
  237. -- end
  238. -- Alert.show("您确定退出社团驻地吗?",Alert.Type.Two,exit_scene)
  239. elseif self.boss_tab1_obj == click_obj then -- 选中晚间社团boss社团排行
  240. self:ChangeGuildBossTab(1)
  241. elseif self.boss_tab2_obj == click_obj then -- 选中晚间社团boss个人排行
  242. self:ChangeGuildBossTab(2)
  243. elseif self.party_ques_obj == click_obj then -- 社团派对活动介绍
  244. EventSystem.Fire(GlobalEventSystem,EventName.OPEN_INSTRUCTION_VIEW, 40007)
  245. elseif self.right_boss_head_obj == click_obj then -- 寻路到boss
  246. self:FindGuildBossWay()
  247. elseif self.inspireBtn_obj == click_obj then -- 战力鼓舞
  248. self:ShowGuildBossEncourage(EncourageTips.ShowType.Open)
  249. elseif self.guild_boss_pv_btn_obj == click_obj then -- 社团boss奖励预览界面
  250. self.model:Fire(GuildModel.OPEN_BOSS_ROLL_PREVIEW_VIEW, true)
  251. elseif self.party_btn1_obj == click_obj then -- 劲音之王music——1
  252. self:OnClickChangeBGM(1)
  253. elseif self.party_btn2_obj == click_obj then -- 劲音之王music——2
  254. self:OnClickChangeBGM(2)
  255. elseif self.guildCollectRewardBtn_obj == click_obj then -- 封印裂隙奖励说明展示
  256. self.model:Fire(GuildModel.OPEN_GUILD_COLLECT_REWARD_VIEW)
  257. elseif self.dance_ques_btn_obj == click_obj then -- 社团晚宴挂机人数加成按钮
  258. self.dance_mem_eff_con_obj:SetActive(not self.dance_mem_eff_con_obj.activeSelf)
  259. elseif self.check_more_support_label_obj == click_obj then --查看更多协助
  260. self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_IFNO_VIEW,GuildModel.SupportTab.List)
  261. elseif self.buffBtn_obj == click_obj then --材料提交BUFF
  262. local buff_kind = OperateActivityModel.MaterialSubmitBuffKind.PEACH_EXP --触发加成后,玩家赏金幻魔/专属幻魔掉落概率+100%
  263. local buff_cfg,buff_info,dot = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(buff_kind)
  264. local abs_pos = click_obj.transform:TransformPoint(Vector3.zero)
  265. local sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT)
  266. local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT, sub_type)
  267. if act_list then
  268. local buff_data = nil
  269. for k,v in pairs(act_list.condition_list) do--[{role_lv,80},{sub,1},{cost,30},{group,5}]
  270. if v[1] == "suit" then--全服进度套件ID
  271. buff_data = OperateActivityModel:getInstance():GetMaterialSubmitServerCfg(tonumber(v[2]),dot)
  272. break
  273. end
  274. end
  275. if buff_data then
  276. local data = {
  277. sub_type = sub_type,
  278. buff_data = buff_data,
  279. pos_x = abs_pos.x,
  280. pos_y = abs_pos.y,
  281. is_outside = true,
  282. }
  283. OperateActivityModel:getInstance():Fire(OperateActivityModel.OPEN_MATERIAL_SUBMIT_BUFF_VIEW,data)
  284. end
  285. end
  286. end
  287. end
  288. AddClickEvent(self.hide_btn_obj, on_click)
  289. AddClickEvent(self.btn_team_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  290. AddClickEvent(self.btn_event_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  291. -- AddClickEvent(self.exitBtn_obj, on_click, LuaSoundManager.SOUND_UI.NONE)
  292. AddClickEvent(self.boss_tab1_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  293. AddClickEvent(self.boss_tab2_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  294. AddClickEvent(self.party_ques_obj, on_click, LuaSoundManager.SOUND_UI.NONE)
  295. AddClickEvent(self.right_boss_head_obj, on_click)
  296. AddClickEvent(self.inspireBtn_obj, on_click)
  297. AddClickEvent(self.guild_boss_pv_btn_obj, on_click)
  298. AddClickEvent(self.party_btn1_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  299. AddClickEvent(self.party_btn2_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  300. AddClickEvent(self.guildCollectRewardBtn_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH)
  301. AddClickEvent(self.dance_ques_btn_obj, on_click)
  302. AddClickEvent(self.check_more_support_label_obj, on_click)
  303. AddClickEvent(self.buffBtn_obj, on_click)
  304. local function changeFunc(is_hide)
  305. -- for k,v in pairs(self.rightIcon_tween) do
  306. -- TweenLite.Stop(v)
  307. -- end
  308. -- self.rightIcon_tween = {}
  309. -- if is_hide then
  310. -- table.insert(self.rightIcon_tween,TweenLite.to(self, self.rightIconCon_obj, TweenLite.UiAnimationType.ALPHA_ALL, 1, 0.3))
  311. -- else
  312. -- table.insert(self.rightIcon_tween,TweenLite.to(self, self.rightIconCon_obj, TweenLite.UiAnimationType.ALPHA_ALL, 0, 0.3))
  313. -- end
  314. self.rightIconCon_obj:SetActive(is_hide)
  315. end
  316. self:BindEvent(GlobalEventSystem, EventName.CHANGE_RIGHT_TIP_ICON, changeFunc)--更新右上角活动图标状态
  317. -- 社团驻地内活动协议更新
  318. local function update_guildBase_event(type)
  319. local event_flag = false
  320. if type == GuildEventType.GuildBossNoon or type == GuildEventType.GuildBossNight then -- 社团boss
  321. event_flag = event_flag or self:CheckGuildBossEvent()
  322. elseif type == GuildEventType.NoonCollect then -- 社团午间采集
  323. event_flag = event_flag or self:CheckGuildCollectEvent()
  324. elseif type == GuildEventType.GuildParty then
  325. event_flag = event_flag or self:CheckGuildPartyEvent()
  326. elseif type == GuildEventType.GuildTV then
  327. event_flag = event_flag or self:CheckGuildTVEvent()
  328. -- self:CheckGuildPartyEvent()
  329. end
  330. if not event_flag then -- 当前的活动是进入关闭阶段,则需要重新检查一下界面右侧的展示内容
  331. self:UpdateView()
  332. else -- 存在活动的情况,关闭无活动的展示界面
  333. self:ShowDefaultEvent(event_flag)
  334. end
  335. end
  336. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_EVENT_BY_TYPE, update_guildBase_event)
  337. local function onOrientationChange()
  338. if self.transform then
  339. if ClientConfig.iphone_x_model then
  340. self.rightIconCon.anchoredPosition = Vector2(-164 - ClientConfig.iphone_x_offset_right, 0)
  341. end
  342. end
  343. end
  344. self:BindEvent(GlobalEventSystem, EventName.ORIENTATION_DID_CHANGE, onOrientationChange)--位置适配
  345. --午间采集活动倒计时
  346. local function onUpateCollectLeftTimeHandler(time)
  347. self:UpdateCollectLeftTime(time)
  348. end
  349. self:BindEvent(self.model,GuildModel.UPDATE_GUILD_COLLECT_LEFT_TIME,onUpateCollectLeftTimeHandler)
  350. --刷新午间采集活动右上角信息栏
  351. local function onUpdateCollectInfoConHandler()
  352. self:UpdateCollectInfoCon()
  353. end
  354. self:BindEvent(self.model,GuildModel.UPDATE_GUILD_COLLECT_INFO_CON,onUpdateCollectInfoConHandler)
  355. --剩余采集怪数量刷新
  356. local function onUpdateCollectLeftCollectMon()
  357. self:UpdateGuildCollectLeftCollectMonNum()
  358. end
  359. self:BindEvent(self.model,GuildModel.UPDATE_GUILD_COLLECT_LEFT_COLLECT_MON_NUM,onUpdateCollectLeftCollectMon)
  360. local function LEFT_FUN_OPEN_VISIBLE( bool )
  361. if self.guild_collect_help_view then
  362. self.guild_collect_help_view.gameObject:SetActive(not bool)
  363. end
  364. end
  365. self:BindEvent(GlobalEventSystem, EventName.LEFT_FUN_OPEN_VISIBLE, LEFT_FUN_OPEN_VISIBLE)
  366. -- 社团boss社团排行刷新
  367. local function update_rank_data(type)
  368. if self.guildboss_ranktype == type then
  369. self:UpdateGuildBossRank()
  370. end
  371. end
  372. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_BOSS_RANK, update_rank_data)
  373. -- 社团boss个人排行刷新
  374. local function update_personal_rank_data(type)
  375. if self.guildboss_ranktype == type then
  376. self:UpdateBossPersonalRank()
  377. end
  378. end
  379. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_BOSS_PERSONAL_RANK, update_personal_rank_data)
  380. -- 更新社团boss血量
  381. local function update_guildboss_hp(var, vo)
  382. self:UpdateGuildBossHp(vo)
  383. end
  384. self.update_guildboss_hp_id = self.model:BindOne("guild_boss_hp_data", update_guildboss_hp)
  385. local function updateGuildBossInvincible(vo)
  386. self:UpdateGuildBossInvincible(vo)
  387. end
  388. self:BindEvent(self.model, GuildModel.UPDATE_GUILDBOSS_INVINCIBLE, updateGuildBossInvincible)
  389. local function updateGuildPartyExp()
  390. self:UpdateGuildPartyExp()
  391. end
  392. self:BindEvent(self.model, GuildModel.UPDATE_GUILDPARTY_EXPDATA, updateGuildPartyExp)
  393. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SCENE_MEMBER_NUM, updateGuildPartyExp)
  394. local function update_guild_boss_encourage_view1( )
  395. local extra_param_list = {}
  396. extra_param_list.show_encourage_times = true
  397. self:ShowGuildBossEncourage(EncourageTips.ShowType.Update,extra_param_list)
  398. -- 更新免费次数的红点
  399. self:UpdateInspireBtnRed()
  400. end
  401. self.update_encourage_handler_1 = self.model:BindOne("encourage_free_times", update_guild_boss_encourage_view1)
  402. self.update_encourage_handler_2 = self.model:BindOne("encourage_cost_times", update_guild_boss_encourage_view1)
  403. local function update_guild_boss_encourage_view2( )
  404. local extra_param_list = {}
  405. extra_param_list.show_encourage_percentage = true
  406. self:ShowGuildBossEncourage(EncourageTips.ShowType.Update,extra_param_list)
  407. end
  408. self.update_encourage_handler_3 = self.model:BindOne("encourage_guild_times", update_guild_boss_encourage_view2)
  409. -- 取消自动战斗后,就清除采集忽略列表
  410. local function clear_guild_collect_ignore_list()
  411. if self.model:IsGuildCollectActive() then return end--封印裂隙改变自动战斗状态时先不要忽略列表
  412. self.model:ClearGuildIgnoreCollection()
  413. end
  414. self:BindEvent(GlobalEventSystem, EventName.STOPAUTOFIGHT, clear_guild_collect_ignore_list)
  415. -- 社团boss活动,掉落通知显示横幅
  416. local function on_guildboss_drop_event(vo)
  417. self:ShowGuildBossDropDialogueTip(vo)
  418. end
  419. self:BindEvent(self.model, GuildModel.GUILD_BOSS_DROP_EVENT, on_guildboss_drop_event)
  420. local function update_guild_boss_roll_data()
  421. -- 添加roll点的按钮
  422. self:UpdateBossRollBtn(true)
  423. end
  424. self:BindEvent(self.model, GuildModel.UPDATE_BOSS_ROLL_DATA, update_guild_boss_roll_data)
  425. -- local function on_change_guild_collect_left_con_state(bool)
  426. -- if self.model:IsGuildCollectActive() then
  427. -- self.guild_support_tip_con_obj:SetActive(bool)
  428. -- else
  429. -- self.guild_support_tip_con_obj:SetActive(false)
  430. -- end
  431. -- end
  432. -- self:BindEvent(self.model, GuildModel.CHANGE_GUILD_COLLECT_LEFT_CON_STATE, on_change_guild_collect_left_con_state)
  433. local function hide_dance_eff_node()
  434. self:ShowDanceEffNode(false)
  435. self:ShowInfoNode(false)
  436. end
  437. local function show_dance_eff_node()
  438. self:ShowDanceEffNode(true)
  439. self:ShowInfoNode(true)
  440. end
  441. self:BindEvent(GlobalEventSystem, EventName.START_COM_DIALOGUE_SHOW_ANIM, hide_dance_eff_node)
  442. self:BindEvent(GlobalEventSystem, EventName.FINISHED_COM_DIALOGUE_SHOW_ANIM, show_dance_eff_node)
  443. -- local function on_update_guild_info()
  444. -- self:CheckGuildAuctionTipsShow()
  445. -- end
  446. -- self.refresh_guild_info_id = self.model:Bind(GuildModel.UPDATE_GUILD_BOSS_INFO, on_update_guild_info)
  447. -- self:CheckGuildAuctionTipsShow()
  448. self:BindMainUIExpandEvent( self.func_btn_con )
  449. local function updata_buff_state(id)
  450. if id == KfActivityModel.TabID.MaterialSubmit and self.is_loaded then
  451. self:UpdateGuildPartyExp()
  452. end
  453. end
  454. self:BindEvent(KfActivityModel:getInstance(), KfActivityModel.ANS_UPDATE_VIEW, updata_buff_state)
  455. --刷新封印裂隙协助信息
  456. local function updateGuildSupportDataInfo( )
  457. if not self.is_loaded then return end
  458. if not self.model:IsGuildCollectActive() then return end
  459. self:UpdateCollectRightSupportTipCon()
  460. end
  461. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SUPPOR_INFO, updateGuildSupportDataInfo)--刷新协助信息列表
  462. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_COLLECT_SUPPORT_INFO_LIST, updateGuildSupportDataInfo)--刷新协助信息列表
  463. self:BindEvent(self.model, GuildModel.UPDATE_GUILD_COLLECT_NOW_SUPPORT_ID, updateGuildSupportDataInfo)
  464. end
  465. -- 打开场景UI后,直接检查一遍所有的社团驻地内活动
  466. function GuildSceneView:UpdateView()
  467. self:SwitchInfoTab()
  468. self:ShowInfoNode(not MainUIModel:getInstance():GetDialogueActionFlag(), true)
  469. local has_event = false -- 是否有活动正在进行
  470. -- 检查活动进行情况
  471. has_event = has_event or self:CheckGuildBossEvent() -- 检查晚间boss活动
  472. has_event = has_event or self:CheckGuildCollectEvent() -- 检查午间采集活动
  473. has_event = has_event or self:CheckGuildPartyEvent() -- 检查社团派对活动
  474. self:CheckGuildTVEvent()--更新竞速按钮
  475. -- 如图没有活动正在进行,则需要打开下一个即将开启的活动展示,如果是全部都进行完了,则需要展示最后一个活动
  476. self:ShowDefaultEvent(has_event)
  477. end
  478. --获取当前正在进行的活动index,用于打开界面时跳转
  479. function GuildSceneView:ShowDefaultEvent(has_event)
  480. self:ClearEventTrailerTimer()
  481. if has_event then
  482. self.trailer_con_obj:SetActive(false)
  483. self.trailer_empty_obj:SetActive(false)
  484. return
  485. end
  486. -- 今天是星期几,映射到周一~周日 = 1~7
  487. local cur_wday = os.date("*t", TimeUtil:getServerTime()).wday - 1
  488. if cur_wday > 7 then
  489. cur_wday = cur_wday - 7
  490. elseif cur_wday < 1 then
  491. cur_wday = cur_wday + 7
  492. end
  493. local event_list = self.model:GetGuildEventByWday(cur_wday)
  494. -- 如果当前没有活动在进行中,则需要通过当前的系统时间来决定定位到哪个即将开启的活动上(2020年3月14日策划需求,如果出现时区定位不准的问题找策划)
  495. local date = os.date("*t", TimeUtil:getServerTime())
  496. local zero_min = date.hour * 60 + date.min -- 当前时区距0点的分钟数
  497. local evt_start_time, evt_time_start, evt_start_hour, evt_start_min
  498. local event_index = 0 -- 没有找到活动开启时处理为今日活动已经进行完
  499. local icon_res = ""
  500. for k, v in ipairs(event_list) do
  501. icon_res = GuildTrailerEventType[tonumber(v.module_id .. v.module_sub)] or ""
  502. if icon_res ~= "" then
  503. evt_start_time = Split(v.time_str, "~")[1]
  504. evt_time_start = Split(evt_start_time,":")
  505. evt_start_hour = evt_time_start[1]
  506. evt_start_min = evt_time_start[2]
  507. if evt_start_hour * 60 + evt_start_min >= zero_min then
  508. event_index = k
  509. break
  510. end
  511. end
  512. end
  513. -- 根据下一场活动的数据来展示预告信息
  514. local event_cfg = event_list[event_index]
  515. local has_cfg = not IsTableEmpty(event_cfg)
  516. self.trailer_con_obj:SetActive(has_cfg)
  517. self.trailer_empty_obj:SetActive(not has_cfg)
  518. if has_cfg then
  519. -- 加载活动图标
  520. lua_resM:setImageSprite(self, self.trailer_event_icon_img, "activityIcon_asset", icon_res, false)
  521. SetSizeDelta(self.trailer_event_icon,60,60)
  522. -- 加载活动时间
  523. self.trailer_start_time_tmp.text = evt_start_time.."开启"
  524. -- 推算活动开始的时间戳,加载倒计时
  525. local event_start_time_stamp = TimeUtil:GetFutureZeroStampServer(0) + (evt_start_hour * 60 + evt_start_min) * 60
  526. local function trailer_timer_func()
  527. local left_time = event_start_time_stamp - TimeUtil:getServerTime()
  528. left_time = left_time < 0 and 0 or left_time
  529. self.trailer_countdown_tmp.text = string.format("活动倒计时:<%s><size=18>%s</size></color>", ColorUtil.GREEN_TIPS, TimeUtil:timeConvert3(left_time))
  530. if left_time <= 0 then
  531. self:ClearEventTrailerTimer()
  532. end
  533. end
  534. trailer_timer_func()
  535. self.trailer_event_timer = GlobalTimerQuest:AddPeriodQuest(trailer_timer_func, 0.5, -1)
  536. -- 加载活动奖励
  537. local reward_data = DailyModel:getInstance():GetRewardList(event_cfg.module_id, event_cfg.module_sub, 1)
  538. self.trailer_reward_creator = self.trailer_reward_creator or self:AddUIComponent(UI.ItemListCreator)
  539. local info = {
  540. data_list = reward_data,
  541. item_con = self.trailer_reward_con,
  542. scroll_view = self.trailer_reward_scroll,
  543. obj_pool_type = UIObjPool.UIType.AwardItem,
  544. item_width = 59,
  545. start_x = 7,
  546. start_y = -5,
  547. space_x = 20,
  548. create_frequency = 0.01,
  549. alignment = UnityEngine.TextAnchor.UpperLeft,
  550. on_update_item = function(item, i, v)
  551. local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2])
  552. local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id)
  553. if goodVo then
  554. item:SetItemSize(59, 59)
  555. item:SetData(goodVo.type_id, v.count , goodVo.color, nil, lock)
  556. end
  557. end,
  558. }
  559. self.trailer_reward_creator:UpdateItems(info)
  560. else
  561. self.trailer_empty_lb_tmp.text = "今日社团活动已结束\n明天尽早参加哦~"
  562. end
  563. end
  564. -- 清除活动预告的活动倒计时
  565. function GuildSceneView:ClearEventTrailerTimer( )
  566. if self.trailer_event_timer then
  567. GlobalTimerQuest:CancelQuest(self.trailer_event_timer)
  568. self.trailer_event_timer = nil
  569. end
  570. end
  571. -- 切换显示右侧信息界面
  572. function GuildSceneView:SwitchInfoVisible( visible )
  573. if self.right_top_visible == visible then
  574. return
  575. end
  576. self.right_top_visible = visible
  577. SetLocalScale(self.hide_arrow, visible and 1 or -1, 1, 1)
  578. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.right_info_con)
  579. local targetX = visible and self.origin_pos_x or self.origin_pos_x-(self.right_info_con_width+70)
  580. if ClientConfig.iphone_x_model then
  581. targetX = ClientConfig.iphone_x_offset_left + targetX
  582. end
  583. local moveAction = cc.MoveTo.createAnchoredType(0.5, targetX, self.origin_pos_y)
  584. moveAction = cc.EaseExponentialOut.New(moveAction)
  585. local action
  586. if visible then
  587. self.right_info_con_obj:SetActive(true)
  588. action = moveAction
  589. else
  590. action = cc.Sequence.New(moveAction, cc.CallFunc.New(function()
  591. self.right_info_con_obj:SetActive(false)
  592. end))
  593. end
  594. self:AddAction(action, self.right_info_con)
  595. end
  596. -- 活动/组队页签切换
  597. function GuildSceneView:SwitchInfoTab(index)
  598. self.right_tab_index = index or self.right_tab_index
  599. self.data_con_obj:SetActive(self.right_tab_index == 1)
  600. self.team_con_obj:SetActive(self.right_tab_index == 2)
  601. lua_resM:setImageSprite(self, self.img_event_img, "guildScene_asset", self.right_tab_index == 1 and "guild_task_btn_sel" or "guild_task_btn_nor", true)
  602. lua_resM:setImageSprite(self, self.img_team_img, "guildScene_asset", self.right_tab_index == 2 and "guild_team_btn_sel" or "guild_team_btn_nor", true)
  603. SetAnchoredPosition(self.img_event, self.right_tab_index == 1 and -1 or 6, self.right_tab_index == 1 and -40 or -47)
  604. SetAnchoredPosition(self.img_team, self.right_tab_index == 2 and -3 or 3, self.right_tab_index == 2 and -118 or -124)
  605. end
  606. function GuildSceneView:ShowInfoNode(show, force)
  607. local target_alpha = show and 1 or 0
  608. if force then
  609. self.hide_btn_cg.alpha = target_alpha
  610. self.right_info_con_cg.alpha = target_alpha
  611. else
  612. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.right_info_con)
  613. local function action_alpha_callback(percent)
  614. self.hide_btn_cg.alpha = show and percent or (1 - percent)
  615. self.right_info_con_cg.alpha = show and percent or (1 - percent)
  616. end
  617. local action_alpha = cc.CustomUpdate.New(0.3, action_alpha_callback)
  618. --cc.ActionManager:getInstance():addAction(action_alpha, self.hide_btn)
  619. cc.ActionManager:getInstance():addAction(action_alpha, self.right_info_con)
  620. end
  621. end
  622. ----------- 午间采集活动 -----------start
  623. --检查设置午间采集活动的UI展示
  624. function GuildSceneView:CheckGuildCollectEvent( )
  625. self.model:ClearGuildIgnoreCollection()
  626. local nc_data = self.model:GetGuildEventByType(GuildEventType.NoonCollect)
  627. if nc_data and nc_data.is_active then -- 采集活动进行中
  628. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40806)
  629. self.collect_info_con_obj:SetActive(true)--展示采集活动右上角数据信息栏
  630. self.guild_support_tip_con_obj:SetActive(true)
  631. self.guildCollectRewardBtn_obj:SetActive(true)--奖励预览按钮
  632. self:UpdateCollectInfoCon()
  633. self:UpdateCollectRewardItem(408,0,1)
  634. self.guild_collect_left_con_obj:SetActive(true)--左上角采集信息栏
  635. self:SetGuildSceneFuncBtn(true, {fun_id = 408, name = "封印裂隙", sort_id = 3})
  636. self:SetGuildSceneFuncBtn(true, {fun_id = 40899, name = "召唤社员", sort_id = 5})
  637. self:UpdateCollectRightSupportTipCon()--右侧协助栏
  638. --先判断进来场景是否协助的,如果是协助就需要请求40808然后去打怪
  639. self.model.guild_collect_confim_into_guild_scene = true
  640. --如果只是从驻地外用40808过来寻怪的,就直接寻怪
  641. if self.model.only_find_way_to_guild_collect_mon then
  642. if self.model.temp_guild_collect_mon_data then
  643. self.model:Fire(GuildModel.FIND_WAY_TO_GUILD_COLLECT_HELP_MON,self.model.temp_guild_collect_mon_data)
  644. end
  645. self.model.only_find_way_to_guild_collect_mon = false
  646. self.model.temp_guild_collect_mon_data = nil
  647. return true
  648. end
  649. local collect_support_data = nil
  650. local guild_collect_support_id = self.model:GetSelfGuildCollectSupportId()
  651. local info = self.model:GetGuildSupportInfo()
  652. for k,v in pairs(info) do
  653. if v.support_sid == guild_collect_support_id then
  654. collect_support_data = v
  655. break
  656. end
  657. end
  658. if collect_support_data and guild_collect_support_id ~= 0 then
  659. if collect_support_data.role_id ~= RoleManager.Instance.mainRoleInfo.role_id then
  660. --主动寻路去击杀协助对应的宝箱怪
  661. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,collect_support_data.support_sid)
  662. self.model.need_go_support_guild_collect_after_40046 = false
  663. return true
  664. end
  665. end
  666. ----------------------------------------------------------
  667. -- -- 进入场景后根据采集次数判断是否需要进入自动采集状态,如果是不能采集,就转为自动挂机状态打场景中的宝箱怪
  668. -- GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT)
  669. -- if not self.model:GuildCollectAutoFightIgnoreCollectMon() then--如果依然还有采集次数,需要主动开启自动采集状态
  670. -- self.model:SetAutoGuildCollectState(true)--切换采集状态
  671. -- self.model:Fire(GuildModel.UPDATE_AUTO_GUILD_COLLECT_STATE)--通知按钮变化
  672. -- else
  673. -- EventSystem.Fire(GlobalEventSystem,EventName.STARTAUTOFIGHT, false, true)
  674. -- end
  675. EventSystem.Fire(GlobalEventSystem,EventName.STARTAUTOFIGHT, false, true)
  676. return true
  677. else
  678. self.collect_info_con_obj:SetActive(false)--隐藏采集活动右上角数据信息栏
  679. self.guild_support_tip_con_obj:SetActive(false)
  680. self.guildCollectRewardBtn_obj:SetActive(false)--奖励预览按钮
  681. self.guild_collect_left_con_obj:SetActive(false)--左上角采集信息栏
  682. self:SetGuildSceneFuncBtn(false, {fun_id = 408, name = "封印裂隙", sort_id = 3})
  683. self:SetGuildSceneFuncBtn(false, {fun_id = 40899, name = "召唤社员", sort_id = 5})
  684. return false
  685. end
  686. return false
  687. end
  688. --刷新午间采集活动的信息栏
  689. function GuildSceneView:UpdateCollectInfoCon()
  690. --封印总次数
  691. local MaxCollectDayTimes = self.model:GetGuildCollectKvByKey("join_time_day").value
  692. local NowCollectDayTimes = self.model:GetDayTotalCollectTimes()
  693. -- local day_collect_color = NowCollectDayTimes < MaxCollectDayTimes and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK
  694. local left_day_collect_times = MaxCollectDayTimes-NowCollectDayTimes >= 0 and MaxCollectDayTimes-NowCollectDayTimes or 0
  695. local day_collect_color = left_day_collect_times > 0 and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK
  696. -- self.activityTimes_tmp.text = string.format("今日可封印次数:<size=20><color=%s>%s</color>/%s</size>",day_collect_color,left_day_collect_times,MaxCollectDayTimes)
  697. self.activityTimes_tmp.text = string.format("今日可封印次数:<size=20><color=%s>%s</color></size>",day_collect_color,left_day_collect_times)
  698. --本次活动封印次数
  699. local MaxCollectSealTimes = self.model:GetGuildCollectKvByKey("collet_time").value -- 单次午间采集活动封印的最大次数
  700. local NowCollectSealTimes = self.model:GetNowCollectSealTimes()
  701. -- local seal_color = NowCollectSealTimes < MaxCollectSealTimes and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK
  702. local left_seal_times = MaxCollectSealTimes-NowCollectSealTimes >= 0 and MaxCollectSealTimes-NowCollectSealTimes or 0
  703. local true_left_seal_times = left_seal_times <= left_day_collect_times and left_seal_times or left_day_collect_times
  704. local seal_color = true_left_seal_times > 0 and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK
  705. -- self.sealTimes_tmp.text = string.format("本场可封印次数:<size=20><color=%s>%s</color>/%s</size>",seal_color,left_seal_times,MaxCollectSealTimes)
  706. self.sealTimes_tmp.text = string.format("本场可封印次数:<size=20><color=%s>%s</color></size>",seal_color,true_left_seal_times)
  707. --如果采集数达到限制了,关闭自动采集状态
  708. if self.model:GuildCollectAutoFightIgnoreCollectMon() then
  709. self.model:SetAutoGuildCollectState(false)--切换采集状态
  710. self.model:Fire(GuildModel.UPDATE_AUTO_GUILD_COLLECT_STATE)--通知按钮变化
  711. end
  712. end
  713. --活动item展示
  714. function GuildSceneView:UpdateCollectRewardItem(ac_num1,ac_num2,ac_num3)
  715. local reward_data = DailyModel.Instance:GetRewardList(ac_num1,ac_num2,ac_num3)
  716. self.reward_item_creator = self.reward_item_creator or self:AddUIComponent(UI.ItemListCreator)
  717. local info = {
  718. data_list = reward_data,
  719. item_con = self.reward_con_collect,
  720. scroll_view = self.reward_scroll_collect,
  721. obj_pool_type = UIObjPool.UIType.AwardItem,
  722. item_width = 59,
  723. start_x = 7,
  724. start_y = -5,
  725. space_x = 20,
  726. create_frequency = 0.01,
  727. alignment = UnityEngine.TextAnchor.UpperLeft,
  728. on_update_item = function(item, i, v)
  729. local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2])
  730. local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id)
  731. if goodVo then
  732. item:SetData(goodVo.type_id, v.count , goodVo.color, nil, lock)
  733. end
  734. end,
  735. }
  736. self.reward_item_creator:UpdateItems(info)
  737. end
  738. --午间采集活动倒计时处理
  739. function GuildSceneView:UpdateCollectLeftTime(time)
  740. local wave_interval_time = self.model:GetGuildCollectKvByKey("total_wave").value -1
  741. local refresh_mon_time = self.model:GetGuildCollectKvByKey("refresh_mon_time").value
  742. local restTime = self.collect_stay_time - wave_interval_time*refresh_mon_time-10 --几波过完后剩余的休息时间
  743. local pre_str = ""
  744. if time >= restTime then
  745. if time >= self.collect_stay_time - 10 then--开场10秒立即刷怪
  746. time = 10 - (self.collect_stay_time - time)
  747. else
  748. time = time - restTime
  749. for i=1,wave_interval_time do
  750. if time > refresh_mon_time then
  751. time = time - refresh_mon_time
  752. end
  753. end
  754. end
  755. pre_str = "下一波:"
  756. self.next_collect_wave_label_tmp.text = string.format("下一波:<color=#fdffc2>%s</color>",TimeUtil:timeConversion(time, "MM-ss"))
  757. if time > 0 and time <= 10 then--此处展示倒计时
  758. if not self.guild_collect_tips_on then
  759. if self.model:IsGuildCollectActive() and self.scene_mgr:IsGuildScene() then
  760. local special_tip_data = {
  761. type = SpecialTipType.Timer2,
  762. sepeical_str = "下一波裂隙来袭 %s",
  763. show_time = time,
  764. }
  765. CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data)
  766. self.guild_collect_tips_on = true
  767. else
  768. CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW)
  769. end
  770. end
  771. else
  772. self.guild_collect_tips_on = false
  773. end
  774. else
  775. pre_str = "结束时间:"
  776. self.next_collect_wave_label_tmp.text = "已无下一波"
  777. end
  778. self.leftTime_tmp.text = string.format("%s<size=18><color=#2CF86F>%s</color></size>",pre_str,TimeUtil:timeConversion(time, "MM-ss"))
  779. end
  780. --刷新场景内剩余采集怪数量显示
  781. function GuildSceneView:UpdateGuildCollectLeftCollectMonNum( )
  782. local mon_num = self.model:GetGuildCollectLeftMon()
  783. self.left_collect_mon_label_tmp.text = string.format("剩余裂隙:<color=#2CF86F>%s</color>",mon_num)
  784. end
  785. function GuildSceneView:UpdateCollectRightSupportTipCon( )
  786. local support_list = self.model:GetGuildSupportInfo() or {}
  787. support_list = DeepCopy(support_list)
  788. local show_support_list = {}
  789. local self_support_sid = self.model:GetSelfGuildCollectSupportId()
  790. for k,v in pairs(support_list) do
  791. --找到所有封印裂隙协助(包括自己请求的,协助是一个宝箱怪对应一条协助,而不是一个人对应一条,需按召唤时间先后排序)
  792. if v.support_cfg_id == 2 then
  793. v.is_in_my_support = self_support_sid == v.support_sid
  794. v.is_my_support = v.role_id == RoleManager.Instance.mainRoleInfo.role_id
  795. table.insert(show_support_list,v)
  796. end
  797. end
  798. --越早召唤的排序越前
  799. local sort_func = function ( a, b )
  800. return a.show_time < b.show_time
  801. end
  802. table.sort(show_support_list, sort_func)
  803. local finnal_show_list = {}
  804. finnal_show_list[1] = show_support_list[1]
  805. finnal_show_list[2] = show_support_list[2]
  806. finnal_show_list[3] = show_support_list[3]
  807. for k,v in pairs(self.guild_collect_support_tip_item_list) do
  808. v:SetVisible(false)
  809. end
  810. for i,v in ipairs(finnal_show_list) do
  811. local item = self.guild_collect_support_tip_item_list[i]
  812. if not item then
  813. item = GuildCollectSupportTip.New(self.guild_support_tip_con)
  814. self.guild_collect_support_tip_item_list[i] = item
  815. end
  816. item:SetVisible(true)
  817. item:SetData(v)
  818. item:SetAnchoredPosition(-1, -1-(i-1)*73)
  819. end
  820. --超过三个以上封印裂隙要显示查看更多协助按钮
  821. self.check_more_support_label_obj:SetActive(#show_support_list>3)
  822. end
  823. ----------- 午间采集活动 -----------end
  824. ----------- 社团boss相关逻辑 -----------start
  825. function GuildSceneView:CheckGuildBossEvent( )
  826. local noonboss_data = self.model:GetGuildEventByType(GuildEventType.GuildBossNoon)
  827. local nightboss_data = self.model:GetGuildEventByType(GuildEventType.GuildBossNight)
  828. local noon_open = noonboss_data and noonboss_data.is_evt_open
  829. local night_open = nightboss_data and nightboss_data.is_evt_open
  830. if noon_open or night_open then -- 活动正在进行
  831. self.cur_guildboss_type = noon_open and GuildEventType.GuildBossNoon or GuildEventType.GuildBossNight -- 确定本次社团boss的boss类型
  832. self.cur_guildboss_act_type = noon_open and 1 or 2 -- 社团boss的活动子类型
  833. self.boss_rank_obj:SetActive(true)
  834. self.inspireBtn_obj:SetActive(true)--鼓舞按钮和boss排行同时出现与消失
  835. self.guild_boss_pv_btn_obj:SetActive(true)
  836. self:UpdateInspireBtnRed()
  837. self:ChangeGuildBossTab(self.guildboss_tabIndex)
  838. self:UpdateGuildBossHp(self.model:GetGuildBossHp())
  839. self:UpdateGuildBossName()
  840. self:UpdateGuildBossInvincible(self.model:GetGuildBossInvincible())
  841. self:UpdateInspirePrecentage()
  842. self:CheckGuildBossEncourgeTipsShow(self.cur_guildboss_type)
  843. if not self.guild_boss_alert_cache[self.cur_guildboss_act_type] then -- 播放一次预警
  844. CommonController.Instance:Fire(EventName.OPEN_BOSS_ALERT_VIEW, true, 40601)
  845. self.guild_boss_alert_cache[self.cur_guildboss_act_type] = true
  846. end
  847. if not self.req_roll_data then
  848. self.req_roll_data = true
  849. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40613)
  850. end
  851. -- 玩法开启时立即进入自动战斗
  852. GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
  853. -- 添加击杀boss的按钮
  854. self:SetGuildSceneFuncBtn(true, {fun_id = 406, name = "", sort_id = 4})
  855. self:UpdateBossRollBtn(true)
  856. self:SetGuildSceneFuncBtn(true, {fun_id = 40699, name = "召唤社员", sort_id = 6})
  857. -- 切换音乐
  858. --BOSS开启播放指定战斗音乐
  859. if not self.auto_change_boss_music then
  860. LuaSoundManager.Instance:StopBacksound()
  861. LuaSoundManager.Instance:PlayBackgroundSound("dungeon4", LuaSoundManager.SOUND_TYPE.SCENE, true)
  862. self.auto_change_boss_music = true
  863. end
  864. return true
  865. else -- 活动未开启或已结束
  866. self:ClearGuildBossHpTimer()
  867. self.boss_rank_obj:SetActive(false)
  868. self.inspireBtn_obj:SetActive(false)--鼓舞按钮和boss排行同时出现与消失
  869. self.guild_boss_pv_btn_obj:SetActive(false)
  870. if self.tip_show_type == self.cur_guildboss_type then -- 当前进行的是社团boss鼓舞的按钮tips,则销毁动画
  871. self:StopRightTopBtnTipsAction()
  872. self.tip_timer_bg_obj:SetActive(false)
  873. self.tip_show_type = nil
  874. end
  875. self:SetGuildSceneFuncBtn(false, {fun_id = 406, name = "", sort_id = 4})
  876. self:UpdateBossRollBtn(false)
  877. self:SetGuildSceneFuncBtn(false, {fun_id = 40699, name = "召唤社员", sort_id = 6})
  878. --BOSS结束播放会当前场景的背景音乐
  879. if self.auto_change_boss_music then
  880. LuaSoundManager.Instance:StopBacksound()
  881. LuaSoundManager.Instance:PlayBackground(SceneManager:getInstance():GetSceneId())
  882. self.auto_change_boss_music = false
  883. end
  884. return false
  885. end
  886. return false
  887. end
  888. -- 更新社团bossroll点表现
  889. function GuildSceneView:UpdateBossRollBtn(show_btn)
  890. local roll_data = self.model:GetGuildBossRollData()
  891. if TableSize(roll_data) > 0 or not show_btn then -- 销毁按钮的情况一定要能进去
  892. self:SetGuildSceneFuncBtn(show_btn, {fun_id = 4062, name = "装备掷点", sort_id = 5})
  893. end
  894. end
  895. -- 更新免费鼓舞按钮红点
  896. function GuildSceneView:UpdateInspireBtnRed( )
  897. local limit_free = self.model:GetGuildBossKV("free_encourage")
  898. local free_time = self.model:GetLeftFreeEncourageTimes()
  899. local has_red = limit_free - free_time > 0
  900. self.inspire_btn_red_obj:SetActive(has_red)
  901. self.inspire_btn_red_lb_tmp.text = limit_free - free_time
  902. if not has_red then -- 没有红点的情况,需要手动删除一次特效
  903. self:ClearUIEffect(self.inspireBtn_effect)
  904. end
  905. -- 没有红点且已经提示过一次tips或者点开过鼓舞界面则消除tips
  906. if (not has_red and self.tip_show_type == self.cur_guildboss_type) or self.is_gboss_encourage_clicked then
  907. -- 没红点之后就干掉这个动画
  908. self:StopRightTopBtnTipsAction()
  909. self.tip_timer_bg_obj:SetActive(false)
  910. self.tip_show_type = nil
  911. else
  912. if self.inspireBtn_obj.activeSelf then -- 鼓舞按钮出现了再打开动画,不然啥都不干
  913. self:CheckGuildBossEncourgeTipsShow(self.cur_guildboss_type)
  914. end
  915. end
  916. end
  917. function GuildSceneView:ChangeGuildBossTab(index)
  918. self.guildboss_tabIndex = index
  919. self.guildboss_ranktype = index == 1 and GuildBossRankType.Guild or GuildBossRankType.Personal
  920. -- 请求两个榜单,请求后后端会根据类型推送40604
  921. if self.guildboss_ranktype == GuildBossRankType.Guild then
  922. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40603, self.cur_guildboss_act_type)
  923. elseif self.guildboss_ranktype == GuildBossRankType.Personal then
  924. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40602, self.cur_guildboss_act_type)
  925. end
  926. local color_selected, color_unselected = ColorUtil:ConvertHexToRGBColor("ffffff"), ColorUtil:ConvertHexToRGBColor("9eb3cf")
  927. self.boss_tab1_tmp.color = index == 1 and color_selected or color_unselected
  928. self.boss_tab2_tmp.color = index == 2 and color_selected or color_unselected
  929. SetTMPSharedMaterial(self.boss_tab1_tmp, index == 1 and ShaderTools.TMPSharedMaterialType.HKYTW7OutlineBrightBlueTitle or ShaderTools.TMPSharedMaterialType.HKYTW7FFDefault)
  930. SetTMPSharedMaterial(self.boss_tab2_tmp, index == 2 and ShaderTools.TMPSharedMaterialType.HKYTW7OutlineBrightBlueTitle or ShaderTools.TMPSharedMaterialType.HKYTW7FFDefault)
  931. self.boss_tab_selected.anchoredPosition = self["boss_tab"..index].anchoredPosition
  932. self:UpdateGuildBossRank()
  933. self:UpdateBossPersonalRank()
  934. end
  935. -- 更新排行数据
  936. function GuildSceneView:UpdateGuildBossRank( )
  937. local data = self.model:GetGuildBossRank(self.cur_guildboss_type, self.guildboss_ranktype)
  938. self.rank_item_creator = self.rank_item_creator or self:AddUIComponent(UI.ItemListCreator)
  939. local info = {
  940. data_list = data,
  941. scroll_view = self.boss_rank_scroll,
  942. item_con = self.boss_rank_con,
  943. item_class = GuildSceneBossRankItem,
  944. item_height = 32,
  945. create_frequency = 0.01,
  946. alignment = UnityEngine.TextAnchor.UpperLeft,
  947. on_update_item = function(item, i, v)
  948. item:SetData(v, true)
  949. end,
  950. }
  951. self.rank_item_creator:UpdateItems(info)
  952. end
  953. -- 更新个体排行数据
  954. function GuildSceneView:UpdateBossPersonalRank( )
  955. -- 更新额外的排行信息
  956. local sub_data = self.model:GetGuildBossPersonalRank(self.cur_guildboss_type, self.guildboss_ranktype)
  957. if not self.guildboss_sub_rank_item then
  958. self.guildboss_sub_rank_item = GuildSceneBossRankItem.New(self.boss_my_rank_bg)
  959. end
  960. local mainVo = RoleManager.Instance.mainRoleInfo
  961. local data = {
  962. rank = sub_data and sub_data.rank or false,
  963. name = self.guildboss_ranktype == GuildBossRankType.Personal and mainVo.name or mainVo.guild_name,
  964. hurt = sub_data and sub_data.hp or 0,
  965. }
  966. self.guildboss_sub_rank_item:SetData(data, false, true)
  967. self.guildboss_sub_rank_item:SetAnchoredPosition(3, 0)
  968. end
  969. ----------- 社团boss血条 -----------start
  970. -- 更新boss名称(只需要跑一次,就单独写出来)
  971. function GuildSceneView:UpdateGuildBossName( )
  972. local mon_basic = ConfigItemMgr.Instance:GetMonsterDataItem(GuildModel.GuildBossId)
  973. self.right_boss_name_tmp.text = Trim(mon_basic.name)
  974. end
  975. -- 更新社团boss血条
  976. function GuildSceneView:UpdateGuildBossHp(hp_vo)
  977. local boos_lives = ConfigItemMgr.Instance:GetMonsterDataItem(GuildModel.GuildBossId).hp_num
  978. -- 如果怪物血量还没有压下来且前端已经存在经验表现则不进行后面的逻辑
  979. if hp_vo and hp_vo.hp > 1000 and self.guild_boss_hp_timer_id then return end
  980. -- 获取活动开始和结束的时间戳
  981. local evt_data = self.model:GetGuildEventByType(self.cur_guildboss_type)
  982. if not evt_data then return end
  983. local start_time = evt_data.stime
  984. local evt_time = Config.Guilddemonkv["continue_time"] and Config.Guilddemonkv["continue_time"].value or 600
  985. local end_time = (start_time + evt_time) * 1000
  986. local function guild_boss_hp_timer()
  987. local percentage = 0
  988. if not hp_vo or hp_vo.hp > 1000 then -- 血量还没压下来,前端做表现
  989. local left_time = (end_time - TimeUtil:getServerTimeMs()) * 0.001
  990. percentage = Mathf.Clamp(left_time / evt_time, 0.01, 1)
  991. else
  992. percentage = hp_vo.hp / hp_vo.hp_limit
  993. end
  994. -- 右侧的boss血条,以百分比形式展示
  995. self.right_boss_hp_fill_img.fillAmount = percentage
  996. self.right_boss_percentage_tmp.text = math.ceil(percentage * 100) .. "%"
  997. -- 刷新boss假血量
  998. self.model:SetGuildBossHpSimulation(percentage/(1/boos_lives))
  999. -------------------------------------------
  1000. end
  1001. self:ClearGuildBossHpTimer()
  1002. self.guild_boss_hp_timer_id = GlobalTimerQuest:AddPeriodQuest(guild_boss_hp_timer, 0.2, -1)
  1003. guild_boss_hp_timer()
  1004. end
  1005. function GuildSceneView:ClearGuildBossHpTimer( )
  1006. if self.guild_boss_hp_timer_id then
  1007. GlobalTimerQuest:CancelQuest(self.guild_boss_hp_timer_id)
  1008. self.guild_boss_hp_timer_id = nil
  1009. end
  1010. end
  1011. ----------- 社团boss血条 -----------end
  1012. -- 更新晚间boss的狂暴特效
  1013. function GuildSceneView:UpdateGuildBossInvincible(vo)
  1014. if not vo then
  1015. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40606) -- 获取boss的狂暴状态
  1016. return
  1017. end
  1018. local monsterVo = Scene:getInstance():GetMonsterByTypeId(GuildModel.GuildBossId)
  1019. if monsterVo then
  1020. if vo.mon_state == 1 then
  1021. monsterVo:GuildBossInvincibleEffect(true, vo.etime - TimeUtil:getServerTime())
  1022. local special_tip_data = {
  1023. sepeical_str = "boss施放无敌技能,击破法术球可解除",
  1024. show_time = 2,
  1025. -- need_flash = true,
  1026. }
  1027. -- 打开预警文本
  1028. CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW_TWO, special_tip_data)
  1029. else
  1030. monsterVo:GuildBossInvincibleEffect(false)
  1031. -- 手动关闭预警文本
  1032. CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW_TWO)
  1033. end
  1034. end
  1035. end
  1036. -- 社团boss寻路
  1037. function GuildSceneView:FindGuildBossWay( )
  1038. local call_back = function ()
  1039. GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT)
  1040. end
  1041. -- 社团场景有两个,所以直接改为获取当前场景即可
  1042. local scene_id = self.scene_mgr:GetSceneId()
  1043. local pos_x,pos_y = self.model:GetGuildBossPos()
  1044. local findVo = FindVo.New()
  1045. findVo.type = FindVo.POINT
  1046. findVo.sceneId = scene_id
  1047. findVo.x = pos_x / SceneObj.LogicRealRatio.x
  1048. findVo.y = pos_y / SceneObj.LogicRealRatio.y
  1049. findVo.call_back = call_back
  1050. GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT)
  1051. Scene:getInstance():FindElement(findVo)
  1052. end
  1053. -- 社团boss鼓舞
  1054. function GuildSceneView:ShowGuildBossEncourage(show_type,extra_param_list)
  1055. local free_encourage_call = function()--免费鼓舞
  1056. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40608,0)
  1057. end
  1058. local gold_encourage_call = function()--红钻鼓舞
  1059. self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40608,1)
  1060. end
  1061. local data = {
  1062. [1] ={
  1063. type_id = false,-- 鼓舞类型(免费)
  1064. use_time = 0,-- 已鼓舞次数
  1065. click_call = false,--点击回调
  1066. },
  1067. [2] ={
  1068. type_id = false,-- 鼓舞类型(付费)
  1069. use_time = 0,-- 已鼓舞次数
  1070. click_call = false,--点击回调
  1071. }
  1072. }
  1073. local limit_free = self.model:GetGuildBossKV("free_encourage")
  1074. local limit_gold = stringtotable(self.model:GetGuildBossKV("bgold_encourage_cost"))[2]
  1075. for i=1,2 do
  1076. data[i].type_id = i
  1077. data[i].limit = i == 1 and limit_free or limit_gold-- 鼓舞最大次数
  1078. data[i].click_call = i == 1 and free_encourage_call or gold_encourage_call
  1079. data[i].use_time = i == 1 and self.model:GetLeftFreeEncourageTimes()
  1080. or self.model:GetleftCostEncourageTimes()
  1081. end
  1082. local encourageType = EncourageTips.EncourageType.GuildBoss
  1083. GlobalEventSystem:Fire(EventName.SHOW_ENCOURAGE_TIPS,show_type,data,encourageType,extra_param_list)
  1084. -- 更新鼓舞加成百分比
  1085. self:UpdateInspirePrecentage()
  1086. -- 已经点击了鼓舞按钮,需要更新按钮tips
  1087. if not self.is_gboss_encourage_clicked then
  1088. self.is_gboss_encourage_clicked = true
  1089. self:UpdateInspireBtnRed()
  1090. end
  1091. end
  1092. -- 更新鼓舞加成百分比
  1093. function GuildSceneView:UpdateInspirePrecentage( )
  1094. local insipre_times = self.model:GetEncourageGuildTimes()
  1095. local damage_percentage = self.model:GetGuildBossKV("encourage_hurt") / 100 --万分比伤害,这里除去100拿百分比伤害
  1096. self.inspire_lb_tmp.text = string.format("当前%s%%", HtmlColorTxt("+" .. insipre_times * damage_percentage, "#fdffc2"))
  1097. end
  1098. -- boss掉落小窗提示
  1099. function GuildSceneView:ShowGuildBossDropDialogueTip(vo)
  1100. local boss_tips = {
  1101. [1] = "不痛不痒,这点奖励就赏赐给你们吧!",
  1102. [2] = "不痛不痒,这点奖励就赏赐给你们吧!",
  1103. [3] = "你们很强,这点奖励就赏赐给你们吧!",
  1104. [4] = "你们很强,这点奖励就赏赐给你们吧!",
  1105. [5] = "你们让我感受到了一点点吃力!这是给你们的赏赐!",
  1106. [6] = "你们让我感受到了一点点吃力!这是给你们的赏赐!",
  1107. [7] = "你们让我感受到了一点点吃力!这是给你们的赏赐!",
  1108. [8] = "可恶!我快坚持不住了,给你们我的宝物!",
  1109. [9] = "可恶!我快坚持不住了,给你们我的宝物!",
  1110. [10] = "可恶!我的宝物都给你们,放过我吧!",
  1111. }
  1112. local mon_cfg = ConfigItemMgr.Instance:GetMonsterDataItem(vo.boss)
  1113. local dialogue_data = {
  1114. head_type = 1000,
  1115. desc = boss_tips[vo.click],
  1116. head_name = Trim(mon_cfg.name),
  1117. hide_time = 3,
  1118. dalay_time = 0.1,
  1119. is_task_type = false,
  1120. }
  1121. GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW, dialogue_data)
  1122. end
  1123. -- 检查社团boss鼓舞按钮tips
  1124. function GuildSceneView:CheckGuildBossEncourgeTipsShow(type)
  1125. if self.tip_show_type == type then return end -- 已经存在了就什么也不做
  1126. local limit_free = self.model:GetGuildBossKV("free_encourage")
  1127. local free_time = self.model:GetLeftFreeEncourageTimes()
  1128. if limit_free - free_time > 0 then -- 存在次数,就展示tips
  1129. -- local tips_data = {
  1130. -- str = "鼓舞可增加社团全体成员伤害",
  1131. -- time = -1,
  1132. -- pos = Vector2(-90, -85) + self.inspireBtn.anchoredPosition,
  1133. -- }
  1134. -- self:StartRightTopBtnTipsAction(tips_data)
  1135. self.tip_show_type = type
  1136. self:ClearUIEffect(self.inspireBtn_effect)
  1137. self:AddUIEffect("ui_bianqiang", self.inspireBtn_effect, "Scene", nil, {x=1,y=1}, true, nil,nil,nil,nil,nil,UIPartical.RenderingOther_List.UIBackward)
  1138. end
  1139. end
  1140. ----------- 社团boss相关逻辑 -----------end
  1141. ----------- 社团派对相关逻辑 -----------start
  1142. function GuildSceneView:CheckGuildPartyEvent( )
  1143. local party_data = self.model:GetGuildEventByType(GuildEventType.GuildParty)
  1144. if party_data and party_data.is_evt_open then
  1145. self.party_con_obj:SetActive(true)
  1146. self.dance_eff_con_obj:SetActive(true)
  1147. self:UpdatePartyExpEffData()
  1148. self:UpdateGuildPartyTimer()
  1149. self:GuildPartyGoDance()
  1150. self:UpdateGuildPartyExp()
  1151. self:BindPartyManulEvent()
  1152. self:CreatePartyRoleEffect()
  1153. self.model:CreateGuildPartyMonster()
  1154. self:ShowDanceEffNode(not MainUIModel:getInstance():GetDialogueActionFlag())
  1155. self:SetGuildSceneFuncBtn(true, {fun_id = 4007, name = "", sort_id = 1})
  1156. self:SetGuildSceneFuncBtn(true, {fun_id = 400799, name = "召唤社员", sort_id = 5})
  1157. if not self.auto_change_party_music then
  1158. self:OnClickChangeBGM(1)
  1159. self.auto_change_party_music = true
  1160. end
  1161. return true
  1162. else
  1163. self:ClearGuildPartyTimer()
  1164. self:CancelBindPartyManulEvent()
  1165. self:ClearUserManulEvent()
  1166. self:RemovePartyRoleEffect()
  1167. self.party_con_obj:SetActive(false)
  1168. self.dance_eff_con_obj:SetActive(false)
  1169. self.model:DeleteGuildPartyMonster()
  1170. -- 活动结束直接发取消跳舞的协议
  1171. -- self.model:Fire(GuildModel.CHANGE_GUILDDANCE_ACTION, 0)
  1172. DanceModel:getInstance():Fire(DanceModel.CHANGE_DANCE_STATUS, false)
  1173. self:SetGuildSceneFuncBtn(false, {fun_id = 4007, name = "", sort_id = 1})
  1174. self:SetGuildSceneFuncBtn(false, {fun_id = 400799, name = "召唤社员", sort_id = 5})
  1175. -- self:OnClickChangeBGM(2)
  1176. if self.need_reset_scene_bgm or self.auto_change_party_music then -- 重置为场景的bgm
  1177. LuaSoundManager.Instance:PlayBackground(self.scene_mgr:GetSceneId())
  1178. self.need_reset_scene_bgm = false
  1179. self.auto_change_party_music = false
  1180. end
  1181. return false
  1182. end
  1183. return false
  1184. end
  1185. -- 初始化社团派对经验值效率数据
  1186. function GuildSceneView:UpdatePartyExpEffData( )
  1187. local eff_list = self.model:GetGuildPartyEffRadioCfg()
  1188. for i, v in ipairs(eff_list) do
  1189. self.dance_eff_num_list[i].txt.text = string.format("%s-%s", v.num_min, v.num_max)
  1190. self.dance_eff_val_list[i].txt.text = v.radio / 100 .. "%"
  1191. end
  1192. end
  1193. -- 设置社团派对倒计时(只加载一次)
  1194. function GuildSceneView:UpdateGuildPartyTimer( )
  1195. self:ClearGuildPartyTimer()
  1196. local party_data = self.model:GetGuildEventByType(GuildEventType.GuildParty)
  1197. if party_data and party_data.stime and party_data.etime then
  1198. local left_time, event_stage, special_tip_data -- 剩余时间,活动阶段和顶部文本结构体
  1199. local function guildPartyTimerFunc()
  1200. left_time = party_data.etime - TimeUtil:getServerTime()
  1201. if left_time > 0 then
  1202. self.party_timer_tmp.text = string.format("<color=%s>%s</color>", ColorUtil.GREEN_DARK,TimeUtil:convertTimeWithoutHour(left_time))
  1203. if TimeUtil:getServerTime() - party_data.stime > 60
  1204. and TimeUtil:getServerTime() - party_data.stime <= 120
  1205. and not self.show_guildTv_tips then -- 活动开始3分钟后5分钟前,展示预告活动
  1206. self.show_guildTv_tips = true
  1207. special_tip_data = {
  1208. type = SpecialTipType.Timer1,
  1209. sepeical_str = "赛马竞猜将在%s秒后开始",
  1210. need_flash = false,
  1211. show_time = 60,
  1212. }
  1213. CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data)
  1214. end
  1215. else
  1216. self.party_timer_tmp.text = "<color=#fa1022>已结束</color>"
  1217. end
  1218. end
  1219. guildPartyTimerFunc()
  1220. self.guild_party_timer_id = GlobalTimerQuest:AddPeriodQuest(guildPartyTimerFunc, 1, -1)
  1221. end
  1222. end
  1223. function GuildSceneView:ClearGuildPartyTimer( )
  1224. if self.guild_party_timer_id then
  1225. GlobalTimerQuest:CancelQuest(self.guild_party_timer_id)
  1226. self.guild_party_timer_id = nil
  1227. end
  1228. end
  1229. -- 仅在社团热舞活动中开启对玩家操作的监听,如果在热舞状态下进行某些操作则要发送协议中断热舞
  1230. function GuildSceneView:CancelDanceWhileUserManul(skill_force)
  1231. -- local exp, pos = self.model:GetGuildPartyExpData()
  1232. local dance_status = self.main_vo.dance_status
  1233. if dance_status ~= 0
  1234. and (not self.is_moving_to_dance or skill_force)
  1235. and not self.model._waiting_12025_respon then -- 热舞状态则发送协议中断,多变量限制防止频繁请求
  1236. -- self.model:Fire(GuildModel.CHANGE_GUILDDANCE_ACTION, 0)
  1237. DanceModel:getInstance():Fire(DanceModel.CHANGE_DANCE_STATUS, false)
  1238. end
  1239. end
  1240. function GuildSceneView:BindPartyManulEvent( )
  1241. if not self.party_move_event_id then -- 对移动的监听
  1242. local function cancelDanceWhileMoving()
  1243. self:CancelDanceWhileUserManul()
  1244. end
  1245. self.party_move_event_id = GlobalEventSystem:Bind(ObjectEventType.MAINROLE_MOVE_EVENT_IMME, cancelDanceWhileMoving)
  1246. end
  1247. if not self.party_skill_event_id then -- 对技能的监听
  1248. local function cancelDanceWhileUseSkill()
  1249. self.last_use_skill_time = Status.NowTime
  1250. self:CancelDanceWhileUserManul(true)
  1251. end
  1252. self.party_skill_event_id = GlobalEventSystem:Bind(FightEvent.SKILL_SHORTCUT_CLICK, cancelDanceWhileUseSkill)
  1253. end
  1254. if not self.dance_status_change_id then -- 跳舞状态变化的监听
  1255. local function updateGuildDanceStatus()
  1256. self:GuildPartyGoDance()
  1257. end
  1258. self.dance_status_change_id = self.main_vo:BindOne("dance_status", updateGuildDanceStatus)
  1259. end
  1260. end
  1261. function GuildSceneView:CancelBindPartyManulEvent( )
  1262. if self.party_move_event_id then
  1263. GlobalEventSystem:UnBind(self.party_move_event_id)
  1264. self.party_move_event_id = nil
  1265. end
  1266. if self.party_skill_event_id then
  1267. GlobalEventSystem:UnBind(self.party_skill_event_id)
  1268. self.party_skill_event_id = nil
  1269. end
  1270. if self.dance_status_change_id then
  1271. self.main_vo:UnBind(self.dance_status_change_id)
  1272. self.dance_status_change_id = nil
  1273. end
  1274. end
  1275. -- 更新社团派对经验值信息
  1276. function GuildSceneView:UpdateGuildPartyExp( )
  1277. local exp = self.model:GetGuildPartyExpData()
  1278. local buff_kind = OperateActivityModel.MaterialSubmitBuffKind.PEACH_EXP--是否存在公会晚宴经验buff
  1279. local buff_cfg,buff_info = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(buff_kind)
  1280. -- buff_info = {etime = TimeUtil:getServerTime( )+300}
  1281. -- buff_cfg = {data = 100}
  1282. if buff_cfg and buff_info then--存在
  1283. local sec = buff_info.etime - TimeUtil:getServerTime( )
  1284. if sec > 0 then
  1285. lua_resM:setOutsideImageSprite(self, self.buffBtn_img, GameResPath.GetOperateActImage("ms_buff_btn_kind_1"), true)
  1286. self.buffBtn_obj:SetActive(true)
  1287. self.party_exp_tmp.text = string.format("<size=80%%>累计经验:<color=%s>%s</color>\n<color=%s>限时活动已加成+%s%%</color></size>", ColorUtil.GREEN_DARK, WordManager:ConvertNum(exp, true),ColorUtil.ORANGE_DARK,buff_cfg.data)
  1288. self:ActBuffTimeLate(sec)
  1289. else
  1290. self.buffBtn_obj:SetActive(false)
  1291. self.party_exp_tmp.text = string.format("累计经验:<color=%s>%s</color>", ColorUtil.GREEN_DARK, WordManager:ConvertNum(exp, true))
  1292. end
  1293. else
  1294. self.buffBtn_obj:SetActive(false)
  1295. self.party_exp_tmp.text = string.format("累计经验:<color=%s>%s</color>", ColorUtil.GREEN_DARK, WordManager:ConvertNum(exp, true))
  1296. end
  1297. -- 场景人数和效率万分比
  1298. local num, eff = self.model:GetGuildSceneMemberNum()
  1299. self.dance_mem_num_tmp.text = string.format("参与活动成员:<color=%s>%s人</color>", ColorUtil.YELLOW_DARK, num)
  1300. self.dance_eff_lb_tmp.text = string.format("经验加成+%s%%", eff / 100)
  1301. -- 获取挂机效率
  1302. local eff_per_min = self.model:GetGuildPartyExpEffPerMin()
  1303. local extra_str = eff > 0 and string.format("(+%s%%)", eff / 100) or ""
  1304. self.dance_exp_eff_tmp.text = string.format("%s/分%s", eff_per_min, extra_str)
  1305. --self.party_buff_txt.text = string.format("热舞经验加成:<color=#0ce148>%s</color>", pos == 0 and "0%" or "10%")--热舞经验收益获得功能取消20/05/26
  1306. end
  1307. --公会晚宴经验BUFF时间倒计时
  1308. function GuildSceneView:ActBuffTimeLate( sec )
  1309. if self.is_loaded then
  1310. if self.act_buff_timer_id then
  1311. GlobalTimerQuest:CancelQuest(self.act_buff_timer_id)
  1312. self.act_buff_timer_id = nil
  1313. end
  1314. if self.sec == sec then
  1315. return
  1316. else
  1317. self.sec = sec
  1318. end
  1319. local sec = sec or 0
  1320. if sec > 0 then
  1321. local function onTimer()
  1322. sec = sec - 1
  1323. if sec > 0 then
  1324. else
  1325. GlobalTimerQuest:CancelQuest(self.act_buff_timer_id)
  1326. self.act_buff_timer_id = nil
  1327. self:UpdateGuildPartyExp()
  1328. end
  1329. end
  1330. if not self.act_buff_timer_id then
  1331. self.act_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
  1332. end
  1333. onTimer()
  1334. else
  1335. self:UpdateGuildPartyExp()
  1336. end
  1337. end
  1338. end
  1339. -- 社团场景内跳舞寻路逻辑(包括玩家静止15秒后进入热舞状态,进入热舞状态的寻路以及寻路状态中打断热舞相关的逻辑)
  1340. function GuildSceneView:GuildPartyGoDance()
  1341. -- 获取热舞状态 0:无 1:热舞中
  1342. local dance_status = self.main_vo.dance_status
  1343. -- 发送跳舞协议
  1344. local function sendDanceReq()
  1345. Message.show("开始热舞")
  1346. -- self.model:Fire(GuildModel.CHANGE_GUILDDANCE_ACTION, 1)
  1347. DanceModel:getInstance():Fire(DanceModel.CHANGE_DANCE_STATUS, true)
  1348. self:ClearUserManulEvent()
  1349. self.is_moving_to_dance = false
  1350. end
  1351. if self.dance_last_status ~= dance_status then -- 协议返回的位置不同再进行寻路逻辑
  1352. if dance_status == 0 then -- 非热舞状态
  1353. if self.is_moving_to_dance then
  1354. OperateManager.Instance:StopMove()
  1355. end
  1356. if self.dance_last_status ~= -1 then
  1357. Message.show("取消热舞")
  1358. end
  1359. self.is_moving_to_dance = false
  1360. -- 玩家手动取消热舞的时间也用这个来保存
  1361. self.last_use_skill_time = Status.NowTime
  1362. local function userManulEvent()
  1363. -- 距上次移动操作和技能操作都超过5秒才可自动进入热舞
  1364. if Status.NowTime - Scene.Instance.user_manul_time >= 5
  1365. and Status.NowTime - self.last_use_skill_time >= 5 then
  1366. -- 计时器跑完时再获取一次跳舞状态
  1367. dance_status = self.main_vo.dance_status
  1368. if dance_status == 0 and not self.model._waiting_12025_respon then
  1369. sendDanceReq()
  1370. self.is_moving_to_dance = false
  1371. self:ClearUserManulEvent()
  1372. end
  1373. end
  1374. end
  1375. self:ClearUserManulEvent()
  1376. self.user_manul_event_id = GlobalTimerQuest:AddPeriodQuest(userManulEvent, 0.1, -1)
  1377. else
  1378. self.is_moving_to_dance = false
  1379. end
  1380. self.dance_last_status = dance_status
  1381. end
  1382. end
  1383. -- 清除掉玩家操作事件的绑定
  1384. function GuildSceneView:ClearUserManulEvent( )
  1385. if self.user_manul_event_id then
  1386. GlobalTimerQuest:CancelQuest(self.user_manul_event_id)
  1387. self.user_manul_event_id = nil
  1388. end
  1389. end
  1390. -- 热舞玩法中,玩家挂载特效,活动结束后消失
  1391. function GuildSceneView:CreatePartyRoleEffect( )
  1392. if not self.party_role_effect_id then
  1393. -- 播放剧情气泡
  1394. local dialogue_data = {
  1395. head_type = 1004,
  1396. desc = "尽情热舞享受晚宴吧,热舞可持续获得巨额经验哦!",
  1397. head_name = "社团助手",
  1398. hide_time = 3,
  1399. dalay_time = 0,
  1400. is_task_type = false,
  1401. }
  1402. GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW, dialogue_data)
  1403. local main_role = Scene:getInstance():GetMainRole()
  1404. if main_role then
  1405. self.party_role_effect_id = ParticleManager.Instance:AddTargetEffect("buffparticle_400_1", main_role.compress_id, false, nil, nil, 7, nil)
  1406. end
  1407. end
  1408. end
  1409. -- 清除掉社团场景内跳舞的特效
  1410. function GuildSceneView:RemovePartyRoleEffect( )
  1411. if self.party_role_effect_id then
  1412. ParticleManager:getInstance():DelEffect(self.party_role_effect_id)
  1413. self.party_role_effect_id = nil
  1414. end
  1415. end
  1416. -- 显示隐藏热舞效率节点
  1417. function GuildSceneView:ShowDanceEffNode(show, force)
  1418. local target_alpha = show and 1 or 0
  1419. if force then
  1420. self.dance_eff_con_cg.alpha = target_alpha
  1421. else
  1422. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.dance_eff_con)
  1423. local function action_alpha_callback(percent)
  1424. self.dance_eff_con_cg.alpha = show and percent or (1 - percent)
  1425. end
  1426. local action_alpha = cc.CustomUpdate.New(0.3, action_alpha_callback)
  1427. cc.ActionManager:getInstance():addAction(action_alpha, self.dance_eff_con)
  1428. end
  1429. end
  1430. ----------- 社团派对相关逻辑 -----------end
  1431. ----------- 赛马竞猜 -----------start
  1432. function GuildSceneView:CheckGuildTVEvent( )
  1433. local guildTV_base_info = GuildTVModel.Instance:GetGuildTVBaseInfo()
  1434. if guildTV_base_info.state == 1 or guildTV_base_info.state == 2 then
  1435. self:SetGuildSceneFuncBtn(true, {fun_id = 1420, name = "赛马", sort_id = 2})
  1436. else
  1437. self:SetGuildSceneFuncBtn(false, {fun_id = 1420, name = "赛马", sort_id = 2})
  1438. end
  1439. end
  1440. ----------- 赛马竞猜 -----------end
  1441. -- 动态创建界面中部预告或功能按钮 flag:添加or删除 data = {fun_id = xxx, name = xxx, sort_id = xxx}
  1442. function GuildSceneView:SetGuildSceneFuncBtn(add, data)
  1443. if not data then return end
  1444. if add then
  1445. if self.fun_icon_cache[data.fun_id] then return end -- 已存在该按钮不处理添加逻辑
  1446. self.fun_icon_cache[data.fun_id] = data
  1447. end
  1448. if not add then
  1449. if not self.fun_icon_cache[data.fun_id] then return end -- 不存在该按钮不处理删除逻辑
  1450. self.fun_icon_cache[data.fun_id] = nil
  1451. end
  1452. -- 更新按钮和位置,故需要重新排序
  1453. local list, item = {}, nil
  1454. for k, v in pairs(self.fun_icon_cache) do
  1455. list[#list+1] = v
  1456. end
  1457. local sort_func = function ( a, b )
  1458. return a.sort_id < b.sort_id
  1459. end
  1460. table.sort(list, sort_func)
  1461. for k, v in ipairs(list) do
  1462. item = self.fun_icon_list[k]
  1463. if not item then
  1464. item = GuildSceneEventBtnItem.New(self.func_btn_con)
  1465. self.fun_icon_list[k] = item
  1466. end
  1467. item:SetAnchoredPosition(self.func_btn_con.sizeDelta.x/2 + ((k-1) - #list/2) * 97 + 10, 0)
  1468. item:SetData(v)
  1469. item:SetVisible(true)
  1470. end
  1471. if #self.fun_icon_list > #list then
  1472. for k = #list+1, #self.fun_icon_list do
  1473. self.fun_icon_list[k]:SetVisible(false)
  1474. end
  1475. end
  1476. end
  1477. -- 2020年8月17日新增 增加社团场景内的按钮可根据自己构建的数据结构展示按钮闪烁tips
  1478. -- tips_data = {
  1479. -- time = 展示多少秒,-1代表一直展示
  1480. -- str = 展示的文本内容
  1481. -- pos = 需要一个坐标来定位节点位置,因为这个tips节点跟按钮同级
  1482. -- blink = 是否需要闪烁
  1483. --}
  1484. function GuildSceneView:StartRightTopBtnTipsAction(tips_data)
  1485. if not tips_data then return end
  1486. self:StopRightTopBtnTipsAction()
  1487. self.tip_timer_bg_obj:SetActive(true)
  1488. self.tip_timer_bg.anchoredPosition = tips_data.pos
  1489. self.tip_timer_bg_canvas.alpha = 0
  1490. if tips_data.blink then
  1491. -- 添加cc动画
  1492. local function show_icon_func( percent )
  1493. self.tip_timer_bg_canvas.alpha = percent
  1494. end
  1495. local show_update = cc.CustomUpdate.New(0.7,show_icon_func)
  1496. local function hide_icon_func( percent )
  1497. self.tip_timer_bg_canvas.alpha = 1 - percent
  1498. end
  1499. local hide_update = cc.CustomUpdate.New(0.7,hide_icon_func)
  1500. local action = cc.Sequence.New(show_update,hide_update)
  1501. cc.ActionManager:getInstance():addAction(cc.RepeatForever.New(action), self.tip_timer_bg)
  1502. else
  1503. self.tip_timer_bg_canvas.alpha = 1
  1504. end
  1505. -- 添加计时器
  1506. if tips_data.time ~= -1 then
  1507. local end_time = TimeUtil:getServerTime() + tips_data.time
  1508. local need_append_time = string.find(tips_data.str, "%%s")
  1509. local function rt_btn_tips_timer()
  1510. local left_time = end_time - TimeUtil:getServerTime()
  1511. left_time = left_time > 0 and left_time or 0
  1512. self.tip_timer_tmp.text = need_append_time and string.format(tips_data.str, left_time) or tips_data.str
  1513. SetSizeDelta(self.tip_timer_bg, self.tip_timer_tmp.preferredWidth + 12, self.tip_timer_tmp.preferredHeight + 27)
  1514. if left_time <= 0 then
  1515. self.tip_timer_bg_obj:SetActive(false)
  1516. self.tip_show_type = nil
  1517. self:StopRightTopBtnTipsAction()
  1518. end
  1519. end
  1520. rt_btn_tips_timer()
  1521. self.rt_btn_tips_timer_id = GlobalTimerQuest:AddPeriodQuest(rt_btn_tips_timer, 1, -1)
  1522. else
  1523. self.tip_timer_tmp.text = tips_data.str
  1524. SetSizeDelta(self.tip_timer_bg, self.tip_timer_tmp.preferredWidth + 12, self.tip_timer_tmp.preferredHeight + 27)
  1525. end
  1526. end
  1527. function GuildSceneView:StopRightTopBtnTipsAction( )
  1528. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.tip_timer_bg)
  1529. if self.rt_btn_tips_timer_id then
  1530. GlobalTimerQuest:CancelQuest(self.rt_btn_tips_timer_id)
  1531. self.rt_btn_tips_timer_id = nil
  1532. end
  1533. end
  1534. function GuildSceneView:DestroySuccess( )
  1535. for k,v in pairs(self.rightIcon_tween) do
  1536. TweenLite.Stop(v)
  1537. end
  1538. if self.guildboss_sub_rank_item then
  1539. self.guildboss_sub_rank_item:DeleteMe()
  1540. self.guildboss_sub_rank_item = nil
  1541. end
  1542. if self.update_guildboss_hp_id then
  1543. self.model:UnBind(self.update_guildboss_hp_id)
  1544. self.update_guildboss_hp_id = nil
  1545. end
  1546. self:ClearGuildBossHpTimer()
  1547. self:ClearGuildPartyTimer()
  1548. self:CancelBindPartyManulEvent()
  1549. self:ClearUserManulEvent()
  1550. self:RemovePartyRoleEffect()
  1551. self.model:DeleteGuildPartyMonster()
  1552. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.dance_eff_con)
  1553. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.right_info_con)
  1554. if self.update_encourage_handler_1 then
  1555. self.model:UnBind(self.update_encourage_handler_1)
  1556. self.update_encourage_handler_1 = nil
  1557. end
  1558. if self.update_encourage_handler_2 then
  1559. self.model:UnBind(self.update_encourage_handler_2)
  1560. self.update_encourage_handler_2 = nil
  1561. end
  1562. if self.update_encourage_handler_3 then
  1563. self.model:UnBind(self.update_encourage_handler_3)
  1564. self.update_encourage_handler_3 = nil
  1565. end
  1566. for k, v in pairs(self.fun_icon_list) do
  1567. v:DeleteMe()
  1568. v = nil
  1569. end
  1570. self.fun_icon_list = nil
  1571. for k, v in pairs(self.guild_collect_support_tip_item_list) do
  1572. v:DeleteMe()
  1573. v = nil
  1574. end
  1575. self.guild_collect_support_tip_item_list = {}
  1576. if self.collect_view then
  1577. self.collect_view:DeleteMe()
  1578. self.collect_view = nil
  1579. end
  1580. self:ClearEventTrailerTimer()
  1581. self:StopRightTopBtnTipsAction()
  1582. -- if self.refresh_guild_info_id then
  1583. -- self.model:UnBind(self.refresh_guild_info_id)
  1584. -- self.refresh_guild_info_id = nil
  1585. -- end
  1586. if self.guild_auction_item then
  1587. self.guild_auction_item:DeleteMe()
  1588. self.guild_auction_item = false
  1589. end
  1590. if self.act_buff_timer_id then
  1591. GlobalTimerQuest:CancelQuest(self.act_buff_timer_id)
  1592. self.act_buff_timer_id = nil
  1593. end
  1594. self.model:ClearGuildIgnoreCollection()
  1595. self:ClearUIEffect(self.inspireBtn_effect)
  1596. GlobalEventSystem:Fire(EventName.HIDE_EXIT_BTN_STATE) -- 隐藏
  1597. end
  1598. -- function GuildSceneView:CheckGuildAuctionTipsShow( )
  1599. -- if GuildModel:getInstance():IsGuildAuctionShow() then
  1600. -- if not self.guild_auction_item then
  1601. -- self.guild_auction_item = GuildBossSceneAuctionTips.New(self.guild_aucion_con)
  1602. -- end
  1603. -- self.guild_auction_item:SetData()
  1604. -- else
  1605. -- if self.guild_auction_item then
  1606. -- self.guild_auction_item:DeleteMe()
  1607. -- self.guild_auction_item = false
  1608. -- end
  1609. -- end
  1610. -- end
  1611. -- 点击切换BGM
  1612. function GuildSceneView:OnClickChangeBGM( bgm_index )
  1613. if bgm_index == 1 then
  1614. self.party_btn1_chosen_obj:SetActive(true)
  1615. self.party_btn2_chosen_obj:SetActive(false)
  1616. LuaSoundManager.Instance:StopBacksound()
  1617. LuaSoundManager.Instance:PlayBackgroundSound("dance", LuaSoundManager.SOUND_TYPE.SCENE, true)
  1618. elseif bgm_index == 2 then
  1619. self.party_btn1_chosen_obj:SetActive(false)
  1620. self.party_btn2_chosen_obj:SetActive(true)
  1621. LuaSoundManager.Instance:StopBacksound()
  1622. LuaSoundManager.Instance:PlayBackgroundSound("field3", LuaSoundManager.SOUND_TYPE.SCENE, true)
  1623. end
  1624. self.need_reset_scene_bgm = true
  1625. end