--============ --XUiGuildDormPanelGuildInformation子面板 --============ local XUiGuildDormPanelGITopInfo = XClass(nil, "XUiGuildDormPanelGITopInfo") local GuildBuildIntervalWhenMaxLevel = CS.XGame.Config:GetInt("GuildBuildIntervalWhenMaxLevel") function XUiGuildDormPanelGITopInfo:Ctor(panel) XTool.InitUiObjectByUi(self, panel) self.BtnSetFace.CallBack = function() self:OnClickBtnSetFace() end XEventManager.AddEventListener(XEventId.EVENT_GUILD_DATA_CHANGED, self.Refresh, self) end --========== --data : XUiGuildDormMainData --========== function XUiGuildDormPanelGITopInfo:Refresh() self.RImgGuildIcon:SetRawImage(XDataCenter.GuildManager.GetGuildIconId()) self.TxtGuildName.text = XDataCenter.GuildManager.GetGuildName() self.TxtLeader.text = XDataCenter.GuildManager.GetGuildLeaderName() local guildLevel = XDataCenter.GuildManager.GetGuildLevel() local curBuild = XDataCenter.GuildManager.GetBuild() local guildLevelTemplate = XGuildConfig.GetGuildLevelDataBylevel(guildLevel) if XDataCenter.GuildManager.CheckAllTalentLevelMax() then local gloryLevel = XDataCenter.GuildManager.GetGloryLevel() self.TxtLvNum.text = string.format("%d(%d)", guildLevel, gloryLevel) else self.TxtLvNum.text = string.format("%d", guildLevel) end if XDataCenter.GuildManager.IsGuildLevelMax(guildLevel) then -- 达到最高等级 self.ImgProgress.fillAmount = curBuild * 1.0 / GuildBuildIntervalWhenMaxLevel self.TxtNum.text = string.format("%s/%s", tostring(curBuild), tostring(GuildBuildIntervalWhenMaxLevel)) else -- 未到达最高等级 self.TxtLvNum.text = guildLevel self.ImgProgress.fillAmount = curBuild * 1.0 / guildLevelTemplate.Build self.TxtNum.text = string.format("%s/%s", tostring(curBuild), tostring(guildLevelTemplate.Build)) end end function XUiGuildDormPanelGITopInfo:OnClickBtnSetFace() XLuaUiManager.Open("UiGuildDormHeadPotrait") end function XUiGuildDormPanelGITopInfo:Dispose() XEventManager.RemoveEventListener(XEventId.EVENT_GUILD_DATA_CHANGED, self.Refresh, self) end return XUiGuildDormPanelGITopInfo