local AwakenActivity_Controller = {} local private = {} local hero_awaken_info_pb = require 'Proto.hero_awaken_info_pb' local EventSystem = require('Event/EventSystem') function AwakenActivity_Controller.OnStartup() EventSystem.Regist(EventID.UI_AwakenActivity_UpdateAwakenActivityInfo, private.RefreshEntryRedPoint) EventSystem.Regist(EventID.UI_AwakenActivity_AwakenChallengeRewardResp, private.RefreshEntryRedPoint) private.hasShowChallengeRed = false end function AwakenActivity_Controller.ShowBattleSummary(msg) CTL.HomeMain.CloseOpenView() UIManager.OpenView(Const_UI_Lua.UIEnum.UIAwakenActivityResult, msg, Const_UI_Lua.UIEnum.UIDemonGodResult) end function AwakenActivity_Controller.OpenUIAwakenActivity(heroId) if heroId then if not MDL.AwakenActivity.IsOpenByHeroId(heroId) then return end else if not MDL.AwakenActivity.IsOpen(heroId) then return end end UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIAwakenActivity, {heroId = heroId}) end function AwakenActivity_Controller.CheckChallengeRed(heroId) local activityInfo = MDL.AwakenActivity.GetAwakenActivityInfo(heroId) if not activityInfo then return false end if activityInfo.curStage == hero_awaken_info_pb.Fighting and (MDL.HeroAwaken.GetIsHeroAwaken(activityInfo.heroId) or CTL.HeroAwaken.IsEnableAwake(activityInfo.heroId)) and not private.hasShowChallengeRed then return true end return false end function AwakenActivity_Controller.CheckRewardRed(heroId) local activityInfo = MDL.AwakenActivity.GetAwakenActivityInfo(heroId) if not activityInfo then return false end if activityInfo.curStage == hero_awaken_info_pb.Showing and not activityInfo.hasChallengeReward then return true end return false end function private.RefreshEntryRedPoint() local activityInfoList = MDL.AwakenActivity.GetAwakenActivityInfoList() for _, v in ipairs(activityInfoList) do if AwakenActivity_Controller.CheckChallengeRed(v.heroId) or AwakenActivity_Controller.CheckRewardRed(v.heroId) then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.AwakenActivity) return end end CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.AwakenActivity) end function AwakenActivity_Controller.RecordChallengeRed() if private.hasShowChallengeRed then return end local activityInfoList = MDL.AwakenActivity.GetAwakenActivityInfoList() for _, v in ipairs(activityInfoList) do if AwakenActivity_Controller.CheckChallengeRed(v.heroId) then private.hasShowChallengeRed = true private.RefreshEntryRedPoint() return end end end return AwakenActivity_Controller