local UIHeroInfoView = UIViewClass() local SkillIconPath = ConstAssetPathConfig.SkillImagePath local LockTextColor = "888b97" local UnlockContentColor = "d5def4" function UIHeroInfoView:OnOpened(context) local heroId = MDL.HeroSelect.curSelectHeroID if context[1] == "Advance" then UIUtils.SetLabel(self.Lab_Top, UIUtils.GetLocalizedTxt(Const_IDS.IDS_HeroAdvanceDetail)) self:ShowAdvanceInfo(heroId) elseif context[1] == "Break" then UIUtils.SetLabel(self.Lab_Top, UIUtils.GetLocalizedTxt(Const_IDS.IDS_HeroStarDetail)) self:ShowBreakInfo(heroId) elseif context[1] == "Compose" then UIUtils.SetLabel(self.Lab_Top, UIUtils.GetLocalizedTxt(Const_IDS.IDS_Jade_Resonance_1)) self:ShowGongMingInfo(context[2]) end end function UIHeroInfoView:ShowBreakInfo(heroId) local heroStar = MDL.HeroStar.GetHeroStarLevel(heroId) local showNumLimit = DataSheetManager.HeroStar:GetDataByHeroID_Star(heroId, heroStar).PreDevelopEffectNum for i, v in DataSheetManager.HeroStar:GetDataByHeroID_Star(heroId) do if v.DevelopEffectID and v.DevelopEffectID ~= 0 then local talentName, desc = MDL.HeroStar.GetTalentNameAndDesc(v.DevelopEffectID) local developEffectData = DataSheetManager.DevelopEffectData:GetDataByID(v.DevelopEffectID) local name = string.FormatByIdsId(Const_IDS[v.DevelopEffectName], v.Star) local icon = developEffectData.Icon local isUnlock = heroStar >= v.Star self.loop_DetailInfo:AddData({name = name, desc = desc, icon = icon, isUnlock = isUnlock}, 0) end if i > showNumLimit then return end end end function UIHeroInfoView:ShowGongMingInfo(displayData) for i = 1, #displayData do local v = displayData[i] self.loop_DetailInfo:AddData({name = v.title, desc = v.attr, isUnlock = v.isUnlock}, 1) end end function UIHeroInfoView:ShowAdvanceInfo(heroId) local advanceLevel = MDL.Advanced.GetHeroAdvancedInfo(heroId) for i, v in DataSheetManager.HeroAdvanceAttr:GetDataByAdvanceTemplateID_AdvanceID(DataSheetManager.HeroNum:GetDataByID(heroId).AdvanceTemplateID) do if v.BigLvupAttr and v.BigLvupAttr > 0 then local isUnlock = advanceLevel >= v.AdvanceID local desc = string.FormatByIdsId(Const_IDS.IDS_HeroAdvanceNew_Hint_11, v.BigLvupAttrDesc1, UTL.Attr.FormatNumberToPercentage(v.BigLvupAttrDesc2, 0)) local advancedData = DataSheetManager.HeroAdvance:GetDataByAdvanceID(v.AdvanceID) local title = string.FormatByIdsId(Const_IDS.IDS_HeroAdvanceNew_Hint_10, advancedData.Stage, advancedData.LightStar) self.loop_DetailInfo:AddData({name = title, desc = desc, isUnlock = isUnlock}, 1) end end end function UIHeroInfoView:OnBackButtonPressed() self:OnButtonClicked(self.BtnClose) end function UIHeroInfoView:OnButtonClicked(comp) if comp == self.BtnClose or comp == self.btn_Bottom then self:CloseView() end end function UIHeroInfoView:OnCellInit(scrollRect, index, cellTable, data) if data.isUnlock then data.desc = UTL.Color.FormatTextByColor(UnlockContentColor, data.desc) else data.desc = UTL.Color.FormatTextByColor(LockTextColor, data.desc) data.name = UTL.Color.FormatTextByColor(LockTextColor, data.name) end UIUtils.SetLabel(cellTable.txt_CellTitle, data.name) UIUtils.SetLabel(cellTable.txt_CellInfo, data.desc) UIUtils.SetActive(cellTable.cell.gameObject, true) if data.icon then UIUtils.SetImageByAssetBundle(cellTable.img_Skill, string.format(SkillIconPath, data.icon)) end UIUtils.SetActive(cellTable.img_Locked, not data.isUnlock) UIUtils.SetActive(cellTable.img_SkillLocked, not data.isUnlock) end return UIHeroInfoView