local UICountryGuildRankView = UIViewClass() local MaxShowCount = DataSheetManager.ConstData:GetDataByID("CountrySignPhaseRankShowNum").IntValue local GuildActivityPowerOfflineTimeLimit = DataSheetManager.ConstData:GetDataByID("GuildActivityPowerOfflineTimeLimit").IntValue function UICountryGuildRankView:OnOpened(context) self:RegistSystemEvent(EventID.Country_RefreshGuildRankInfo, self.UpdateInfo) MDL.Country.CountryGetGuildRankReq() UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_CountrySelection_CheckGuildBtn) local seconds = DataSheetManager.ConstData:GetDataByID("GuildPowerRankRefreshTime").IntValue local timeStr = UTL.Time.GetShowTimeByMinutes(seconds / UTL.Time.TotalSecondsOneMinute) self.lab_Refresh.text = string.FormatByIdsId(Const_IDS.IDS_CountrySelection_GuildRankRefreshIntro, timeStr) local allStageTime = MDL.Country.GetAllStageTime() local curStage = MDL.Country.GetCurStage() local structTime = allStageTime[curStage + 1] local countTime = structTime.stageEnd - UTL.Time.GetServerTimestamp() CTL.Country.SetCdTime(self.txt_Countdown, countTime, Const_IDS.IDS_CountrySelection_EvaluatingCountdown) end function UICountryGuildRankView:UpdateInfo(msg) self.preDominating = msg.preDominating for i, v in ipairs(msg.guildList) do self.LoopScroll_Details:AddData(v, 0) end self:SetMyInfo(msg.myGuildInfo, msg.guildList) end function UICountryGuildRankView:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif self.img_Info == comp then local text = string.FormatByIdsId(Const_IDS.IDS_Country_GuildPowerTip, GuildActivityPowerOfflineTimeLimit) UIManager.OpenView(Const_UI_Lua.UIEnum.UIDescriptionPanel, {target = self.img_Info, posType = LuaConst.DescriptionPanelType.Center, text = text}) end end function UICountryGuildRankView:OnCellSelect(scrollRect, index, cellTable, data) MDL.Country.CountryGetTargetGuildInfoReq(data.guildId) end function UICountryGuildRankView:OnCellInit(scrollRect, index, cellTable, data) cellTable.txt_GuildName.text = data.guildName cellTable.lab_ServerName.text = CTL.CrossServer.GetServerShowStr(data.serverId) cellTable.txt_PowerNumber.text = data.guildGs if DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame) then UTL.Item.SetAtlasSprite(cellTable.ico_GuildBg, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame).Image) end cellTable.txt_TitleGuildName.text = data.guildEmblemContent cellTable.lab_GuildNum.text = data.guildNum cellTable.lab_GuildLord.text = data.guildLeadName if index < MDL.Country.CountryType.Qun then UIUtils.SetLabelText(cellTable.lab_Level, Const_IDS.IDS_Country_King) elseif index < MaxShowCount then UIUtils.SetLabelText(cellTable.lab_Level, Const_IDS.IDS_Country_OptionalGuild) UIUtils.SetActive(cellTable.img_Overlord, false) else cellTable.lab_Level.text = nil UIUtils.SetActive(cellTable.img_Overlord, false) end local maxCoreGuildNum = MDL.Country.GetMaxCoreGuildNum() if index <= 3 then cellTable.state_Level:SetState(1) elseif index <= maxCoreGuildNum + 3 then cellTable.state_Level:SetState(2) else cellTable.state_Level:SetState(0) end for i, v in ipairs(self.preDominating) do if data.guildId == v then UIUtils.SetActive(cellTable.img_Overlord, true) return end end UIUtils.SetActive(cellTable.img_Overlord, false) end function UICountryGuildRankView:SetMyInfo(data, list) local index = nil for i, v in ipairs(list) do if v.guildId == data.guildId then index = i - 1 break end end if not MDL.Guild.GetMyGuildInfo().isEndTriaRun then UIUtils.SetActive(self.group_Mydetail.gameObject, true) UIUtils.SetActive(self.group_Mydetail.img_Level.gameObject, false) UIUtils.SetLabelText(self.txt_EndTriaRun, Const_IDS.IDS_Country_TrialGuildCannotJoin) self.group_Mydetail.img_NotList.text = nil UIUtils.SetActive(self.group_Mydetail.ico_GuildBg, false) index = 1 elseif IsServerDataNotNil(data) then self:OnCellInit(nil, index or MDL.Country.GetMaxCoreGuildNum() + 4, self.group_Mydetail, data) else UIUtils.SetActive(self.group_Mydetail.gameObject, false) end if index == nil then UIUtils.SetLabelText(self.group_Mydetail.img_NotList, Const_IDS.IDS_GuildBoss_NotInList) end end return UICountryGuildRankView