GuildSceneView = GuildSceneView or BaseClass(BaseView) local GuildSceneView = GuildSceneView local LuaSoundManager = LuaSoundManager function GuildSceneView:__init() self.base_file = "guildScene" self.layout_file = "GuildSceneView" self.layer_name = "Main" self.destroy_imm = true self.change_scene_close = false self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 self.auto_change_party_music = false self.req_roll_data = false -- 是否请求了roll点信息 self.auto_change_boss_music = false self.model = GuildModel:getInstance() self.scene_mgr = SceneManager:getInstance() self.init_exit_btn = false self.right_top_visible = true -- 当前右上角界面显示flag self.right_tab_index = 1 -- 右侧信息显示index 1 = 活动, 2 = 组队 self.rightIcon_tween = {}--右上角缓动动画列表 self.need_reset_scene_bgm = false -- 是否需要重置背景音乐 self.cur_guildboss_type = GuildEventType.GuildBossNoon -- 确定本次社团boss的boss类型,默认午间boss类型 self.cur_guildboss_act_type = 1 -- 社团boss的活动子类型,默认午间boss类型 self.guildboss_tabIndex = 1 -- 社团boss排行榜tabindex self.guildboss_ranktype = GuildBossRankType.Guild -- 当前查看的社团排行类型 self.guildboss_sub_rank_item = nil -- 社团boss个体排行item self.guild_boss_alert_cache = {} -- 社团boss预警状态缓存标志量 self.is_gboss_encourage_clicked = false self.show_guildTv_tips = false -- 是否展示过跑马的specialTip -- self.main_ui_right_top_hide = true -- 主界面右上角按钮是否处于收起状态 self.main_vo = RoleManager.Instance.mainRoleInfo self.dance_last_status = -1 -- 上次缓存的社团热舞坐标配置index,默认-1激活静默挂机的计时器 self.last_use_skill_time = Status.NowTime -- 上次使用技能的时间 self.is_moving_to_dance = false -- 是否正在寻路前往热舞 self.collect_stay_time = self.model:GetGuildEventStayTime(GuildModel.GuildCollectModuleId,0) --整个持续时间 self.tip_show_type = nil -- 已经展示过了的tips类型缓存 self.fun_icon_cache = {} -- 社团内功能按钮缓存 self.fun_icon_list = {} -- 社团内功能按钮列表 self.guild_auction_item = false --社团拍卖提示界面 GuildTVModel:getInstance():Fire(GuildTVConst.REQ_GTV_SCMD, 14215) self.guild_collect_support_tip_item_list = {}--社团协助右侧协助tips self.load_callback = function () self:LoadSuccess() self:AddEvent() end self.open_callback = function ( ) self:UpdateView() end self.destroy_callback = function ( ) self:DestroySuccess() end end function GuildSceneView:Open( ) BaseView.Open(self) end function GuildSceneView:LoadSuccess() local nodes = { -- 界面隐藏按钮和子节点容器相关 "hide_btn:obj", "hide_btn/hide_arrow", "right_info_con:obj", "right_info_con/btn_con", "right_info_con/btn_con/img_event:img", "right_info_con/btn_con/img_team:img", "right_info_con/btn_con/btn_team:obj", "right_info_con/btn_con/btn_event:obj", "right_info_con/data_con:obj", "right_info_con/team_con:obj", -- 社团采集活动相关 "right_info_con/data_con/collect_info_con:obj",--午间采集玩法右上角信息栏 "right_info_con/data_con/collect_info_con/leftTime:tmp",--活动时间倒计时 "right_info_con/data_con/collect_info_con/activityTimes:tmp",--今天活动参与次数 "right_info_con/data_con/collect_info_con/sealTimes:tmp",--本次活动封印次数 "right_info_con/data_con/collect_info_con/reward_scroll_collect/Viewport/reward_con_collect", --展示奖励 "right_info_con/data_con/collect_info_con/reward_scroll_collect", "rightIconCon/guildCollectRewardBtn:obj", --封印裂隙奖励预览按钮 "guild_collect_left_con:obj:img", --左上角封印裂隙信息栏 "guild_collect_left_con/left_collect_mon_label:tmp", --剩余采集怪数量 "guild_collect_left_con/next_collect_wave_label:tmp", --下一波倒计时 "right_info_con/data_con/collect_info_con/collect_info_bg:img", "guild_help_con:obj", --社团协助栏父容器 "guild_support_tip_con:obj", --封印裂隙侧边协助tips "guild_support_tip_con/check_more_support_label:obj", --查看更多协助 -- 右上角退出按钮 "rightIconCon:obj", -- "rightIconCon/exitBtn:obj", "rightIconCon/inspireBtn:obj", "rightIconCon/inspireBtn/inspireBtn_effect", "rightIconCon/inspireBtn/inspire_btn_red:obj", "rightIconCon/inspireBtn/inspire_btn_red/inspire_btn_red_lb:tmp", "rightIconCon/inspireBtn/inspire_lb:tmp", "rightIconCon/guild_boss_pv_btn:obj", -- 右上角按钮tips节点 "rightIconCon/tip_timer_bg:obj", "rightIconCon/tip_timer_bg/tip_timer:tmp", -- 社团boss相关 "right_info_con/data_con/boss_rank:obj", "right_info_con/data_con/boss_rank/boss_tab_selected", "right_info_con/data_con/boss_rank/boss_my_rank_bg", "right_info_con/data_con/boss_rank/boss_rank_scroll", "right_info_con/data_con/boss_rank/boss_rank_scroll/Viewport/boss_rank_con", "right_info_con/data_con/boss_rank/boss_tab1:obj:tmp", "right_info_con/data_con/boss_rank/boss_tab2:obj:tmp", "right_info_con/data_con/boss_rank/right_boss_percentage:tmp", "right_info_con/data_con/boss_rank/right_boss_hp_fill:img", "right_info_con/data_con/boss_rank/right_boss_head:obj", "right_info_con/data_con/boss_rank/right_boss_name:tmp", -- 社团派对相关(晚间派对) "right_info_con/data_con/party_con:obj:img", "right_info_con/data_con/party_con/party_ques:obj", "right_info_con/data_con/party_con/party_timer:tmp", "right_info_con/data_con/party_con/party_exp:tmp", "right_info_con/data_con/party_con/party_buff:tmp", "right_info_con/data_con/party_con/chosen_con/party_btn2/party_btn2_chosen:obj", "right_info_con/data_con/party_con/chosen_con/party_btn1/party_btn1_chosen:obj", "right_info_con/data_con/party_con/chosen_con/party_btn2:obj", "right_info_con/data_con/party_con/chosen_con/party_btn1:obj", -- 社团派对经验效率节点 "dance_eff_con:obj:cg", "dance_eff_con/dance_exp_eff:tmp", "dance_eff_con/dance_eff_lb:tmp", "dance_eff_con/dance_mem_num:tmp", "dance_eff_con/dance_ques_btn:obj", "dance_eff_con/dance_mem_eff_con:obj", -- 社团活动预告界面(无当前进行中活动时展示) "right_info_con/data_con/trailer_con:obj:img", "right_info_con/data_con/trailer_con/trailer_event_iconBg/trailer_event_icon:img", "right_info_con/data_con/trailer_con/trailer_countdown:tmp", "right_info_con/data_con/trailer_con/trailer_start_time:tmp", "right_info_con/data_con/trailer_con/trailer_reward_scroll", "right_info_con/data_con/trailer_con/trailer_reward_scroll/Viewport/trailer_reward_con", -- 空预告界面 "right_info_con/data_con/trailer_empty:obj:img", "right_info_con/data_con/trailer_empty/trailer_empty_lb:tmp", -- 社团界面内功能按钮容器 "func_btn_con:obj", -- 社团boss采集表现界面容器 "boos_collect_con", --社团拍卖提示 "guild_aucion_con", --社团材料提交BUFF相关 "right_info_con/data_con/party_con/buffBtn:obj:img", } self:GetChildren(nodes) --组队页签透明度 self.hide_btn_cg = self:GetChild("hide_btn"):GetComponent("CanvasGroup") self.right_info_con_cg = self:GetChild("right_info_con"):GetComponent("CanvasGroup") -- 获取社团晚间派对效率阶段节点 self.dance_eff_num_list = {} self.dance_eff_val_list = {} for i = 1, 3 do self.dance_eff_num_list[i] = {} self.dance_eff_num_list[i].txt = self:GetChild("dance_eff_con/dance_mem_eff_con/d_m_num_" .. i):GetComponent("TextMeshProUGUI") self.dance_eff_val_list[i] = {} self.dance_eff_val_list[i].txt = self:GetChild("dance_eff_con/dance_mem_eff_con/d_m_val_" .. i):GetComponent("TextMeshProUGUI") end --设置sceneView的自适应 self.transform.sizeDelta = Vector2(0,0) self.transform.localPosition = Vector3(0,0,0) -- if ClientConfig.iphone_x_model then -- self.transform.offsetMin = Vector2(ClientConfig.iphone_x_offset_left,0) -- self.transform.offsetMax = Vector2(-ClientConfig.iphone_x_offset_right,0) -- end self.tip_timer_bg_canvas = self.tip_timer_bg:GetComponent("CanvasGroup") local posX, posY = GetAnchoredPosition(self.right_info_con) self.origin_pos_x = posX self.origin_pos_y = posY self.right_info_con_width = GetSizeDeltaX(self.right_info_con) -- 加载组队节点 self.team_view = self.team_view or TeamView.New(self.team_con) self:AutoDelete(self.team_view) self.team_view:SetData() self.team_view:SetAnchoredPosition(0,0) -- 创建采集节点 self.collect_view = GuildSceneCollectView.New(self.boos_collect_con) self.collect_view:SetVisible(false) -- 先隐藏派对经验挂机效率节点 self.dance_eff_con_obj:SetActive(false) --看看是否需要显示跑马界面 if GuildTVModel:getInstance():IsGuildTVOpen() then local function delay_method( ) GlobalEventSystem:Fire(GuildTVConst.OPEN_GUILDTV_MAIN_VIEW) end setTimeout(delay_method, 1) end --封印裂隙社团协助栏 self.guild_collect_help_view = self:CreateItem(GuildCollectHelpRankView, self.guild_help_con, self.layer_name) SetAnchoredPositionY(self.guild_help_con,-240) -- 拍卖节点固定到界面正中心 self.guild_aucion_con_posx = -ScreenWidth / 2 + 110 SetAnchoredPosition(self.guild_aucion_con, self.guild_aucion_con_posx, 0) lua_resM:setOutsideImageSprite(self, self.collect_info_bg_img, GameResPath.GetViewBigBg("common_right_top_img2")) lua_resM:setOutsideImageSprite(self, self.party_con_img, GameResPath.GetViewBigBg("common_right_top_img2")) lua_resM:setOutsideImageSprite(self, self.trailer_con_img, GameResPath.GetViewBigBg("common_right_top_img2")) -- 新版 通用退出按钮 if not self.init_exit_btn then self.init_exit_btn = true local function call_back( ... ) local function exit_scene() CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW) self.model:Fire(GuildModel.LEAVE_GUILD_BASE) end Alert.show("您确定退出社团驻地吗?", Alert.Type.Two, exit_scene) end local data = {call_back = call_back, pos = {x = 243, y = 311}} GlobalEventSystem:Fire(EventName.SHOW_EXIT_BTN_STATE, data) end self:InitLittleMove() end function GuildSceneView:InitLittleMove( ) self.rightIconCon.anchoredPosition = Vector2(-164 - ClientConfig.iphone_x_offset_right, 0) -- self.right_info_con.anchoredPosition = Vector2(1 + ClientConfig.iphone_x_offset_left, -163) -- self.hide_btn.anchoredPosition = Vector2(18 + ClientConfig.iphone_x_offset_left, -246) -- self.dance_eff_con.anchoredPosition = Vector2(0 - ClientConfig.iphone_x_offset_right, -71.5) -- self.guild_help_con.anchoredPosition = Vector2(0 - ClientConfig.iphone_x_offset_right, -148) -- self.guild_collect_left_con.anchoredPosition = Vector2(0 - ClientConfig.iphone_x_offset_right, -64) self:BindLittleMove(self.rightIconCon, BaseView.LittleMoveDir.Top, 0) self:BindLittleMove(self.func_btn_con, BaseView.LittleMoveDir.Bottom, 143.5) -- BindLittleMove 里会算offset,但是我们已经算过了,所以得把它抵消 by msh local offset_temp = 0 self:BindLittleMove(self.hide_btn, BaseView.LittleMoveDir.Left, 1 + offset_temp) self:BindLittleMove(self.right_info_con, BaseView.LittleMoveDir.Left, 1 + offset_temp) local offset_temp_r = 0 self:BindLittleMove(self.dance_eff_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r) self:BindLittleMove(self.guild_collect_left_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r) self:BindLittleMove(self.guild_help_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r) self:BindLittleMove(self.guild_support_tip_con, BaseView.LittleMoveDir.Right, 0 + offset_temp_r) self:BindLittleMove(self.guild_aucion_con, BaseView.LittleMoveDir.Right, self.guild_aucion_con_posx + offset_temp_r) end function GuildSceneView:AddEvent() local on_click = function ( click_obj ) if self.hide_btn_obj == click_obj then --隐藏/显示右侧信息按钮 self:SwitchInfoVisible(not self.right_top_visible) elseif self.btn_team_obj == click_obj then -- 切换到组队页签 self:SwitchInfoTab(2) elseif self.btn_event_obj == click_obj then -- 切换到活动页签 self:SwitchInfoTab(1) -- elseif self.exitBtn_obj == click_obj then --退出按钮 -- local function exit_scene() -- CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW) -- self.model:Fire(GuildModel.LEAVE_GUILD_BASE) -- end -- Alert.show("您确定退出社团驻地吗?",Alert.Type.Two,exit_scene) elseif self.boss_tab1_obj == click_obj then -- 选中晚间社团boss社团排行 self:ChangeGuildBossTab(1) elseif self.boss_tab2_obj == click_obj then -- 选中晚间社团boss个人排行 self:ChangeGuildBossTab(2) elseif self.party_ques_obj == click_obj then -- 社团派对活动介绍 EventSystem.Fire(GlobalEventSystem,EventName.OPEN_INSTRUCTION_VIEW, 40007) elseif self.right_boss_head_obj == click_obj then -- 寻路到boss self:FindGuildBossWay() elseif self.inspireBtn_obj == click_obj then -- 战力鼓舞 self:ShowGuildBossEncourage(EncourageTips.ShowType.Open) elseif self.guild_boss_pv_btn_obj == click_obj then -- 社团boss奖励预览界面 self.model:Fire(GuildModel.OPEN_BOSS_ROLL_PREVIEW_VIEW, true) elseif self.party_btn1_obj == click_obj then -- 劲音之王music——1 self:OnClickChangeBGM(1) elseif self.party_btn2_obj == click_obj then -- 劲音之王music——2 self:OnClickChangeBGM(2) elseif self.guildCollectRewardBtn_obj == click_obj then -- 封印裂隙奖励说明展示 self.model:Fire(GuildModel.OPEN_GUILD_COLLECT_REWARD_VIEW) elseif self.dance_ques_btn_obj == click_obj then -- 社团晚宴挂机人数加成按钮 self.dance_mem_eff_con_obj:SetActive(not self.dance_mem_eff_con_obj.activeSelf) elseif self.check_more_support_label_obj == click_obj then --查看更多协助 self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_IFNO_VIEW,GuildModel.SupportTab.List) elseif self.buffBtn_obj == click_obj then --材料提交BUFF local buff_kind = OperateActivityModel.MaterialSubmitBuffKind.PEACH_EXP --触发加成后,玩家赏金幻魔/专属幻魔掉落概率+100% local buff_cfg,buff_info,dot = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(buff_kind) local abs_pos = click_obj.transform:TransformPoint(Vector3.zero) local sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT) local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT, sub_type) if act_list then local buff_data = nil for k,v in pairs(act_list.condition_list) do--[{role_lv,80},{sub,1},{cost,30},{group,5}] if v[1] == "suit" then--全服进度套件ID buff_data = OperateActivityModel:getInstance():GetMaterialSubmitServerCfg(tonumber(v[2]),dot) break end end if buff_data then local data = { sub_type = sub_type, buff_data = buff_data, pos_x = abs_pos.x, pos_y = abs_pos.y, is_outside = true, } OperateActivityModel:getInstance():Fire(OperateActivityModel.OPEN_MATERIAL_SUBMIT_BUFF_VIEW,data) end end end end AddClickEvent(self.hide_btn_obj, on_click) AddClickEvent(self.btn_team_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.btn_event_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) -- AddClickEvent(self.exitBtn_obj, on_click, LuaSoundManager.SOUND_UI.NONE) AddClickEvent(self.boss_tab1_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.boss_tab2_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.party_ques_obj, on_click, LuaSoundManager.SOUND_UI.NONE) AddClickEvent(self.right_boss_head_obj, on_click) AddClickEvent(self.inspireBtn_obj, on_click) AddClickEvent(self.guild_boss_pv_btn_obj, on_click) AddClickEvent(self.party_btn1_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.party_btn2_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.guildCollectRewardBtn_obj, on_click, LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.dance_ques_btn_obj, on_click) AddClickEvent(self.check_more_support_label_obj, on_click) AddClickEvent(self.buffBtn_obj, on_click) local function changeFunc(is_hide) -- for k,v in pairs(self.rightIcon_tween) do -- TweenLite.Stop(v) -- end -- self.rightIcon_tween = {} -- if is_hide then -- table.insert(self.rightIcon_tween,TweenLite.to(self, self.rightIconCon_obj, TweenLite.UiAnimationType.ALPHA_ALL, 1, 0.3)) -- else -- table.insert(self.rightIcon_tween,TweenLite.to(self, self.rightIconCon_obj, TweenLite.UiAnimationType.ALPHA_ALL, 0, 0.3)) -- end self.rightIconCon_obj:SetActive(is_hide) end self:BindEvent(GlobalEventSystem, EventName.CHANGE_RIGHT_TIP_ICON, changeFunc)--更新右上角活动图标状态 -- 社团驻地内活动协议更新 local function update_guildBase_event(type) local event_flag = false if type == GuildEventType.GuildBossNoon or type == GuildEventType.GuildBossNight then -- 社团boss event_flag = event_flag or self:CheckGuildBossEvent() elseif type == GuildEventType.NoonCollect then -- 社团午间采集 event_flag = event_flag or self:CheckGuildCollectEvent() elseif type == GuildEventType.GuildParty then event_flag = event_flag or self:CheckGuildPartyEvent() elseif type == GuildEventType.GuildTV then event_flag = event_flag or self:CheckGuildTVEvent() -- self:CheckGuildPartyEvent() end if not event_flag then -- 当前的活动是进入关闭阶段,则需要重新检查一下界面右侧的展示内容 self:UpdateView() else -- 存在活动的情况,关闭无活动的展示界面 self:ShowDefaultEvent(event_flag) end end self:BindEvent(self.model, GuildModel.UPDATE_GUILD_EVENT_BY_TYPE, update_guildBase_event) local function onOrientationChange() if self.transform then if ClientConfig.iphone_x_model then self.rightIconCon.anchoredPosition = Vector2(-164 - ClientConfig.iphone_x_offset_right, 0) end end end self:BindEvent(GlobalEventSystem, EventName.ORIENTATION_DID_CHANGE, onOrientationChange)--位置适配 --午间采集活动倒计时 local function onUpateCollectLeftTimeHandler(time) self:UpdateCollectLeftTime(time) end self:BindEvent(self.model,GuildModel.UPDATE_GUILD_COLLECT_LEFT_TIME,onUpateCollectLeftTimeHandler) --刷新午间采集活动右上角信息栏 local function onUpdateCollectInfoConHandler() self:UpdateCollectInfoCon() end self:BindEvent(self.model,GuildModel.UPDATE_GUILD_COLLECT_INFO_CON,onUpdateCollectInfoConHandler) --剩余采集怪数量刷新 local function onUpdateCollectLeftCollectMon() self:UpdateGuildCollectLeftCollectMonNum() end self:BindEvent(self.model,GuildModel.UPDATE_GUILD_COLLECT_LEFT_COLLECT_MON_NUM,onUpdateCollectLeftCollectMon) local function LEFT_FUN_OPEN_VISIBLE( bool ) if self.guild_collect_help_view then self.guild_collect_help_view.gameObject:SetActive(not bool) end end self:BindEvent(GlobalEventSystem, EventName.LEFT_FUN_OPEN_VISIBLE, LEFT_FUN_OPEN_VISIBLE) -- 社团boss社团排行刷新 local function update_rank_data(type) if self.guildboss_ranktype == type then self:UpdateGuildBossRank() end end self:BindEvent(self.model, GuildModel.UPDATE_GUILD_BOSS_RANK, update_rank_data) -- 社团boss个人排行刷新 local function update_personal_rank_data(type) if self.guildboss_ranktype == type then self:UpdateBossPersonalRank() end end self:BindEvent(self.model, GuildModel.UPDATE_GUILD_BOSS_PERSONAL_RANK, update_personal_rank_data) -- 更新社团boss血量 local function update_guildboss_hp(var, vo) self:UpdateGuildBossHp(vo) end self.update_guildboss_hp_id = self.model:BindOne("guild_boss_hp_data", update_guildboss_hp) local function updateGuildBossInvincible(vo) self:UpdateGuildBossInvincible(vo) end self:BindEvent(self.model, GuildModel.UPDATE_GUILDBOSS_INVINCIBLE, updateGuildBossInvincible) local function updateGuildPartyExp() self:UpdateGuildPartyExp() end self:BindEvent(self.model, GuildModel.UPDATE_GUILDPARTY_EXPDATA, updateGuildPartyExp) self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SCENE_MEMBER_NUM, updateGuildPartyExp) local function update_guild_boss_encourage_view1( ) local extra_param_list = {} extra_param_list.show_encourage_times = true self:ShowGuildBossEncourage(EncourageTips.ShowType.Update,extra_param_list) -- 更新免费次数的红点 self:UpdateInspireBtnRed() end self.update_encourage_handler_1 = self.model:BindOne("encourage_free_times", update_guild_boss_encourage_view1) self.update_encourage_handler_2 = self.model:BindOne("encourage_cost_times", update_guild_boss_encourage_view1) local function update_guild_boss_encourage_view2( ) local extra_param_list = {} extra_param_list.show_encourage_percentage = true self:ShowGuildBossEncourage(EncourageTips.ShowType.Update,extra_param_list) end self.update_encourage_handler_3 = self.model:BindOne("encourage_guild_times", update_guild_boss_encourage_view2) -- 取消自动战斗后,就清除采集忽略列表 local function clear_guild_collect_ignore_list() if self.model:IsGuildCollectActive() then return end--封印裂隙改变自动战斗状态时先不要忽略列表 self.model:ClearGuildIgnoreCollection() end self:BindEvent(GlobalEventSystem, EventName.STOPAUTOFIGHT, clear_guild_collect_ignore_list) -- 社团boss活动,掉落通知显示横幅 local function on_guildboss_drop_event(vo) self:ShowGuildBossDropDialogueTip(vo) end self:BindEvent(self.model, GuildModel.GUILD_BOSS_DROP_EVENT, on_guildboss_drop_event) local function update_guild_boss_roll_data() -- 添加roll点的按钮 self:UpdateBossRollBtn(true) end self:BindEvent(self.model, GuildModel.UPDATE_BOSS_ROLL_DATA, update_guild_boss_roll_data) -- local function on_change_guild_collect_left_con_state(bool) -- if self.model:IsGuildCollectActive() then -- self.guild_support_tip_con_obj:SetActive(bool) -- else -- self.guild_support_tip_con_obj:SetActive(false) -- end -- end -- self:BindEvent(self.model, GuildModel.CHANGE_GUILD_COLLECT_LEFT_CON_STATE, on_change_guild_collect_left_con_state) local function hide_dance_eff_node() self:ShowDanceEffNode(false) self:ShowInfoNode(false) end local function show_dance_eff_node() self:ShowDanceEffNode(true) self:ShowInfoNode(true) end self:BindEvent(GlobalEventSystem, EventName.START_COM_DIALOGUE_SHOW_ANIM, hide_dance_eff_node) self:BindEvent(GlobalEventSystem, EventName.FINISHED_COM_DIALOGUE_SHOW_ANIM, show_dance_eff_node) -- local function on_update_guild_info() -- self:CheckGuildAuctionTipsShow() -- end -- self.refresh_guild_info_id = self.model:Bind(GuildModel.UPDATE_GUILD_BOSS_INFO, on_update_guild_info) -- self:CheckGuildAuctionTipsShow() self:BindMainUIExpandEvent( self.func_btn_con ) local function updata_buff_state(id) if id == KfActivityModel.TabID.MaterialSubmit and self.is_loaded then self:UpdateGuildPartyExp() end end self:BindEvent(KfActivityModel:getInstance(), KfActivityModel.ANS_UPDATE_VIEW, updata_buff_state) --刷新封印裂隙协助信息 local function updateGuildSupportDataInfo( ) if not self.is_loaded then return end if not self.model:IsGuildCollectActive() then return end self:UpdateCollectRightSupportTipCon() end self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SUPPOR_INFO, updateGuildSupportDataInfo)--刷新协助信息列表 self:BindEvent(self.model, GuildModel.UPDATE_GUILD_COLLECT_SUPPORT_INFO_LIST, updateGuildSupportDataInfo)--刷新协助信息列表 self:BindEvent(self.model, GuildModel.UPDATE_GUILD_COLLECT_NOW_SUPPORT_ID, updateGuildSupportDataInfo) end -- 打开场景UI后,直接检查一遍所有的社团驻地内活动 function GuildSceneView:UpdateView() self:SwitchInfoTab() self:ShowInfoNode(not MainUIModel:getInstance():GetDialogueActionFlag(), true) local has_event = false -- 是否有活动正在进行 -- 检查活动进行情况 has_event = has_event or self:CheckGuildBossEvent() -- 检查晚间boss活动 has_event = has_event or self:CheckGuildCollectEvent() -- 检查午间采集活动 has_event = has_event or self:CheckGuildPartyEvent() -- 检查社团派对活动 self:CheckGuildTVEvent()--更新竞速按钮 -- 如图没有活动正在进行,则需要打开下一个即将开启的活动展示,如果是全部都进行完了,则需要展示最后一个活动 self:ShowDefaultEvent(has_event) end --获取当前正在进行的活动index,用于打开界面时跳转 function GuildSceneView:ShowDefaultEvent(has_event) self:ClearEventTrailerTimer() if has_event then self.trailer_con_obj:SetActive(false) self.trailer_empty_obj:SetActive(false) return end -- 今天是星期几,映射到周一~周日 = 1~7 local cur_wday = os.date("*t", TimeUtil:getServerTime()).wday - 1 if cur_wday > 7 then cur_wday = cur_wday - 7 elseif cur_wday < 1 then cur_wday = cur_wday + 7 end local event_list = self.model:GetGuildEventByWday(cur_wday) -- 如果当前没有活动在进行中,则需要通过当前的系统时间来决定定位到哪个即将开启的活动上(2020年3月14日策划需求,如果出现时区定位不准的问题找策划) local date = os.date("*t", TimeUtil:getServerTime()) local zero_min = date.hour * 60 + date.min -- 当前时区距0点的分钟数 local evt_start_time, evt_time_start, evt_start_hour, evt_start_min local event_index = 0 -- 没有找到活动开启时处理为今日活动已经进行完 local icon_res = "" for k, v in ipairs(event_list) do icon_res = GuildTrailerEventType[tonumber(v.module_id .. v.module_sub)] or "" if icon_res ~= "" then evt_start_time = Split(v.time_str, "~")[1] evt_time_start = Split(evt_start_time,":") evt_start_hour = evt_time_start[1] evt_start_min = evt_time_start[2] if evt_start_hour * 60 + evt_start_min >= zero_min then event_index = k break end end end -- 根据下一场活动的数据来展示预告信息 local event_cfg = event_list[event_index] local has_cfg = not IsTableEmpty(event_cfg) self.trailer_con_obj:SetActive(has_cfg) self.trailer_empty_obj:SetActive(not has_cfg) if has_cfg then -- 加载活动图标 lua_resM:setImageSprite(self, self.trailer_event_icon_img, "activityIcon_asset", icon_res, false) SetSizeDelta(self.trailer_event_icon,60,60) -- 加载活动时间 self.trailer_start_time_tmp.text = evt_start_time.."开启" -- 推算活动开始的时间戳,加载倒计时 local event_start_time_stamp = TimeUtil:GetFutureZeroStampServer(0) + (evt_start_hour * 60 + evt_start_min) * 60 local function trailer_timer_func() local left_time = event_start_time_stamp - TimeUtil:getServerTime() left_time = left_time < 0 and 0 or left_time self.trailer_countdown_tmp.text = string.format("活动倒计时:<%s>%s", ColorUtil.GREEN_TIPS, TimeUtil:timeConvert3(left_time)) if left_time <= 0 then self:ClearEventTrailerTimer() end end trailer_timer_func() self.trailer_event_timer = GlobalTimerQuest:AddPeriodQuest(trailer_timer_func, 0.5, -1) -- 加载活动奖励 local reward_data = DailyModel:getInstance():GetRewardList(event_cfg.module_id, event_cfg.module_sub, 1) self.trailer_reward_creator = self.trailer_reward_creator or self:AddUIComponent(UI.ItemListCreator) local info = { data_list = reward_data, item_con = self.trailer_reward_con, scroll_view = self.trailer_reward_scroll, obj_pool_type = UIObjPool.UIType.AwardItem, item_width = 59, start_x = 7, start_y = -5, space_x = 20, create_frequency = 0.01, alignment = UnityEngine.TextAnchor.UpperLeft, on_update_item = function(item, i, v) local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2]) local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id) if goodVo then item:SetItemSize(59, 59) item:SetData(goodVo.type_id, v.count , goodVo.color, nil, lock) end end, } self.trailer_reward_creator:UpdateItems(info) else self.trailer_empty_lb_tmp.text = "今日社团活动已结束\n明天尽早参加哦~" end end -- 清除活动预告的活动倒计时 function GuildSceneView:ClearEventTrailerTimer( ) if self.trailer_event_timer then GlobalTimerQuest:CancelQuest(self.trailer_event_timer) self.trailer_event_timer = nil end end -- 切换显示右侧信息界面 function GuildSceneView:SwitchInfoVisible( visible ) if self.right_top_visible == visible then return end self.right_top_visible = visible SetLocalScale(self.hide_arrow, visible and 1 or -1, 1, 1) cc.ActionManager:getInstance():removeAllActionsFromTarget(self.right_info_con) local targetX = visible and self.origin_pos_x or self.origin_pos_x-(self.right_info_con_width+70) if ClientConfig.iphone_x_model then targetX = ClientConfig.iphone_x_offset_left + targetX end local moveAction = cc.MoveTo.createAnchoredType(0.5, targetX, self.origin_pos_y) moveAction = cc.EaseExponentialOut.New(moveAction) local action if visible then self.right_info_con_obj:SetActive(true) action = moveAction else action = cc.Sequence.New(moveAction, cc.CallFunc.New(function() self.right_info_con_obj:SetActive(false) end)) end self:AddAction(action, self.right_info_con) end -- 活动/组队页签切换 function GuildSceneView:SwitchInfoTab(index) self.right_tab_index = index or self.right_tab_index self.data_con_obj:SetActive(self.right_tab_index == 1) self.team_con_obj:SetActive(self.right_tab_index == 2) 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) 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) SetAnchoredPosition(self.img_event, self.right_tab_index == 1 and -1 or 6, self.right_tab_index == 1 and -40 or -47) SetAnchoredPosition(self.img_team, self.right_tab_index == 2 and -3 or 3, self.right_tab_index == 2 and -118 or -124) end function GuildSceneView:ShowInfoNode(show, force) local target_alpha = show and 1 or 0 if force then self.hide_btn_cg.alpha = target_alpha self.right_info_con_cg.alpha = target_alpha else cc.ActionManager:getInstance():removeAllActionsFromTarget(self.right_info_con) local function action_alpha_callback(percent) self.hide_btn_cg.alpha = show and percent or (1 - percent) self.right_info_con_cg.alpha = show and percent or (1 - percent) end local action_alpha = cc.CustomUpdate.New(0.3, action_alpha_callback) --cc.ActionManager:getInstance():addAction(action_alpha, self.hide_btn) cc.ActionManager:getInstance():addAction(action_alpha, self.right_info_con) end end ----------- 午间采集活动 -----------start --检查设置午间采集活动的UI展示 function GuildSceneView:CheckGuildCollectEvent( ) self.model:ClearGuildIgnoreCollection() local nc_data = self.model:GetGuildEventByType(GuildEventType.NoonCollect) if nc_data and nc_data.is_active then -- 采集活动进行中 self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40806) self.collect_info_con_obj:SetActive(true)--展示采集活动右上角数据信息栏 self.guild_support_tip_con_obj:SetActive(true) self.guildCollectRewardBtn_obj:SetActive(true)--奖励预览按钮 self:UpdateCollectInfoCon() self:UpdateCollectRewardItem(408,0,1) self.guild_collect_left_con_obj:SetActive(true)--左上角采集信息栏 self:SetGuildSceneFuncBtn(true, {fun_id = 408, name = "封印裂隙", sort_id = 3}) self:SetGuildSceneFuncBtn(true, {fun_id = 40899, name = "召唤社员", sort_id = 5}) self:UpdateCollectRightSupportTipCon()--右侧协助栏 --先判断进来场景是否协助的,如果是协助就需要请求40808然后去打怪 self.model.guild_collect_confim_into_guild_scene = true --如果只是从驻地外用40808过来寻怪的,就直接寻怪 if self.model.only_find_way_to_guild_collect_mon then if self.model.temp_guild_collect_mon_data then self.model:Fire(GuildModel.FIND_WAY_TO_GUILD_COLLECT_HELP_MON,self.model.temp_guild_collect_mon_data) end self.model.only_find_way_to_guild_collect_mon = false self.model.temp_guild_collect_mon_data = nil return true end local collect_support_data = nil local guild_collect_support_id = self.model:GetSelfGuildCollectSupportId() local info = self.model:GetGuildSupportInfo() for k,v in pairs(info) do if v.support_sid == guild_collect_support_id then collect_support_data = v break end end if collect_support_data and guild_collect_support_id ~= 0 then if collect_support_data.role_id ~= RoleManager.Instance.mainRoleInfo.role_id then --主动寻路去击杀协助对应的宝箱怪 self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40808,collect_support_data.support_sid) self.model.need_go_support_guild_collect_after_40046 = false return true end end ---------------------------------------------------------- -- -- 进入场景后根据采集次数判断是否需要进入自动采集状态,如果是不能采集,就转为自动挂机状态打场景中的宝箱怪 -- GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT) -- if not self.model:GuildCollectAutoFightIgnoreCollectMon() then--如果依然还有采集次数,需要主动开启自动采集状态 -- self.model:SetAutoGuildCollectState(true)--切换采集状态 -- self.model:Fire(GuildModel.UPDATE_AUTO_GUILD_COLLECT_STATE)--通知按钮变化 -- else -- EventSystem.Fire(GlobalEventSystem,EventName.STARTAUTOFIGHT, false, true) -- end EventSystem.Fire(GlobalEventSystem,EventName.STARTAUTOFIGHT, false, true) return true else self.collect_info_con_obj:SetActive(false)--隐藏采集活动右上角数据信息栏 self.guild_support_tip_con_obj:SetActive(false) self.guildCollectRewardBtn_obj:SetActive(false)--奖励预览按钮 self.guild_collect_left_con_obj:SetActive(false)--左上角采集信息栏 self:SetGuildSceneFuncBtn(false, {fun_id = 408, name = "封印裂隙", sort_id = 3}) self:SetGuildSceneFuncBtn(false, {fun_id = 40899, name = "召唤社员", sort_id = 5}) return false end return false end --刷新午间采集活动的信息栏 function GuildSceneView:UpdateCollectInfoCon() --封印总次数 local MaxCollectDayTimes = self.model:GetGuildCollectKvByKey("join_time_day").value local NowCollectDayTimes = self.model:GetDayTotalCollectTimes() -- local day_collect_color = NowCollectDayTimes < MaxCollectDayTimes and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK local left_day_collect_times = MaxCollectDayTimes-NowCollectDayTimes >= 0 and MaxCollectDayTimes-NowCollectDayTimes or 0 local day_collect_color = left_day_collect_times > 0 and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK -- self.activityTimes_tmp.text = string.format("今日可封印次数:%s/%s",day_collect_color,left_day_collect_times,MaxCollectDayTimes) self.activityTimes_tmp.text = string.format("今日可封印次数:%s",day_collect_color,left_day_collect_times) --本次活动封印次数 local MaxCollectSealTimes = self.model:GetGuildCollectKvByKey("collet_time").value -- 单次午间采集活动封印的最大次数 local NowCollectSealTimes = self.model:GetNowCollectSealTimes() -- local seal_color = NowCollectSealTimes < MaxCollectSealTimes and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK local left_seal_times = MaxCollectSealTimes-NowCollectSealTimes >= 0 and MaxCollectSealTimes-NowCollectSealTimes or 0 local true_left_seal_times = left_seal_times <= left_day_collect_times and left_seal_times or left_day_collect_times local seal_color = true_left_seal_times > 0 and ColorUtil.GREEN_TIPS or ColorUtil.RED_DARK -- self.sealTimes_tmp.text = string.format("本场可封印次数:%s/%s",seal_color,left_seal_times,MaxCollectSealTimes) self.sealTimes_tmp.text = string.format("本场可封印次数:%s",seal_color,true_left_seal_times) --如果采集数达到限制了,关闭自动采集状态 if self.model:GuildCollectAutoFightIgnoreCollectMon() then self.model:SetAutoGuildCollectState(false)--切换采集状态 self.model:Fire(GuildModel.UPDATE_AUTO_GUILD_COLLECT_STATE)--通知按钮变化 end end --活动item展示 function GuildSceneView:UpdateCollectRewardItem(ac_num1,ac_num2,ac_num3) local reward_data = DailyModel.Instance:GetRewardList(ac_num1,ac_num2,ac_num3) self.reward_item_creator = self.reward_item_creator or self:AddUIComponent(UI.ItemListCreator) local info = { data_list = reward_data, item_con = self.reward_con_collect, scroll_view = self.reward_scroll_collect, obj_pool_type = UIObjPool.UIType.AwardItem, item_width = 59, start_x = 7, start_y = -5, space_x = 20, create_frequency = 0.01, alignment = UnityEngine.TextAnchor.UpperLeft, on_update_item = function(item, i, v) local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2]) local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id) if goodVo then item:SetData(goodVo.type_id, v.count , goodVo.color, nil, lock) end end, } self.reward_item_creator:UpdateItems(info) end --午间采集活动倒计时处理 function GuildSceneView:UpdateCollectLeftTime(time) local wave_interval_time = self.model:GetGuildCollectKvByKey("total_wave").value -1 local refresh_mon_time = self.model:GetGuildCollectKvByKey("refresh_mon_time").value local restTime = self.collect_stay_time - wave_interval_time*refresh_mon_time-10 --几波过完后剩余的休息时间 local pre_str = "" if time >= restTime then if time >= self.collect_stay_time - 10 then--开场10秒立即刷怪 time = 10 - (self.collect_stay_time - time) else time = time - restTime for i=1,wave_interval_time do if time > refresh_mon_time then time = time - refresh_mon_time end end end pre_str = "下一波:" self.next_collect_wave_label_tmp.text = string.format("下一波:%s",TimeUtil:timeConversion(time, "MM-ss")) if time > 0 and time <= 10 then--此处展示倒计时 if not self.guild_collect_tips_on then if self.model:IsGuildCollectActive() and self.scene_mgr:IsGuildScene() then local special_tip_data = { type = SpecialTipType.Timer2, sepeical_str = "下一波裂隙来袭 %s", show_time = time, } CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data) self.guild_collect_tips_on = true else CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW) end end else self.guild_collect_tips_on = false end else pre_str = "结束时间:" self.next_collect_wave_label_tmp.text = "已无下一波" end self.leftTime_tmp.text = string.format("%s%s",pre_str,TimeUtil:timeConversion(time, "MM-ss")) end --刷新场景内剩余采集怪数量显示 function GuildSceneView:UpdateGuildCollectLeftCollectMonNum( ) local mon_num = self.model:GetGuildCollectLeftMon() self.left_collect_mon_label_tmp.text = string.format("剩余裂隙:%s",mon_num) end function GuildSceneView:UpdateCollectRightSupportTipCon( ) local support_list = self.model:GetGuildSupportInfo() or {} support_list = DeepCopy(support_list) local show_support_list = {} local self_support_sid = self.model:GetSelfGuildCollectSupportId() for k,v in pairs(support_list) do --找到所有封印裂隙协助(包括自己请求的,协助是一个宝箱怪对应一条协助,而不是一个人对应一条,需按召唤时间先后排序) if v.support_cfg_id == 2 then v.is_in_my_support = self_support_sid == v.support_sid v.is_my_support = v.role_id == RoleManager.Instance.mainRoleInfo.role_id table.insert(show_support_list,v) end end --越早召唤的排序越前 local sort_func = function ( a, b ) return a.show_time < b.show_time end table.sort(show_support_list, sort_func) local finnal_show_list = {} finnal_show_list[1] = show_support_list[1] finnal_show_list[2] = show_support_list[2] finnal_show_list[3] = show_support_list[3] for k,v in pairs(self.guild_collect_support_tip_item_list) do v:SetVisible(false) end for i,v in ipairs(finnal_show_list) do local item = self.guild_collect_support_tip_item_list[i] if not item then item = GuildCollectSupportTip.New(self.guild_support_tip_con) self.guild_collect_support_tip_item_list[i] = item end item:SetVisible(true) item:SetData(v) item:SetAnchoredPosition(-1, -1-(i-1)*73) end --超过三个以上封印裂隙要显示查看更多协助按钮 self.check_more_support_label_obj:SetActive(#show_support_list>3) end ----------- 午间采集活动 -----------end ----------- 社团boss相关逻辑 -----------start function GuildSceneView:CheckGuildBossEvent( ) local noonboss_data = self.model:GetGuildEventByType(GuildEventType.GuildBossNoon) local nightboss_data = self.model:GetGuildEventByType(GuildEventType.GuildBossNight) local noon_open = noonboss_data and noonboss_data.is_evt_open local night_open = nightboss_data and nightboss_data.is_evt_open if noon_open or night_open then -- 活动正在进行 self.cur_guildboss_type = noon_open and GuildEventType.GuildBossNoon or GuildEventType.GuildBossNight -- 确定本次社团boss的boss类型 self.cur_guildboss_act_type = noon_open and 1 or 2 -- 社团boss的活动子类型 self.boss_rank_obj:SetActive(true) self.inspireBtn_obj:SetActive(true)--鼓舞按钮和boss排行同时出现与消失 self.guild_boss_pv_btn_obj:SetActive(true) self:UpdateInspireBtnRed() self:ChangeGuildBossTab(self.guildboss_tabIndex) self:UpdateGuildBossHp(self.model:GetGuildBossHp()) self:UpdateGuildBossName() self:UpdateGuildBossInvincible(self.model:GetGuildBossInvincible()) self:UpdateInspirePrecentage() self:CheckGuildBossEncourgeTipsShow(self.cur_guildboss_type) if not self.guild_boss_alert_cache[self.cur_guildboss_act_type] then -- 播放一次预警 CommonController.Instance:Fire(EventName.OPEN_BOSS_ALERT_VIEW, true, 40601) self.guild_boss_alert_cache[self.cur_guildboss_act_type] = true end if not self.req_roll_data then self.req_roll_data = true self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40613) end -- 玩法开启时立即进入自动战斗 GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT) -- 添加击杀boss的按钮 self:SetGuildSceneFuncBtn(true, {fun_id = 406, name = "", sort_id = 4}) self:UpdateBossRollBtn(true) self:SetGuildSceneFuncBtn(true, {fun_id = 40699, name = "召唤社员", sort_id = 6}) -- 切换音乐 --BOSS开启播放指定战斗音乐 if not self.auto_change_boss_music then LuaSoundManager.Instance:StopBacksound() LuaSoundManager.Instance:PlayBackgroundSound("dungeon4", LuaSoundManager.SOUND_TYPE.SCENE, true) self.auto_change_boss_music = true end return true else -- 活动未开启或已结束 self:ClearGuildBossHpTimer() self.boss_rank_obj:SetActive(false) self.inspireBtn_obj:SetActive(false)--鼓舞按钮和boss排行同时出现与消失 self.guild_boss_pv_btn_obj:SetActive(false) if self.tip_show_type == self.cur_guildboss_type then -- 当前进行的是社团boss鼓舞的按钮tips,则销毁动画 self:StopRightTopBtnTipsAction() self.tip_timer_bg_obj:SetActive(false) self.tip_show_type = nil end self:SetGuildSceneFuncBtn(false, {fun_id = 406, name = "", sort_id = 4}) self:UpdateBossRollBtn(false) self:SetGuildSceneFuncBtn(false, {fun_id = 40699, name = "召唤社员", sort_id = 6}) --BOSS结束播放会当前场景的背景音乐 if self.auto_change_boss_music then LuaSoundManager.Instance:StopBacksound() LuaSoundManager.Instance:PlayBackground(SceneManager:getInstance():GetSceneId()) self.auto_change_boss_music = false end return false end return false end -- 更新社团bossroll点表现 function GuildSceneView:UpdateBossRollBtn(show_btn) local roll_data = self.model:GetGuildBossRollData() if TableSize(roll_data) > 0 or not show_btn then -- 销毁按钮的情况一定要能进去 self:SetGuildSceneFuncBtn(show_btn, {fun_id = 4062, name = "装备掷点", sort_id = 5}) end end -- 更新免费鼓舞按钮红点 function GuildSceneView:UpdateInspireBtnRed( ) local limit_free = self.model:GetGuildBossKV("free_encourage") local free_time = self.model:GetLeftFreeEncourageTimes() local has_red = limit_free - free_time > 0 self.inspire_btn_red_obj:SetActive(has_red) self.inspire_btn_red_lb_tmp.text = limit_free - free_time if not has_red then -- 没有红点的情况,需要手动删除一次特效 self:ClearUIEffect(self.inspireBtn_effect) end -- 没有红点且已经提示过一次tips或者点开过鼓舞界面则消除tips if (not has_red and self.tip_show_type == self.cur_guildboss_type) or self.is_gboss_encourage_clicked then -- 没红点之后就干掉这个动画 self:StopRightTopBtnTipsAction() self.tip_timer_bg_obj:SetActive(false) self.tip_show_type = nil else if self.inspireBtn_obj.activeSelf then -- 鼓舞按钮出现了再打开动画,不然啥都不干 self:CheckGuildBossEncourgeTipsShow(self.cur_guildboss_type) end end end function GuildSceneView:ChangeGuildBossTab(index) self.guildboss_tabIndex = index self.guildboss_ranktype = index == 1 and GuildBossRankType.Guild or GuildBossRankType.Personal -- 请求两个榜单,请求后后端会根据类型推送40604 if self.guildboss_ranktype == GuildBossRankType.Guild then self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40603, self.cur_guildboss_act_type) elseif self.guildboss_ranktype == GuildBossRankType.Personal then self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40602, self.cur_guildboss_act_type) end local color_selected, color_unselected = ColorUtil:ConvertHexToRGBColor("ffffff"), ColorUtil:ConvertHexToRGBColor("9eb3cf") self.boss_tab1_tmp.color = index == 1 and color_selected or color_unselected self.boss_tab2_tmp.color = index == 2 and color_selected or color_unselected SetTMPSharedMaterial(self.boss_tab1_tmp, index == 1 and ShaderTools.TMPSharedMaterialType.HKYTW7OutlineBrightBlueTitle or ShaderTools.TMPSharedMaterialType.HKYTW7FFDefault) SetTMPSharedMaterial(self.boss_tab2_tmp, index == 2 and ShaderTools.TMPSharedMaterialType.HKYTW7OutlineBrightBlueTitle or ShaderTools.TMPSharedMaterialType.HKYTW7FFDefault) self.boss_tab_selected.anchoredPosition = self["boss_tab"..index].anchoredPosition self:UpdateGuildBossRank() self:UpdateBossPersonalRank() end -- 更新排行数据 function GuildSceneView:UpdateGuildBossRank( ) local data = self.model:GetGuildBossRank(self.cur_guildboss_type, self.guildboss_ranktype) self.rank_item_creator = self.rank_item_creator or self:AddUIComponent(UI.ItemListCreator) local info = { data_list = data, scroll_view = self.boss_rank_scroll, item_con = self.boss_rank_con, item_class = GuildSceneBossRankItem, item_height = 32, create_frequency = 0.01, alignment = UnityEngine.TextAnchor.UpperLeft, on_update_item = function(item, i, v) item:SetData(v, true) end, } self.rank_item_creator:UpdateItems(info) end -- 更新个体排行数据 function GuildSceneView:UpdateBossPersonalRank( ) -- 更新额外的排行信息 local sub_data = self.model:GetGuildBossPersonalRank(self.cur_guildboss_type, self.guildboss_ranktype) if not self.guildboss_sub_rank_item then self.guildboss_sub_rank_item = GuildSceneBossRankItem.New(self.boss_my_rank_bg) end local mainVo = RoleManager.Instance.mainRoleInfo local data = { rank = sub_data and sub_data.rank or false, name = self.guildboss_ranktype == GuildBossRankType.Personal and mainVo.name or mainVo.guild_name, hurt = sub_data and sub_data.hp or 0, } self.guildboss_sub_rank_item:SetData(data, false, true) self.guildboss_sub_rank_item:SetAnchoredPosition(3, 0) end ----------- 社团boss血条 -----------start -- 更新boss名称(只需要跑一次,就单独写出来) function GuildSceneView:UpdateGuildBossName( ) local mon_basic = ConfigItemMgr.Instance:GetMonsterDataItem(GuildModel.GuildBossId) self.right_boss_name_tmp.text = Trim(mon_basic.name) end -- 更新社团boss血条 function GuildSceneView:UpdateGuildBossHp(hp_vo) local boos_lives = ConfigItemMgr.Instance:GetMonsterDataItem(GuildModel.GuildBossId).hp_num -- 如果怪物血量还没有压下来且前端已经存在经验表现则不进行后面的逻辑 if hp_vo and hp_vo.hp > 1000 and self.guild_boss_hp_timer_id then return end -- 获取活动开始和结束的时间戳 local evt_data = self.model:GetGuildEventByType(self.cur_guildboss_type) if not evt_data then return end local start_time = evt_data.stime local evt_time = Config.Guilddemonkv["continue_time"] and Config.Guilddemonkv["continue_time"].value or 600 local end_time = (start_time + evt_time) * 1000 local function guild_boss_hp_timer() local percentage = 0 if not hp_vo or hp_vo.hp > 1000 then -- 血量还没压下来,前端做表现 local left_time = (end_time - TimeUtil:getServerTimeMs()) * 0.001 percentage = Mathf.Clamp(left_time / evt_time, 0.01, 1) else percentage = hp_vo.hp / hp_vo.hp_limit end -- 右侧的boss血条,以百分比形式展示 self.right_boss_hp_fill_img.fillAmount = percentage self.right_boss_percentage_tmp.text = math.ceil(percentage * 100) .. "%" -- 刷新boss假血量 self.model:SetGuildBossHpSimulation(percentage/(1/boos_lives)) ------------------------------------------- end self:ClearGuildBossHpTimer() self.guild_boss_hp_timer_id = GlobalTimerQuest:AddPeriodQuest(guild_boss_hp_timer, 0.2, -1) guild_boss_hp_timer() end function GuildSceneView:ClearGuildBossHpTimer( ) if self.guild_boss_hp_timer_id then GlobalTimerQuest:CancelQuest(self.guild_boss_hp_timer_id) self.guild_boss_hp_timer_id = nil end end ----------- 社团boss血条 -----------end -- 更新晚间boss的狂暴特效 function GuildSceneView:UpdateGuildBossInvincible(vo) if not vo then self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40606) -- 获取boss的狂暴状态 return end local monsterVo = Scene:getInstance():GetMonsterByTypeId(GuildModel.GuildBossId) if monsterVo then if vo.mon_state == 1 then monsterVo:GuildBossInvincibleEffect(true, vo.etime - TimeUtil:getServerTime()) local special_tip_data = { sepeical_str = "boss施放无敌技能,击破法术球可解除", show_time = 2, -- need_flash = true, } -- 打开预警文本 CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW_TWO, special_tip_data) else monsterVo:GuildBossInvincibleEffect(false) -- 手动关闭预警文本 CommonController.Instance:Fire(EventName.CLOSE_SPECIALTIPVIEW_TWO) end end end -- 社团boss寻路 function GuildSceneView:FindGuildBossWay( ) local call_back = function () GlobalEventSystem:Fire(EventName.STARTAUTOFIGHT) end -- 社团场景有两个,所以直接改为获取当前场景即可 local scene_id = self.scene_mgr:GetSceneId() local pos_x,pos_y = self.model:GetGuildBossPos() local findVo = FindVo.New() findVo.type = FindVo.POINT findVo.sceneId = scene_id findVo.x = pos_x / SceneObj.LogicRealRatio.x findVo.y = pos_y / SceneObj.LogicRealRatio.y findVo.call_back = call_back GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT) Scene:getInstance():FindElement(findVo) end -- 社团boss鼓舞 function GuildSceneView:ShowGuildBossEncourage(show_type,extra_param_list) local free_encourage_call = function()--免费鼓舞 self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40608,0) end local gold_encourage_call = function()--红钻鼓舞 self.model:Fire(GuildModel.REQUEST_CCMD_EVENT,40608,1) end local data = { [1] ={ type_id = false,-- 鼓舞类型(免费) use_time = 0,-- 已鼓舞次数 click_call = false,--点击回调 }, [2] ={ type_id = false,-- 鼓舞类型(付费) use_time = 0,-- 已鼓舞次数 click_call = false,--点击回调 } } local limit_free = self.model:GetGuildBossKV("free_encourage") local limit_gold = stringtotable(self.model:GetGuildBossKV("bgold_encourage_cost"))[2] for i=1,2 do data[i].type_id = i data[i].limit = i == 1 and limit_free or limit_gold-- 鼓舞最大次数 data[i].click_call = i == 1 and free_encourage_call or gold_encourage_call data[i].use_time = i == 1 and self.model:GetLeftFreeEncourageTimes() or self.model:GetleftCostEncourageTimes() end local encourageType = EncourageTips.EncourageType.GuildBoss GlobalEventSystem:Fire(EventName.SHOW_ENCOURAGE_TIPS,show_type,data,encourageType,extra_param_list) -- 更新鼓舞加成百分比 self:UpdateInspirePrecentage() -- 已经点击了鼓舞按钮,需要更新按钮tips if not self.is_gboss_encourage_clicked then self.is_gboss_encourage_clicked = true self:UpdateInspireBtnRed() end end -- 更新鼓舞加成百分比 function GuildSceneView:UpdateInspirePrecentage( ) local insipre_times = self.model:GetEncourageGuildTimes() local damage_percentage = self.model:GetGuildBossKV("encourage_hurt") / 100 --万分比伤害,这里除去100拿百分比伤害 self.inspire_lb_tmp.text = string.format("当前%s%%", HtmlColorTxt("+" .. insipre_times * damage_percentage, "#fdffc2")) end -- boss掉落小窗提示 function GuildSceneView:ShowGuildBossDropDialogueTip(vo) local boss_tips = { [1] = "不痛不痒,这点奖励就赏赐给你们吧!", [2] = "不痛不痒,这点奖励就赏赐给你们吧!", [3] = "你们很强,这点奖励就赏赐给你们吧!", [4] = "你们很强,这点奖励就赏赐给你们吧!", [5] = "你们让我感受到了一点点吃力!这是给你们的赏赐!", [6] = "你们让我感受到了一点点吃力!这是给你们的赏赐!", [7] = "你们让我感受到了一点点吃力!这是给你们的赏赐!", [8] = "可恶!我快坚持不住了,给你们我的宝物!", [9] = "可恶!我快坚持不住了,给你们我的宝物!", [10] = "可恶!我的宝物都给你们,放过我吧!", } local mon_cfg = ConfigItemMgr.Instance:GetMonsterDataItem(vo.boss) local dialogue_data = { head_type = 1000, desc = boss_tips[vo.click], head_name = Trim(mon_cfg.name), hide_time = 3, dalay_time = 0.1, is_task_type = false, } GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW, dialogue_data) end -- 检查社团boss鼓舞按钮tips function GuildSceneView:CheckGuildBossEncourgeTipsShow(type) if self.tip_show_type == type then return end -- 已经存在了就什么也不做 local limit_free = self.model:GetGuildBossKV("free_encourage") local free_time = self.model:GetLeftFreeEncourageTimes() if limit_free - free_time > 0 then -- 存在次数,就展示tips -- local tips_data = { -- str = "鼓舞可增加社团全体成员伤害", -- time = -1, -- pos = Vector2(-90, -85) + self.inspireBtn.anchoredPosition, -- } -- self:StartRightTopBtnTipsAction(tips_data) self.tip_show_type = type self:ClearUIEffect(self.inspireBtn_effect) self:AddUIEffect("ui_bianqiang", self.inspireBtn_effect, "Scene", nil, {x=1,y=1}, true, nil,nil,nil,nil,nil,UIPartical.RenderingOther_List.UIBackward) end end ----------- 社团boss相关逻辑 -----------end ----------- 社团派对相关逻辑 -----------start function GuildSceneView:CheckGuildPartyEvent( ) local party_data = self.model:GetGuildEventByType(GuildEventType.GuildParty) if party_data and party_data.is_evt_open then self.party_con_obj:SetActive(true) self.dance_eff_con_obj:SetActive(true) self:UpdatePartyExpEffData() self:UpdateGuildPartyTimer() self:GuildPartyGoDance() self:UpdateGuildPartyExp() self:BindPartyManulEvent() self:CreatePartyRoleEffect() self.model:CreateGuildPartyMonster() self:ShowDanceEffNode(not MainUIModel:getInstance():GetDialogueActionFlag()) self:SetGuildSceneFuncBtn(true, {fun_id = 4007, name = "", sort_id = 1}) self:SetGuildSceneFuncBtn(true, {fun_id = 400799, name = "召唤社员", sort_id = 5}) if not self.auto_change_party_music then self:OnClickChangeBGM(1) self.auto_change_party_music = true end return true else self:ClearGuildPartyTimer() self:CancelBindPartyManulEvent() self:ClearUserManulEvent() self:RemovePartyRoleEffect() self.party_con_obj:SetActive(false) self.dance_eff_con_obj:SetActive(false) self.model:DeleteGuildPartyMonster() -- 活动结束直接发取消跳舞的协议 -- self.model:Fire(GuildModel.CHANGE_GUILDDANCE_ACTION, 0) DanceModel:getInstance():Fire(DanceModel.CHANGE_DANCE_STATUS, false) self:SetGuildSceneFuncBtn(false, {fun_id = 4007, name = "", sort_id = 1}) self:SetGuildSceneFuncBtn(false, {fun_id = 400799, name = "召唤社员", sort_id = 5}) -- self:OnClickChangeBGM(2) if self.need_reset_scene_bgm or self.auto_change_party_music then -- 重置为场景的bgm LuaSoundManager.Instance:PlayBackground(self.scene_mgr:GetSceneId()) self.need_reset_scene_bgm = false self.auto_change_party_music = false end return false end return false end -- 初始化社团派对经验值效率数据 function GuildSceneView:UpdatePartyExpEffData( ) local eff_list = self.model:GetGuildPartyEffRadioCfg() for i, v in ipairs(eff_list) do self.dance_eff_num_list[i].txt.text = string.format("%s-%s", v.num_min, v.num_max) self.dance_eff_val_list[i].txt.text = v.radio / 100 .. "%" end end -- 设置社团派对倒计时(只加载一次) function GuildSceneView:UpdateGuildPartyTimer( ) self:ClearGuildPartyTimer() local party_data = self.model:GetGuildEventByType(GuildEventType.GuildParty) if party_data and party_data.stime and party_data.etime then local left_time, event_stage, special_tip_data -- 剩余时间,活动阶段和顶部文本结构体 local function guildPartyTimerFunc() left_time = party_data.etime - TimeUtil:getServerTime() if left_time > 0 then self.party_timer_tmp.text = string.format("%s", ColorUtil.GREEN_DARK,TimeUtil:convertTimeWithoutHour(left_time)) if TimeUtil:getServerTime() - party_data.stime > 60 and TimeUtil:getServerTime() - party_data.stime <= 120 and not self.show_guildTv_tips then -- 活动开始3分钟后5分钟前,展示预告活动 self.show_guildTv_tips = true special_tip_data = { type = SpecialTipType.Timer1, sepeical_str = "赛马竞猜将在%s秒后开始", need_flash = false, show_time = 60, } CommonController.Instance:Fire(EventName.OPEN_SPECIALTIPVIEW, special_tip_data) end else self.party_timer_tmp.text = "已结束" end end guildPartyTimerFunc() self.guild_party_timer_id = GlobalTimerQuest:AddPeriodQuest(guildPartyTimerFunc, 1, -1) end end function GuildSceneView:ClearGuildPartyTimer( ) if self.guild_party_timer_id then GlobalTimerQuest:CancelQuest(self.guild_party_timer_id) self.guild_party_timer_id = nil end end -- 仅在社团热舞活动中开启对玩家操作的监听,如果在热舞状态下进行某些操作则要发送协议中断热舞 function GuildSceneView:CancelDanceWhileUserManul(skill_force) -- local exp, pos = self.model:GetGuildPartyExpData() local dance_status = self.main_vo.dance_status if dance_status ~= 0 and (not self.is_moving_to_dance or skill_force) and not self.model._waiting_12025_respon then -- 热舞状态则发送协议中断,多变量限制防止频繁请求 -- self.model:Fire(GuildModel.CHANGE_GUILDDANCE_ACTION, 0) DanceModel:getInstance():Fire(DanceModel.CHANGE_DANCE_STATUS, false) end end function GuildSceneView:BindPartyManulEvent( ) if not self.party_move_event_id then -- 对移动的监听 local function cancelDanceWhileMoving() self:CancelDanceWhileUserManul() end self.party_move_event_id = GlobalEventSystem:Bind(ObjectEventType.MAINROLE_MOVE_EVENT_IMME, cancelDanceWhileMoving) end if not self.party_skill_event_id then -- 对技能的监听 local function cancelDanceWhileUseSkill() self.last_use_skill_time = Status.NowTime self:CancelDanceWhileUserManul(true) end self.party_skill_event_id = GlobalEventSystem:Bind(FightEvent.SKILL_SHORTCUT_CLICK, cancelDanceWhileUseSkill) end if not self.dance_status_change_id then -- 跳舞状态变化的监听 local function updateGuildDanceStatus() self:GuildPartyGoDance() end self.dance_status_change_id = self.main_vo:BindOne("dance_status", updateGuildDanceStatus) end end function GuildSceneView:CancelBindPartyManulEvent( ) if self.party_move_event_id then GlobalEventSystem:UnBind(self.party_move_event_id) self.party_move_event_id = nil end if self.party_skill_event_id then GlobalEventSystem:UnBind(self.party_skill_event_id) self.party_skill_event_id = nil end if self.dance_status_change_id then self.main_vo:UnBind(self.dance_status_change_id) self.dance_status_change_id = nil end end -- 更新社团派对经验值信息 function GuildSceneView:UpdateGuildPartyExp( ) local exp = self.model:GetGuildPartyExpData() local buff_kind = OperateActivityModel.MaterialSubmitBuffKind.PEACH_EXP--是否存在公会晚宴经验buff local buff_cfg,buff_info = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(buff_kind) -- buff_info = {etime = TimeUtil:getServerTime( )+300} -- buff_cfg = {data = 100} if buff_cfg and buff_info then--存在 local sec = buff_info.etime - TimeUtil:getServerTime( ) if sec > 0 then lua_resM:setOutsideImageSprite(self, self.buffBtn_img, GameResPath.GetOperateActImage("ms_buff_btn_kind_1"), true) self.buffBtn_obj:SetActive(true) self.party_exp_tmp.text = string.format("累计经验:%s\n限时活动已加成+%s%%", ColorUtil.GREEN_DARK, WordManager:ConvertNum(exp, true),ColorUtil.ORANGE_DARK,buff_cfg.data) self:ActBuffTimeLate(sec) else self.buffBtn_obj:SetActive(false) self.party_exp_tmp.text = string.format("累计经验:%s", ColorUtil.GREEN_DARK, WordManager:ConvertNum(exp, true)) end else self.buffBtn_obj:SetActive(false) self.party_exp_tmp.text = string.format("累计经验:%s", ColorUtil.GREEN_DARK, WordManager:ConvertNum(exp, true)) end -- 场景人数和效率万分比 local num, eff = self.model:GetGuildSceneMemberNum() self.dance_mem_num_tmp.text = string.format("参与活动成员:%s人", ColorUtil.YELLOW_DARK, num) self.dance_eff_lb_tmp.text = string.format("经验加成+%s%%", eff / 100) -- 获取挂机效率 local eff_per_min = self.model:GetGuildPartyExpEffPerMin() local extra_str = eff > 0 and string.format("(+%s%%)", eff / 100) or "" self.dance_exp_eff_tmp.text = string.format("%s/分%s", eff_per_min, extra_str) --self.party_buff_txt.text = string.format("热舞经验加成:%s", pos == 0 and "0%" or "10%")--热舞经验收益获得功能取消20/05/26 end --公会晚宴经验BUFF时间倒计时 function GuildSceneView:ActBuffTimeLate( sec ) if self.is_loaded then if self.act_buff_timer_id then GlobalTimerQuest:CancelQuest(self.act_buff_timer_id) self.act_buff_timer_id = nil end if self.sec == sec then return else self.sec = sec end local sec = sec or 0 if sec > 0 then local function onTimer() sec = sec - 1 if sec > 0 then else GlobalTimerQuest:CancelQuest(self.act_buff_timer_id) self.act_buff_timer_id = nil self:UpdateGuildPartyExp() end end if not self.act_buff_timer_id then self.act_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1) end onTimer() else self:UpdateGuildPartyExp() end end end -- 社团场景内跳舞寻路逻辑(包括玩家静止15秒后进入热舞状态,进入热舞状态的寻路以及寻路状态中打断热舞相关的逻辑) function GuildSceneView:GuildPartyGoDance() -- 获取热舞状态 0:无 1:热舞中 local dance_status = self.main_vo.dance_status -- 发送跳舞协议 local function sendDanceReq() Message.show("开始热舞") -- self.model:Fire(GuildModel.CHANGE_GUILDDANCE_ACTION, 1) DanceModel:getInstance():Fire(DanceModel.CHANGE_DANCE_STATUS, true) self:ClearUserManulEvent() self.is_moving_to_dance = false end if self.dance_last_status ~= dance_status then -- 协议返回的位置不同再进行寻路逻辑 if dance_status == 0 then -- 非热舞状态 if self.is_moving_to_dance then OperateManager.Instance:StopMove() end if self.dance_last_status ~= -1 then Message.show("取消热舞") end self.is_moving_to_dance = false -- 玩家手动取消热舞的时间也用这个来保存 self.last_use_skill_time = Status.NowTime local function userManulEvent() -- 距上次移动操作和技能操作都超过5秒才可自动进入热舞 if Status.NowTime - Scene.Instance.user_manul_time >= 5 and Status.NowTime - self.last_use_skill_time >= 5 then -- 计时器跑完时再获取一次跳舞状态 dance_status = self.main_vo.dance_status if dance_status == 0 and not self.model._waiting_12025_respon then sendDanceReq() self.is_moving_to_dance = false self:ClearUserManulEvent() end end end self:ClearUserManulEvent() self.user_manul_event_id = GlobalTimerQuest:AddPeriodQuest(userManulEvent, 0.1, -1) else self.is_moving_to_dance = false end self.dance_last_status = dance_status end end -- 清除掉玩家操作事件的绑定 function GuildSceneView:ClearUserManulEvent( ) if self.user_manul_event_id then GlobalTimerQuest:CancelQuest(self.user_manul_event_id) self.user_manul_event_id = nil end end -- 热舞玩法中,玩家挂载特效,活动结束后消失 function GuildSceneView:CreatePartyRoleEffect( ) if not self.party_role_effect_id then -- 播放剧情气泡 local dialogue_data = { head_type = 1004, desc = "尽情热舞享受晚宴吧,热舞可持续获得巨额经验哦!", head_name = "社团助手", hide_time = 3, dalay_time = 0, is_task_type = false, } GlobalEventSystem:Fire(EventName.SHOW_COM_DIALOGUE_SHOW_VIEW, dialogue_data) local main_role = Scene:getInstance():GetMainRole() if main_role then self.party_role_effect_id = ParticleManager.Instance:AddTargetEffect("buffparticle_400_1", main_role.compress_id, false, nil, nil, 7, nil) end end end -- 清除掉社团场景内跳舞的特效 function GuildSceneView:RemovePartyRoleEffect( ) if self.party_role_effect_id then ParticleManager:getInstance():DelEffect(self.party_role_effect_id) self.party_role_effect_id = nil end end -- 显示隐藏热舞效率节点 function GuildSceneView:ShowDanceEffNode(show, force) local target_alpha = show and 1 or 0 if force then self.dance_eff_con_cg.alpha = target_alpha else cc.ActionManager:getInstance():removeAllActionsFromTarget(self.dance_eff_con) local function action_alpha_callback(percent) self.dance_eff_con_cg.alpha = show and percent or (1 - percent) end local action_alpha = cc.CustomUpdate.New(0.3, action_alpha_callback) cc.ActionManager:getInstance():addAction(action_alpha, self.dance_eff_con) end end ----------- 社团派对相关逻辑 -----------end ----------- 赛马竞猜 -----------start function GuildSceneView:CheckGuildTVEvent( ) local guildTV_base_info = GuildTVModel.Instance:GetGuildTVBaseInfo() if guildTV_base_info.state == 1 or guildTV_base_info.state == 2 then self:SetGuildSceneFuncBtn(true, {fun_id = 1420, name = "赛马", sort_id = 2}) else self:SetGuildSceneFuncBtn(false, {fun_id = 1420, name = "赛马", sort_id = 2}) end end ----------- 赛马竞猜 -----------end -- 动态创建界面中部预告或功能按钮 flag:添加or删除 data = {fun_id = xxx, name = xxx, sort_id = xxx} function GuildSceneView:SetGuildSceneFuncBtn(add, data) if not data then return end if add then if self.fun_icon_cache[data.fun_id] then return end -- 已存在该按钮不处理添加逻辑 self.fun_icon_cache[data.fun_id] = data end if not add then if not self.fun_icon_cache[data.fun_id] then return end -- 不存在该按钮不处理删除逻辑 self.fun_icon_cache[data.fun_id] = nil end -- 更新按钮和位置,故需要重新排序 local list, item = {}, nil for k, v in pairs(self.fun_icon_cache) do list[#list+1] = v end local sort_func = function ( a, b ) return a.sort_id < b.sort_id end table.sort(list, sort_func) for k, v in ipairs(list) do item = self.fun_icon_list[k] if not item then item = GuildSceneEventBtnItem.New(self.func_btn_con) self.fun_icon_list[k] = item end item:SetAnchoredPosition(self.func_btn_con.sizeDelta.x/2 + ((k-1) - #list/2) * 97 + 10, 0) item:SetData(v) item:SetVisible(true) end if #self.fun_icon_list > #list then for k = #list+1, #self.fun_icon_list do self.fun_icon_list[k]:SetVisible(false) end end end -- 2020年8月17日新增 增加社团场景内的按钮可根据自己构建的数据结构展示按钮闪烁tips -- tips_data = { -- time = 展示多少秒,-1代表一直展示 -- str = 展示的文本内容 -- pos = 需要一个坐标来定位节点位置,因为这个tips节点跟按钮同级 -- blink = 是否需要闪烁 --} function GuildSceneView:StartRightTopBtnTipsAction(tips_data) if not tips_data then return end self:StopRightTopBtnTipsAction() self.tip_timer_bg_obj:SetActive(true) self.tip_timer_bg.anchoredPosition = tips_data.pos self.tip_timer_bg_canvas.alpha = 0 if tips_data.blink then -- 添加cc动画 local function show_icon_func( percent ) self.tip_timer_bg_canvas.alpha = percent end local show_update = cc.CustomUpdate.New(0.7,show_icon_func) local function hide_icon_func( percent ) self.tip_timer_bg_canvas.alpha = 1 - percent end local hide_update = cc.CustomUpdate.New(0.7,hide_icon_func) local action = cc.Sequence.New(show_update,hide_update) cc.ActionManager:getInstance():addAction(cc.RepeatForever.New(action), self.tip_timer_bg) else self.tip_timer_bg_canvas.alpha = 1 end -- 添加计时器 if tips_data.time ~= -1 then local end_time = TimeUtil:getServerTime() + tips_data.time local need_append_time = string.find(tips_data.str, "%%s") local function rt_btn_tips_timer() local left_time = end_time - TimeUtil:getServerTime() left_time = left_time > 0 and left_time or 0 self.tip_timer_tmp.text = need_append_time and string.format(tips_data.str, left_time) or tips_data.str SetSizeDelta(self.tip_timer_bg, self.tip_timer_tmp.preferredWidth + 12, self.tip_timer_tmp.preferredHeight + 27) if left_time <= 0 then self.tip_timer_bg_obj:SetActive(false) self.tip_show_type = nil self:StopRightTopBtnTipsAction() end end rt_btn_tips_timer() self.rt_btn_tips_timer_id = GlobalTimerQuest:AddPeriodQuest(rt_btn_tips_timer, 1, -1) else self.tip_timer_tmp.text = tips_data.str SetSizeDelta(self.tip_timer_bg, self.tip_timer_tmp.preferredWidth + 12, self.tip_timer_tmp.preferredHeight + 27) end end function GuildSceneView:StopRightTopBtnTipsAction( ) cc.ActionManager:getInstance():removeAllActionsFromTarget(self.tip_timer_bg) if self.rt_btn_tips_timer_id then GlobalTimerQuest:CancelQuest(self.rt_btn_tips_timer_id) self.rt_btn_tips_timer_id = nil end end function GuildSceneView:DestroySuccess( ) for k,v in pairs(self.rightIcon_tween) do TweenLite.Stop(v) end if self.guildboss_sub_rank_item then self.guildboss_sub_rank_item:DeleteMe() self.guildboss_sub_rank_item = nil end if self.update_guildboss_hp_id then self.model:UnBind(self.update_guildboss_hp_id) self.update_guildboss_hp_id = nil end self:ClearGuildBossHpTimer() self:ClearGuildPartyTimer() self:CancelBindPartyManulEvent() self:ClearUserManulEvent() self:RemovePartyRoleEffect() self.model:DeleteGuildPartyMonster() cc.ActionManager:getInstance():removeAllActionsFromTarget(self.dance_eff_con) cc.ActionManager:getInstance():removeAllActionsFromTarget(self.right_info_con) if self.update_encourage_handler_1 then self.model:UnBind(self.update_encourage_handler_1) self.update_encourage_handler_1 = nil end if self.update_encourage_handler_2 then self.model:UnBind(self.update_encourage_handler_2) self.update_encourage_handler_2 = nil end if self.update_encourage_handler_3 then self.model:UnBind(self.update_encourage_handler_3) self.update_encourage_handler_3 = nil end for k, v in pairs(self.fun_icon_list) do v:DeleteMe() v = nil end self.fun_icon_list = nil for k, v in pairs(self.guild_collect_support_tip_item_list) do v:DeleteMe() v = nil end self.guild_collect_support_tip_item_list = {} if self.collect_view then self.collect_view:DeleteMe() self.collect_view = nil end self:ClearEventTrailerTimer() self:StopRightTopBtnTipsAction() -- if self.refresh_guild_info_id then -- self.model:UnBind(self.refresh_guild_info_id) -- self.refresh_guild_info_id = nil -- end if self.guild_auction_item then self.guild_auction_item:DeleteMe() self.guild_auction_item = false end if self.act_buff_timer_id then GlobalTimerQuest:CancelQuest(self.act_buff_timer_id) self.act_buff_timer_id = nil end self.model:ClearGuildIgnoreCollection() self:ClearUIEffect(self.inspireBtn_effect) GlobalEventSystem:Fire(EventName.HIDE_EXIT_BTN_STATE) -- 隐藏 end -- function GuildSceneView:CheckGuildAuctionTipsShow( ) -- if GuildModel:getInstance():IsGuildAuctionShow() then -- if not self.guild_auction_item then -- self.guild_auction_item = GuildBossSceneAuctionTips.New(self.guild_aucion_con) -- end -- self.guild_auction_item:SetData() -- else -- if self.guild_auction_item then -- self.guild_auction_item:DeleteMe() -- self.guild_auction_item = false -- end -- end -- end -- 点击切换BGM function GuildSceneView:OnClickChangeBGM( bgm_index ) if bgm_index == 1 then self.party_btn1_chosen_obj:SetActive(true) self.party_btn2_chosen_obj:SetActive(false) LuaSoundManager.Instance:StopBacksound() LuaSoundManager.Instance:PlayBackgroundSound("dance", LuaSoundManager.SOUND_TYPE.SCENE, true) elseif bgm_index == 2 then self.party_btn1_chosen_obj:SetActive(false) self.party_btn2_chosen_obj:SetActive(true) LuaSoundManager.Instance:StopBacksound() LuaSoundManager.Instance:PlayBackgroundSound("field3", LuaSoundManager.SOUND_TYPE.SCENE, true) end self.need_reset_scene_bgm = true end