local UICommonSkillTips = UIViewClass() local SkillIconWidth = -100 local SkillIconPath = ConstAssetPathConfig.SkillImagePath function UICommonSkillTips:OnOpened(context) local heroId = context.heroId local skillType = context.skillType local skillId = context.skillId local isLock = context.isLock local skillPath = nil local skillName = nil local skillTips = nil UIUtils.SetActive(self.group_LockInfo.gameObject, false) if skillType == CTL.Tips.SkillType.ActiveSkill or skillType == CTL.Tips.SkillType.PassiveSkill then local info = DataSheetManager.SkillTipsData:GetDataByID(skillId) skillName = info.Name skillPath = string.format(SkillIconPath, info.SkillIcon) skillTips = UTL.String.FormatCombineTextByID(info.TipsFunc) if info.LevelUpType == 3 and heroId and not MDL.HeroSelect.IsMagicWeaponActive(heroId) then local name = DataSheetManager.MagicWeaponData:GetDataByMagicWeaponID(heroId).MagicWeaponName local desc = string.FormatByIdsId(Const_IDS["IDS_UnactiveHeroOptimize_Hint2"], UIUtils.GetLocalizedTxt(Const_IDS[name])) self.txt_LockInfo.text = desc UIUtils.SetActive(self.group_LockInfo.gameObject, true) end elseif skillType == CTL.Tips.SkillType.DevelopEffect then skillName, skillTips = MDL.HeroStar.GetTalentNameAndDesc(skillId) local developEffectData = DataSheetManager.DevelopEffectData:GetDataByID(skillId) skillPath = string.format(SkillIconPath, developEffectData.Icon) if isLock and heroId then local star for i, v in DataSheetManager.HeroStar:GetDataByHeroID_Star(heroId) do if v.DevelopEffectID == skillId then star = v.Star break end end local desc = string.FormatByIdsId(Const_IDS["IDS_UnactiveHeroOptimize_Hint3"], star) self.txt_LockInfo.text = desc UIUtils.SetActive(self.group_LockInfo.gameObject, true) end elseif skillType == CTL.Tips.SkillType.Buff then local data = DataSheetManager.BuffData:GetDataByBuffID(skillId) skillName = data.BuffName skillPath = data.BuffIcon skillTips = UTL.String.FormatCombineTextByID(data.BuffDescribe) --BuffManager.BuffDescribeSplice(data.BuffDescribe, data.BuffFormula) elseif skillType == CTL.Tips.SkillType.ConstantBuff then local data = DataSheetManager.BuffData:GetDataByBuffID(skillId) skillName = data.BuffName skillPath = data.BuffIcon skillTips = UTL.String.FormatCombineTextByID(data.BuffDescribe) elseif skillType == CTL.Tips.SkillType.BuildingSkill then local info = DataSheetManager.SkillTipsData:GetDataByID(skillId) skillName = info.Name if not string.isNilOrEmpty(info.SkillIcon) then skillPath = string.format(SkillIconPath, info.SkillIcon) else skillPath = ConstAssetPathConfig.Const_SlashBtnIcon end skillTips = UTL.String.FormatCombineTextByID(info.TipsFunc) else logging.error(LTAG.ERROR, "没有找到该SkillType: ", skillType, ",请检查。") end self:SetContent(skillName, skillTips, skillPath, context.parentTf, isLock) end function UICommonSkillTips:SetContent(name, tips, path, parentTf, isLock) if isLock then UIUtils.SetActive(self.txt_IsUnlock, true) else UIUtils.SetActive(self.txt_IsUnlock, false) end UIUtils.SetLabelText(self.txt_SkillName, Const_IDS[name]) UIUtils.SetLabel(self.txt_SkillDes, tips) UIUtils.SetImageByAssetBundle(self.img_Skill, path) local viewTf = self.group_SkillDetailInfo.parent viewTf:SetParent(parentTf) viewTf:SetAnchoredPosition(SkillIconWidth, 0) end function UICommonSkillTips:OnButtonClicked(comp) if comp == self.img_Back then self:CloseView() end end return UICommonSkillTips