local UITownHome_ActivityEntry = UIViewClass() local EventSystem = require('Event/EventSystem') local TRAnimDisappearPath = ConstAssetPathConfig.TRAnimDisappearPath local TRAnimAppearPath = ConstAssetPathConfig.TRAnimAppearPath local DRAW_CARD_DAY = DataSheetManager.ConstData:GetDataByID("ShowRecruitmentDays").IntValue local QQGroupPCUrl = "http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=hCk-_5uz49VtG6dKDd8siy_ramKqIcUG&authKey=y%2BMbGCJ66%2Bhr6QpkRCSOxuaOq5BPhilVIeBR6Zi9NAXBIvEuaC5UCT36kBdRKRkw&noverify=0&group_code=784429859" --活动按钮配置 local ActivitiesButtonCfgs = { Shop = {type="CommonButton", icon = "zc_icon_sp", lable = "IDS_Store", sound = "UI_shops"}, Welfare = {type="CommonButton", icon = "zc_icon_qiandaofuli", lable = "IDS_Welfare", sound = "UI_welfare"}, QQ = {type="CommonButton", icon = "zc_icon_qq", lable = "IDS_QQGroup", sound = "UI_contact"}, Auction = {type="AuctionButton", sound = "UI_shops"}, GuildWar = {type="GuildWarButton", icon = "zc_icon_slzb1", sound = "UI_shili"}, PushGift = {type="PushGiftButton", icon = "dxlb_icon_01", lable = "IDS_PushGift_SuperValue", effect = ConstAssetPathConfig.effect, sound = "UI_foundation"}, Turntable = {type="CommonButton", icon = "zc_icon_zpqy", lable = "IDS_Turntable_Title", effect = ConstAssetPathConfig.effect, sound = "UI_shops"}, CycleRecharge = {type="CommonButton", icon = "zc_icon_jbzl", lable = "IDS_CycleRecharge_Title", effect = ConstAssetPathConfig.effect, sound = "UI_shops"}, FirstCharge = {type="CommonButton",icon = "zc_icon_xq", iconW = 124, lable = "IDS_FirstCharge_FirstChargeIcon", sound = "UI_treasures", effect = ConstAssetPathConfig.effect2}, FirstChargeVN = {type="CommonButton",icon = "zc_icon_zy02", iconW = 124, lable = "IDS_FirstCharge_FirstChargeIcon", sound = "UI_treasures", effect = ConstAssetPathConfig.effect2}, FirstChargeNew = {type="CommonButton",icon = "zc_icon_ssx", iconW = 124, lable = "IDS_FirstCharge_FirstChargeIcon", sound = "UI_treasures", effect = ConstAssetPathConfig.effect2}, AccumulatingRecharge = {type="CommonButton", icon = "zc_icon_gj", iconW = 124, lable = "IDS_Accumulating_IconButton", sound = "UI_treasures", effect = ConstAssetPathConfig.effect3}, CountryReset = {type="CountryResetButton", sound = "UI_shili"}, PayMall = {type="CommonButton", icon = "zc_icon_sc", lable = "IDS_Store_PayStore", sound = "UI_shops"}, NewYear = {type="CommonButton", icon = "", lable = "", sound = "UI_jeweled_04", effect = ""}, WebActivity = {type="CommonButton", icon = "icon_dj_bt", lable = "IDS_WebActivity_WebActivity", sound = "UI_shops"}, CommandTheWorld = {type="CommonButton", icon = "zc_icon_scdb", lable = "IDS_BattlefieldMuster_Title", sound = "UI_dominant"}, Hegemony = {type="CommonButton",icon = "zc_icon_byzs", lable = "IDS_7DayActivity_Title_1", sound = "UI_dominant"}, DrawCard = {type="CommonButton", icon = "zc_icon_zm01", lable = "IDS_DrawCard", sound = "UI_begin"}, GodBeastActivity = {type="GodBeastActivityButton", sound = "UI_jeweled_04"}, VIPInvitation = {type="CommonButton", icon = "zc_icon_jzyqh", lable = "IDS_VIPInvitation_Title_3", sound = "UI_red_packet"}, FriendRecharge = {type="CommonButton", icon = "zc_icon_jzyqh", lable = "IDS_VIPInvitation_Title_3", sound = "UI_red_packet"}, FreeBuy = {type="CommonButton", icon = "zc_icon_0yg", lable = "IDS_FreeBuy_Title", sound = "UI_shops"}, TreasureBowl = {type="CommonButton", icon = "zc_icon_zcjb", lable = "IDS_TreasureBowl_Title1", sound = "UI_shops", effect = ConstAssetPathConfig.effect3}, WarZoneAuction = {type="CommonButton", icon = "zc_icon_yyzq", lable = "IDS_ActivityName_WarZoneAuction", sound = "UI_shops"}, LuckyLottery = {type="CommonButton", icon = "zc_icon_xynd", lable = "IDS_LuckyLottery_Title", sound = "UI_jeweled_04", effect = ConstAssetPathConfig.effect}, LuckyLotteryJP = {type="CommonButton", icon = "zc_icon_xynd", lable = "IDS_LuckyLottery_Title_JP", sound = "UI_jeweled_04", effect = ConstAssetPathConfig.effect}, HeroMatch1v1 = {type="HeroMatch1v1Button", sound = "UI_dominant"}, HeroMatch3v3 = {type="HeroMatch1v1Button", sound = "UI_dominant"}, FairSoloTournament = {type="ButtonTimerAndAnim", icon = "zc_icon_txhw", lable = "IDS_FairTournament_Name", sound = "UI_dominant"}, RedEnvelopRain = {type="ButtonTimerAndAnim", icon = "zc_icon_hby", lable = "IDS_RedEnvelopeRain_Icon", sound = "UI_red_packet"}, LiveBroadcast = {type="CommonButton", icon = "zc_icon_zbyg", lable = "IDS_LiveBroadcast_NoticeTitle", sound = "UI_jeweled_04", effect = ConstAssetPathConfig.effect}, AnniversaryPrepare = {type="CommonButton", icon = "zc_icon_xynd", lable = "IDS_LuckyLottery_Title", sound = "UI_jeweled_04", effect = ConstAssetPathConfig.effect}, GoldHeroReprint = {type="CommonButton", icon = "zc_icon_gslz", iconW = 124, lable = "IDS_JP_GoldHeroReprint_Title", sound = "UI_shops"}, GoldHeroPreview = {type="CommonButton", icon = "zc_icon_gslz", iconW = 124, lable = "IDS_GoldGeneralPreview_Preview", sound = "UI_red_packet"}, GoldHeroGroup = {type="GoldHeroGroup"}, GuildFamous = {type="GuildWarButton", icon = "zc_icon_mmwz", lable = "IDS_GuildLeaderInspire_Rank3Guild", sound = "UI_dominant"}, SyncFourCountryWar = {type="ButtonTimerAndAnim", icon = "zc_icon_sjzz", lable = "IDS_SyncFourCountry_Title", sound = "UI_dominant"}, FunctionUpdateNotice = {type="CommonButton", icon = "zc_icon_bbnr", lable = "IDS_FunctionUpdateNotice_Hint_1", sound = "UI_welfare"}, AnnualArchive = {type="CommonButton", icon = "zc_icon_znhg", lable = "IDS_Gift_Survey", sound = "UI_luxian", effect = ConstAssetPathConfig.effect}, GameStreamerPackageBtn1 = {type="CommonButton", icon = "zc_icon_txhw", iconW = 124, lable = "IDS_ZhuBo_EntryName1", sound = "UI_shops"}, GameStreamerPackageBtn2 = {type="CommonButton", icon = "zc_icon_sjzz", iconW = 124, lable = "IDS_ZhuBo_EntryName2", sound = "UI_red_packet"}, GameStreamerPackageBtn3 = {type="CommonButton", icon = "zc_icon_rg", iconW = 124, lable = "IDS_LevelName_XianZhenWuShuang", sound = "UI_red_packet"}, AnnualArchiveJP = {type="CommonButton", icon = "zc_icon_znhg", lable = "IDS_AnniversaryAnnualArchives_Title", sound = "UI_jeweled_04", ConstAssetPathConfig.effect}, WeekTotalCharge = {type="CommonButton", icon = "zc_icon_zqlc", lable = "IDS_TotalCharge_Title", sound = "UI_welfare"}, TeamFairChampionship = {type="ButtonTimerAndAnim", icon = "zc_icon_dfdj", lable = "IDS_ACTIVITYDATA_RewardTips_1_100", sound = "UI_dominant"}, DouYinRechargeReward = {type="CommonGradientLabButton", icon = "dxlb_icon_01", lable = "IDS_DouYinRecharge_Title", sound = "UI_welfare", lowColor = "#FFFFFF", upColor = "#FFE4AA"}, AppPushGift = {type="ButtonTimerAndAnim", icon = "zc_icon_hgts", lable = "IDS_AppPush_CallBackTitle", sound = "UI_foundation"}, AwakenActivity = {type="CommonButton", icon = "zc_icon_jxsl", lable = "IDS_HeroAwaken_ActivityName", sound = "UI_achievement"}, LaterEnter = {type="CommonButton", icon = "zc_icon_hqzx", lable = "IDS_LaterEnter_Title", sound = "UI_welfare"}, SubjectMonth = {type="CommonButton", icon = "zc_icon_hgts", lable = "IDS_HeroMatch1v1_Test", sound = "UI_achievement"}, } function UITownHome_ActivityEntry:CreateOneActiveButton(funcId, templateType, buttonName) if self.kvActivityButton[funcId] then return end local funcBarCfg = DataSheetManager.FunctionBar:GetDataByID(funcId) local newButton if funcBarCfg.Line == 1 then newButton = self:InstantiateCollection(self.group_TopLine1, self.ActivitiesButtonTemplate[ActivitiesButtonCfgs[templateType].type].gameObject) elseif funcBarCfg.Line == 2 then newButton = self:InstantiateCollection(self.group_TopLine2, self.ActivitiesButtonTemplate[ActivitiesButtonCfgs[templateType].type].gameObject) end if ActivitiesButtonCfgs[templateType].type == "CommonButton" or ActivitiesButtonCfgs[templateType].type == "GuildWarButton" then if funcId == MDL.Unlock.FunctionType.SubjectMonth then UIUtils.SetAtlasImage(newButton.img_Icon, "UI_Main", CTL.SubjectMonth.GetTownEntryIcon()) UIUtils.SetLabelText(newButton.lab_Button, CTL.SubjectMonth.GetTownEntryName()) else UIUtils.SetAtlasImage(newButton.img_Icon, "UI_Main", ActivitiesButtonCfgs[templateType].icon) if not string.isNilOrEmpty(ActivitiesButtonCfgs[templateType].lable) then UIUtils.SetLabelText(newButton.lab_Button, Const_IDS[ActivitiesButtonCfgs[templateType].lable]) end end if ActivitiesButtonCfgs[templateType].iconW then newButton.img_Icon.transform:SetSizeDelta(ActivitiesButtonCfgs[templateType].iconW, ActivitiesButtonCfgs[templateType].iconW) end if not string.isNilOrEmpty(ActivitiesButtonCfgs[templateType].effect) then newButton.effect:PlayUIEffect(ActivitiesButtonCfgs[templateType].effect, 0) end if not string.isNilOrEmpty(buttonName) then newButton.Button.gameObject.name = buttonName end UIUtils.SetActive(newButton.group_NewYear, false) elseif ActivitiesButtonCfgs[templateType].type == "ButtonTimerAndAnim" then UIUtils.SetAtlasImage(newButton.img_Icon, "UI_Main", ActivitiesButtonCfgs[templateType].icon) newButton.lab_Button:SetText(UIUtils.GetLocalizedTxt(Const_IDS[ActivitiesButtonCfgs[templateType].lable])) elseif ActivitiesButtonCfgs[templateType].type == "CommonGradientLabButton" then UIUtils.SetAtlasImage(newButton.img_Icon, "UI_Main", ActivitiesButtonCfgs[templateType].icon) UIUtils.SetLabelText(newButton.lab_Button, Const_IDS[ActivitiesButtonCfgs[templateType].lable]) UIUtils.SetTitleText(newButton.lab_Button, 26, ActivitiesButtonCfgs[templateType].lowColor, ActivitiesButtonCfgs[templateType].upColor) end local insertIndex = 1 for i = #self.activityButtonSortIds, 1, -1 do if self.activityButtonSortIds[i] <= funcBarCfg.Sort then insertIndex = i + 1 break end end table.insert(self.activityButtonSortIds, insertIndex, funcBarCfg.Sort) table.insert(self.activityButtonList, insertIndex, newButton) self.kvActivityButton[funcId] = newButton --对按钮进行物理排序 for i = 1, #self.activityButtonList do UIUtils.SetSiblingIndex(self.activityButtonList[i].gameObject.transform, 0) end if funcBarCfg.Show == 0 then if funcId ~= MDL.Unlock.FunctionType.DrawCard or MDL.Player.GetServerDayCount() > DRAW_CARD_DAY then self.needAnimButtons[funcId] = newButton end end self.funcIdToTemplate[funcId] = templateType if funcId == MDL.Unlock.FunctionType.GoldHeroActivity then self.group_GoldHero = newButton elseif funcId == MDL.Unlock.FunctionType.SuperGoldActivity then self.group_SuperGold = newButton elseif funcId == MDL.Unlock.FunctionType.HorseRear then self.group_HorseRear = newButton elseif funcId == MDL.Unlock.FunctionType.Monopoly then self.group_Monopoly = newButton elseif funcId == MDL.Unlock.FunctionType.PayMall then UIUtils.SetActive(newButton.group_NewYear, CTL.NewYear.IsInCfgNewYearPeriod()) end end function UITownHome_ActivityEntry:SetActiveButton(funcId, active, templateType, buttonName) if active then self:CreateOneActiveButton(funcId, templateType, buttonName) UIUtils.SetActive(self.kvActivityButton[funcId].gameObject, active) elseif self.kvActivityButton[funcId] then UIUtils.SetActive(self.kvActivityButton[funcId].gameObject, active) end end function UITownHome_ActivityEntry:SetActivityButtonImage(funcId, imagePath, isFullPath) if self.kvActivityButton[funcId] then if isFullPath then UIUtils.SetImageByAssetBundle(self.kvActivityButton[funcId].img_Icon, imagePath) else UIUtils.SetAtlasImage(self.kvActivityButton[funcId].img_Icon, "UI_Main", ActivitiesButtonCfgs[imagePath].icon) end end end function UITownHome_ActivityEntry:SetActivityButtonLable(funcId, constIds, lableStr, isScrollTxt, scrollSpeed) if self.kvActivityButton[funcId] then if isScrollTxt then if constIds then self.kvActivityButton[funcId].lab_Button:SetText(UIUtils.GetLocalizedTxt(constIds)) else self.kvActivityButton[funcId].lab_Button:SetText(lableStr) end if scrollSpeed then self.kvActivityButton[funcId].lab_Button:SetScrollSpeed(scrollSpeed) end else if constIds then UIUtils.SetLabelText(self.kvActivityButton[funcId].lab_Button, constIds) else UIUtils.SetLabel(self.kvActivityButton[funcId].lab_Button, lableStr) end end end end function UITownHome_ActivityEntry:StopActivityButtonTimer(funcId) if self.kvActivityButton[funcId] then self.kvActivityButton[funcId].timer_Activity:EndTimer() end end function UITownHome_ActivityEntry:SetActivityButtonDHMSStr(funcId, dayStr, hourStr, minStr, secStr) if self.kvActivityButton[funcId] then self.kvActivityButton[funcId].timer_Activity:SetDHMSStr(dayStr, hourStr, minStr, secStr) end end function UITownHome_ActivityEntry:SetActivityButtonDHMSType(funcId, timerFormat, frequency, DHMSType) if self.kvActivityButton[funcId] then self.kvActivityButton[funcId].timer_Activity:SetCustomString(timerFormat, frequency, DHMSType) end end function UITownHome_ActivityEntry:ResetAndBeginActivityTimer(funcId, isRevert, time, cdTime, frequency, timerFormat) if self.kvActivityButton[funcId] then if not timerFormat then self.kvActivityButton[funcId].timer_Activity:ResetAndBeginTimer(isRevert, time, cdTime, frequency) else self.kvActivityButton[funcId].timer_Activity:ResetAndBeginCustomTimer(isRevert, time, cdTime, timerFormat, frequency) end end end function UITownHome_ActivityEntry:SetActivityTipsBg(funcId, isActive) if self.kvActivityButton[funcId] then UIUtils.SetActive(self.kvActivityButton[funcId].img_TimeBG, isActive) end end function UITownHome_ActivityEntry:SetActivityTips(funcId, tipsIds) if self.kvActivityButton[funcId] then UIUtils.SetLabelText(self.kvActivityButton[funcId].txt_Tips, tipsIds) end end function UITownHome_ActivityEntry:SetActivityState(funcId, state, stateCompName) if self.kvActivityButton[funcId] then if stateCompName then self.kvActivityButton[funcId][stateCompName]:SetState(state) else self.kvActivityButton[funcId].state_Activity:SetState(state) end end end function UITownHome_ActivityEntry:SetActivityButtonRed(funcId, red) if self.kvActivityButton[funcId] then self.kvActivityButton[funcId].Button:SetRedPoint(red) end end function UITownHome_ActivityEntry:SetTestFalgActive(funcId, active) if self.kvActivityButton[funcId] then UIUtils.SetActive(self.kvActivityButton[funcId].testFlag, active) end end function UITownHome_ActivityEntry:IsActivityButtonClicked(funcId, clickObj) if self.kvActivityButton[funcId] then if self.kvActivityButton[funcId].Button == clickObj then CTL.Sound.PlayGameSound(ActivitiesButtonCfgs[self.funcIdToTemplate[funcId]].sound) return true end end return false end function UITownHome_ActivityEntry:PlayActivityButtonEffect(funcId, effectPath, effectDuration) if self.kvActivityButton[funcId] then self.kvActivityButton[funcId].effect:PlayUIEffect(effectPath, effectDuration) end end function UITownHome_ActivityEntry:PlayActivityButtonAnim(funcId, animPath, isPlay) if self.kvActivityButton[funcId] then if isPlay then self.kvActivityButton[funcId].img_Anim:PlayAnimByPath(animPath) else self.kvActivityButton[funcId].img_Anim:StopAnim(true) end end end function UITownHome_ActivityEntry:OnCreated() self.kvActivityButton = {} self.activityButtonSortIds = {} self.activityButtonList = {} self.needAnimButtons = {} self.funcIdToTemplate = {} --功能id和模板对应 --金将和彩金将比较特殊 self.group_GoldHero = {} self.group_SuperGold = {} self.group_HorseRear = {} self.group_Monopoly = {} end function UITownHome_ActivityEntry:OnOpened() self:RegistSystemEvent(EventID.UI_Update_FirstChargeInfo, self.UpdateFirstChargeEntry) self:RegistSystemEvent(EventID.UI_HeroMatch1v1_RefreshInfo, self.UpdateHeroMatch1v1Entry) -- 刷新天地群雄入口显隐 self:RegistSystemEvent(EventID.UI_HeroMatch3v3_RefreshInfo, self.UpdateHeroMatch3v3Entry) -- 刷新天地群雄入口显隐 self:RegistSystemEvent(EventID.UI_TeamFairChampionship_RefreshInfo, self.UpdateTeamFairChampionshipEntry) self:RegistSystemEvent(EventID.UI_FairSoloTournament_RefreshModuleInfo, self.UpdateFairSoloTournamentEntry) -- 刷新天地会武入口显隐 self:RegistSystemEvent(EventID.UI_TotalTopUp_RefreshInfo, self.UpdateAccumulatingRechargeEntry) self:RegistSystemEvent(EventID.FunctionUnlockUpdate, self.OnFunctionUnlockUpdate) self:RegistSystemEvent(EventID.UI_TownHome_Btn_Exchange, self.ExchangeBtn) self:RegistSystemEvent(EventID.UI_UpdateServerDay, self.OnServerDayChanged) self:RegistSystemEvent(EventID.New_Day_Refresh, self.RefreshWebActivityBtnRp) self:RegistSystemEvent(EventID.UI_DirectGift_GiftInfoUpdate, self.RefreshMonopolyRp) --红点消息 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.BossMain, self.RefreshBossRedPoint) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GVGFight, self.RefreshBossRedPoint) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.FirstCharge, self.RefreshFirstChargeBtnRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.AccumulatingRechargeGJ, self.RefreshAccumulatingRechargeBtnRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.UIActivity, self.RefreshUIActivityRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.FairPlay, self.RefreshFairPlayRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Shop, self.RefreshShopRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.PayMall, self.RefreshPayMallRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.HorseRear, self.RefreshHorseRearRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GodBeastActivity, self.RefreshGodBeastActivityRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.NewYear, self.RefreshNewYearRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.CommandTheWorld, self.RefreshCommandTheWorldRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.FreeBuy, self.RefreshFreeBuyRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.WarZoneAuction, self.RefreshWarZoneAuctionRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.LuckyLottery, self.RefreshLuckyLotteryRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.FriendRecharge, self.RefreshFriendRechargeRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.RedEnvelopeRain, self.RefreshRedEnvelopRainRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.AnniversaryPrepare, self.RefreshAnniversaryPrepareRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GuildFamousEntry, self.RefreshGuildFamousEntryRp) -- 势力名望入口红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.WeekTotalCharge, self.RefreshWeekTotalChargeRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.HeroMatch1v1, self.RefreshHeroMatch1v1Rp) -- 天地群雄红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.HeroMatch3v3, self.RefreshHeroMatch3v3Rp) -- 天地群雄红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.FairSoloTournament, self.RefreshFairSoloTournamentRp) -- 天下会武红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country_Worship, self.RefreshCountryRp) -- 一统天下膜拜红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country_SignIn, self.RefreshCountryRp) -- 一统天下签到红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.TeamFairChampionship, self.RefreshTeamFairChampionshipRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.FunctionUpdateNotice, self.RefreshFunctionUpdateNoticeEntryRp) -- 版本更新入口红点 self:RegistSystemEvent(EventID.UI_TreasureBowl_UpdateRedPoint, self.RefreshTreasureBowlRp) -- 招财聚宝红点 self:RegistSystemEvent(EventID.UI_Turntable_UpdateRedPoint,self.RefreshTurntableRp) -- 转盘活动 self:RegistSystemEvent(EventID.UI_CycleRecharge_UpdateRedPoint,self.RefreshCycleRechargeRp) --聚宝赠礼(周期累充) self:RegistSystemEvent(EventID.UI_Monopoly_RefreshRp, self.RefreshMonopolyRp) --九州\神州秘宝红点刷新 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.DouYinRechargeReward, self.RefreshDouYinRechargeRewardEntryRp) -- 渠道专属充值返利活动入口红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.AwakenActivity, self.RefreshAwakenActivityEntryRp) --觉醒试炼入口红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.SubjectMonth, self.RefreshSubjectMonthEntryRp) --觉醒试炼入口红点 ---右下角折叠按钮红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.DrawCard, self.RefreshDrawCardRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country, self.RefreshCountryRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.SyncFourCountryWar, self.UpdateFourCountryEntry) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.LaterEnter, self.UpdateLaterEnterBtn) -- 后起之秀 self:RegistSystemEvent(CTL.Welfare.WelfareRpEventId.TownHome, self.RefreshWelfareRp) self:RegistSystemEvent(EventID.UI_SDKUser_Unlock_Update, self.UpdateGMState) self:RegistSystemEvent(EventID.UI_GuildWarStageUpdate, self.ShowGuildWarBtn) self:RegistSystemEvent(EventID.UI_GuildAuctionBtnState_Refresh, self.RefreshGuildAuctionBtnInfo) self:RegistSystemEvent(EventID.Country_OnCountryResetChange, self.RefreshCountryBtn) self:RegistSystemEvent(EventID.UI_Guild_FamousInfoRefresh, self.RefreshGuildFamousEntry) --运营活动按钮刷新 self:RegistSystemEvent(EventID.UI_OperationActivity_InfoChanged, self.RefreshOperationActivityButton) self:RegistSystemEvent(EventID.UI_LevelSelect_LevelFinished, self.RefreshOperationActivityButton) self:RegistSystemEvent(EventID.TeamLevelUpdate, self.RefreshOperationActivityButton) self:RegistSystemEvent(EventID.FunctionUnlockUpdate, self.RefreshOperationActivityButton) self:RegistSystemEvent(EventID.UI_DirectGift_GiftInfoUpdate, self.RefreshOperationActivityButton) self:RegistSystemEvent(EventID.UI_GodBeastActivity_InfoUpdate, self.RefreshOperationActivityButton) self:RegistSystemEvent(EventID.UI_PushGift_TimeRefresh, self.RefreshPushGift) self:RegistSystemEvent(EventID.UI_DirectGift_NewGiftInfoChange, self.RefreshWelfareNewImg) self:RegistSystemEvent(EventID.UI_DirectGift_GiftInfoUpdate, self.RefreshWelfareNewImg) self:RegistSystemEvent(CTL.Hegemony.HegemonyRpEventId.TownHome, self.RefreshHegemonyRp) self:RegistSystemEvent(EventID.UI_VIPInvitation_TimeRefresh, self.UpdateVIPInvitationButton) self:RegistSystemEvent(EventID.UI_TownHome_ShowRightMainBtnGroup, self.ShowOrHideRightMainThreeBtnGroup) self:RegistSystemEvent(EventID.UI_UpdateServerDay, self.RefreshGoldHeroPreviewEntry) self:RegistSystemEvent(EventID.UI_FourCountryWar_StageChange, self.UpdateFourCountryEntry) self:RegistSystemEvent(EventID.UI_AppPushGift_UpdateRecallGiftInfo, self.UpdateAppPushGiftBtn) self:RegistSystemEvent(EventID.UI_AwakenActivity_UpdateAwakenActivityInfo, self.RefreshAwakenActivityEntry) self.goldHeroActivityId = {} self.superGoldActivityId = {} self.horseRearActivityId = {} self.monopolyActivityId = {} self.TRDisappearAniHandle = {} self.TRAppearAniHandle = {} if MDL.OperationActivity.HotControlInfo then local goldHeroTypeData = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.GoldenHero) if goldHeroTypeData then for i, v in pairs(goldHeroTypeData) do if CTL.OperationActivity.IsOperationActivityOpen(v) then self:RegistSystemEvent(CTL.GoldenHeroMain.RpEventId[v.activityId].TownHome, self.RefreshGoldHeroRp) if GameAppInfo.IsJapanesePackage() then --日服整合所有抽卡界面 self:RegistSystemEvent(CTL.GoldenHeroMain.RpEventId[v.activityId].DrawCardAvailable, self.RefreshDrawCardRp) end end end end local superGoldTypeData = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.SuperGold) if superGoldTypeData then for i, v in pairs(superGoldTypeData) do if CTL.OperationActivity.IsOperationActivityOpen(v) then self:RegistSystemEvent(CTL.SuperGoldMain.RpEventId[v.activityId].TownHome, self.RefreshSuperGoldRp) if GameAppInfo.IsJapanesePackage() then --日服整合所有抽卡界面 self:RegistSystemEvent(CTL.SuperGoldMain.RpEventId[v.activityId].DrawCardAvailable, self.RefreshDrawCardRp) end end end end local horseRearTypeData = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.HorseRear) if horseRearTypeData then for i, v in pairs(horseRearTypeData) do if CTL.OperationActivity.IsOperationActivityOpen(v) then self:RegistSystemEvent(CTL.HorseRear.RpEventId[v.activityId].TownHome, self.RefreshHorseRearRp) end end end if GameAppInfo.IsJapanesePackage() then local goldHeroReprint = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.GoldHeroReprint) if goldHeroReprint and GameAppInfo.IsJapanesePackage() then self:RegistSystemEvent(EventID.BagItem_Update, self.RefreshGoldHeroReprintRp) end end end --还需要监听VIP的事件 self:RefreshOperationActivityButton() self:ShowGuildWarBtn() self:RefreshCountryBtn() self:InitBtns() self:InitBtnsRp() self:InitExchangeBtn() self:UpdateGMState() if GameAppInfo.IsJapanesePackage() then --日服百战商店 self:RegistSystemEvent(EventID.UI_Shop_UpdateJPBaiZhanNewSymbolState, self.OnJPBaiZhanNewSymbolStateUpdate) self:OnJPBaiZhanNewSymbolStateUpdate() end self:InitGameStreamerPackageBtn() end function UITownHome_ActivityEntry:UpdateGMState() self:UpdateFirstChargeEntry() end function UITownHome_ActivityEntry:InitBtns() ---这个这么写 是因为 这个按钮 self:UpdateBtns(MDL.Unlock.FunctionType.Battle3V3, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Battle3V3) or MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Boss) or MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.SyncSolo)) self:UpdateBtns(MDL.Unlock.FunctionType.WorldBoss, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WorldBoss) or (CTL.WarZone.IsWarZoneOpen() and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.CountryWorldBoss))) self:UpdateBtns(MDL.Unlock.FunctionType.Country, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Country)) self:UpdateBtns(MDL.Unlock.FunctionType.Shop, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Shop)) self:UpdateBtns(MDL.Unlock.FunctionType.QQGroup, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.QQGroup)) self:UpdateBtns(MDL.Unlock.FunctionType.GuildAuction, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GuildAuction)) self:UpdateBtns(MDL.Unlock.FunctionType.FirstCharge, MDL.FirstCharge.HasEntry()) self:UpdateBtns(MDL.Unlock.FunctionType.FirstChargeAlipay, MDL.FirstCharge.HasEntry()) self:UpdateBtns(MDL.Unlock.FunctionType.DrawCard, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.DrawCard)) self:UpdateBtns(MDL.Unlock.FunctionType.PayMall, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.PayMall)) self:UpdateBtns(MDL.Unlock.FunctionType.WebActivity, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WebActivity)) self:UpdateBtns(MDL.Unlock.FunctionType.GoldHeroPreview, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GoldHeroPreview)) self:UpdateBtns(MDL.Unlock.FunctionType.LiveBroadcast, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LiveBroadcast)) self:UpdateBtns(MDL.Unlock.FunctionType.GuildFamous, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GuildFamous)) self:UpdateBtns(MDL.Unlock.FunctionType.SyncFourCountryWar, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.SyncFourCountryWar)) self:UpdateBtns(MDL.Unlock.FunctionType.FunctionUpdateNotice, CTL.FunctionUpdateNotice.IsCanShowEntrance()) self:UpdateBtns(MDL.Unlock.FunctionType.DouYinRechargeReward, CTL.DouYinRechargeReward.IsCanShowEntrance()) self:UpdateBtns(MDL.Unlock.FunctionType.WeekTotalCharge) self:UpdateBtns(MDL.Unlock.FunctionType.AppPushGift) self:UpdateBtns(MDL.Unlock.FunctionType.LaterEnter) self:UpdateBtns(MDL.Unlock.FunctionType.SubjectMonth) self:RefreshGuildAuctionBtnInfo() self:RefreshWelfareButton() self:UpdateHeroMatch1v1Entry() self:UpdateHeroMatch3v3Entry() self:UpdateFairSoloTournamentEntry() self:UpdateAccumulatingRechargeEntry() self:UpdateVIPInvitationButton() self:UpdateRightMainThreeBtnGroup() self:UpdateAnnualArchiveEntry() self:UpdateAnnualArchiveEntryJP() if GameAppInfo.IsJapanesePackage() then --日服百战商店 self:RegistSystemEvent(EventID.UI_Shop_UpdateJPBaiZhanNewSymbolState, self.OnJPBaiZhanNewSymbolStateUpdate) self:OnJPBaiZhanNewSymbolStateUpdate() self:UpdateWebActivityEntry() else self:SetActiveButton(MDL.Unlock.FunctionType.WebActivity, false, "WebActivity") end self:UpdateRightMainThreeBtnGroup() self:RefreshGoldHeroPreviewEntry() self:UpdateTeamFairChampionshipEntry() self:RefreshAwakenActivityEntry() end function UITownHome_ActivityEntry:OnFunctionUnlockUpdate(id, state) self:UpdateBtns(id, state) self:RefreshWelfareButton() end -- 日服网页版元旦活动入口显隐 function UITownHome_ActivityEntry:UpdateWebActivityEntry() self:SetActiveButton(MDL.Unlock.FunctionType.WebActivity, MDL.WebActivity.CheckIsShowWebActivityEntry(), "WebActivity") local webActivityTimer = 0 local webActivityEndTimer = UTL.Time.GetServerIntervalTimeByTimeId(MDL.WebActivity.WebActivityClosed) if MDL.WebActivity.CheckIsWebActivityInOpeningTime() then if webActivityEndTimer < UTL.Time.TotalSecondsOneDay then self:StartRepeatFunc(self.UpdateWebActivityRP, webActivityEndTimer) else webActivityTimer = UTL.Time.TotalSecondsOneDay - UTL.Time.GetServerSecondsIntervalFromZero() self:StartRepeatFunc(self.UpdateWebActivityRP, webActivityTimer) end else webActivityTimer = UTL.Time.GetServerIntervalTimeByTimeId(MDL.WebActivity.WebActivityOpen) if webActivityTimer > 0 then self:StartRepeatFunc(self.UpdateWebActivityRP, webActivityTimer) end end end function UITownHome_ActivityEntry:UpdateRightMainThreeBtnGroup() local isShow = true if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.DragonArteryRegistArea) or BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.CrossHeroMatchTown) or BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.CrossHeroMatchTown3V3) or BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.CrossFairSoloTournamentTown or BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.SingleFairSoloTournamentTown)) or BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.TeamFairChampionshipTown) then isShow = false end UIUtils.SetActive(self.group_RightMainBtn, isShow) end function UITownHome_ActivityEntry:ShowOrHideRightMainThreeBtnGroup(isShow) UIUtils.SetActive(self.group_RightMainBtn.gameObject, isShow) end -- 金将活动开服预告 function UITownHome_ActivityEntry:RefreshGoldHeroPreviewEntry() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GoldHeroPreview) then local data = MDL.GoldHeroPreview.GetOpenGoldenHeroPreviewData() if data then self:SetActiveButton(MDL.Unlock.FunctionType.GoldHeroPreview, true, "GoldHeroPreview") self:SetActivityButtonImage(MDL.Unlock.FunctionType.GoldHeroPreview, data.ActivityIcon, true) return end end self:SetActiveButton(MDL.Unlock.FunctionType.GoldHeroPreview, false, "GoldHeroPreview") end -- 天下会武入口显隐 function UITownHome_ActivityEntry:UpdateFairSoloTournamentEntry() local hasEntry = MDL.FairSoloTournament.IsShowEntry() self:SetActiveButton(MDL.Unlock.FunctionType.FairSoloTournament, hasEntry, "FairSoloTournament") if not hasEntry then return end self:StopActivityButtonTimer(MDL.Unlock.FunctionType.FairSoloTournament) if hasEntry then self:SetActivityTipsBg(MDL.Unlock.FunctionType.FairSoloTournament, true) local StageCfg = DataSheetManager.FairMatchStage:GetDataByID(MDL.FairSoloTournament.GetCurStageID()) if StageCfg.ID == MDL.FairSoloTournament.ConfigStage.Prepare then --预告期倒计时是到全服榜结算的时间 local timer = CTL.FairSoloTournament.GetLeftTimeFromResult() if timer >= UTL.Time.TotalSecondsOneDay then self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.FairSoloTournament, "{0}:{1}:{2}", 1, 2) else self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.FairSoloTournament, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), 1, 11) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.FairSoloTournament, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), "{0}:{1}:{2}", "{0}:{1}", "{0}:{1}") end self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.FairSoloTournament, false, timer, 0, 1, nil) else self:SetActivityTips(MDL.Unlock.FunctionType.FairSoloTournament, Const_IDS[StageCfg.IconDes]) end end end function UITownHome_ActivityEntry:UpdateFourCountryEntry() self:SetActiveButton(MDL.Unlock.FunctionType.SyncFourCountryWar, MDL.SyncFourCountryWar.IsOpen(), "SyncFourCountryWar") self:SetActivityButtonRed(MDL.Unlock.FunctionType.SyncFourCountryWar, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.SyncFourCountryWar)) if MDL.SyncFourCountryWar.IsOpen() and MDL.SyncFourCountryWar.IsForecast() then local dayStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime1) local hourStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime2) local minStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime3) local secStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime4) self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.SyncFourCountryWar, nil, 1, 9) self.kvActivityButton[MDL.Unlock.FunctionType.SyncFourCountryWar].timer_Activity.IsHideTimeEnd = true self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.SyncFourCountryWar, dayStr, hourStr, minStr, secStr) local offset = MDL.SyncFourCountryWar.GetStageTime()[2] - UTL.Time.GetServerTimestamp() self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.SyncFourCountryWar, false, offset, 0, 1, nil) end end function UITownHome_ActivityEntry:UpdateFunctionUpdateNoticeEntry() self:SetActiveButton(MDL.Unlock.FunctionType.FunctionUpdateNotice, CTL.FunctionUpdateNotice.IsCanShowEntrance(), "FunctionUpdateNotice") self:RefreshFunctionUpdateNoticeEntryRp() end function UITownHome_ActivityEntry:UpdateDouYinRechargeRewardEntry() self:SetActiveButton(MDL.Unlock.FunctionType.DouYinRechargeReward, CTL.DouYinRechargeReward.IsCanShowEntrance(), "DouYinRechargeReward") self:RefreshDouYinRechargeRewardEntryRp() end -- 天下群雄入口显隐 function UITownHome_ActivityEntry:UpdateHeroMatch1v1Entry() local isShowEntry = MDL.HeroMatch1v1.IsShowHeroMatch1v1Entry() self:SetActiveButton(MDL.Unlock.FunctionType.HeroMatch1v1, isShowEntry, "HeroMatch1v1") if not isShowEntry then return end self:SetActivityButtonLable(MDL.Unlock.FunctionType.HeroMatch1v1, Const_IDS.IDS_HeroMatch3v3_Title2, nil, true, 1) local StageCfg = DataSheetManager.MatchStage:GetDataByID(MDL.HeroMatch1v1.GetCurStageID()) self:StopActivityButtonTimer(MDL.Unlock.FunctionType.HeroMatch1v1) if StageCfg.ID == MDL.HeroMatch1v1.Stage.Join then local MatchTime = DataSheetManager.MatchTime:GetDataByID(MDL.HeroMatch1v1.GetCurMatchTimeID()) local timer = MDL.HeroMatch1v1.GetHeroMatch1v1AllInfo().startTm + MatchTime.Day * UTL.Time.TotalSecondsOneDay - UTL.Time.GetServerTimestamp() if timer >= UTL.Time.TotalSecondsOneDay then self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.HeroMatch1v1, "{0}:{1}:{2}", 1, 2) else self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.HeroMatch1v1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), 1, 11) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.HeroMatch1v1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), "{0}:{1}:{2}", "{0}:{1}", "{0}:{1}") end self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.HeroMatch1v1, false, timer, 0, 1) else self:SetActivityTips(MDL.Unlock.FunctionType.HeroMatch1v1, Const_IDS[StageCfg.IconDes]) end end -- 天下群雄3v3入口显隐 function UITownHome_ActivityEntry:UpdateHeroMatch3v3Entry() local isShowEntry = MDL.HeroMatch3v3.IsShowHeroMatch3v3Entry() self:SetActiveButton(MDL.Unlock.FunctionType.HeroMatch3v3, MDL.HeroMatch3v3.IsShowHeroMatch3v3Entry(), "HeroMatch3v3") if not isShowEntry then return end self:SetActivityButtonLable(MDL.Unlock.FunctionType.HeroMatch3v3, Const_IDS.IDS_HeroMatch3v3_Title, nil, true, 1) local StageCfg = DataSheetManager.TeamMatchStage:GetDataByID(MDL.HeroMatch3v3.GetCurStageID()) self:StopActivityButtonTimer(MDL.Unlock.FunctionType.HeroMatch3v3) if StageCfg.ID == MDL.HeroMatch3v3.Stage.Join then local MatchTime = DataSheetManager.TeamMatchTime:GetDataByID(MDL.HeroMatch3v3.GetCurMatchTimeID()) local timer = MDL.HeroMatch3v3.GetHeroMatch3v3AllInfo().startTm + MatchTime.Day * UTL.Time.TotalSecondsOneDay - UTL.Time.GetServerTimestamp() if timer >= UTL.Time.TotalSecondsOneDay then self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.HeroMatch3v3, "{0}:{1}:{2}", 1, 2) else self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.HeroMatch3v3, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), 1, 11) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.HeroMatch3v3, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), "{0}:{1}:{2}", "{0}:{1}", "{0}:{1}") end self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.HeroMatch3v3, false, timer, 0, 1) else self:SetActivityTips(MDL.Unlock.FunctionType.HeroMatch3v3, Const_IDS[StageCfg.IconDes]) end end --**_Lock是右下角面板遮罩的显隐,event_**是按钮本身的显隐,请注意 function UITownHome_ActivityEntry:UpdateBtns(id, state) -- 主按钮(竞技) if id == MDL.Unlock.FunctionType.Battle3V3 or id == MDL.Unlock.FunctionType.Boss or id == MDL.Unlock.FunctionType.SyncSolo then UIUtils.SetActive(self.event_FairPlay, state and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Battle3V3) or MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Boss) or MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.SyncSolo)) -- 主按钮(对抗) elseif id == MDL.Unlock.FunctionType.WorldBoss or id == MDL.Unlock.FunctionType.CountryWorldBoss then UIUtils.SetActive(self.event_WBoss, state and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WorldBoss) or (CTL.WarZone.IsWarZoneOpen() and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.CountryWorldBoss)) or MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GVGFight)) self:RefreshBossRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.BossMain) or CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFight)) -- 主按钮(国家) elseif id == MDL.Unlock.FunctionType.Country then self:RefreshCountryBtn() elseif id == MDL.Unlock.FunctionType.DrawCard then self:SetActiveButton(id, state, "DrawCard", "event_DrawCard") elseif id == MDL.Unlock.FunctionType.Shop then self:SetActiveButton(id, state, "Shop", "event_Shop") self:RefreshShopRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Shop)) elseif id == MDL.Unlock.FunctionType.GuildAuction then self:SetActiveButton(id, state, "Auction") elseif id == MDL.Unlock.FunctionType.FirstCharge or id == MDL.Unlock.FunctionType.FirstChargeAlipay then if GameAppInfo.IsVietnamPackage() then self:SetActiveButton(MDL.Unlock.FunctionType.FirstCharge, MDL.FirstCharge.HasEntry(), "FirstChargeVN") elseif GameAppInfo.IsChinesePackage() then self:SetActiveButton(MDL.Unlock.FunctionType.FirstCharge, MDL.FirstCharge.HasEntry(), "FirstChargeNew") else self:SetActiveButton(MDL.Unlock.FunctionType.FirstCharge, MDL.FirstCharge.HasEntry(), "FirstCharge") end elseif CTL.MultilevelRecharge.IsFunctionRelatedToAccumulatingRechargeGJ(id) then self:UpdateAccumulatingRechargeEntry() elseif id == MDL.Unlock.FunctionType.PayMall then self:SetActiveButton(id, state, "PayMall") elseif id == MDL.Unlock.FunctionType.HeroMatch1v1 then -- 天下群雄 self:UpdateHeroMatch1v1Entry() elseif id == MDL.Unlock.FunctionType.HeroMatch3v3 then -- 天下群雄 self:UpdateHeroMatch3v3Entry() elseif id == MDL.Unlock.FunctionType.FairSoloTournament then -- 天下会武 self:UpdateFairSoloTournamentEntry() elseif id == MDL.Unlock.FunctionType.VIPInvitation then self:SetActiveButton(id, CTL.VIP.IsShowVIPInvitation(), "VIPInvitation") elseif id == MDL.Unlock.FunctionType.QQGroup then self:SetActiveButton(id, state and GameAppInfo.IsShowQQ(), "QQ") elseif id == MDL.Unlock.FunctionType.WebActivity then --【日服】网页版元旦活动入口显隐 self:SetActiveButton(MDL.Unlock.FunctionType.WebActivity, state and MDL.WebActivity.CheckIsShowWebActivityEntry(), "WebActivity") self:RefreshWebActivityBtnRp() elseif id == MDL.Unlock.FunctionType.GoldHeroPreview then self:RefreshGoldHeroPreviewEntry() elseif id == MDL.Unlock.FunctionType.LiveBroadcast then self:SetActiveButton(MDL.Unlock.FunctionType.LiveBroadcast, state and CTL.PushInterface.InTimeLiveBroadcastReward(), "LiveBroadcast") elseif id == MDL.Unlock.FunctionType.GuildFamous then self:RefreshGuildFamousEntry() elseif id == MDL.Unlock.FunctionType.SyncFourCountryWar then self:UpdateFourCountryEntry() elseif id == MDL.Unlock.FunctionType.FunctionUpdateNotice then self:UpdateFunctionUpdateNoticeEntry() elseif id == MDL.Unlock.FunctionType.AnnualArchive then self:UpdateAnnualArchiveEntry() elseif id == MDL.Unlock.FunctionType.AnnualArchiveJP then self:UpdateAnnualArchiveEntryJP() elseif id == MDL.Unlock.FunctionType.WeekTotalCharge or id == MDL.Unlock.FunctionType.MonthTotalCharge or id == MDL.Unlock.FunctionType.WeekAndMonthTotalCharge then self:UpdateWeekTotalCharge() elseif id == MDL.Unlock.FunctionType.DouYinRechargeReward then self:UpdateDouYinRechargeRewardEntry() elseif id == MDL.Unlock.FunctionType.AppPushGift then self:UpdateAppPushGiftBtn() elseif id == MDL.Unlock.FunctionType.AwakenActivity then self:RefreshAwakenActivityEntry() elseif id == MDL.Unlock.FunctionType.LaterEnter then self:UpdateLaterEnterBtn() elseif id == MDL.Unlock.FunctionType.SubjectMonth then self:RefreshSubjectMonthEntry() end end --觉醒试炼活动入口 function UITownHome_ActivityEntry:RefreshAwakenActivityEntry() self:SetActiveButton(MDL.Unlock.FunctionType.AwakenActivity, MDL.AwakenActivity.IsOpen(), "AwakenActivity") self:RefreshAwakenActivityEntryRp() end function UITownHome_ActivityEntry:RefreshAwakenActivityEntryRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.AwakenActivity, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.AwakenActivity)) end --主题月活动入口 function UITownHome_ActivityEntry:RefreshSubjectMonthEntry() self:SetActiveButton(MDL.Unlock.FunctionType.SubjectMonth, CTL.SubjectMonth.IsOpen(), "SubjectMonth") self:RefreshSubjectMonthEntryRp() end function UITownHome_ActivityEntry:RefreshSubjectMonthEntryRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.SubjectMonth, CTL.SubjectMonth.GetEntryRedPoint()) end function UITownHome_ActivityEntry:RefreshWelfareButton() self:SetActiveButton(MDL.Unlock.FunctionType.Welfare, CTL.Welfare.IsWelfareUnlock(), "Welfare") end --商城 function UITownHome_ActivityEntry:OnClickShop() UIManager.OpenView(Const_UI_Lua.UIEnum.UIShopMain) end function UITownHome_ActivityEntry:NeedHideBtn(isShow) UIUtils.SetActive(self.group_NoHide, isShow) UIUtils.SetActive(self.group_TopRight, isShow) EventSystem.Dispatch(EventID.GuildEscort_Town_HideSelf, isShow) EventSystem.Dispatch(EventID.UI_MiniMap_HideSelf, isShow) EventSystem.Dispatch(EventID.UI_ActivityNotice_HideSelf, isShow) EventSystem.Dispatch(EventID.Country_HideBattleList, not isShow) end --isFoldIn:false展开功能面板, true则收起 function UITownHome_ActivityEntry:OnClickExchangeTR(isFoldIn, isEvent) if not isEvent then if isFoldIn then CTL.Sound.PlayGameSound("UI_fold") else CTL.Sound.PlayGameSound("UI_expand") end end if isFoldIn then for i, v in pairs(self.TRAppearAniHandle) do self:StopUIAnimation(v) end else for i, v in pairs(self.TRDisappearAniHandle) do self:StopUIAnimation(v) end end self:TRHideOrShow(isFoldIn) self:PlayTRBtnAnimation(isFoldIn) MDL.HomeMain.SetTownHomeUIFoldStateByType(MDL.HomeMain.TownFoldType.RightTop, not isFoldIn) EventSystem.Dispatch(EventID.UI_TownHome_BtnState_Changed, MDL.HomeMain.TownFoldType.RightTop, not isFoldIn) end function UITownHome_ActivityEntry:FinishAllTRBtnAnimation() for _, v in pairs(self.TRAppearAniHandle) do self:StopUIAnimation(v, false, true) end for _, v in pairs(self.TRDisappearAniHandle) do self:StopUIAnimation(v, false, true) end end --播放主城上面按钮的动画 function UITownHome_ActivityEntry:PlayTRBtnAnimation(isFoldIn) if isFoldIn then for k, v in pairs(self.needAnimButtons) do local playingID = self.TRDisappearAniHandle[k] if playingID == nil then if self.foldInAnimPlayingId == nil then playingID = self:PlayUIAnimation(TRAnimDisappearPath, v.gameObject.transform, true) self.TRDisappearAniHandle[k] = playingID self.foldInAnimPlayingId = playingID else self.TRDisappearAniHandle[k] = self:PlayUIAnimation(TRAnimDisappearPath, v.gameObject.transform) end else self:PlayUIAnimation(playingID) end end else for k, v in pairs(self.needAnimButtons) do UIUtils.SetActive(v.gameObject, true) local playingID = self.TRAppearAniHandle[k] if playingID == nil then self.TRAppearAniHandle[k] = self:PlayUIAnimation(TRAnimAppearPath, v.gameObject.transform, true) else self:PlayUIAnimation(playingID) end end end end function UITownHome_ActivityEntry:OnUIAnimationStoped(playingID) if self.foldInAnimPlayingId == playingID then for k, v in pairs(self.needAnimButtons) do UIUtils.SetActive(v.gameObject, false) end end end function UITownHome_ActivityEntry:TRHideOrShow(isShow) UIUtils.SetActive(self.img_ExchangeHide.gameObject, not isShow) UIUtils.SetActive(self.img_ExchangeShow.gameObject, isShow) end function UITownHome_ActivityEntry:ExchangeBtn(foldType, value, isForce) local state = MDL.HomeMain.GetTownHomeUIFoldStateByType(foldType) if state ~= value or isForce == true then if foldType == MDL.HomeMain.TownFoldType.RightTop then self:OnClickExchangeTR(not value, true) end end end function UITownHome_ActivityEntry:OnServerDayChanged() if MDL.Player.GetServerDayCount() > DRAW_CARD_DAY then self.needAnimButtons[MDL.Unlock.FunctionType.DrawCard] = nil end end function UITownHome_ActivityEntry:InitExchangeBtn() for i, v in pairs(MDL.HomeMain.TownFoldType) do local value = MDL.HomeMain.GetTownHomeUIFoldStateByType(v) self:ExchangeBtn(v, value, true) end --每次打开不播动画 self:FinishAllTRBtnAnimation() end function UITownHome_ActivityEntry:OnButtonClicked(obj) if obj == self.event_ExchangeTR then local value = self.img_ExchangeHide.gameObject.activeInHierarchy self:OnClickExchangeTR(value) elseif obj == self.event_Activities then --活动 UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIActivitiesMain) elseif obj == self.event_WBoss then --Boss一级界面 local isUnlock = CTL.Activities.IsOpen(LuaConst.ActivityType.GVGFight) if CTL.WarZone.IsWarZoneOpen() or isUnlock then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIBossMainPanel) else CTL.WorldBoss.OpenMainPanel() end elseif obj == self.event_Country then CTL.Country.ClickCountryBtn() elseif obj == self.event_FairPlay then --公平 UIManager.OpenView(Const_UI_Lua.UIEnum.UIFairPlayMainPanel) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.HeroMatch1v1, obj) then -- 天下群雄 if MDL.HeroMatch1v1.GetCurMatchTimeID() > MDL.HeroMatch1v1.Enum_BigStage.Advance then CTL.HeroMatch1v1.OpenHeroMatch1v1MainView() else UIManager.OpenView(Const_UI_Lua.UIEnum.UIPushInterfaceHeroMatch1v1) end elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.HeroMatch3v3, obj) then -- 天下群雄 if MDL.HeroMatch3v3.GetCurMatchTimeID() > MDL.HeroMatch3v3.Enum_BigStage.Advance then CTL.HeroMatch3v3.OpenHeroMatch3v3MainView() else UIManager.OpenView(Const_UI_Lua.UIEnum.UIPushInterfaceHeroMatch3v3) end elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.FairSoloTournament, obj) then -- 天下群雄 if MDL.FairSoloTournament.GetCurMatchTimeID() > MDL.FairSoloTournament.Enum_BigStage.FairAdvance then CTL.FairSoloTournament.OpenMain() else UIManager.OpenView(Const_UI_Lua.UIEnum.UIPushInterfaceFairSoloTournament) end elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.PushGift, obj) then --定向礼包 CTL.PushGift.OpenView() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.DrawCard, obj) then CTL.DrawCard.OpenMainView() EventSystem.Dispatch(EventID.BI_ViewClick, BIManager.ViewBIEvent.UITownHome_ActivityEntry_event_DrawCard) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.Welfare, obj) then --这个空表不要删除,因为打开在C#端会存这个table用来做恢复使用 UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIWelfareBasePanel, {}) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.Shop, obj) then self:OnClickShop() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.FirstCharge, obj) then --首充 CTL.FirstCharge.OpenFirstCharge() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AccumulatingRechargeGJ, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.OperationActivity.UIAccumulatingRecharge) --运营活动 elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.HegemonyActivity, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.OperationActivity.UIHegemonyActivity) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.GuildAuction, obj) then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIGuildAuctionBase) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.GuildWar, obj) then CTL.GuildWar.OpenMainView() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.PayMall, obj) then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIPayMallBasePanel) EventSystem.Dispatch(EventID.BI_ViewClick, BIManager.ViewBIEvent.UITownHome_ActivityEntry_event_Store) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.NewYear, obj) then CTL.NewYear.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.GodBeastActivity, obj) then local godBeastData = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.GodBeastActivity) if godBeastData then for i, v in pairs(godBeastData) do local info = MDL.OperationActivity.GetOperationActivityInfo(MDL.OperationActivity.ActivityType.GodBeastActivity, v.activityId) if CTL.OperationActivity.IsOperationActivityOpen(info) then CTL.GodBeastActivity.OpenMainPanel(v.activityId) return end end end elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AnnualArchive, obj) then local linkId = 7 -- 暂时填7,后续会再修改 if GameAppInfo.IsAndroidPackage() then SDKUtil.AndroidCallMethod("openBrowser", linkId, "", true, true) elseif GameAppInfo.IsiOSPackage() then SDKUtil.OpenBrowserByWebId(linkId) end elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AnnualArchiveJP, obj) then if not GameAppInfo.IsJapanesePackage() then return end local targetUrl if GameAppInfo.IsOfficalPackage() then targetUrl = string.format(LuaConst.AnnualArchiveJP.Prod, MDL.Login.GetServerId(), MDL.Player.GetRoleId()) else targetUrl = string.format(LuaConst.AnnualArchiveJP.QA, MDL.Login.GetServerId(), MDL.Player.GetRoleId()) end UnityEngine.Application.OpenURL(targetUrl) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.CommandTheWorld, obj) then CTL.CommandTheWorld.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.WarZoneAuction, obj) then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIWarZoneAuctionMain) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.VIPInvitation, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIVIPInvitation) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.FriendRecharge, obj) then -- 金兰邀约(组队充值) CTL.FriendRecharge.OpenFriendRechargeMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.RedEnvelopeRain, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIRedEnvelopeRainMain) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.FreeBuy, obj) then --0元购 UIManager.OpenView(Const_UI_Lua.UIEnum.OperationActivity.UIFreeBuy) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.LuckyLottery, obj) then --幸运扭蛋 CTL.LuckyLottery.OpenLotteryPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.TreasureBowl, obj) then --聚宝盆 CTL.TreasureBowl.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.Turntable, obj) then --转盘 CTL.Turntable.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.CycleRecharge, obj) then --聚宝赠礼(周期累充) CTL.CycleRecharge.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.GoldHeroReprint, obj) then -- 日服金将复刻抽卡 UIManager.OpenView(Const_UI_Lua.UIEnum.UIGoldHeroReprint) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.QQGroup, obj) then --QQ群 local isSuccess = false if UNITY_IOS and not UNITY_EDITOR then local key = "aTZLrQSLWLe3M89xkz6yXJXPzmFRS/gqaX2VFpt5g2hBFxWerofllHSPJrHTA2s0" local groupNum = "784429859" isSuccess = SDKUtil.JoinQQGroup(key, groupNum) elseif UNITY_ANDROID and not UNITY_EDITOR then local key = "3ZG5wt8zR_1WucT6843-8GqnLXr68YK_" isSuccess = SDKUtil.JoinQQGroup(key) elseif GameAppInfo.IsPCPackage() then UnityEngine.Application.OpenURL(QQGroupPCUrl) isSuccess = true end if isSuccess == false then CTL.Tips.AddTipsMsg(Const_IDS["IDS_QQFailed"]) end --QQ拉群一次性红点 if MDL.RedPoint.GetOneTimeRedPointInfoByType(MDL.RedPoint.RedPointType.QQ) == 0 then CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.QQ) MDL.RedPoint.OneTimeRedPointRequest(MDL.RedPoint.RedPointType.QQ, 1, false) end elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.WebActivity, obj) then --【日服】网页版元旦活动入口显隐 PersistentData.PlayerData:Set(MDL.WebActivity.SaveRPTime, UTL.Time.GetServerTimestamp(), true) if MDL.WebActivity.CheckIsWebActivityInOpeningTime() then CTL.WebActivity.OpenWebActivity() else CTL.Tips.AddTipsMsg(Const_IDS["IDS_GoldHeroActivity_TimeHint3"]) self:SetActiveButton(MDL.Unlock.FunctionType.WebActivity, MDL.WebActivity.CheckIsShowWebActivityEntry(), "WebActivity") end self:RefreshWebActivityBtnRp() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.Country, obj) then CTL.Country.OpenCountryResetPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.GoldHeroPreview, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGoldenHeroPreview) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AnniversaryPrepare, obj) then CTL.AnniversaryPrepare.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.LiveBroadcast, obj) then CTL.PushInterface.OpenPushInterface(CTL.PushInterface.PushInterfaceEnum.LiveBroadcast2) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.GuildFamous, obj) then MDL.RedPoint.OneTimeRedPointRequest(MDL.RedPoint.RedPointType.GuildFamousEntry, 1, true) UIManager.OpenView(Const_UI_Lua.UIEnum.UIGuildFamousPop) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.SyncFourCountryWar, obj) then CTL.SyncFourCountryWar.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.FunctionUpdateNotice, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIFunctionUpdateNotice) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AnchorChallenge, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIMaterialLevel, {id = LuaConst.ActivityType.ResourcesChapterChild205}) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AnchorShow, obj) then MDL.LevelSelect.EnterNormalPVEFuben(627010, 627010) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.RogueLike, obj) then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIRogueSelectHeroPanel) elseif self:IsActivityButtonClicked(MDL.CycleRecharge.GetFunctionID(), obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIAccumulatedCharge) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.TeamFairChampionship, obj) then CTL.TeamFairChampionship.OpenMainPanel() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AppPushGift, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIPushInterfaceRegression) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.DouYinRechargeReward, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIDouYinRechargeReward,{isEntry = true}) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.AwakenActivity, obj) then CTL.AwakenActivity.OpenUIAwakenActivity() elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.LaterEnter, obj) then UIManager.OpenView(Const_UI_Lua.UIEnum.UILaterEnterMain) elseif self:IsActivityButtonClicked(MDL.Unlock.FunctionType.SubjectMonth, obj) then CTL.SubjectMonth.OpenMainView() else for i, v in ipairs(self.group_GoldHero) do if obj == v.event_GoldenHero then CTL.GoldenHeroMain.OpenMainView(self.goldHeroActivityId[i]) local heroType = MDL.GoldenHeroMain.GetHeroTypeByActivityId(self.goldHeroActivityId[i]) local goldHeroActivityModeData = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(heroType) if goldHeroActivityModeData then CTL.Sound.PlayGameSound(goldHeroActivityModeData.UIClickSound) end return end end for i, v in ipairs(self.group_SuperGold) do if obj == v.event_GoldenHero then CTL.SuperGoldMain.OpenMainView(self.superGoldActivityId[i]) local heroType = MDL.SuperGoldMain.GetHeroTypeByActivityId(self.superGoldActivityId[i]) local modeData = DataSheetManager.SuperGoldActivityModeData:GetDataByHeroType(heroType) if modeData then CTL.Sound.PlayGameSound(modeData.UIClickSound) end end end for i, v in ipairs(self.group_HorseRear) do if obj == v.Button then CTL.HorseRear.OpenMainPanel(self.horseRearActivityId[i]) CTL.Sound.PlayGameSound("UI_horse_feed") end end for i, v in ipairs(self.group_Monopoly) do if obj == v.Button then CTL.Monopoly.OpenMainPanel(self.monopolyActivityId[i]) CTL.Sound.PlayGameSound("UI_shops") end end end end --首充按钮红点 function UITownHome_ActivityEntry:RefreshFirstChargeBtnRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.FirstCharge, active) end function UITownHome_ActivityEntry:UpdateFirstChargeEntry() self:SetActiveButton(MDL.Unlock.FunctionType.FirstCharge, MDL.FirstCharge.HasEntry(), "FirstCharge") end function UITownHome_ActivityEntry:UpdateAnnualArchiveEntry() if GameAppInfo.IsPCPackage() then --PC包不显示入口 return end self:SetActiveButton(MDL.Unlock.FunctionType.AnnualArchive, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.AnnualArchive), "AnnualArchive") end function UITownHome_ActivityEntry:UpdateAnnualArchiveEntryJP() if GameAppInfo.IsJapanesePackage() then self:SetActiveButton(MDL.Unlock.FunctionType.AnnualArchiveJP, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.AnnualArchiveJP), "AnnualArchiveJP") end end function UITownHome_ActivityEntry:UpdateVIPInvitationButton() self:SetActiveButton(MDL.Unlock.FunctionType.VIPInvitation, CTL.VIP.IsShowVIPInvitation(), "VIPInvitation") end --累充送郭嘉按钮 function UITownHome_ActivityEntry:UpdateAccumulatingRechargeEntry() local value = CTL.MultilevelRecharge.IsShowAccumulatingRechargeGJ() self:SetActiveButton(MDL.Unlock.FunctionType.AccumulatingRechargeGJ, value, "AccumulatingRecharge") end --累充送郭嘉按钮红点 function UITownHome_ActivityEntry:RefreshAccumulatingRechargeBtnRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.AccumulatingRechargeGJ, active) end function UITownHome_ActivityEntry:RefreshOperationActivityButton() --霸业之始入口 local hegemonyType = MDL.OperationActivity.ActivityType.Hegemony self:SetActiveButton(MDL.Unlock.FunctionType.HegemonyActivity, CTL.OperationActivity.IsOperationActivityTypeOpen(hegemonyType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(hegemonyType), "Hegemony") -- 神兽活动入口 彩金区分显示 self:RefreshOAGodBeastActivityButton() --新年入口 local newYearType = MDL.OperationActivity.ActivityType.NewYear if CTL.OperationActivity.IsOperationActivityTypeEntryOpen(newYearType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(newYearType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.NewYear) then local info = MDL.OperationActivity.GetOperationActivityInfo(newYearType) local name = "" if info then for i, v in pairs(info) do local modeData = MDL.OperationActivity.ActivityBaseData[newYearType]:GetDataByActivityID(i) local hotControlInfo = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(newYearType, i) name = hotControlInfo.ActivityName ActivitiesButtonCfgs.NewYear.icon = modeData.TownIcon ActivitiesButtonCfgs.NewYear.effect = modeData.TownIconEffect break end end self:SetActiveButton(MDL.Unlock.FunctionType.NewYear, true, "NewYear") self:RefreshNewYearRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.NewYear)) self:SetActivityButtonLable(MDL.Unlock.FunctionType.NewYear, nil, name) else self:SetActiveButton(MDL.Unlock.FunctionType.NewYear, false, "NewYear") end --周年预热 self:RefreshOAAnniversaryPrepareButton() --号令天下入口 self:SetActiveButton(MDL.Unlock.FunctionType.CommandTheWorld, CTL.CommandTheWorld.IsShowActivity(), "CommandTheWorld") --大拍卖(战区拍卖)入口 local warZoneAuctionType = MDL.OperationActivity.ActivityType.WarZoneAuction local show = CTL.OperationActivity.IsOperationActivityTypeEntryOpen(warZoneAuctionType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(warZoneAuctionType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.WarZoneAuction) self:SetActiveButton(MDL.Unlock.FunctionType.WarZoneAuction, show, "WarZoneAuction") if show then MDL.WarZoneAuction.WarZoneAuctionRefreshRequest() end self:RefreshOAGoldHeroButton() self:RefreshOASuperGoldButton() --养马入口 self:RefreshOAHorseRearButton() --宝物活动入口 self:RefreshMonopolyButton() self:RefreshPushGift() --0元购入口 self:SetActiveButton(MDL.Unlock.FunctionType.FreeBuy, CTL.FreeBuy.IsCanShowEntrance(), "FreeBuy") local luckyLotteryType = MDL.OperationActivity.ActivityType.LuckyLottery if GameAppInfo.IsJapanesePackage() then self:SetActiveButton(MDL.Unlock.FunctionType.LuckyLottery, CTL.OperationActivity.IsOperationActivityTypeOpen(luckyLotteryType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(luckyLotteryType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LuckyLottery), "LuckyLotteryJP") else self:SetActiveButton(MDL.Unlock.FunctionType.LuckyLottery, CTL.OperationActivity.IsOperationActivityTypeOpen(luckyLotteryType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(luckyLotteryType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.LuckyLottery), "LuckyLottery") end local treasureBowlType = MDL.OperationActivity.ActivityType.TreasureBowl self:RefreshTreasureBowlRp() self:SetActiveButton(MDL.Unlock.FunctionType.TreasureBowl, CTL.OperationActivity.IsOperationActivityTypeOpen(treasureBowlType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(treasureBowlType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.TreasureBowl), "TreasureBowl") if GameAppInfo.IsJapanesePackage() then self:RefreshOAGoldHeroReprintButton() else self:SetActiveButton(MDL.Unlock.FunctionType.GoldHeroReprint, false, "GoldHeroReprint") end self:RefreshOAFriendRechargeButton() -- 红包雨入口 self:UpdateRedEnvelopRain() --转盘活动 self:UpdateTurntable() --聚宝赠礼(周期累充) self:UpdateCycleRecharge() --版本更新介绍入口 self:UpdateFunctionUpdateNoticeEntry() self:UpdateDouYinRechargeRewardEntry() self:UpdateLaterEnterBtn() end function UITownHome_ActivityEntry:RefreshPushGift() if not MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.PushGift) then self:SetActiveButton(MDL.Unlock.FunctionType.PushGift, false, "PushGift") return end --定向礼包不走通用的运营活动时间,应该拿所有定向礼包的结束时间来判断 local pushGiftType = MDL.OperationActivity.ActivityType.PushGift if MDL.PushGift.GetIfOpen() and CTL.OperationActivity.IsOperationActivityTypeUnlock(pushGiftType) then self:SetActiveButton(MDL.Unlock.FunctionType.PushGift, true, "PushGift") local timeOffset = MDL.PushGift.GetMinTimeOffset() if timeOffset then self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.PushGift, false, timeOffset, 0, 1, "{0}:{1}:{2}") else self:StopActivityButtonTimer(MDL.Unlock.FunctionType.PushGift) end else self:StopActivityButtonTimer(MDL.Unlock.FunctionType.PushGift) self:SetActiveButton(MDL.Unlock.FunctionType.PushGift, false, "PushGift") end end local function SortGoldHeroActivity(a, b) return a.ActivityID < b.ActivityID end function UITownHome_ActivityEntry:RefreshOAGoldHeroButton() local index = 1 if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GoldHeroActivity) then local goldHeroType = MDL.OperationActivity.ActivityType.GoldenHero local goldHeroTypeData = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(goldHeroType) local goldHeroInfoList = MDL.OperationActivity.GetOperationActivityInfo(goldHeroType) if goldHeroTypeData and goldHeroInfoList then local list = {} for i, v in pairs(goldHeroTypeData) do table.insert(list, v) end --需要排序一下,为了防止主界面的按钮顺序不稳定 table.sort(list, SortGoldHeroActivity) for i, v in ipairs(list) do if CTL.OperationActivity.IsOperationActivityUnlock(v) then local activityId = v.ActivityID local info = goldHeroInfoList[activityId] local isOpen = CTL.OperationActivity.IsOperationActivityOpen(info) local isStillGoing = CTL.OperationActivity.IsOperationActivityStillGoing(goldHeroType, activityId) if isOpen and isStillGoing then if #self.group_GoldHero <= 0 then self:SetActiveButton(MDL.Unlock.FunctionType.GoldHeroActivity, true, "GoldHeroGroup") end local btnCell = self.group_GoldHero[index] if not btnCell then btnCell = self:InstantiateCollection(self.group_GoldHero, self.ActivitiesButtonTemplate.cell_GoldenHero.gameObject) end UIUtils.SetActive(btnCell.gameObject, true) self.goldHeroActivityId[index] = activityId --按钮的图标和名称 local heroType = MDL.GoldenHeroMain.GetHeroTypeByActivityId(activityId) local heroTypeData = DataSheetManager.GoldHeroActivityModeData:GetDataByHeroType(heroType) UIUtils.SetImageByAssetBundle(btnCell.img_GoldenHero, heroTypeData.TownIcon) UIUtils.SetLabelText(btnCell.lab_GoldenHero, Const_IDS[heroTypeData.TownName]) if Localization.IsThailand() then btnCell.lab_GoldenHero_Scroll:SetText(UIUtils.GetLocalizedTxt(Const_IDS[heroTypeData.TownName])) end btnCell.event_GoldenHero:SetRedPoint(MDL.RedPoint.GetNodeStateByMultiKey(CTL.GoldenHeroMain.RpEventId[activityId].TownHome)) btnCell.effect_GoldenHero:PlayUIEffect() index = index + 1 end end end end end if #self.group_GoldHero > 0 then for i = #self.group_GoldHero, index, -1 do self:DestroyCollection(self.group_GoldHero, i) self.goldHeroActivityId[i] = nil end end end function UITownHome_ActivityEntry:RefreshOASuperGoldButton() local index = 1 if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.SuperGoldActivity) then local superGoldType = MDL.OperationActivity.ActivityType.SuperGold local superGoldTypeData = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(superGoldType) local superGoldInfoList = MDL.OperationActivity.GetOperationActivityInfo(superGoldType) if superGoldTypeData and superGoldInfoList then local list = {} for i, v in pairs(superGoldTypeData) do table.insert(list, v) end --需要排序一下,为了防止主界面的按钮顺序不稳定 table.sort(list, SortGoldHeroActivity) for i, v in ipairs(list) do if CTL.OperationActivity.IsOperationActivityUnlock(v) then local activityId = v.ActivityID local info = superGoldInfoList[activityId] local isOpen = CTL.OperationActivity.IsOperationActivityOpenEntry(info) local isStillGoing = CTL.OperationActivity.IsOperationActivityStillGoing(superGoldType, activityId) if isOpen and isStillGoing then if #self.group_SuperGold <= 0 then self:SetActiveButton(MDL.Unlock.FunctionType.SuperGoldActivity, true, "GoldHeroGroup") end local btnCell = self.group_SuperGold[index] if not btnCell then btnCell = self:InstantiateCollection(self.group_SuperGold, self.ActivitiesButtonTemplate.cell_GoldenHero.gameObject) end UIUtils.SetActive(btnCell.gameObject, true) self.superGoldActivityId[index] = activityId --按钮的图标和名称 local heroType = MDL.SuperGoldMain.GetHeroTypeByActivityId(activityId) local heroTypeData = DataSheetManager.SuperGoldActivityModeData:GetDataByHeroType(heroType) UIUtils.SetImageByAssetBundle(btnCell.img_GoldenHero, heroTypeData.TownIcon) UIUtils.SetLabelText(btnCell.lab_GoldenHero, Const_IDS[heroTypeData.TownName]) if Localization.IsThailand() then btnCell.lab_GoldenHero_Scroll:SetText(UIUtils.GetLocalizedTxt(Const_IDS[heroTypeData.TownName])) end btnCell.event_GoldenHero:SetRedPoint(MDL.RedPoint.GetNodeStateByMultiKey(CTL.SuperGoldMain.RpEventId[activityId].TownHome)) btnCell.effect_GoldenHero:PlayUIEffect(heroTypeData.TownIconEffect, -1) index = index + 1 end end end end end if #self.group_SuperGold > 0 then for i = #self.group_SuperGold, index, -1 do self:DestroyCollection(self.group_SuperGold, i) self.superGoldActivityId[i] = nil end end end -- 养马入口 彩金区分显示 function UITownHome_ActivityEntry:RefreshOAHorseRearButton() local horseRearType = MDL.OperationActivity.ActivityType.HorseRear local horseRearFunctionId = MDL.Unlock.FunctionType.HorseRear local index = 1 if MDL.Unlock.IsUnlock(horseRearFunctionId) then local horseRearTypeData = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(horseRearType) local horseRearInfoList = MDL.OperationActivity.GetOperationActivityInfo(horseRearType) if horseRearTypeData and horseRearInfoList then local list = {} for i, v in pairs(horseRearTypeData) do table.insert(list, v) end --需要排序一下,为了防止主界面的按钮顺序不稳定 table.sort(list, SortGoldHeroActivity) for i, v in ipairs(list) do if CTL.OperationActivity.IsOperationActivityUnlock(v) then local activityId = v.ActivityID local info = horseRearInfoList[activityId] local isOpen = CTL.OperationActivity.IsOperationActivityOpen(info) local isStillGoing = CTL.OperationActivity.IsOperationActivityStillGoing(horseRearType, activityId) if isOpen and isStillGoing then if #self.group_HorseRear <= 0 then self:SetActiveButton(horseRearFunctionId, true, "GoldHeroGroup") end local btnCell = self.group_HorseRear[index] if not btnCell then btnCell = self:InstantiateCollection(self.group_HorseRear, self.ActivitiesButtonTemplate.cell_HorseRear.gameObject) end UIUtils.SetActive(btnCell.gameObject, true) self.horseRearActivityId[index] = activityId --按钮的图标和名称 local button = self.kvActivityButton[horseRearFunctionId] if CTL.HorseRear.IsSuperGold(activityId) then UIUtils.SetImageByAssetBundle(btnCell.img_Icon, ConstAssetPathConfig.AssetPath172) UIUtils.SetLabelText(btnCell.lab_HorseRearDark, Const_IDS.IDS_HorseActivity_High_Title) btnCell.effect_Activity:PlayUIEffect(ConstAssetPathConfig.effect, -1) btnCell.state_Activity:SetState(1) else UIUtils.SetImageByAssetBundle(btnCell.img_Icon, ConstAssetPathConfig.AssetPath173) UIUtils.SetLabelText(btnCell.lab_Button, Const_IDS.IDS_HorseActivity_Title) btnCell.state_Activity:SetState(0) end if Localization.IsThailand() then local btnTitle = CTL.HorseRear.IsSuperGold(activityId) and UIUtils.GetLocalizedTxt(Const_IDS.IDS_HorseActivity_High_Title) or UIUtils.GetLocalizedTxt(Const_IDS.IDS_HorseActivity_Title) btnCell.lab_Button_Scroll:SetText(btnTitle) btnCell.loc_Txt:SetState(2) end btnCell.Button:SetRedPoint(MDL.RedPoint.GetNodeStateByMultiKey(CTL.HorseRear.RpEventId[activityId].TownHome)) index = index + 1 end end end end end if #self.group_HorseRear > 0 then for i = #self.group_HorseRear, index, -1 do self:DestroyCollection(self.group_HorseRear, i) self.horseRearActivityId[i] = nil end end end --九州秘宝\神州秘宝 彩金区分显示 function UITownHome_ActivityEntry:RefreshMonopolyButton() local monopolyType = MDL.OperationActivity.ActivityType.Monopoly local monopolyFunctionId = MDL.Unlock.FunctionType.Monopoly local index = 1 if MDL.Unlock.IsUnlock(monopolyFunctionId) then local monopolyTypeData = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(monopolyType) local monopolyInfoList = MDL.OperationActivity.GetOperationActivityInfo(monopolyType) if monopolyTypeData and monopolyInfoList then local list = {} for _, v in pairs(monopolyTypeData) do table.insert(list, v) end --需要排序一下,为了防止主界面的按钮顺序不稳定 table.sort(list, SortGoldHeroActivity) for _, v in ipairs(list) do if CTL.OperationActivity.IsOperationActivityUnlock(v) then local activityId = v.ActivityID local info = monopolyInfoList[activityId] local isOpen = CTL.OperationActivity.IsOperationActivityOpen(info) if isOpen then if #self.group_Monopoly <= 0 then self:SetActiveButton(monopolyFunctionId, true, "GoldHeroGroup") end local btnCell = self.group_Monopoly[index] if not btnCell then btnCell = self:InstantiateCollection(self.group_Monopoly, self.ActivitiesButtonTemplate.cell_Monopoly.gameObject) end UIUtils.SetActive(btnCell.gameObject, true) self.monopolyActivityId[index] = activityId --按钮的图标和名称 if CTL.Monopoly.IsSuperGold(activityId) then btnCell.state_Activity:SetState(1) else btnCell.state_Activity:SetState(0) end if Localization.IsThailand() then local btnTitle = CTL.Monopoly.IsSuperGold(activityId) and UIUtils.GetLocalizedTxt(Const_IDS["IDS_Monopoly_High_Title"]) or UIUtils.GetLocalizedTxt(Const_IDS["IDS_Monopoly_Title"]) btnCell.lab_Button_Scroll:SetText(btnTitle) btnCell.loc_Txt:SetState(2) end btnCell.Button:SetRedPoint(MDL.Monopoly.HasMonopolyRp(activityId) or CTL.Monopoly.HasGiftRp(activityId)) index = index + 1 end end end end end if #self.group_Monopoly > 0 then for i = #self.group_Monopoly, index, -1 do self:DestroyCollection(self.group_Monopoly, i) self.monopolyActivityId[i] = nil end end end -- 日服金将复刻抽卡 function UITownHome_ActivityEntry:RefreshOAGoldHeroReprintButton() local activityId = MDL.GoldHeroReprint.GetGoldHeroReprintActivityID() if activityId and activityId > 0 then local UpHeroID = MDL.OperationActivity.GoldHeroReprintShowHero:GetDataByActivityID_OrderID(activityId, 1).HeroShowID self:SetActiveButton(MDL.Unlock.FunctionType.GoldHeroReprint, GameAppInfo.IsJapanesePackage() and MDL.GoldHeroReprint.CheckIsShowEntry() or false, "GoldHeroReprint") self:SetActivityButtonImage(MDL.Unlock.FunctionType.GoldHeroReprint, MDL.GoldHeroReprint.GetTownHomeIconByGoldenHeroID(UpHeroID), true) self:RefreshGoldHeroReprintRp() else self:SetActiveButton(MDL.Unlock.FunctionType.GoldHeroReprint, false, "GoldHeroReprint") end end -- 金兰邀约入口显隐 function UITownHome_ActivityEntry:RefreshOAFriendRechargeButton() local friendRechargeType = MDL.OperationActivity.ActivityType.FriendRecharge local activityId = MDL.FriendRecharge.GetFriendRechargeActivityID() if activityId > 0 then local isShowEntry = CTL.OperationActivity.IsOperationActivityTypeOpen(friendRechargeType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(friendRechargeType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.FriendRecharge) if isShowEntry then self:SetActiveButton(MDL.Unlock.FunctionType.FriendRecharge, CTL.OperationActivity.IsOperationActivityOpen(MDL.OperationActivity.GetOperationActivityInfo(friendRechargeType, activityId)), "FriendRecharge") local backGround = MDL.OperationActivity.ActivityBaseData[friendRechargeType]:GetDataByActivityID(activityId) self:SetActivityButtonImage(MDL.Unlock.FunctionType.FriendRecharge, backGround.TownIcon, true) self:SetActivityButtonLable(MDL.Unlock.FunctionType.FriendRecharge, Const_IDS[backGround.TownName]) if not string.isNilOrEmpty(backGround.TownIconEffect) then self:PlayActivityButtonEffect(MDL.Unlock.FunctionType.FriendRecharge, backGround.TownIconEffect, -1) end end else self:SetActiveButton(MDL.Unlock.FunctionType.FriendRecharge, false, "FriendRecharge") end end -- 周年预热入口 function UITownHome_ActivityEntry:RefreshOAAnniversaryPrepareButton() local anniversaryPrepareType = MDL.OperationActivity.ActivityType.AnniversaryPrepare local anniversaryPrepareId = MDL.AnniversaryPrepare.GetActivityID() if CTL.OperationActivity.IsOperationActivityTypeEntryOpen(anniversaryPrepareType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(anniversaryPrepareType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.AnniversaryPrepare) then local info = MDL.OperationActivity.GetOperationActivityInfo(anniversaryPrepareType, anniversaryPrepareId) if info and CTL.OperationActivity.IsOperationActivityOpen(info) then self:SetActiveButton(MDL.Unlock.FunctionType.AnniversaryPrepare, true, "AnniversaryPrepare") local modeData = MDL.OperationActivity.ActivityBaseData[anniversaryPrepareType]:GetDataByActivityID(anniversaryPrepareId) self:SetActivityButtonImage(MDL.Unlock.FunctionType.AnniversaryPrepare, modeData.TownIcon, true) local hotControlInfo = MDL.OperationActivity.HotControlInfo:GetDataByActivityType_ActivityID(anniversaryPrepareType, anniversaryPrepareId) if string.isNilOrEmpty(modeData.TownName) then self:SetActivityButtonLable(MDL.Unlock.FunctionType.AnniversaryPrepare, nil, hotControlInfo.ActivityName) else self:SetActivityButtonLable(MDL.Unlock.FunctionType.AnniversaryPrepare, Const_IDS[modeData.TownName]) end self:PlayActivityButtonEffect(MDL.Unlock.FunctionType.AnniversaryPrepare, modeData.TownIconEffect, 0) else self:SetActiveButton(MDL.Unlock.FunctionType.AnniversaryPrepare, false, "AnniversaryPrepare") end else self:SetActiveButton(MDL.Unlock.FunctionType.AnniversaryPrepare, false, "AnniversaryPrepare") end end -- 神兽活动入口 彩金区分显示 function UITownHome_ActivityEntry:RefreshOAGodBeastActivityButton() local GodBeastType = MDL.OperationActivity.ActivityType.GodBeastActivity local godBeastActivityFunctionId = MDL.Unlock.FunctionType.GodBeastActivity local isShowGodBeastButton = CTL.OperationActivity.IsOperationActivityTypeOpen(GodBeastType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(GodBeastType) and MDL.Unlock.IsUnlock(godBeastActivityFunctionId) self:SetActiveButton(godBeastActivityFunctionId, isShowGodBeastButton, "GodBeastActivity", "event_GodBeastActivity") if isShowGodBeastButton then local godBeastActivityBasicData = MDL.OperationActivity.ActivityBaseData[GodBeastType]:GetDataByActivityID(MDL.GodBeastActivity.GetActivityId()) local button = self.kvActivityButton[godBeastActivityFunctionId] self:SetActivityButtonImage(godBeastActivityFunctionId, godBeastActivityBasicData.TownIcon, true) self:SetActivityButtonLable(godBeastActivityFunctionId, Const_IDS[godBeastActivityBasicData.TownName]) if CTL.GodBeastActivity.IsSuperGold() then UIUtils.SetLabelText(button.lab_GodBeastDark, Const_IDS[godBeastActivityBasicData.TownName]) self:PlayActivityButtonEffect(godBeastActivityFunctionId, godBeastActivityBasicData.TownIconEffect, -1) self:SetActivityState(godBeastActivityFunctionId, 1) else self:SetActivityState(godBeastActivityFunctionId, 0) end end end function UITownHome_ActivityEntry:UpdateRedEnvelopRain() local redEnvelopeRainType = MDL.OperationActivity.ActivityType.RedEnvelopeRain local redEnvelopeRainShow = CTL.OperationActivity.IsOperationActivityTypeEntryOpen(redEnvelopeRainType) and CTL.OperationActivity.IsOperationActivityTypeUnlock(redEnvelopeRainType) and MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.RedEnvelopeRain) self:SetActiveButton(MDL.Unlock.FunctionType.RedEnvelopeRain, redEnvelopeRainShow, "RedEnvelopRain") if redEnvelopeRainShow then local isInForeshow, residueForeshowTime = CTL.RedEnvelopRain.ResidueRedEnvelopRainForeshowTime() if residueForeshowTime > 0 then if isInForeshow then self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.RedEnvelopeRain, UIUtils.GetLocalizedTxt(Const_IDS.IDS_RedEnvelopeRain_IconTips), 1, 5) self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.RedEnvelopeRain, false, residueForeshowTime, 0, 1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_RedEnvelopeRain_IconTips)) self:StartRepeatFunc(self.UpdateRedEnvelopRain, residueForeshowTime + 1, 1) -- 加一秒 时间相等的极限情况 self:PlayActivityButtonAnim(MDL.Unlock.FunctionType.RedEnvelopeRain, ConstAssetPathConfig.AssetPath174, true) else self:StopActivityButtonTimer(MDL.Unlock.FunctionType.RedEnvelopeRain) self:SetActivityTipsBg(MDL.Unlock.FunctionType.RedEnvelopeRain, false) self:PlayActivityButtonAnim(MDL.Unlock.FunctionType.RedEnvelopeRain, ConstAssetPathConfig.AssetPath174, false) self:StartRepeatFunc(self.UpdateRedEnvelopRain, residueForeshowTime + 1, 1) -- 加一秒 时间相等的极限情况 end else self:StopActivityButtonTimer(MDL.Unlock.FunctionType.RedEnvelopeRain) self:PlayActivityButtonAnim(MDL.Unlock.FunctionType.RedEnvelopeRain, ConstAssetPathConfig.AssetPath174, false) end else self:StopActivityButtonTimer(MDL.Unlock.FunctionType.RedEnvelopeRain) self:SetActivityTipsBg(MDL.Unlock.FunctionType.RedEnvelopeRain, false) self:PlayActivityButtonAnim(MDL.Unlock.FunctionType.RedEnvelopeRain, ConstAssetPathConfig.AssetPath174, false) end end function UITownHome_ActivityEntry:UpdateTurntable() local type = MDL.OperationActivity.ActivityType.Turntable local isOpen = CTL.OperationActivity.IsOperationActivityTypeOpen(type) local isOpUnlock = CTL.OperationActivity.IsOperationActivityTypeUnlock(type) local isFuncUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Turntable) local canShow = isOpen and isOpUnlock and isFuncUnlock self:SetActiveButton(MDL.Unlock.FunctionType.Turntable, canShow, "Turntable") end function UITownHome_ActivityEntry:UpdateCycleRecharge() local cycleRechargeType = MDL.OperationActivity.ActivityType.CycleRecharge local isOpen = CTL.OperationActivity.IsOperationActivityTypeOpen(cycleRechargeType) local isOpUnlock = CTL.OperationActivity.IsOperationActivityTypeUnlock(cycleRechargeType) local isFuncUnlock = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.CycleRecharge) local cycleRechargeShow = isOpen and isOpUnlock and isFuncUnlock self:SetActiveButton(MDL.Unlock.FunctionType.CycleRecharge, cycleRechargeShow, "CycleRecharge") end --region 红点 function UITownHome_ActivityEntry:InitBtnsRp() self:RefreshBossRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.BossMain) or CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFight)) self:RefreshDrawCardRp() self:RefreshUIActivityRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.UIActivity)) self:RefreshFairPlayRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.FairPlay)) self:RefreshHegemonyRp(MDL.RedPoint.GetNodeStateByMultiKey(CTL.Hegemony.HegemonyRpEventId.TownHome)) self:RefreshWelfareRp(MDL.RedPoint.GetNodeStateByMultiKey(CTL.Welfare.WelfareRpEventId.TownHome)) self:RefreshFirstChargeBtnRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.FirstCharge)) self:RefreshAccumulatingRechargeBtnRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.AccumulatingRechargeGJ)) self:RefreshShopRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Shop)) self:RefreshHeroMatch1v1Rp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.HeroMatch1v1)) -- 天下群雄红点 self:RefreshHeroMatch3v3Rp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.HeroMatch3v3)) -- 天下群雄红点 self:RefreshFairSoloTournamentRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.FairSoloTournament)) -- 天下群雄红点 self:RefreshPayMallRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.PayMall)) self:RefreshMonopolyRp() self:RefreshHorseRearRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.HorseRear)) self:RefreshGodBeastActivityRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GodBeastActivity)) self:RefreshLuckyLotteryRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.LuckyLottery)) self:RefreshNewYearRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.NewYear)) self:RefreshCommandTheWorldRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.CommandTheWorld)) self:RefreshFreeBuyRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.FreeBuy)) self:RefreshWarZoneAuctionRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.WarZoneAuction)) self:RefreshWebActivityBtnRp() self:RefreshFriendRechargeRp() self:RefreshAnniversaryPrepareRp() self:RefreshRedEnvelopRainRp() self:RefreshGuildFamousEntryRp() self:RefreshCycleRechargeRp() self:RefreshTurntableRp() self:RefreshFunctionUpdateNoticeEntryRp() self:RefreshAwakenActivityEntryRp() if GameAppInfo.IsJapanesePackage() then self:RefreshGoldHeroReprintRp() end end function UITownHome_ActivityEntry:RefreshQQBtnRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.QQGroup, active) end function UITownHome_ActivityEntry:RefreshWebActivityBtnRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.WebActivity, MDL.WebActivity.CheckIsShowRP()) end function UITownHome_ActivityEntry:RefreshFairPlayRp(active) self.event_FairPlay:SetRedPoint(active) end function UITownHome_ActivityEntry:RefreshDrawCardRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.DrawCard, CTL.DrawCard.GetDrawCardRedPoint()) end -- 日服金将复刻抽卡 function UITownHome_ActivityEntry:RefreshGoldHeroReprintRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.GoldHeroReprint, MDL.GoldHeroReprint.GetGoldHeroReprintRedPoint()) end function UITownHome_ActivityEntry:RefreshUIActivityRp(active) self.event_Activities:SetRedPoint(active) end function UITownHome_ActivityEntry:RefreshHegemonyRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.HegemonyActivity, active) end function UITownHome_ActivityEntry:RefreshGoldHeroRp() for i, v in ipairs(self.group_GoldHero) do v.event_GoldenHero:SetRedPoint(MDL.RedPoint.GetNodeStateByMultiKey(CTL.GoldenHeroMain.RpEventId[self.goldHeroActivityId[i]].TownHome)) end end function UITownHome_ActivityEntry:RefreshSuperGoldRp() for i, v in ipairs(self.group_SuperGold) do v.event_GoldenHero:SetRedPoint(MDL.RedPoint.GetNodeStateByMultiKey(CTL.SuperGoldMain.RpEventId[self.superGoldActivityId[i]].TownHome)) end end function UITownHome_ActivityEntry:RefreshHorseRearRp(active) for i, v in ipairs(self.group_HorseRear) do v.Button:SetRedPoint(MDL.RedPoint.GetNodeStateByMultiKey(CTL.HorseRear.RpEventId[self.horseRearActivityId[i]].TownHome)) end end function UITownHome_ActivityEntry:RefreshMonopolyRp() for i, v in ipairs(self.group_Monopoly) do local aid = self.monopolyActivityId[i] v.Button:SetRedPoint(MDL.Monopoly.HasMonopolyRp(aid) or CTL.Monopoly.HasGiftRp(aid)) end end ---@public 天下群雄红点 function UITownHome_ActivityEntry:RefreshHeroMatch1v1Rp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.HeroMatch1v1, active) end function UITownHome_ActivityEntry:RefreshHeroMatch3v3Rp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.HeroMatch3v3, active) end function UITownHome_ActivityEntry:RefreshFairSoloTournamentRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.FairSoloTournament, active) end function UITownHome_ActivityEntry:RefreshWelfareRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.Welfare, active) end -- 刷新首领按钮红点 function UITownHome_ActivityEntry:RefreshBossRedPoint(active) self.event_WBoss:SetRedPoint(active) end --有"新"就不显示红点 function UITownHome_ActivityEntry:OnJPBaiZhanNewSymbolStateUpdate() local state = CTL.PayMall.GetNewSymbolState_JPBaiZhan() if state then self:SetActivityButtonRed(MDL.Unlock.FunctionType.Shop, false) else self:SetActivityButtonRed(MDL.Unlock.FunctionType.Shop, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Shop) and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Shop)) end end function UITownHome_ActivityEntry:RefreshShopRp(active) if GameAppInfo.IsJapanesePackage() then self:OnJPBaiZhanNewSymbolStateUpdate() else self:SetActivityButtonRed(MDL.Unlock.FunctionType.Shop, MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Shop) and active) end end function UITownHome_ActivityEntry:RefreshWelfareNewImg() local active = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.PayMall) and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.PayMall) self:SetActivityButtonRed(active or CTL.DirectGift.IsWelfareShowNew() or MDL.PayMall.GetMonthCardNewGoodsRedPoint()) end function UITownHome_ActivityEntry:RefreshPayMallRp(active) active = MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.PayMall) and active self:SetActivityButtonRed(MDL.Unlock.FunctionType.PayMall, active or CTL.DirectGift.IsWelfareShowNew() or MDL.PayMall.GetMonthCardNewGoodsRedPoint()) end function UITownHome_ActivityEntry:RefreshGodBeastActivityRp(active) local unlockType = MDL.Unlock.FunctionType.GodBeastActivity self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshLuckyLotteryRp(active) local unlockType = MDL.Unlock.FunctionType.LuckyLottery self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshNewYearRp(active) local unlockType = MDL.Unlock.FunctionType.NewYear self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshCommandTheWorldRp(active) local unlockType = MDL.Unlock.FunctionType.CommandTheWorld self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshFreeBuyRp(active) local unlockType = MDL.Unlock.FunctionType.FreeBuy self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshWarZoneAuctionRp(active) local unlockType = MDL.Unlock.FunctionType.WarZoneAuction self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshTreasureBowlRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.TreasureBowl, CTL.TreasureBowl.GetTreasureBowlRedPoint()) end function UITownHome_ActivityEntry:RefreshCycleRechargeRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.CycleRecharge, CTL.CycleRecharge.GetCycleRechargeRedPoint()) end function UITownHome_ActivityEntry:RefreshTurntableRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.Turntable, CTL.Turntable.GetEntryRedPoint()) end -- 金兰邀约入口显隐 function UITownHome_ActivityEntry:RefreshFriendRechargeRp(active) self:SetActivityButtonRed(MDL.Unlock.FunctionType.FriendRecharge, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.FriendRecharge)) end function UITownHome_ActivityEntry:RefreshRedEnvelopRainRp(active) local unlockType = MDL.Unlock.FunctionType.RedEnvelopeRain self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and active) end function UITownHome_ActivityEntry:RefreshAnniversaryPrepareRp(active) local unlockType = MDL.Unlock.FunctionType.AnniversaryPrepare self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.AnniversaryPrepare)) end function UITownHome_ActivityEntry:RefreshGuildFamousEntryRp() self:SetActivityButtonRed(MDL.Unlock.FunctionType.GuildFamous, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GuildFamousEntry)) end function UITownHome_ActivityEntry:RefreshFunctionUpdateNoticeEntryRp() local unlockType = MDL.Unlock.FunctionType.FunctionUpdateNotice self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.FunctionUpdateNotice)) end function UITownHome_ActivityEntry:RefreshDouYinRechargeRewardEntryRp() local unlockType = MDL.Unlock.FunctionType.DouYinRechargeReward self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.DouYinRechargeReward)) end function UITownHome_ActivityEntry:RefreshLaterEnterEntryRp() local unlockType = MDL.Unlock.FunctionType.LaterEnter self:SetActivityButtonRed(unlockType, MDL.Unlock.IsUnlock(unlockType) and CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.LaterEnter)) end --endregion 红点 function UITownHome_ActivityEntry:ShowGuildWarBtn() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GuildWar) then local info = MDL.GuildWar.GetWarInfo() if info and info.issue == 1 and not CTL.WarZone.IsWarZoneOpen() then self:SetActiveButton(MDL.Unlock.FunctionType.GuildWar, true, "GuildWar") self:SetActivityButtonLable(MDL.Unlock.FunctionType.GuildWar, Const_IDS.IDS_ActivityName_GuildWar) if info.Stage < MDL.GuildWar.Stages.StageTypeBattle then local timeValue = info.battleOpenTime - UTL.Time.GetServerTimestamp() self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.GuildWar, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime1),UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime2), UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime3),UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime4)) self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.GuildWar, false, timeValue, 0, 1) elseif info.Stage == MDL.GuildWar.Stages.StageTypeBattle then self:SetActivityTips(MDL.Unlock.FunctionType.GuildWar, Const_IDS.IDS_PreviewTime5) else self:SetActivityTips(MDL.Unlock.FunctionType.GuildWar, Const_IDS.IDS_PreviewTime6) end else self:SetActiveButton(MDL.Unlock.FunctionType.GuildWar, false, "GuildWar") end else self:SetActiveButton(MDL.Unlock.FunctionType.GuildWar, false, "GuildWar") end end -- 刷新势力名门按钮 function UITownHome_ActivityEntry:RefreshGuildFamousEntry() local guildInfo = MDL.Guild.GetMyFamousInfo() if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.GuildFamous) and not guildInfo.hasFirstBalance then local timeValue = guildInfo.balanceTime - UTL.Time.GetServerTimestamp() if timeValue > 0 then self:SetActiveButton(MDL.Unlock.FunctionType.GuildFamous, true, "GuildFamous") self:SetActivityButtonDHMSStr( MDL.Unlock.FunctionType.GuildFamous, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime1), UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime2), UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime3), UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime4) ) self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.GuildFamous, false, timeValue, 0, 1) end else self:SetActiveButton(MDL.Unlock.FunctionType.GuildFamous, false, "GuildFamous") end end function UITownHome_ActivityEntry:RefreshGuildAuctionBtnInfo() local state = MDL.GuildAuction.GetTownHomeBtnShowType() if state == MDL.GuildAuction.TownHomeBtnState.None then self:SetActivityState(MDL.Unlock.FunctionType.GuildAuction, 0) self:SetActivityTips(MDL.Unlock.FunctionType.GuildAuction, Const_IDS.IDS_Auction_FunctionName) UIUtils.SetActive(self.auction_GroupInfo, false) self:SetActivityButtonRed(MDL.Unlock.FunctionType.GuildAuction, CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GuildAuction_ShareBonus)) else self:SetActivityState(MDL.Unlock.FunctionType.GuildAuction, 1) self:SetActivityTips(MDL.Unlock.FunctionType.GuildAuction, Const_IDS.IDS_Auction_AuctionOpening) if state == MDL.GuildAuction.TownHomeBtnState.Guild then self:SetActivityState(MDL.Unlock.FunctionType.GuildAuction, 1, "state_Activity1") elseif state == MDL.GuildAuction.TownHomeBtnState.Cross then self:SetActivityState(MDL.Unlock.FunctionType.GuildAuction, 2, "state_Activity1") elseif state == MDL.GuildAuction.TownHomeBtnState.World then self:SetActivityState(MDL.Unlock.FunctionType.GuildAuction, 0, "state_Activity1") end end end ---@public 刷新日服网页版元旦活动入口显隐和红点 function UITownHome_ActivityEntry:UpdateWebActivityRP() PersistentData.PlayerData:Set(MDL.WebActivity.SaveRPTime, 0, true) self:RefreshWebActivityBtnRp() self:UpdateWebActivityEntry() end function UITownHome_ActivityEntry:RefreshCountryBtn() if CTL.Country.IsUnlockCountry() then if MDL.Country.GetCurStage() == MDL.Country.Stage.CountryBuildPreBalance then local countDown = MDL.Country.GetClosePrediction() if countDown > 0 then self:SetActiveButton(MDL.Unlock.FunctionType.Country, true, "CountryReset") if Localization.IsThailand() then self.kvActivityButton[MDL.Unlock.FunctionType.Country].lab_Button_Scroll:SetText(UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_LastWar)) else self:SetActivityButtonLable(MDL.Unlock.FunctionType.Country, Const_IDS.IDS_Country_LastWar) end local dayStr = string.FormatByIdsId(Const_IDS.IDS_CountrySelection_EvaluatingCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_1)) local hourStr = string.FormatByIdsId(Const_IDS.IDS_CountrySelection_EvaluatingCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_2)) local minStr = string.FormatByIdsId(Const_IDS.IDS_CountrySelection_EvaluatingCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_3)) local secStr = string.FormatByIdsId(Const_IDS.IDS_CountrySelection_EvaluatingCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_4)) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.Country, dayStr, hourStr, minStr, secStr) self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.Country, false, countDown, 0, 1) end elseif MDL.Country.GetCurStage() == MDL.Country.Stage.CountryReset then local closeTime = MDL.Country.GetAllStageTime()[MDL.Country.Stage.CountryReset + 1] local countDown = closeTime.stageEnd - UTL.Time.GetServerTimestamp() if countDown > 0 then self:SetActiveButton(MDL.Unlock.FunctionType.Country, true, "CountryReset") if Localization.IsThailand() then self.kvActivityButton[MDL.Unlock.FunctionType.Country].lab_Button_Scroll:SetText(UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_Unification)) else self:SetActivityButtonLable(MDL.Unlock.FunctionType.Country, Const_IDS.IDS_Country_Unification) end local dayStr = string.FormatByIdsId(Const_IDS.IDS_Country_CeremonyCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_1)) local hourStr = string.FormatByIdsId(Const_IDS.IDS_Country_CeremonyCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_2)) local minStr = string.FormatByIdsId(Const_IDS.IDS_Country_CeremonyCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_3)) local secStr = string.FormatByIdsId(Const_IDS.IDS_Country_CeremonyCountdown, UIUtils.GetLocalizedTxt(Const_IDS.IDS_DirectGift_TimeHint_4)) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.Country, dayStr, hourStr, minStr, secStr) self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.Country, false, countDown, 0, 1) end else self:SetActiveButton(MDL.Unlock.FunctionType.Country, false, "CountryReset") end if CTL.WarZone.GetTimeState() == CTL.WarZone.TimeState.Preview or CTL.Country.GetCountryTimeOpen() > 0 then UIUtils.SetActive(self.event_Country, true) local timeInfo = MDL.WarZone.GetTimeInfo() --战区开启时过几十秒才生产国家相关模块 倒计时延迟一分钟 local offsetTime = timeInfo.startTime - UTL.Time.GetServerTimestamp() + UTL.Time.TotalSecondsOneMinute local dayStr = string.FormatByIdsId(Const_IDS.IDS_7DayActivityNew_Hint1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime1)) local hourStr = string.FormatByIdsId(Const_IDS.IDS_7DayActivityNew_Hint1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime2)) local minStr = string.FormatByIdsId(Const_IDS.IDS_7DayActivityNew_Hint1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime3)) local secStr = string.FormatByIdsId(Const_IDS.IDS_7DayActivityNew_Hint1, UIUtils.GetLocalizedTxt(Const_IDS.IDS_PreviewTime4)) self.txt_CountryTime:SetDHMSStr(dayStr, hourStr, minStr, secStr) self.txt_CountryTime:ResetAndBeginCustomTimer(false, offsetTime, 0, 1) UIUtils.SetActive(self.img_StateBg, true) self:StartRepeatFunc(self.RefreshCountryBtn, offsetTime, 1) elseif CTL.WarZone.GetTimeState() == CTL.WarZone.TimeState.NotStart then UIUtils.SetActive(self.event_Country, true) UIUtils.SetLabelText(self.txt_State, Const_IDS.IDS_BossChallenge_AboutToOpen) UIUtils.SetActive(self.img_StateBg, true) else UIUtils.SetActive(self.img_StateBg, false) end self:RefreshCountryRp() else self:SetActiveButton(MDL.Unlock.FunctionType.Country, false, "CountryReset") UIUtils.SetActive(self.event_Country, false) end end function UITownHome_ActivityEntry:RefreshCountryRp() if MDL.Country.GetCurStage() == MDL.Country.Stage.CountryReset then local rp = CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_Worship) or CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_SignIn) self:SetActivityButtonRed(MDL.Unlock.FunctionType.Country, rp) elseif MDL.Country.GetCurStage() and MDL.Country.GetCurStage() >= MDL.Country.Stage.CountryBuild then self.event_Country:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country)) end end function UITownHome_ActivityEntry:InitGameStreamerPackageBtn() if GameAppInfo.IsMarketPackage() or GameAppInfo.IsGameStreamerPackage() then self:SetActiveButton(MDL.Unlock.FunctionType.AnchorShow, true, "GameStreamerPackageBtn2") end if GameAppInfo.IsGameStreamerPackage() then self:SetActiveButton(MDL.Unlock.FunctionType.AnchorChallenge, true, "GameStreamerPackageBtn1") self:SetActiveButton(MDL.Unlock.FunctionType.RogueLike, true, "GameStreamerPackageBtn3") end end function UITownHome_ActivityEntry:UpdateWeekTotalCharge() self:SetActiveButton(MDL.CycleRecharge.GetFunctionID(), MDL.CycleRecharge.IsOpenWeekTotalCharge(), "WeekTotalCharge") self:RefreshWeekTotalChargeRp() end function UITownHome_ActivityEntry:RefreshWeekTotalChargeRp() self:SetActivityButtonRed(MDL.CycleRecharge.GetFunctionID(), CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.WeekTotalCharge)) end function UITownHome_ActivityEntry:UpdateAppPushGiftBtn() local isOpen = MDL.AppPushGift.IsOpen() self:SetActiveButton(MDL.Unlock.FunctionType.AppPushGift, isOpen, "AppPushGift") if isOpen then self:SetTestFalgActive(MDL.Unlock.FunctionType.AppPushGift, false) local timer = MDL.AppPushGift.GetRecallGiftInfo().endTime - UTL.Time.GetServerTimestamp() if timer > UTL.Time.TotalSecondsOneDay then self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.AppPushGift, "{0}:{1}:{2}", 1, 2) else self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.AppPushGift, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), 1, 11) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.AppPushGift, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), "{0}:{1}:{2}", "{0}:{1}", "{0}:{1}") end self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.AppPushGift, false, timer, 0, 1, nil) end end function UITownHome_ActivityEntry:UpdateLaterEnterBtn() self:SetActiveButton(MDL.Unlock.FunctionType.LaterEnter, CTL.LaterEnter.IsCanShowEntrance(), "LaterEnter") self:RefreshLaterEnterEntryRp() end -- 天下会武3V3 function UITownHome_ActivityEntry:UpdateTeamFairChampionshipEntry() local isShowEntry = CTL.TeamFairChampionship.IsShowEntry() self:SetActiveButton(MDL.Unlock.FunctionType.TeamFairChampionship, isShowEntry, "TeamFairChampionship") if not isShowEntry then return end self:SetActivityButtonLable(MDL.Unlock.FunctionType.TeamFairChampionship, Const_IDS.IDS_TeamFairTournamen_Name, nil, true, 1) local StageCfg = DataSheetManager.TeamFairMatchStage:GetDataByID(MDL.TeamFairChampionship.GetCurStageID()) self:StopActivityButtonTimer(MDL.Unlock.FunctionType.TeamFairChampionship) if StageCfg.ID == MDL.TeamFairChampionship.Stage.Join then local bigMatchStageId = MDL.TeamFairChampionship.GetCurBigStageID() local bigMatchStageCfg = DataSheetManager.TeamFairMatchTime:GetDataByID(bigMatchStageId) local timeCfg = DataSheetManager.TimeRefresh:GetDataByID(bigMatchStageCfg.EndTime) local timer = MDL.TeamFairChampionship.GetBigMatchZeroStartTime(bigMatchStageId) + timeCfg.HMS+bigMatchStageCfg.Day * UTL.Time.TotalSecondsOneDay - UTL.Time.GetServerTimestamp() if timer >= UTL.Time.TotalSecondsOneDay then self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.TeamFairChampionship, "{0}:{1}:{2}", 1, 2) else self:SetActivityButtonDHMSType(MDL.Unlock.FunctionType.TeamFairChampionship, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), 1, 11) self:SetActivityButtonDHMSStr(MDL.Unlock.FunctionType.TeamFairChampionship, UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPrivilege_BuffShow), "{0}:{1}:{2}", "{0}:{1}", "{0}:{1}") end self:ResetAndBeginActivityTimer(MDL.Unlock.FunctionType.TeamFairChampionship, false, timer, 0, 1) else self:SetActivityTipsBg(MDL.Unlock.FunctionType.TeamFairChampionship, true) if CTL.TeamFairChampionship.IsInMatchingTime() then self:SetActivityTips(MDL.Unlock.FunctionType.TeamFairChampionship, Const_IDS["IDS_TeamFairTournamen_RaceGoing"]) else self:SetActivityTips(MDL.Unlock.FunctionType.TeamFairChampionship, Const_IDS[StageCfg.IconDes]) end end self:RefreshTeamFairChampionshipRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.TeamFairChampionship)) end function UITownHome_ActivityEntry:RefreshTeamFairChampionshipRp(rp) self:SetActivityButtonRed(MDL.Unlock.FunctionType.TeamFairChampionship, rp) end return UITownHome_ActivityEntry