local UIHeroSelectShowPanel = UIViewClass() ---------------------------------------------- 系统函数 ---------------------------------------------------------- function UIHeroSelectShowPanel:OnOpened(context) self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.heroSelect) self.selectedId = context and context.showHeroID or nil self:InitPanel() AuxUtil.SetSSSCameraClipParams(true, 0.3, 750) CTL.Setting.Set5SSkin(true) end function UIHeroSelectShowPanel:InitPanel() UIManager.ActiveUIModle(false, "UIHeroSelectShowPanel") UIUtils.SetActive(self.btn_Back, self.selectedId ~= nil) if self.UITemplateTitlePanel then UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS["IDS_LoginSystem_Register_Return"]) end if self.selectedId then -- 直接武将3D模型显示 self:RefreshHeroData(self.selectedId) self:CreatHeroObj(self.selectedId) end end function UIHeroSelectShowPanel:OnButtonClicked(comp) if self.UITemplateTitlePanel then if comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() end end end function UIHeroSelectShowPanel:OnClosed() UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) AuxUtil.SetSSSCameraClipParams(false, 1, 750) CTL.Setting.Set5SSkin(false) if self.soundId then CTL.Sound.StopById(self.soundId) end self.heroList = nil UIManager.ActiveUIModle(true, "UIHeroSelectShowPanel") end function UIHeroSelectShowPanel:RefreshHeroData(id) local heroData = MDL.HeroSelect.GetHeroDataById(id) if not heroData then logging.error(LTAG.ERROR, "not find hero by id", id) return end CTL.HeroSelect.SetHeroName(id, self.loc_Name, self.img_Name, self.txt_Name) if self.loc_Name.CurState == 0 then UIUtils.SetLocalizationImage(self.img_Country,"country_"..heroData.Kingdom..".png") else UIUtils.SetLocalizationImage(self.img_CountryEn,"country_"..heroData.Kingdom..".png") end local heroName = UIUtils.GetLocalizedTxt(Const_IDS[heroData.NameIDS]) local count = UTL.String.GetStrCharCount(heroName, 1) self.uistate:SetState(count - 2) -- 组件从2个字名字开始放位置 -- 设置武将职业 CTL.HeroSelect.SetHeroProfession(id, self.obj_Profession, false) if self.group_LoadingShow then UIUtils.SetPolygonVerticesValue(self.group_LoadingShow.img_polygon,heroData.Tendentiousness) end self.txt_Intelligence.text = heroData.HeroIntelligence CTL.HeroSelect.ShowCV(self.txt_CV, id) end function UIHeroSelectShowPanel:CreatHeroObj(id) UTL.UIRender.CreateHeroTimelineTrans(self.modelComponentDataHandle, UTL.UIRender.LoadSelectHero(id, true), 0, 1600, 0) self.soundId = CTL.Sound.PlayGameSound(CTL.HeroSelect.GetHeroSound(id, "ShowSound")) end return UIHeroSelectShowPanel