local UIGVGFightGarrisonTroops = UIViewClass() --[[ 攻城略地城池内 context = { cityId --选中城池Id -- 可选参数 playerShowType, -- 页签类型 默认为 ShowAll page, -- 当前页数 默认为 1 } --]] local CityInsidePlayerShowTypeIds = { [MDL.GVGFight.CityInsidePlayerShowType.ShowAll] = Const_IDS.IDS_GVGFight_InCity_Screen1, -- 显示全部 [MDL.GVGFight.CityInsidePlayerShowType.OccupyGuild] = Const_IDS.IDS_GVGFight_InCity_Screen2, -- 占领势力 [MDL.GVGFight.CityInsidePlayerShowType.EnemyGuild] = Const_IDS.IDS_GVGFight_InCity_Screen3, -- 敌对势力 } local GVGFightCityCaptureBuff = FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GVGFightCityCaptureBuff").FloatValue) -- 占领收益 local GVGFightCityHarvestRation = FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GVGFightCityHarvestRation").FloatValue) -- 丰产收益 local GVGFightCityCaptureOnlyBuffLimit = DataSheetManager.ConstData:GetDataByID("GVGFightCityCaptureOnlyBuffLimit").IntValue -- 触发独占人数 local GVGFightCityCaptureOnlyBuff = FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GVGFightCityCaptureOnlyBuff").FloatValue) -- 独占系数 local GVGFightCityFullNumber = DataSheetManager.ConstData:GetDataByID("GVGFightCityFullNumber").IntValue -- 超员减产人数 local GVGFightCityFullDebuff = FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GVGFightCityFullDebuff").FloatValue) -- 超员减产系数 local GVGFightCostRatioInFierceFighting = FP.tonumberV1(DataSheetManager.ConstData:GetDataByID("GVGFightCostRatioInFierceFighting").FloatValue) -- 激战期消耗比例 local GVGFightHarvestRationRefreshTime = DataSheetManager.ConstData:GetDataByID("GVGFightHarvestRationRefreshTime").IntValue -- 刷新丰产时间ID -------------------- function UIGVGFightGarrisonTroops:OnCreated() self.playerShowType = MDL.GVGFight.CityInsidePlayerShowType.ShowAll self.curPage = 1 self.cityStationCostNumIsEnough = false self.refreshBtnCountdown = 0 end function UIGVGFightGarrisonTroops:OnOpened(context) self:RegistSystemEvent(EventID.GVGFight_RefreshCityState, self.RefreshCityState) self:RegistSystemEvent(EventID.GVGFight_RefreshCityPlayerList, self.RefreshCityPlayer) self:RegistSystemEvent(EventID.UI_RefreshCurrency, self.RefreshHutCityCost) self:RegistSystemEvent(EventID.GVGFight_RefreshSevereWound, self.RefreshSevereWound) self:RegistSystemEvent(EventID.GVGFight_RefreshGVGFightState, self.RefreshGVGState) self:RegistSystemEvent(EventID.GVGFight_RefreshGVGFightState, self.RefreshHutCityCost) self:RegistSystemEvent(EventID.GVGFight_CloseUIGVGFightGarrisonTroops, self.OnBackButtonPressed) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.GVGFightAssist, self.RefreshAssistRp) self:RegistSystemEvent(EventID.UI_CloseAndRecoverView, self.OnCloseAndRecoverView) self.cityCfgData = DataSheetManager.GVGFightCity:GetDataByCityID(context.cityId) local playerShowType = self.context.playerShowType if playerShowType and playerShowType > 0 then self.playerShowType = playerShowType end local curPage = self.context.page if curPage and curPage > 0 then self.curPage = curPage end self:InitPanel() -- 进入界面时向服务器订阅消息 self:EnterGVGCityInnerInfoReq() -- 订阅城池内 MDL.GVGFight.GVGMainPanelReq(true) -- 订阅城池地图 self:StartRepeatFunc(self.EnterGVGCityInnerInfoReq, CTL.GVGFight.SubscribeInterval) if not CTL.Activities.IsOpen(LuaConst.ActivityType.GVGFight) then self:CloseView(true) -- GMS关闭后,有时候这个ui push在后台,等弹出的时候需要再判断下 end end function UIGVGFightGarrisonTroops:OnClosed() -- 退出时向服务器取消订阅消息 MDL.GVGFight.GVGCityInnerInfoReq(self.cityCfgData.CityID, false) -- 取消订阅城池内 MDL.GVGFight.GVGMainPanelReq(false) -- 取消订阅城池地图 self.cdTimer:EndTimer() end function UIGVGFightGarrisonTroops:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIGVGFightGarrisonTroops:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView() 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_ShowAll then self:OnClickShowAll() 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)) MDL.GVGFight.GVGMainPanelReq(true) self:StartRepeatFunc(self.OnUpdateRefreshBtnTimer, 1, -1) end elseif comp == self.btn_CityGuardingArray then if MDL.Guild.IsHasGuild() then UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightCityGuardingArray, {cityId = self.cityCfgData.CityID}) else CTL.Tips.AddTipsMsg(Const_IDS.IDS_GVGFight_Protection_Tips10) end elseif comp == self.btn_Stationed then if not self.cityStationCostNumIsEnough then UTL.MessageBox.ShowOKCancelBox(Const_IDS.IDS_Store_BuyButton, Const_IDS.IDS_GVGFight_StationTips1, function() for _, v in MDL.OperationActivity.StoreGoodsData:GetEnumerator() do if v.ItemID == MDL.GVGFight.ProvisionsItemId then UTL.ItemTips.OpenQuickPurchaseView(v.ID) return end end end) else -- 判断自身兵力 if MDL.GVGFight.GetCurTroops() > 0 then MDL.GVGFight.GVGHutCityReq(self.cityCfgData.CityID) else UTL.MessageBox.ShowOKCancelBox("", UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_StationTips4), function() self:OnBackButtonPressed() end) end end elseif comp == self.btn_LastPage then self.curPage = self.curPage - 1 MDL.GVGFight.SetAllIsChangeFightingState() self:RefreshCityPlayer() elseif comp == self.btn_NextPage then self.curPage = self.curPage + 1 MDL.GVGFight.SetAllIsChangeFightingState() self:RefreshCityPlayer() end end function UIGVGFightGarrisonTroops:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Channel then UIUtils.SetLabelText(cellTable.txt_Channel, CityInsidePlayerShowTypeIds[data]) elseif scrollRect == self.loop_GVGTroops then -- 设置兵力 local curTroops = data.troops cellTable.slider_Troops.value = curTroops / MDL.GVGFight.GVGFightForcesMax if curTroops == 0 then curTroops = UTL.Color.FormatRedColor(curTroops) else curTroops = UTL.Color.FormatGreenColor(curTroops) end UIUtils.SetLabel(cellTable.txt_Troops, string.format("%s%s/%s", UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_MyInfo_Force), curTroops, MDL.GVGFight.GVGFightForcesMax)) -- 设置名字 UIUtils.SetLabel(cellTable.txt_PlayerInfo, data.playerName .. string.FormatByIdsId(Const_IDS.IDS_CrossSever_SeverSuffixText1, data.serverId)) -- 设置势力相关 if not string.isNilOrEmpty(data.guildAcid) then UIUtils.SetLabel(cellTable.txt_Name, data.guildName) -- 设置军团徽记 CTL.Guild.SetGuildEmblem(cellTable.img_GuildIcon, cellTable.txt_Guild, data.emblemFrame, data.emblemContent) else UIUtils.SetActive(cellTable.img_GuildIcon, false) UIUtils.SetLabelText(cellTable.txt_Name, Const_IDS.IDS_GVGFight_InCity_NoGuild) end -- 设置战力 UIUtils.SetLabel(cellTable.txt_CENum, data.gs) -- 设置徽章 local badgeData = CTL.GVGFight.GetGVGFightBadgeData(data.badgeScore) cellTable.obj_StarState:SetState(badgeData.BadgeStar) if string.isNilOrEmpty(badgeData.BadgeEffects) then -- 设置徽章图标 UIUtils.SetActive(cellTable.img_Medal, true) UIUtils.SetImageByAssetBundle(cellTable.img_Medal, badgeData.BadgeIcon) cellTable.effect_Medal:StopUIEffect() else -- 设置徽章特效 cellTable.effect_Medal:PlayUIEffect(badgeData.BadgeEffects, 0) UIUtils.SetActive(cellTable.img_Medal, false) end -- 设置战斗中标识 if data.isChangeFightingState then if data.isFighting then cellTable.effect_Fight:PlayUIEffect() else cellTable.effect_Fight:StopUIEffect() end MDL.GVGFight.ResetCityInsideInfoPlayEffectState(data.playerAcid) end -- 设置 自身、友军、敌人 颜色 if data.playerAcid == BattleDataGetter.GetAcID() then cellTable.state_City:SetState(0) elseif MDL.Guild.IsSameGuild(data.guildAcid) then cellTable.state_City:SetState(1) else cellTable.state_City:SetState(2) end end end function UIGVGFightGarrisonTroops:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_Channel then self.playerShowType = data self.curPage = 1 UIUtils.SetLabelText(self.txt_ShowAll, CityInsidePlayerShowTypeIds[self.playerShowType]) self:OnClickShowAll() MDL.GVGFight.SetAllIsChangeFightingState() self:RefreshCityPlayer() elseif scrollRect == self.loop_GVGTroops then if data.playerAcid == BattleDataGetter.GetAcID() then CTL.Tips.AddTipsMsg(UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_CanntAttackMyselfTips)) else UIManager.OpenView(Const_UI_Lua.UIEnum.UIGVGFightAttack, { attackAcid = data.playerAcid, cityId = self.cityCfgData.CityID, playerShowType = self.playerShowType, curPage = self.curPage, }) end end end -------------------- function UIGVGFightGarrisonTroops:InitPanel() -- 设置标题 UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS[self.cityCfgData.CityName]) -- 初始化显示分组 UIUtils.SetLabelText(self.txt_ShowAll, CityInsidePlayerShowTypeIds[self.playerShowType]) self.state_Arrow:SetState(1) UIUtils.SetActive(self.group_ShowAll, false) -- 设置占领加成 UIUtils.SetLabel(self.txt_Occupy1, string.format("+%.2s%%", GVGFightCityCaptureBuff * 100)) -- 设置收益道具间隔 UIUtils.SetLabel(self.lab_Profit, string.FormatByIdsId(Const_IDS.IDS_GVGFight_InCity_IncomeEfficiency, self.cityCfgData.CityBasicHarvestPerTime)) UTL.Item.MoneyIcon(self.img_Profit, self.cityCfgData.CityBasicHarvestItem) -- 设置驻扎消耗道具 UTL.Item.MoneyIcon(self.img_Coin, self.cityCfgData.CityStationCostItem) self:RefreshHutCityCost() -- 设置独占 UIUtils.SetLabel(self.txt_ReduceProduction1, string.format("+%.2s%%", GVGFightCityCaptureOnlyBuff * 100)) -- 设置超员减产 UIUtils.SetLabel(self.txt_FullDebuff, string.format("-%.2s%%", GVGFightCityFullDebuff * 100)) -- 初始刷城池占领状态 self:RefreshCityState() -- 初始化城池玩家 self:RefreshCityPlayer() -- 设置护城阵状态 UIUtils.SetActive(self.btn_CityGuardingArray, self.cityCfgData.CityType ~= MDL.GVGFight.GVGFightCityType.CampCity) -- 初始化重伤 self:RefreshSevereWound() -- 初始化刷新按钮状态 self.btn_Refresh:SetGray(false, true) UIUtils.SetLabelText(self.lab_Refresh, Const_IDS.IDS_GVGFight_Rank_Refresh) -- 如果此时在战斗场景中 则需要重置一下镜头置灰 if BattleDataGetter.CheckCurLevelType(LuaConst.LevelType.AttackCity) then CameraController.Instance:SetGray(false) end -- 刷新红点 self:RefreshAssistRp(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.GVGFightAssist)) end function UIGVGFightGarrisonTroops:RefreshCityState() local cityInfo = MDL.GVGFight.GetCityOuterInfo(self.cityCfgData.CityID) -- 设置占领公会 if cityInfo and not string.isNilOrEmpty(cityInfo.guildId) then self.obj_OccupyTopState:SetState(0) UIUtils.SetLabel(self.txt_OccupyInformation, cityInfo.guildName) -- 设置势力徽记 CTL.Guild.SetGuildEmblem(self.img_OccupyIcon, self.img_OccupyTxt, cityInfo.emblemFrame, cityInfo.emblemContent) -- 设置区服 UIUtils.SetLabel(self.txt_Server, string.FormatByIdsId(Const_IDS.IDS_ServerInfo, cityInfo.guildServerId)) -- 设置护城阵 UIUtils.SetActive(self.img_ShieldIconBg, cityInfo.isCityGuardingArray) if cityInfo.guildId == MDL.Guild.GetMyGuildId() then self.obj_OccupyState:SetState(1) self.state_Occupy:SetState(1) else self.obj_OccupyState:SetState(0) self.state_Occupy:SetState(0) end else if self.cityCfgData.CityType == MDL.GVGFight.GVGFightCityType.CampCity then self.obj_OccupyTopState:SetState(2) self.obj_OccupyState:SetState(2) else self.obj_OccupyTopState:SetState(1) self.obj_OccupyState:SetState(0) end end -- 设置捣乱减产 and 收益 self:SetMakeTroubleAndProfit() -- 设置驻扎 if MDL.GVGFight.IsSevereWound() then UIUtils.SetActive(self.btn_Stationed, false) self:SetCoinShow(false) else self:SetStationedBtnState() end end function UIGVGFightGarrisonTroops:RefreshCityPlayer() local allPage = MDL.GVGFight.GetCityInsidePage(self.playerShowType) if self.curPage > allPage then self.curPage = allPage end if self.curPage < 1 then self.curPage = 1 end -- 设置按钮状态 UIUtils.SetActive(self.ani_RightArrow.gameObject, self.curPage ~= allPage) UIUtils.SetActive(self.ani_LeftArrow.gameObject, self.curPage ~= 1) UIUtils.SetLabel(self.lab_Page, string.format("%s/%s", self.curPage, allPage)) MDL.GVGFight.SetCityInsideData(self.curPage, self.playerShowType) CSExt.CSFunc_ReloadAll(self.loop_GVGTroops, MDL.GVGFight.EnumCityInsideData) -- 设置捣乱减产 and 收益 self:SetMakeTroubleAndProfit() end -- 驻扎消耗 function UIGVGFightGarrisonTroops:RefreshHutCityCost() if MDL.GVGFight.GetBelongCityId() == self.cityCfgData.CityID then return end self:SetCoinShow(true) local coinCount = UTL.Item.GetItemStockCount(self.cityCfgData.CityStationCostItem) local cityStationCostNum = self.cityCfgData.CityStationCostNum if MDL.GVGFight.GetCurGVGFightState() == MDL.GVGFight.GVGFightStage.Fierce then cityStationCostNum = math.floor(cityStationCostNum * GVGFightCostRatioInFierceFighting) end if coinCount < cityStationCostNum then self.cityStationCostNumIsEnough = false UIUtils.SetLabel(self.txt_Coin, UTL.Color.FormatRedColor(cityStationCostNum)) else self.cityStationCostNumIsEnough = true UIUtils.SetLabel(self.txt_Coin, UTL.Color.FormatGreenColor(cityStationCostNum)) end end -- 阶段切换事件 function UIGVGFightGarrisonTroops:RefreshGVGState() local curGVGFightState = MDL.GVGFight.GetCurGVGFightState() if curGVGFightState == MDL.GVGFight.GVGFightStage.OffSeason then UTL.MessageBox.ShowOnlyOkNoCloseBox("", Const_IDS.IDS_GVGFight_Protection_Tips9, function() if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIGVGFightGarrisonTroops) then self:OnBackButtonPressed() end end) end end -- 刷新重伤信息 function UIGVGFightGarrisonTroops:RefreshSevereWound() if MDL.GVGFight.IsSevereWound() then UIUtils.SetActive(self.txt_SeriousInjury, true) UIUtils.SetActive(self.btn_Stationed, false) self:SetCoinShow(false) self.cdTimer:ResetAndBeginCustomTimer(false, MDL.GVGFight.GetResidueSevereWoundTime(), 0, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GVGFight_IMyInfo_njuryCD)) self:StartRepeatFunc(self.OnUpdateSevereWound, 0.5, -1) else UIUtils.SetActive(self.txt_SeriousInjury, false) self:SetStationedBtnState() end end function UIGVGFightGarrisonTroops:OnUpdateSevereWound(deltaTime, timeSinceUpdate) if not MDL.GVGFight.IsSevereWound() then self:StopRepeatFunc(self.OnUpdateSevereWound) UIUtils.SetActive(self.txt_SeriousInjury, false) self:SetStationedBtnState() end end -- 设置捣乱减产 and 收益 function UIGVGFightGarrisonTroops:SetMakeTroubleAndProfit() local cityInfo = MDL.GVGFight.GetCityOuterInfo(self.cityCfgData.CityID) if cityInfo then local profit = self.cityCfgData.CityBasicHarvestNum if cityInfo.isHighYield then profit = math.ceil(profit * GVGFightCityHarvestRation) end UIUtils.SetLabel(self.txt_Profit1, profit) -- 计算额外收益系数 local extraProfitCoefficient = 0 -- 超员减产 if self.cityCfgData.CityType == MDL.GVGFight.GVGFightCityType.CampCity then self.obj_FullDebuff:SetState(2) else if MDL.GVGFight.GetBelongCityId() == self.cityCfgData.CityID then local selfIndex = MDL.GVGFight.GetSelfCityInsideIndex() if selfIndex > GVGFightCityFullNumber then self.obj_FullDebuff:SetState(1) extraProfitCoefficient = extraProfitCoefficient - GVGFightCityFullDebuff else self.obj_FullDebuff:SetState(0) end UIUtils.SetLabel(self.lab_FullDebuff, string.FormatByIdsId(Const_IDS.IDS_GVGFight_InCity_CityFullDebuff, selfIndex)) else local playerCount = MDL.GVGFight.GetCityInsidePlayerCount(MDL.GVGFight.CityInsidePlayerShowType.ShowAll) if playerCount >= GVGFightCityFullNumber then self.obj_FullDebuff:SetState(1) else self.obj_FullDebuff:SetState(0) end UIUtils.SetLabel(self.lab_FullDebuff, string.FormatByIdsId(Const_IDS.IDS_GVGFight_InCity_CityFullDebuffPreview, playerCount)) end end if not string.isNilOrEmpty(cityInfo.guildId) then local allPlayerCount = MDL.GVGFight.GetCityInsidePlayerCount(MDL.GVGFight.CityInsidePlayerShowType.ShowAll) local notOccupyPlayerCount = allPlayerCount - MDL.GVGFight.GetCityInsidePlayerCount(MDL.GVGFight.CityInsidePlayerShowType.OccupyGuild) UIUtils.SetLabel(self.lab_ReduceProduction, string.FormatByIdsId(Const_IDS.IDS_GVGFight_InCity_IncomeOnlyBuff, notOccupyPlayerCount, GVGFightCityCaptureOnlyBuffLimit)) self.obj_ReduceProductionState:SetState(0) if cityInfo.guildId == MDL.Guild.GetMyGuildId() then extraProfitCoefficient = extraProfitCoefficient + GVGFightCityCaptureBuff if notOccupyPlayerCount < GVGFightCityCaptureOnlyBuffLimit then extraProfitCoefficient = extraProfitCoefficient + GVGFightCityCaptureOnlyBuff self.obj_ReduceProductionState:SetState(1) end end else if self.cityCfgData.CityType == MDL.GVGFight.GVGFightCityType.CampCity then self.obj_ReduceProductionState:SetState(2) else self.obj_ReduceProductionState:SetState(0) UIUtils.SetLabel(self.lab_ReduceProduction, string.FormatByIdsId(Const_IDS.IDS_GVGFight_InCity_IncomeOnlyBuff, 0, GVGFightCityCaptureOnlyBuffLimit)) end end -- 设置额外收益 if extraProfitCoefficient == 0 then UIUtils.SetActive(self.txt_Profit2, false) elseif extraProfitCoefficient > 0 then UIUtils.SetActive(self.txt_Profit2, true) -- 此直接使用 向上取整 会多1,所以先保留两位小数,后在取整 local reserveProfit = math.modf(profit * extraProfitCoefficient * 100) / 100 local str = string.format("+%s", math.ceil(reserveProfit)) UIUtils.SetLabel(self.txt_Profit2, UTL.Color.FormatGreenColor(str)) elseif extraProfitCoefficient < 0 then UIUtils.SetActive(self.txt_Profit2, true) -- 此直接使用 向上取整 会多1,所以先保留两位小数,后在取整 local reserveProfit = math.modf(profit * extraProfitCoefficient * 100) / 100 UIUtils.SetLabel(self.txt_Profit2, UTL.Color.FormatRedColor(math.ceil(reserveProfit))) end end end function UIGVGFightGarrisonTroops: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 UIGVGFightGarrisonTroops:OnClickShowAll() if self.group_ShowAll.gameObject.activeSelf then CTL.Sound.PlayGameSound("UI_fold") UIUtils.SetActive(self.group_ShowAll, false) self.state_Arrow:SetState(1) else CTL.Sound.PlayGameSound("UI_expand") UIUtils.SetActive(self.group_ShowAll, true) self.state_Arrow:SetState(0) if self.loop_Channel.Count > 0 then self.loop_Channel:ClearCells() end -- 添加除当前选中的以外的tab for i = MDL.GVGFight.CityInsidePlayerShowType.ShowAll, MDL.GVGFight.CityInsidePlayerShowType.EnemyGuild do if i ~= self.playerShowType then self.loop_Channel:AddData(i, 0) end end end end function UIGVGFightGarrisonTroops:RefreshAssistRp(active) self.btn_CityGuardingArray:SetRedPoint(active) end function UIGVGFightGarrisonTroops:EnterGVGCityInnerInfoReq() MDL.GVGFight.GVGCityInnerInfoReq(self.cityCfgData.CityID, true) end function UIGVGFightGarrisonTroops:SetStationedBtnState() UIUtils.SetActive(self.btn_Stationed, true) if MDL.GVGFight.GetBelongCityId() == self.cityCfgData.CityID then self.btn_Stationed:SetGray(true) UIUtils.SetLabelText(self.lab_Stationed, Const_IDS.IDS_GVGFight_Stationing) self:SetCoinShow(false) else self.btn_Stationed:SetGray(false, true) UIUtils.SetLabelText(self.lab_Stationed, Const_IDS.IDS_GVGFight_StationButton) self:SetCoinShow(true) end end function UIGVGFightGarrisonTroops:SetCoinShow(show) if not show then UIUtils.SetActive(self.group_Coin, false) else if self.cityCfgData.CityStationCostNum == 0 or MDL.GVGFight.IsSevereWound() then UIUtils.SetActive(self.group_Coin, false) else UIUtils.SetActive(self.group_Coin, true) end end end return UIGVGFightGarrisonTroops