local UIGVGFightMain = UIViewClass() --[[ 攻城略地主界面 --]] local NextGVGFightStageHint = { [MDL.GVGFight.GVGFightStage.SubGroup] = Const_IDS.IDS_GVGFight_SeasonCD_4, -- 下赛季为分组期 [MDL.GVGFight.GVGFightStage.Struggle] = Const_IDS.IDS_GVGFight_SeasonCD_5, -- 下赛季为争夺期 [MDL.GVGFight.GVGFightStage.Fierce] = Const_IDS.IDS_GVGFight_SeasonCD_1, -- 下赛季为激战期 [MDL.GVGFight.GVGFightStage.OffSeason] = Const_IDS.IDS_GVGFight_SeasonCD_3, -- 下赛季为休赛期 } local GVGFightCityCaptureOnlyBuffLimit = DataSheetManager.ConstData:GetDataByID("GVGFightCityCaptureOnlyBuffLimit").IntValue -- 触发独占人数 local GVGFightCityFullNumber = DataSheetManager.ConstData:GetDataByID("GVGFightCityFullNumber").IntValue -- 超员减产人数 local GVGFightHarvestRationRefreshTime = DataSheetManager.ConstData:GetDataByID("GVGFightHarvestRationRefreshTime").IntValue -- 刷新丰产时间ID -------------------- function UIGVGFightMain:OnCreated() self.cityDic = {} self.refreshBtnCountdown = 0 end function UIGVGFightMain:OnOpened(context) self:RegistSystemEvent(EventID.GVGFight_RefreshSeasonId, self.RefreshSeasonId) self:RegistSystemEvent(EventID.GVGFight_RefreshGVGBadgeScore, self.RefreshBadgeState) self:RegistSystemEvent(EventID.GVGFight_RefreshGVGFightState, self.RefreshGVGState) self:RegistSystemEvent(EventID.GVGFight_RefreshCityState, self.RefreshCityInfo) self:RegistSystemEvent(EventID.GVGFight_RefreshCurTroops, self.RefreshTroops) self:RegistSystemEvent(EventID.GVGFight_RefreshGVGFightState, self.RefreshTroops) self:RegistSystemEvent(EventID.UI_RefreshCurrency, self.RefreshTroops) self:RegistSystemEvent(EventID.GVGFight_RefreshSevereWound, self.RefreshSevereWound) self:RegistSystemEvent(EventID.GVGFight_RefreshNextHighYieldRefreshTime, self.RefreshNextHighYieldRefreshTime) self:RegistSystemEvent(EventID.UI_CloseAndRecoverView, self.OnCloseAndRecoverView) self:RegistSystemEvent(EventID.GVGFight_RefreshSeasonCountdownRankBtn, self.RefreshSeasonCountdownRankBtn) self:RegistSystemEvent(EventID.New_Day_Refresh, self.RefreshSeasonCountdown) -- 红点 self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GVGFight_Reward, self.RefreshRewardRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GVGFight_SeasonTask, self.RefreshSeasonTaskRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GVGFight_SeasonMedal, self.RefreshSeasonMedalRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Shop_GVGFight, self.RefreshGVGFightShopRp) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GVGFight_WarReport, self.RefreshWarReporRp) -- 初始红点 self:RefreshRewardRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFight_Reward)) self:RefreshSeasonTaskRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFight_SeasonTask)) self:RefreshSeasonMedalRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFight_SeasonMedal)) self:RefreshGVGFightShopRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Shop_GVGFight)) self:RefreshWarReporRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFight_WarReport)) self:InitPanel() -- 加入聊天频道 if not MDL.GVGFight.IsInOffSeasonWeekState() then MDL.ChannelChat.TryJoinGVGFightChannel() end self:EnterGVGMainPanelReq() self:StartRepeatFunc(self.EnterGVGMainPanelReq, CTL.GVGFight.SubscribeInterval) if not CTL.Activities.IsOpen(LuaConst.ActivityType.GVGFight) then self:CloseView(true) -- GMS关闭后,有时候这个ui push在后台,等弹出的时候需要再判断下 end MDL.FreeLineUp.FreeLineUpGetInfoRequest(MDL.FreeLineUp.FuncType.GvGFight) CTL.GVGFight.SetCurSeasonStruggleViewed() self.soundId = CTL.Sound.PlayGameSound("UI_sound_Loading") end function UIGVGFightMain:OnClosed() CTL.GVGFight.SetCanPlayGVGBullet(false) MDL.GVGFight.GVGMainPanelReq(false) self.cdTimer:EndTimer() -- 退出对应的聊天频道 MDL.ChannelChat.ExitChannelByChannelType(MDL.ChannelChat.ChannelCfgId.GVGFight) MDL.ChannelChat.ClearGVGFightNameDict() -- 清空当前弹幕 CTL.BulletScreen.ClearScreen() -- 停止播放音效 CTL.Sound.StopById(self.soundId) end function UIGVGFightMain:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIGVGFightMain:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.AttackCity) then MDL.Level.SendRoleLeaveFuben() end self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.AttackCity) then MDL.Level.SendRoleLeaveFuben() end CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.GVGFightMain, params = {GVGFightCityCaptureOnlyBuffLimit, GVGFightCityFullNumber, GVGFightCityFullNumber, UTL.Time.GetDiffLocalStrById(GVGFightHarvestRationRefreshTime)}}) elseif comp == self.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightSeasonStage) elseif comp == self.btn_Refresh then -- 增加倒计时CD if self.refreshBtnCountdown > 0 then CTL.Tips.AddTipsMsg(Const_IDS.IDS_GVGFight_Refresh_Tips1) else self.refreshBtnCountdown = MDL.GVGFight.GVGMainPanelReqInterval self.btn_Refresh:SetGray(true, true) UIUtils.SetLabel(self.lab_Refresh, string.FormatByIdsId(Const_IDS.IDS_SecondsCountdown, self.refreshBtnCountdown)) self:EnterGVGMainPanelReq() self:StartRepeatFunc(self.OnUpdateRefreshBtnTimer, 1, -1) end elseif comp == self.btn_Reward then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightSeasonReward) elseif comp == self.btn_Medal then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightSeasonMedal) elseif comp == self.btn_WarReport then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightWarReport) elseif comp == self.btn_Array then UIManager.OpenAndPush(Const_UI_Lua.UIEnum.UICommonLineUpView, {functionType = MDL.Unlock.FunctionType.GVGFight}, Const_UI_Lua.UIEnum.UIArray, Const_UI_Lua.UIEnum.UIGVGFightMain) elseif comp == self.btn_Store then UIManager.OpenAndPushAll(Const_UI_Lua.UIEnum.UIShopMain, {TabEnum = CTL.PayMall.ShopMainTabEnum.GVGFight}) elseif comp == self.btn_Task then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightWarTasks) elseif comp == self.btn_Rank or comp == self.btn_progress1 then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightRank) elseif comp == self.btn_Profit then local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightRewardInfo, {}, "ClimbTower/UIClimbTowerEarningsInfo") else CTL.Tips.AddTipsMsg(Const_IDS.IDS_GVGFight_MyInfo_SeasonNotOpen) end elseif comp == self.btn_Conscription then MDL.GVGFight.GVGConscriptReq() elseif comp == self.event_Open then CTL.GVGFight.SetGVGFightBulletScreenOpen(false) self.state_Btn:SetState(1) -- 隐藏弹幕 CTL.BulletScreen.Hide() elseif comp == self.event_Close then CTL.GVGFight.SetGVGFightBulletScreenOpen(true) self.state_Btn:SetState(0) -- 打开弹幕 CTL.BulletScreen.Show() elseif comp == self.group_Coordinate then local belongCityId = MDL.GVGFight.GetBelongCityId() if belongCityId > 0 then self:OnClickCity(belongCityId) end else for cityId, cityTable in pairs(self.cityDic) do if cityTable.group_City == comp then self:OnClickCity(cityId) end end end end -------------------- function UIGVGFightMain:InitPanel() self:RefreshSeasonId() -- 初始化城池 for _, v in DataSheetManager.GVGFightCity:GetEnumerator() do local cityTable = self:InstantiateCollection(self.img_Map, self.city_template.gameObject) UIUtils.SetActive(cityTable.gameObject, false) -- 设置初始状态 if v.CityType == MDL.GVGFight.GVGFightCityType.CampCity then cityTable.obj_OccupyState:SetState(3) else cityTable.obj_OccupyState:SetState(2) end -- 设置城池名字 UIUtils.SetLabelText(cityTable.txt_CityName, Const_IDS[v.CityName]) -- 设置城池图片 UIUtils.SetImageByAssetBundle(cityTable.img_City, v.CityImage) cityTable.img_City:SetNativeSize() -- 设置特效状态 cityTable.state_Effect:SetState(v.CityType - 1) cityTable.state_Pos:SetState(v.CityType - 1) -- 设置城池人数 初始为0人 local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then UIUtils.SetActive(cityTable.txt_CityNum, true) UIUtils.SetLabel(cityTable.txt_CityNum, string.FormatByIdsId(Const_IDS.IDS_GVGFight_CityPeople, 0)) else UIUtils.SetActive(cityTable.txt_CityNum, false) end -- 设置丰产状态 cityTable.effect_HighYield:StopUIEffect() UIUtils.SetActive(cityTable.group_HighYield, false) -- 设置保护罩 cityTable.effect_Shield:StopUIEffect() -- 设置位置 cityTable.gameObject.transform:SetAnchoredPosition(v.CityPosition[1], v.CityPosition[2], 0) -- 保存城池数据 self.cityDic[v.CityID] = cityTable end -- 初始化阶段信息 self:RefreshGVGState() -- 初始化徽章信息 self:RefreshBadgeState() -- 初始化兵力信息 self:RefreshTroops() -- 初始化重伤消息 self:RefreshSevereWound() -- 初始化征兵粮草图标 UTL.Item.MoneyIcon(self.img_Coin, MDL.GVGFight.ProvisionsItemId) -- 设置地图位置 local x, y = CTL.GVGFight.GetCityMapPos() self.img_Map.gameObject.transform:SetAnchoredPosition(x, y, 0) CTL.GVGFight.RecordCityMapPos(0, 0) -- 设置弹幕开关状态 if CTL.GVGFight.GetGVGFightBulletScreenOpen() then self.state_Btn:SetState(0) CTL.BulletScreen.Show() else self.state_Btn:SetState(1) CTL.BulletScreen.Hide() end -- 加载小聊天框 self.subView:CloseAll() self.subView:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIBattleChatDlg), {onlyChat = true}) -- 初始化刷新按钮状态 self.btn_Refresh:SetGray(false, true) UIUtils.SetLabelText(self.lab_Refresh, Const_IDS.IDS_GVGFight_Rank_Refresh) -- 日本和越南地区屏蔽弹幕功能 if GameAppInfo.IsJapanesePackage() or GameAppInfo.IsVietnamPackage() then UIUtils.SetActive(self.event_Open, false) end end function UIGVGFightMain:RefreshSeasonId() -- 设置标题 local currentSeasonId = MDL.GVGFight.GetCurSeasonId() if currentSeasonId == 0 then UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_GVGFight_Name) else UIUtils.SetLabel(self.UITemplateTitlePanel.lab_Title, string.FormatByIdsId(Const_IDS.IDS_GVGFight_NameNew, currentSeasonId)) end end -- 刷新城池状态 function UIGVGFightMain:RefreshCityInfo() local belongCityId = MDL.GVGFight.GetBelongCityId() UIUtils.SetActive(self.group_Coordinate.gameObject, belongCityId > 0) self.btn_Conscription:SetGray(false, true) local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() for cityId, cityTable in pairs(self.cityDic) do if MDL.GVGFight.IsEffectiveCity(cityId) then UIUtils.SetActive(cityTable.gameObject, true) local cityInfo = MDL.GVGFight.GetCityOuterInfo(cityId) local cityData = DataSheetManager.GVGFightCity:GetDataByCityID(cityId) -- 设置城内人数 if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then UIUtils.SetActive(cityTable.txt_CityNum, true) UIUtils.SetLabel(cityTable.txt_CityNum, string.FormatByIdsId(Const_IDS.IDS_GVGFight_CityPeople, cityInfo.playerNum)) else UIUtils.SetActive(cityTable.txt_CityNum, false) end -- 设置占领公会 if not string.isNilOrEmpty(cityInfo.guildId) then if cityInfo.guildId == MDL.Guild.GetMyGuildId() then cityTable.obj_OccupyState:SetState(1) else cityTable.obj_OccupyState:SetState(0) end UIUtils.SetLabel(cityTable.txt_guildName, cityInfo.guildName) -- 设置势力徽记 CTL.Guild.SetGuildEmblem(cityTable.img_GuildIcon, cityTable.img_OccupyTxt, cityInfo.emblemFrame, cityInfo.emblemContent) -- 设置区服 UIUtils.SetLabel(cityTable.txt_Server, string.FormatByIdsId(Const_IDS.IDS_ServerInfo, cityInfo.guildServerId)) else if cityData.CityType == MDL.GVGFight.GVGFightCityType.CampCity then cityTable.obj_OccupyState:SetState(3) else cityTable.obj_OccupyState:SetState(2) end end -- 丰产状态 if cityInfo.isHighYield then UIUtils.SetActive(cityTable.group_HighYield, true) cityTable.effect_HighYield:PlayUIEffect() else cityTable.effect_HighYield:StopUIEffect() UIUtils.SetActive(cityTable.group_HighYield, false) end -- 设置保护罩状态 if cityInfo.isCityGuardingArray then UIUtils.SetActive(cityTable.img_ShieldIcon, true) UIUtils.SetActive(cityTable.effect_Shield, true) cityTable.effect_Shield:PlayUIEffect() else UIUtils.SetActive(cityTable.img_ShieldIcon, false) cityTable.effect_Shield:StopUIEffect() UIUtils.SetActive(cityTable.effect_Shield, false) end -- 设置自身所处位置 if cityId == belongCityId then if cityInfo.isHighYield then local cityName = UIUtils.GetLocalizedTxt(Const_IDS[cityData.CityName]) UIUtils.SetLabel(self.txt_Coordinate, string.format("%s(%s)", cityName, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_CityMoreIncome))) else UIUtils.SetLabelText(self.txt_Coordinate, Const_IDS[cityData.CityName]) end self.btn_Conscription:SetGray(cityData.CityType ~= MDL.GVGFight.GVGFightCityType.CampCity, true) end else UIUtils.SetActive(cityTable.gameObject, false) end end -- 刷新丰产倒计时 self:StartRepeatFunc(self.OnUpdateHighYieldTime, 1, -1) end -- 刷新阶段信息 function UIGVGFightMain:RefreshGVGState() local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() UIUtils.SetLabelText(self.txt_CurrentStage, MDL.GVGFight.GetGVGFightStateIds(curGVGFightState)) -- 设置下一阶段倒计时提示 UIUtils.SetLabelText(self.lab_Info1, NextGVGFightStageHint[MDL.GVGFight.GetNextGVGFightState()]) local nextStageTime = MDL.GVGFight.GetNextStageTime() UIUtils.SetLabel(self.txt_Info1, UTL.Time.GetShowTimeBySeconds(nextStageTime)) -- 争夺期显示下次丰产时间 self:RefreshNextHighYieldRefreshTime() -- 争夺期、激战期 显示 城池人数 for cityId, cityTable in pairs(self.cityDic) do local cityInfo = MDL.GVGFight.GetCityOuterInfo(cityId) if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then UIUtils.SetActive(cityTable.txt_CityNum, true) UIUtils.SetLabel(cityTable.txt_CityNum, string.FormatByIdsId(Const_IDS.IDS_GVGFight_CityPeople, cityInfo.playerNum)) else UIUtils.SetActive(cityTable.txt_CityNum, false) end end -- 刷新阶段倒计时 self:StartRepeatFunc(self.OnUpdateGVGStateTime, 1, -1) self:RefreshSeasonCountdown() end function UIGVGFightMain:RefreshSeasonCountdown() if not MDL.GVGFight.IsInOffSeasonWeekState() then UIUtils.SetActive(self.Group_SeasonCountdown, false) UIUtils.SetActive(self.ani_Right, true) else UIUtils.SetActive(self.Group_SeasonCountdown, true) UIUtils.SetActive(self.ani_Right, false) local dayStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_NewYearActivity_DirectGiftTimeHint_1) local hourStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_NewYearActivity_DirectGiftTimeHint_2) local minStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_NewYearActivity_DirectGiftTimeHint_3) local secStr = UIUtils.GetLocalizedTxt(Const_IDS.IDS_NewYearActivity_DirectGiftTimeHint_4) self.season_open_time:SetDHMSStr(dayStr, hourStr, minStr, secStr) local time = MDL.GVGFight.GetNextStageTime() self.season_open_time:ResetAndBeginCustomTimer(false, time, 0, 1) UIUtils.SetActive(self.btn_progress1, MDL.GVGFight.GetPriorPeriodRank()) end end function UIGVGFightMain:RefreshSeasonCountdownRankBtn() UIUtils.SetActive(self.btn_progress1, MDL.GVGFight.IsInOffSeasonWeekState() and MDL.GVGFight.GetPriorPeriodRank()) end function UIGVGFightMain:RefreshNextHighYieldRefreshTime() local nextHighYieldRefreshTime = MDL.GVGFight.GetNextHighYieldRefreshTime() if MDL.GVGFight.GetCurGVGFightState() == MDL.GVGFight.GVGFightStage.Struggle and nextHighYieldRefreshTime > 0 then UIUtils.SetActive(self.group_Info2, true) UIUtils.SetLabel(self.txt_Info2, UTL.Time.GetShowTimeBySeconds(nextHighYieldRefreshTime)) else UIUtils.SetActive(self.group_Info2, false) end end -- 刷新徽章信息 function UIGVGFightMain:RefreshBadgeState() local badgeScore = MDL.GVGFight.GetBadgeScore() local gvgFightBadgeData = CTL.GVGFight.GetGVGFightBadgeData(badgeScore) -- 设置徽章名字 UIUtils.SetLabelText(self.txt_Medal, Const_IDS[gvgFightBadgeData.BadgeName]) if string.isNilOrEmpty(gvgFightBadgeData.BadgeEffects) then -- 设置徽章图标 UIUtils.SetActive(self.img_Icon, true) UIUtils.SetImageByAssetBundle(self.img_Icon, gvgFightBadgeData.BadgeIcon) self.effect_Medal:StopUIEffect() UIUtils.SetActive(self.effect_Medal, false) else -- 设置徽章特效 UIUtils.SetActive(self.effect_Medal, true) self.effect_Medal:PlayUIEffect(gvgFightBadgeData.BadgeEffects, 0) UIUtils.SetActive(self.img_Icon, false) end -- 设置徽章星星数量 self.obj_StarState:SetState(gvgFightBadgeData.BadgeStar) end -- 刷新兵力信息 function UIGVGFightMain:RefreshTroops() local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then self.state_Info:SetState(0) -- 设置兵力 local curTroops = MDL.GVGFight.GetCurTroops() self.slider_Troops.value = curTroops / MDL.GVGFight.GVGFightForcesMax if curTroops == 0 then curTroops = UTL.Color.FormatRedColor(curTroops) self.eff_Conscription:PlayUIEffect() else curTroops = UTL.Color.FormatGreenColor(curTroops) self.eff_Conscription:StopUIEffect() end UIUtils.SetLabel(self.txt_Troops, string.format("%s%s/%s", UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_MyInfo_Force), curTroops, MDL.GVGFight.GVGFightForcesMax)) -- 设置粮草(不设置图标, 仅仅设置) local need, own = MDL.GVGFight.GetConscriptionProvisionNeedAndOwn() if need > own then UIUtils.SetLabel(self.txt_Coin, UTL.Color.FormatRedColor(need)) else UIUtils.SetLabel(self.txt_Coin, UTL.Color.FormatGreenColor(need)) end else self.eff_Conscription:StopUIEffect() self.state_Info:SetState(1) end end -- 刷新重伤信息 function UIGVGFightMain:RefreshSevereWound() if MDL.GVGFight.IsSevereWound() then UIUtils.SetActive(self.txt_SeriousInjury, true) self.cdTimer:ResetAndBeginCustomTimer(false, MDL.GVGFight.GetResidueSevereWoundTime(), 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_IMyInfo_njuryCD)) else UIUtils.SetActive(self.txt_SeriousInjury, false) end end -- 阶段计时器 function UIGVGFightMain:OnUpdateGVGStateTime(deltaTime, timeSinceUpdate) -- 将计时取整 保证计时平滑 local roundTime = math.floor(timeSinceUpdate) local nextStageTime = MDL.GVGFight.GetNextStageTime() UIUtils.SetLabel(self.txt_Info1, UTL.Time.GetShowTimeBySeconds(nextStageTime - roundTime)) if nextStageTime - roundTime < 0 then self:StopRepeatFunc(self.OnUpdateGVGStateTime) end end -- 丰产计时器 function UIGVGFightMain:OnUpdateHighYieldTime(deltaTime, timeSinceUpdate) -- 将计时取整 保证计时平滑 local roundTime = math.floor(timeSinceUpdate) local nextHighYieldRefreshTime = MDL.GVGFight.GetNextHighYieldRefreshTime() UIUtils.SetLabel(self.txt_Info2, UTL.Time.GetShowTimeBySeconds(nextHighYieldRefreshTime - roundTime)) if nextHighYieldRefreshTime - roundTime < 0 then self:StopRepeatFunc(self.OnUpdateHighYieldTime) end end -- 按钮倒计时器 function UIGVGFightMain:OnUpdateRefreshBtnTimer(deltaTime, timeSinceUpdate) self.refreshBtnCountdown = self.refreshBtnCountdown - 1 if self.refreshBtnCountdown < 0 then self:StopRepeatFunc(self.OnUpdateRefreshBtnTimer) self.btn_Refresh:SetGray(false, true) UIUtils.SetLabelText(self.lab_Refresh, Const_IDS.IDS_GVGFight_Rank_Refresh) else UIUtils.SetLabel(self.lab_Refresh, string.FormatByIdsId(Const_IDS.IDS_SecondsCountdown, self.refreshBtnCountdown)) end end function UIGVGFightMain:OnClickCity(cityId) local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if curGVGFightState == MDL.GVGFight.GVGFightStage.Struggle or curGVGFightState == MDL.GVGFight.GVGFightStage.Fierce then local x, y = self.img_Map.gameObject.transform:GetAnchoredPosition() CTL.GVGFight.RecordCityMapPos(x, y) UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightGarrisonTroops, {cityId = cityId}) else CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(Const_IDS.IDS_GVGFight_CityNoOpenTips) end end function UIGVGFightMain:RefreshRewardRp(active) self.btn_Profit:SetRedPoint(active) end function UIGVGFightMain:RefreshSeasonTaskRp(active) self.btn_Task:SetRedPoint(active) end function UIGVGFightMain:RefreshSeasonMedalRp(active) self.btn_Medal:SetRedPoint(active) end function UIGVGFightMain:RefreshGVGFightShopRp(active) self.btn_Store:SetRedPoint(active) end function UIGVGFightMain:RefreshWarReporRp(active) self.btn_WarReport:SetRedPoint(active) end function UIGVGFightMain:EnterGVGMainPanelReq() MDL.GVGFight.GVGMainPanelReq(true) end return UIGVGFightMain