local UICountryResetExhibitPanel = UIViewClass() function UICountryResetExhibitPanel:OnOpened(context) self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.renderModel) local info = MDL.Country.GetKingCountry() local countryData = DataSheetManager.CountryBase:GetDataByID(info.countryID) UIUtils.SetImageByAssetBundle(self.img_Flag, countryData.LogoPath) UIUtils.SetLocalizationImage(self.img_Country, countryData.NamePath) UIUtils.SetImageByAssetBundle(self.img_NameBg, countryData.CountryPlatePath) CTL.Country.SetCountryState(self.state_Country, info.countryID) local playerInfo = MDL.Country.GetCountryLeader(info.officialList) self.txt_Country.text = MDL.Country.GetCountryTitle(info.reignTitle, info.countryID) local leaderInfo = self:ShowHeroRT(playerInfo.showInfo) self.txt_PlayerName.text = leaderInfo.name self.lab_ServerName.text = CTL.CrossServer.GetServerShowStr(leaderInfo.ShowServerId) self.txt_TitleGuildName.text = leaderInfo.EmblemContent self.txt_GuildName.text = leaderInfo.guildName UTL.Item.SetAtlasSprite(self.ico_GuildBg, "UI_Guild", DataSheetManager.GuildEmblem:GetDataByID(leaderInfo.EmblemFrame).Image) local closeTime = MDL.Country.GetAllStageTime()[MDL.Country.Stage.CountryReset + 1] local countDown = closeTime.stageEnd - UTL.Time.GetServerTimestamp() CTL.Country.SetTitleShow(self.titleTemplate) self.btn_Gift:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_SignIn)) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country_SignIn, self.RefreshCountrySignIn) self:RegistSystemEvent(CTL.RedPoint.RedPointKey.Country_Worship, self.RefreshCountrySignIn) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Country_Unification) self.btn_Worship:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_Worship)) if context and context.playAnimation then self.soundId = CTL.Sound.PlayGameSound("National_war_VO") self:PlayUIAnimation("aniTitle3") end self.UITitleText:SetText(UIUtils.GetLocalizedTxt(Const_IDS.IDS_Country_EmperorPoem)) UIUtils.SetActive(self.UITemplateTitlePanel.effect_Back, false) self.UITemplateTitlePanel.state_Title:SetState(1) end function UICountryResetExhibitPanel:OnClosed() UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) if self.soundId then CTL.Sound.StopById(self.soundId) end UIUtils.SetActive(self.UITemplateTitlePanel.effect_Back, true) self.UITemplateTitlePanel.state_Title:SetState(0) end function UICountryResetExhibitPanel:RefreshCountrySignIn() self.btn_Gift:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_SignIn)) self.btn_Worship:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.Country_Worship)) end function UICountryResetExhibitPanel:ShowModel(heroInfo) CTL.Country.SetRenderModel(self.modelComponentDataHandle, self.renderModel, heroInfo) end function UICountryResetExhibitPanel:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.btn_Rank then CTL.Rank.OpenRankPanelByType(MDL.Rank.RankType.Country) elseif comp == self.btn_Gift then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryResetTip) elseif comp == self.btn_Worship then CTL.Country.FindPathWorshipKing() self:CloseView() elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.CountryOver}) end end function UICountryResetExhibitPanel:ShowHeroRT() local basicInfo = MDL.Country.GetStatueBasicInfo() for i, v in ipairs(basicInfo) do if v.countryInfo.countryJobId == MDL.Country.CountryJob.CountryKing then local roleInfo = CTL.Player.RoleSceneBasicToCommonRoleInfo(v) self:ShowModel(roleInfo) CTL.Country.LvBuMoShenPlayAni(roleInfo.HeroID, roleInfo.HeroAppearanceID) return roleInfo end end end return UICountryResetExhibitPanel