local RedPoint_Controller = {} local private = {} local EventSystem = require('Event/EventSystem') local LuaUpdater = require "Main/LuaUpdater" local curRedPointList = {} local redPointTree = {} RedPoint_Controller.RedPointKey = { HeroBtn = "HeroBtn",--武将按钮相关的红点 HeroBtn_HeroSelect = "HeroBtn_HeroSelect", WeaponBtn = "WeaponBtn", --神兵相关的红点 WeaponBtn_WeaponView = "WeaponBtn_WeaponView", WeaponBtn_WeaponView_Act = "WeaponBtn_WeaponView_Act", WeaponBtn_WeaponView_Appearance = "WeaponBtn_WeaponView_Appearance", WeaponBtn_WeaponView_Forge = "WeaponBtn_WeaponView_Forge", WeaponBtn_WeaponView_ForgeSoul = "WeaponBtn_WeaponView_ForgeSoul", WeaponBtn_WeaponView_AwakenSkill = "WeaponBtn_WeaponView_AwakenSkill", Boss = "Boss", PVP = "PVP", Activities = "Activities", QQ = "QQ", Formation = "Formation", Formation_Hero = "Formation_Hero", Formation_Equipment = "Formation_Equipment", Formation_WarHorse = "Formation_WarHorse", Formation_Gem = "Formation_Gem", Formation_Weapon = "Formation_Weapon", Formation_Treasure = "Formation_Treasure", Formation_AssistFight = "Formation_AssistFight", Formation_Stratagem = "Formation_Stratagem", Formation_GodBeast = "Formation_GodBeast", Formation_Pet = "Formation_Pet", Formation_Pet_Rune = "Formation_Pet_Rune", Formation_Pet_Rune_Break = "Formation_Pet_Rune_Break", Formation_Pet_Rune_Merge = "Formation_Pet_Rune_Merge", Formation_Pet_Rune_Study = "Formation_Pet_Rune_Study", Formation_Pet_LevelUp = "Formation_Pet_LevelUp", Formation_Pet_MainLineUp = "Formation_Pet_MainLineUp", Formation_Pet_AssistLineUp = "Formation_Pet_AssistLineUp", Formation_Pet_OneTimeNotice = "Formation_Pet_OneTimeNotice", Equipment = "Equipment", Equipment_Debris = "Equipment_Debris", FirstCharge = "FirstCharge", FirstCharge_Tab1 = "FirstCharge_Tab1",--首充1档 FirstCharge_Tab2 = "FirstCharge_Tab2",--首充2档 FirstCharge_Tab3 = "FirstCharge_Tab3",--首充3档 AccumulatingRechargeGJ = "AccumulatingRecharge", --累充送郭嘉 OfficialPosition = "OfficialPosition", OfficialPosition_Main = "OfficialPosition_Main",--官职页签红点 OfficialPosition_Main_Type1 = "OfficialPosition_Main_Type1",--官职类型1的红点 OfficialPosition_Main_Type2 = "OfficialPosition_Main_Type2",--官职类型2的红点 OfficialPosition_Main_Type3 = "OfficialPosition_Main_Type3",--官职类型3的红点 OfficialPosition_Privilege = "OfficialPosition_Privilege",--官职特权页签红点 OfficialPosition_Privilege_Inquire = "OfficialPosition_Privilege_Inquire",--请安红点 FunctionNotice = "FunctionNotice", --功能预告 FunctionNotice_Award = "FunctionNotice_Award", TownHead = "TownHead", --主界面头像 TownHead_Title = "TownHead_Title", --称号红点 TownHead_Title_Type1 = "TownHead_Title_Type1", TownHead_Title_Type2 = "TownHead_Title_Type2", TownHead_Title_Type3 = "TownHead_Title_Type3", TownHead_Title_Type4 = "TownHead_Title_Type4", TownHead_Team = "TownHead_Team", -- 战队红点 TownHead_HonorSignet = "TownHead_HonorSignet", -- 荣誉印记 TownHead_Team_Head = "TownHead_Team_Head", -- 战斗头像红点 TownHead_Team_Head_Portrait = "TownHead_Team_Head_Portrait", -- 头像装扮红点 TownHead_Team_Head_Frame = "TownHead_Team_Head_Frame", -- 头像装扮红点 TownHead_Team_Head_Competition = "TownHead_Team_Head_Competition", -- 竞技装扮红点 TownHead_Team_Head_ClickEffect = "TownHead_Team_Head_ClickEffect", -- 点击特效红点 TownHead_Team_Head_ChatBubble = "TownHead_Team_Head_ChatBubble", -- 聊天气泡红点 TownHead_Team_Head_NameDye = "TownHead_Team_Head_NameDye", -- 名染红点 TestingGiftEntry = "TestingGift", --测试有礼入口 TestingGift_FaceBook = "TestingGift_FaceBook", TestingGift_StoreScore = "TestingGift_StoreScore", TestingGift_BindAccount = "TestingGift_BindAccount", Biography = "Biography", LevelSelect = "LevelSelect", DrawCard = "DrawCard", -- DrawCard_FreeCount = "DrawCard_FreeCount", UIActivity = "UIActivity", WarHorse = "WarHorse", --坐骑总红点 WarHorse_OldMoudles = "WarHorse_OldMoudles", --坐骑其他模块旧逻辑的红点,是通过实时计算得出来的,应摒弃这种做法 WarHorse_Equip = "WarHorse_Equip", --坐骑战装红点 FairPlay = "FairPlay", FairPlay_PointReward = "FairPlay_PointReward", FairPlay_SyncSolo = "FairPlay_SyncSolo", FairPlay_SyncTeamPVP = "FairPlay_SyncTeamPVP", FairPlay_SyncTeamPVP_Reward = "FairPlay_SyncTeamPVP_Reward", FairPlay_SyncTeamPVP_Reward_DanReward = "FairPlay_SyncTeamPVP_Reward_DanReward", FairPlay_SyncTeamPVP_Reward_WinCountReward = "FairPlay_SyncTeamPVP_Reward_WinCountReward", FairPlay_SyncTeamPVP_DailyReward = "FairPlay_SyncTeamPVP_DailyReward", --3V3每日奖励红点 FairPlay_SyncSolo_Reward = "FairPlay_SyncSolo_Reward", FairPlay_SyncSolo_Reward_DanReward = "FairPlay_SyncSolo_Reward_DanReward", -- 1v1段位奖励 FairPlay_SyncSolo_Reward_WinCountReward = "FairPlay_SyncSolo_Reward_WinCountReward", --胜场奖励 FairPlay_SyncSolo_DailyReward = "FairPlay_SyncSolo_DailyReward", --每日奖励红点 FairPlay_SyncSolo_WeeklyCanGet = "FairPlay_SyncSolo_WeeklyCanGet", --每周任务可领取 FairPlay_KingChallenge = "FairPlay_KingChallenge", --王者挑战红点 Treasure = "Treasure", Bag = "Bag", Rank = "Rank", Rank_ThumbsUp = "Rank_ThumbsUp", Guild = "Guild", Guild_MainPage = "Guild_MainPage", Guild_Welfare = "Guild_Welfare", Guild_Welfare_Cultivation = "Guild_Welfare_Cultivation", Guild_Welfare_Salary = "Guild_Welfare_Salary", Guild_Welfare_LeaderReward = "Guild_Welfare_LeaderReward", GuildFamousEntry = 'GuildFamousEntry', Guild_Member = "Guild_Member", Guild_Member_Approval = "Guild_Member_Approval", Guild_Member_RedPacket = "Guild_Member_RedPacket", Guild_Target = "Guild_Target", --越南势力共建 Guild_Task = "Guild_Task", Guild_Activity = "Guild_Activity", Guild_Activity_Donate = "Guild_Activity_Donate", Guild_Activity_GuildWar = "Guild_Activity_GuildWar", Guild_Activity_GuildWar_Sign = "Guild_Activity_GuildWar_Sign", Guild_Activity_GuildWar_LineUp = "Guild_Activity_GuildWar_LineUp", Guild_Activity_Allies = "Guild_Activity_Allies", Guild_Activity_GuildMine = "Guild_Activity_GuildMine", Guild_Activity_SlgGvE = "Guild_Activity_SlgGvE", Guild_Activity_SlgGvE_Official = "Guild_Activity_SlgGvE_Official", Guild_Activity_SlgGvE_Talent = "Guild_Activity_SlgGvE_Talent", Guild_Activity_SlgGvE_Season = "Guild_Activity_SlgGvE_Season", Guild_Activity_SlgGvE_Thief = "Guild_Activity_SlgGvE_Thief", Guild_Activity_SlgGvE_Auction = "Guild_Activity_SlgGvE_Auction", GuildAuction = "GuildAuction", GuildAuction_ShareBonus = "GuildAuction_ShareBonus", SignInReward = "SignInReward", Library = "Library", -- 官邸图鉴 Library_Hero = "Library_Hero", -- 武将图鉴 Library_Weapon = "Library_Weapon", --神兵图鉴 Library_Horse = "Library_Horse", --战骑图鉴 Library_Treasure = "Library_Treasure", --宝物图鉴 Library_Stratagem = "Library_Stratagem",--计略图鉴 Library_PlotReview = "Library_PlotReview", -- 剧情回顾 Library_GodBeast = "Library_GodBeast", -- 神兽图鉴 Library_LightEffect = "Library_LightEffect", -- 光效图鉴 Library_Dye = "Library_Dye", -- 染色图鉴 Library_Appearance = "Library_Appearance", -- 外显图鉴 Setting = "Setting", Setting_Notification = "Setting_Notification", Setting_Customer = "Setting_Customer", Nobility = "Nobility", --商城相关红点 PayMall = "PayMall", PayMall_TotalTop = "PayMall_TotalTop", PayMall_DirectGiftOrder = "PayMall_DirectGiftOrder", --直购Tab相关红点 PayMall_DirectGiftOrder_DirectGift1 = "PayMall_DirectGiftOrder_DirectGift1", --新手特惠相关红点 PayMall_DirectGiftOrder_DirectGift2 = "PayMall_DirectGiftOrder_DirectGift2", --限时特惠相关红点 PayMall_DirectGiftOrder_DirectGift3 = "PayMall_DirectGiftOrder_DirectGift3", --周常礼包相关红点 PayMall_DirectGiftOrder_DirectGift4 = "PayMall_DirectGiftOrder_DirectGift4", --月度礼包相关红点 PayMall_DirectGiftOrder_DirectGift5 = "PayMall_DirectGiftOrder_DirectGift5", --坐骑特惠相关红点 PayMall_DirectGiftOrder_DirectGift6 = "PayMall_DirectGiftOrder_DirectGift6", --宝物特惠相关红点 PayMall_DirectGiftOrder_DirectGift7 = "PayMall_DirectGiftOrder_DirectGift7", --定向-夏侯惇礼包相关红点 PayMall_DirectGiftOrder_DirectGift8 = "PayMall_DirectGiftOrder_DirectGift8", --定向-夏侯惇外观礼包相关红点 PayMall_DirectGiftOrder_DirectGift9 = "PayMall_DirectGiftOrder_DirectGift9", --定向-夏侯惇神兵外观礼包相关红点 PayMall_DirectGiftOrder_DirectGift10 = "PayMall_DirectGiftOrder_DirectGift10", --元旦特惠相关红点 PayMall_DirectGiftOrder_DirectGift11 = "PayMall_DirectGiftOrder_DirectGift11", --直购-每日礼包 PayMall_PreferentialOrder = "PayMall_PreferentialOrder", --特惠相关红点 PayMall_PreferentialOrder_DailyGift = "PayMall_PreferentialOrder_DailyGift", --每日礼包红点 PayMall_PreferentialOrder_MonthCard = "PayMall_PreferentialOrder_MonthCard", --月卡红点 PayMall_PreferentialOrder_GrowthFund = "PayMall_PreferentialOrder_GrowthFund", --成长基金红点 PayMall_PreferentialOrder_OfficialPositionFund = "PayMall_PreferentialOrder_OfficialPositionFund", --官职基金红点 PayMall_PreferentialOrder_HonorOrder = "PayMall_PreferentialOrder_HonorOrder", --战令红点 PayMall_PreferentialOrder_HeroFund = "PayMall_PreferentialOrder_HeroFund", --名将之路红点 PayMall_PreferentialOrder_HorseFund = "PayMall_PreferentialOrder_HorseFund", --玉络金鞍(坐骑之路)红点 PayMall_PreferentialOrder_TreasureFund = "PayMall_PreferentialOrder_TreasureFund", --物华天宝(宝物之路)红点 PayMall_PreferentialOrder_GoldIngotFund = "PayMall_PreferentialOrder_GoldIngotFund", --元宝战令红点 PayMall_PayMallBase = "PayMall_PayMallBase", --商城Tab相关红点 PayMall_PayMallBase_DoubleMonthCard = "PayMall_PayMallBase_DoubleMonthCard", --双月卡商城红点 PayMall_PayMallBase_Charge = "PayMall_PayMallBase_Charge", Shop = "Shop", Shop_YuanBao = "Shop_YuanBao", Shop_LongYu = "Shop_LongYu", Shop_ShiLi = "Shop_ShiLi", Shop_YanWu = "Shop_YanWu", Shop_ZuDui = "Shop_ZuDui", Shop_GongPing = "Shop_GongPing", Shop_MonthCard = "Shop_MonthCard", Shop_WeekActivity = "Shop_WeekActivity", Shop_GVGFight = "Shop_GVGFight", InfoReminder = "InfoReminder", -- 战令 HonorOrder = "HonorOrder", HonorOrder_Reward = "HonorOrder_Reward", -- 战令奖励 HonorOrder_Challenge = "HonorOrder_Challenge", -- 战令挑战 HonorOrder_Challenge_Daily = "HonorOrder_Challenge_Daily", -- 战令挑战-日常挑战 HonorOrder_Challenge_Cycle = "HonorOrder_Challenge_Cycle", -- 战令挑战-周期挑战 HonorOrder_Shop = "HonorOrder_Shop", -- 战令商店 -- 邮件 Mail = "Mail", -- 好友 Friend = "Friend", Friend_Apply = "Friend_Apply", HorseRear = "HorseRear", WarZoneAuction = "WarZoneAuction", GodBeastActivity = "GodBeastActivity", -- 神兽活动 NewYear = "NewYear", NewYear_RegularFunctions = "NewYear_RegularFunctions", --新年换皮活动固定入口的总红点。目前此红点处理并不合适,每次刷新都需重新结算。正确方法:每个入口的红点状态应单独计算,并存储在此活动的红点树中,作为总活动红点的叶子节点。 NewYear_ExpelMonster = "NewYear_ExpelMonster", --打年兽 NewYear_AnniversaryLuckyDraw = "NewYear_AnniversaryLuckyDraw", --锦鲤抽奖 --boss BossMain = "BossMain", BossMain_WarZone = "BossMain_WarZone", BossMain_World = "BossMain_World", --0元购 FreeBuy = "FreeBuy", FreeBuy_HasReward = "FreeBuy_HasReward", --0元购可领取返还奖励 CommandTheWorld = "CommandTheWorld", --号令天下 CommandTheWorld_HasItem = "CommandTheWorld_HasItem" ,--号令天下--有道具 CommandTheWorld_GetRewardInBox = "CommandTheWorld_GetRewardInBox" , --号令天下 --势力宝箱奖励 CommandTheWorld_RewardInHonour = "CommandTheWorld_RewardInHonour" ,--号令天下 -- 荣誉榜奖励 CommandTheWorld_RewardInTask = "CommandTheWorld_RewardInTask",--号令天下--活跃任务奖励 CommandTheWorld_RewardInGift = "CommandTheWorld_RewardInGift",--号令天下--充值有礼 --魔神 DemonGold = "DemonGold", DemonGold_Reward = "DemonGold_Reward", DemonGold_Chanllengy = "DemonGold_Chanllengy", -- 四国爬塔 ClimbTowerEntry = "ClimbTowerEntry", ClimbTowerEntry_ClimbMain = "ClimbTowerEntry_ClimbMain", --爬塔入口 ClimbTowerEntry_Progress = "ClimbTowerEntry_Progress", --历程按钮 ClimbTowerEntry_Challenge = "ClimbTowerEntry_Challenge", -- 四国可挑战 ClimbTowerEntry_LineUp = "ClimbTowerEntry_LineUp", -- 四国可布阵 Stratagem = "Stratagem", LuckyLottery = "LuckyLottery", --天地群雄 HeroMatch1v1 = "HeroMatch1v1", HeroMatch1v1_Login = "HeroMatch1v1_Login", -- 登录红点 HeroMatch1v1_WorshipReward = "HeroMatch1v1_WorshipReward", -- 膜拜奖励红点 HeroMatch3v3 = "HeroMatch3v3", HeroMatch3v3_Login = "HeroMatch3v3_Login", -- 登录红点 HeroMatch3v3_WorshipReward = "HeroMatch3v3_WorshipReward", -- 膜拜奖励红点 --天下会武 FairSoloTournament = "FairSoloTournament", FairSoloTournament_Task = "FairSoloTournament_Task", FairSoloTournament_Task_Click = "FairSoloTournament_Task_Click", --任务查看 FairSoloTournament_Task_CanGet = "FairSoloTournament_Task_CanGet", --任务可领取 ThreeTeamFight = "ThreeTeamFight", ThreeTeamFight_ThumbsUp = "ThreeTeamFight_ThumbsUp", ThreeTeamFight_TaskCanGet = "ThreeTeamFight_TaskCanGet", Country = "Country", Country_SignIn = "Country_SignIn", Country_Worship = "Country_Worship", Country_SalaryReward = "Country_SalaryReward", Country_SyncCityWar = "Country_SyncCityWar", --长安争夺战 --国战悬赏任务红点 CountryWantedTask = "CountryWantedTask", --悬赏任务入口 -- 铸炼(纳灵)红点 Reborn = "Reborn", -- 铸炼入口红点 Reborn_RecycleFragment = "Reborn_RecycleFragment", -- 纳灵红点 Reborn_RecycleFragment_Man = "Reborn_RecycleFragment_Man", -- 纳灵人之灵 Reborn_RecycleFragment_Earth = "Reborn_RecycleFragment_Earth", -- 纳灵地之灵 Reborn_RecycleFragment_Heaven = "Reborn_RecycleFragment_Heaven", -- 纳灵天之灵 -- 暴风 Storm = "Storm", -- 暴风红点 Storm_Entry = "Storm_Entry", -- 入口红点 -- 周历红点 ActivityPreview = "ActivityPreview", -- 晚间活动提示红点 -- 攻城略地(GVG红点) GVGFight = "GVGFight", GVGFight_Reward = "GVGFight_Reward", -- GVG收益红点 GVGFight_SeasonTask = "GVGFight_SeasonTask", -- GVG赛季任务 GVGFight_SeasonMedal = "GVGFight_SeasonMedal", -- GVG徽章 GVGFight_WarReport = "GVGFight_WarReport", -- GVG战报 GVGFightAssist = "GVGFightAssist", -- GVG助力 GVGFight_NewSeasonStruggleStart = "GVGFight_NewSeasonStruggleStart", -- GVG新赛季争夺期开始 GVGFight_CanOccupyCity = "GVGFight_CanOccupyCity", -- GVG可布置城池 AnniversaryPrepare = "AnniversaryPrepare", --周年预热 -- 金兰活动红点 FriendRecharge = "FriendRecharge", FriendRecharge_Invite = "FriendRecharge_Invite", -- 金兰受邀红点 FriendRecharge_Invited = "FriendRecharge_Invited", -- 金兰接受我的邀请红点 FriendRecharge_Level = "FriendRecharge_Level", -- 金兰等级奖励 FriendRecharge_Task = "FriendRecharge_Task", -- 金兰任务 -- 红包雨 RedEnvelopeRain = "RedEnvelopeRain", -- 红包雨 -- 神兽 GodBeast = "GodBeast", Pet = "Pet", Pet_GodActive = "Pet_GodActive", --神宠激活 Pet_GodBreak = "Pet_GodBreak", --神宠进阶 Pet_BreedReward = "Pet_BreedReward", --繁殖奖励 --四国乱斗 SyncFourCountryWar = "SyncFourCountryWar", FunctionUpdateNotice = "FunctionUpdateNotice", -- 版本更新介绍红点 WeekTotalCharge = "WeekTotalCharge", --周期累充红点 WeekTotalCharge_Week = "WeekTotalCharge_Week", --周期累充周奖励红点 WeekTotalCharge_Month = "WeekTotalCharge_Month", --周期累充日奖励红点 TeamFairChampionship = "TeamFairChampionship", ---天下会武3v3 TeamFairChampionship_Start = "TeamFairChampionship_Start", ---天下会武3v3 任务 TeamFairChampionship_Task = "TeamFairChampionship_Task", ---天下会武3v3 任务 TeamFairChampionship_Task_CanGet = "TeamFairChampionship_Task_CanGet", ---天下会武3v3 可领取 TeamFairChampionship_Task_Click = "TeamFairChampionship_Task_Click", ---天下会武3v3 任务查看 DouYinRechargeReward = "DouYinRechargeReward", -- 渠道专属充值返利活动 ChangAnSiegeLineUp = "ChangAnSiegeLineUp", --长安争夺战布阵红点 DragonArteryLineUp = "DragonArteryLineUp", --龙脉争夺战布阵红点 CountryNightBossLineUp = "CountryNightBossLineUp", --烽火四起布阵红点 AwakenActivity = "AwakenActivity", --左慈试炼活动 LaterEnter = "LaterEnter", --后起之秀 SubjectMonth = "SubjectMonth", --主题月活动 SubjectMonth_SignIn = "SubjectMonth_SignIn", --月度签到 SubjectMonth_HonorOrder = "SubjectMonth_HonorOrder", --月度战令 SubjectMonth_HonorOrder_Reward = "SubjectMonth_HonorOrder_Reward", SubjectMonth_HonorOrder_Task = "SubjectMonth_HonorOrder_Task", SubjectMonthHonorOrderGameTask = "SubjectMonthHonorOrderGameTask", SubjectMonthHonorOrderMonthTask = "SubjectMonthHonorOrderMonthTask", SubjectMonth_BossChallenge = "SubjectMonth_BossChallenge", --无双挑战 SubjectMonth_Rogue = "SubjectMonth_Rogue", --肉鸽 SubjectMonth_Rogue_StarReward = "SubjectMonth_Rogue_StarReward", SubjectMonth_Rogue_Hero = "SubjectMonth_Rogue_Hero", SubjectMonth_Rogue_Hero_LevelReward = "SubjectMonth_Rogue_Hero_LevelReward", SubjectMonth_Rogue_Hero_SkillLevelUp = "SubjectMonth_Rogue_Hero_SkillLevelUp", } function RedPoint_Controller.UpdateOneTimeRedPoint() for i,v in pairs(MDL.RedPoint.RedPointType) do local isShowedRp = MDL.RedPoint.GetOneTimeRedPointInfoByType(v) if v == MDL.RedPoint.RedPointType.PVP then if isShowedRp == 0 then if CTL.Unlock.JudgeIfSatisfiedUnlockTable(DataSheetManager.FuctionUnlock:GetDataByFucID(MDL.Unlock.FunctionType.Battle3V3).Unlock_Table) then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.PVP) end end elseif v == MDL.RedPoint.RedPointType.Boss then if isShowedRp == 0 then if CTL.Unlock.JudgeIfSatisfiedUnlockTable(DataSheetManager.BossChallengeData:GetDataByID(1).Unlock_Table) then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.Boss) end end elseif v == MDL.RedPoint.RedPointType.QQ then if isShowedRp == 0 then CTL.RedPoint.AddRedPoint(CTL.RedPoint.RedPointKey.QQ) end elseif v == MDL.RedPoint.RedPointType.MonthCard then if isShowedRp == 0 then CTL.PayMall.RefreshShopRedPoints() end end end EventSystem.Dispatch(EventID.UI_Activity_Main_RedPoint) end function RedPoint_Controller.OnStartup() EventSystem.Regist(EventID.TeamLevelUpdate, RedPoint_Controller.UpdateOneTimeRedPoint) EventSystem.Regist(EventID.UI_UpdateRoleInfo, RedPoint_Controller.UpdateOneTimeRedPoint) EventSystem.Regist(EventID.FunctionUnlockUpdate, private.OnFunctionUnlockUpdate) for k,v in pairs(RedPoint_Controller.RedPointKey) do local keys = string.split(v,"_") local str = nil for i,name in ipairs(keys) do local childName = nil if str == nil then childName = name else childName = str.."_"..name end private.CreateTree(str,childName) str = childName end private.CreateTree(str,nil) end private.redPointFuncTimer = nil private.redPointFuncTable = {} end function RedPoint_Controller.AddRedPoint(name) if redPointTree[name].child and #redPointTree[name].child > 0 then logging.error(LTAG.ERROR,"错误 不能add 中间节点") end private.SetRedPointActive(name,true) end function RedPoint_Controller.RemoveRedPoint(name) if redPointTree[name].child and #redPointTree[name].child > 0 then logging.error(LTAG.ERROR,"错误 不能Remove 中间节点") end private.SetRedPointActive(name,false) end function RedPoint_Controller.GetRedPointActive(name) if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.EntryRedPoint) == false then return false end return curRedPointList[name] end function private.OnFunctionUnlockUpdate(funcID, isComplete) if funcID == MDL.Unlock.FunctionType.EntryRedPoint then for _,v in pairs(RedPoint_Controller.RedPointKey) do EventSystem.Dispatch(v, RedPoint_Controller.GetRedPointActive(v)) end end end function private.CreateTree(parentName,childName) if redPointTree[parentName] and redPointTree[childName] then return end if parentName=="" or parentName== nil then return end if redPointTree[parentName] == nil then redPointTree[parentName] = {} redPointTree[parentName].child = {} end if childName == nil then return end if redPointTree[childName] == nil then redPointTree[childName] = {} redPointTree[childName].child = {} end redPointTree[childName].parent = parentName table.insert(redPointTree[parentName].child,childName) end function private.SetParentActive(name,active) if name=="" or name == nil or redPointTree[name].parent == nil then return end curRedPointList[name] = active local curNode = redPointTree[name] local parentName = curNode.parent if #redPointTree[parentName].child > 1 then for i,v in ipairs(redPointTree[parentName].child) do if curRedPointList[v] ~= active then return end end EventSystem.Dispatch(parentName, active) local tep = redPointTree[parentName] private.SetParentActive(tep.parent, active) end end function private.SetRedPointActive(name, active) if name=="" or name == nil then return end if redPointTree[name].parent == nil then curRedPointList[name] = active if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.EntryRedPoint) then EventSystem.Dispatch(name, active) end return end local value = curRedPointList[name] if value~= active then curRedPointList[name] = active if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.EntryRedPoint) then EventSystem.Dispatch(name, active) end local parentName = redPointTree[name].parent if #redPointTree[parentName].child > 1 then local isChange = true for i,v in ipairs(redPointTree[parentName].child) do if v ~= name and curRedPointList[v] == true then isChange = false end end if isChange then private.SetRedPointActive(parentName,active) end else private.SetRedPointActive(parentName,active) end end end function private.RedPointFuncErrorMsg(msg) logging.error(LTAG.ERROR, "RedPointFuncErrorMsg执行失败", msg) end function RedPoint_Controller.AddOneRedPointFunc(redPointFunc) private.redPointFuncTable[redPointFunc] = 1 if not private.redPointFuncTimer then LuaUpdater.StartRealTimeUpdate(private.StartExcuteRedPointFunc) private.redPointFuncTimer = true end end function private.StartExcuteRedPointFunc(deltaTime, timeSinceUpdate) LuaUpdater.StopRealTimeUpdate(private.StartExcuteRedPointFunc) private.redPointFuncTimer = false for redPointFunc, __ in pairs(private.redPointFuncTable) do xpcall(redPointFunc, private.RedPointFuncErrorMsg) private.redPointFuncTable[redPointFunc] = nil end end return RedPoint_Controller