local InfoReminder_Controller = {} local EventSystem = require('Event/EventSystem') local private = {} function InfoReminder_Controller.OnStartup() EventSystem.Regist(EventID.UI_Team_ApplyInfoHandle, private.RefreshTeamApply) EventSystem.Regist(EventID.UI_Team_InviteInfoHandle, private.RefreshTeamInvite) EventSystem.Regist(EventID.UI_Team_ApplyInfoHandle, private.RefreshTeamInvite) EventSystem.Regist(EventID.UI_Team_LeaveTeam, private.RefreshTeamBubble) EventSystem.Regist(EventID.UI_Team_CreateTeam, private.RefreshTeamBubble) EventSystem.Regist(EventID.UI_UpdateChatRed, private.OnRefreshFriendRed) end function InfoReminder_Controller.InitInfoReminder() private.RefreshTeamBubble(true) private.OnRefreshFriendRed(true) end function private.RefreshTeamBubble() private.RefreshTeamInvite() private.RefreshTeamApply() end function private.RefreshTeamInvite(isAdd) local inviteLength = #MDL.Team.GetInviteList() -- 此处为房间和队伍的全部被邀请请求 if not isAdd then inviteLength = inviteLength - 1 end if inviteLength > 0 then if BattleDataGetter.IsTownLevel() and not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITeamInvitedPanel) and not MDL.CustomRoom.IsInRoom() and CTL.Team.IsAutoPopUpInvitedview() then if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIActivitiesRemind) or UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIFightThroneRemind) then CTL.HomeMain.AddTownHomeDelayView(Const_UI_Lua.UIEnum.UITeamInvitedPanel) else if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIFriendBase) then UIManager.OpenView(Const_UI_Lua.UIEnum.UITeamInvitedPanel) end end end CTL.HomeMain.AddMainNotice(CTL.HomeMain.NoticeType.TeamInvite) else CTL.HomeMain.RemoveMainNotice(CTL.HomeMain.NoticeType.TeamInvite) end end function private.RefreshTeamApply(isAdd) local applyLength = #MDL.Team.GetApplyTeamList() if not isAdd then applyLength = applyLength - 1 end if applyLength > 0 then if BattleDataGetter.IsTownLevel() and not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITeamApplyPanel) and CTL.Team.IsAutoPopUpApplyview() and not MDL.Team.IsAutoAccept then if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIActivitiesRemind) or UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIFightThroneRemind) then CTL.HomeMain.AddTownHomeDelayView(Const_UI_Lua.UIEnum.UITeamApplyPanel, {isAutoPopUp = true}) else if not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIFriendBase) then UIManager.OpenView(Const_UI_Lua.UIEnum.UITeamApplyPanel, {isAutoPopUp = true}) end end end CTL.HomeMain.AddMainNotice(CTL.HomeMain.NoticeType.TeamApply) else CTL.HomeMain.RemoveMainNotice(CTL.HomeMain.NoticeType.TeamApply) end end function private.OnRefreshFriendRed() local num = MDL.Friend.GetUnreadMsgNumByType(MDL.Friend.ListType.Recent) + CTL.SpecialTeam.GetSumGroupChatRedCount() if num > 0 then CTL.HomeMain.AddMainNotice(CTL.HomeMain.NoticeType.PresonChat) else CTL.HomeMain.RemoveMainNotice(CTL.HomeMain.NoticeType.PresonChat) end end local firstIndex = 1 function InfoReminder_Controller.GetFirstNotices() local notices = CTL.HomeMain.GetFirstNotices()[firstIndex] if notices then firstIndex = firstIndex + 1 if MDL.InfoReminder.IsShowLevelType(notices) then return notices else return InfoReminder_Controller.GetFirstNotices() end end firstIndex = 1 end local secondIndex = 1 function InfoReminder_Controller.GetSecondNotices() local notices = CTL.HomeMain.GetSecondNotices()[secondIndex] if notices then secondIndex = secondIndex + 1 if MDL.InfoReminder.IsShowLevelType(notices) then return notices else return InfoReminder_Controller.GetSecondNotices() end end secondIndex = 1 end function InfoReminder_Controller.RefreshRedPoint(list) for i, v in ipairs(list) do if v.isRead == false then local excelData = DataSheetManager.PlayerEventType:GetDataByID(v.mainTempId) if excelData == nil then logging.error(LTAG.ERROR,"PlayerEventType not find ",v.mainTempId) return end if excelData.HongDian == 1 and MDL.Unlock.IsUnlock(excelData.FunctionID) then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.InfoReminder) return end end end CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.InfoReminder) end return InfoReminder_Controller