local SuperGoldBoss_Controller = {} local private = {} local EventSystem = require 'Event/EventSystem' function SuperGoldBoss_Controller.OnStartup() EventSystem.Regist(EventID.AcquireSystemRedAfterUnlock, private.RefreshRedPoint) EventSystem.Regist(EventID.UI_OperationActivity_DataChanged, private.RefreshRedPoint) EventSystem.Regist(EventID.UI_OperationActivity_DataChanged, private.RefreshRedPoint) EventSystem.Regist(EventID.UI_GoldenHero_RefreshCurrency, private.RefreshItemEnoughRedPoint) EventSystem.Regist(EventID.UI_RefreshCurrency, private.RefreshItemEnoughRedPoint) EventSystem.Regist(EventID.BagItem_Update, private.RefreshItemEnoughRedPoint) EventSystem.Regist(EventID.UI_SuperGold_ServerRedPointRefresh, private.RefreshTimesRewardRedPoint) private.ActivityType = MDL.OperationActivity.ActivityType.SuperGold end function private.RefreshRedPoint() private.RefreshTimesRewardRedPoint() private.RefreshItemEnoughRedPoint() end function private.RefreshTimesRewardRedPoint() if MDL.OperationActivity.HotControlInfo then local info = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(private.ActivityType) if info then for i, v in pairs(info) do local activityId = v.ActivityID if not MDL.SuperGoldMain.GetHeroTypeByActivityId(activityId) then return end local rpEventId = CTL.SuperGoldMain.RpEventId[activityId] if rpEventId then MDL.RedPoint.UpdateNodeStateByLogicParams(CTL.SuperGoldMain.GetRedPointInfoByType(activityId, CTL.SuperGoldMain.RedPointType.Trail), rpEventId.TownHome, rpEventId.BossTrailHasReward) else CTL.SuperGoldMain.InitBossRedPointTreeByActivityId(v.ActivityID) end end end end end function private.RefreshItemEnoughRedPoint() if MDL.OperationActivity.HotControlInfo then local info = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(private.ActivityType) if info then for i, v in pairs(info) do local activityId = v.ActivityID if not MDL.SuperGoldMain.GetHeroTypeByActivityId(activityId) then return end local rpEventId = CTL.SuperGoldMain.RpEventId[activityId] if rpEventId then MDL.RedPoint.UpdateNodeStateByLogicParams(SuperGoldBoss_Controller.IsItemEnough(activityId), rpEventId.TownHome, rpEventId.BossTrailItemEnough) else CTL.SuperGoldMain.InitBossRedPointTreeByActivityId(v.ActivityID) end end end end end function SuperGoldBoss_Controller.IsTimeRewardClaimed(activityId, rewardId) for i, v in ipairs(MDL.SuperGoldBoss.GetTimesRewardList(activityId)) do if v == rewardId then return true end end return false end function SuperGoldBoss_Controller.IsItemEnough(activityId) if not CTL.SuperGoldMain.IsActivityInValidFuncTime(activityId) then return false end local heroType = MDL.SuperGoldMain.GetHeroTypeByActivityId(activityId) local bossData = DataSheetManager.SuperGoldBossData:GetDataByHeroType(heroType) return UTL.Item.GetItemStockCount(bossData.EnergyItem) >= bossData.EnergyNum end function SuperGoldBoss_Controller.LocateDifficultLevel(activityId, difficult) if MDL.SuperGoldMain.IsActivityInFuncTime(activityId) then local heroType = MDL.SuperGoldMain.GetHeroTypeByActivityId(activityId) UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UISuperGoldBossMain, {activityId = activityId, heroType = heroType, difficult = difficult}) end end function SuperGoldBoss_Controller.SaveTempData(activityId, difficultId, bossLevelId) private.tempActivityId = activityId private.tempDifficultId = difficultId private.tempBossLevelId = bossLevelId end function SuperGoldBoss_Controller.LoadTempData() return private.tempActivityId, private.tempDifficultId, private.tempBossLevelId end function SuperGoldBoss_Controller.ClearTempData() private.tempActivityId = nil private.tempDifficultId = nil private.tempBossLevelId = nil end function SuperGoldBoss_Controller.ShowBattleSummary(msgResp) UIManager.OpenView(Const_UI_Lua.UIEnum.UISuperGoldBossBattleSummary, {battleResult = msgResp.superGoldTrial, passTime = msgResp.passTime}) end return SuperGoldBoss_Controller