local UICountryGuildListPanel = UIViewClass() function UICountryGuildListPanel:OnOpened(context) self:ShowSovereignList() self:ShowCoreInfo() self:ShowMyGuildInfo() UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_Country_GuildList) end function UICountryGuildListPanel:OnButtonClicked(comp) if comp == self.btn_Rank then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryGuildRankView) elseif comp == self.group_Own.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UIDescriptionPanel, {target = self.group_Own.flag_Description, posType = LuaConst.DescriptionPanelType.Center, text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_GuildListIntro)}) elseif comp == self.UICommonPopUp.btn_Close then self:CloseView() else for i, v in ipairs(self.MonarchGroups) do if v.btn == comp then local list = MDL.Country.GetSovereignGuildList() MDL.Country.CountryGetTargetGuildInfoReq(list[i].guildId) end end end end function UICountryGuildListPanel:OnCellInit(scrollRect, index, cellTable, data) cellTable.txt_GuildName.text = data.guildName cellTable.lab_ServerName.text = CTL.CrossServer.GetServerShowStr(data.serverId) UTL.Item.SetAtlasSprite(cellTable.ico_GuildBg, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame).Image) cellTable.txt_TitleGuildName.text = data.guildEmblemContent if data.country > 0 then CTL.Country.SetCountryImage(cellTable, data.country) UIUtils.SetActive(cellTable.img_Flag, true) else UIUtils.SetActive(cellTable.img_Flag, false) end end function UICountryGuildListPanel:OnCellSelect(scrollRect, index, cellTable, data) MDL.Country.CountryGetTargetGuildInfoReq(data.guildId) end function UICountryGuildListPanel:ShowSovereignList() local list = MDL.Country.GetSovereignGuildList() if list then for i, v in ipairs(list) do self:ShowSovereign(self.MonarchGroups[i], v) end end end function UICountryGuildListPanel:ShowSovereign(collection, data) if data then collection.lab_GuildName.text = data.guildName collection.lab_ServerName.text = CTL.CrossServer.GetServerShowStr(data.serverId) if DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame) then UTL.Item.SetAtlasSprite(collection.ico_GuildBg, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame).Image) end collection.txt_TitleGuildName.text = data.guildEmblemContent if data.country > 0 then CTL.Country.SetCountryImage(collection, data.country) else UIUtils.SetActive(collection.img_Flag, false) end end end function UICountryGuildListPanel:ShowCoreInfo() local list = MDL.Country.GetCoreGuildList() self.Loop_CountryGuildList:ReloadAll(list) end function UICountryGuildListPanel:ShowMyGuildInfo() if MDL.Guild.IsHasGuild() then local data = MDL.Country.GetMyGuildInfo() self.group_Own.txt_GuildName.text = data.guildName self.group_Own.lab_ServerName.text = CTL.CrossServer.GetServerShowStr(data.serverId) UTL.Item.SetAtlasSprite(self.group_Own.ico_GuildBg, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(data.guildEmblemFrame).Image) self.group_Own.txt_TitleGuildName.text = data.guildEmblemContent UIUtils.SetActive(self.group_Own.gameObject, true) local str = nil if MDL.Country.MyIsSovereign() then str = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_King) elseif MDL.Country.MyIsCore() then str = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_OptionalGuild) else str = UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_NormalRank) end self.group_Own.lab_Level.text = string.FormatByIdsId (Const_IDS.IDS_Country_Evaluate, str) else UIUtils.SetActive(self.group_Own.gameObject, false) end end return UICountryGuildListPanel