local UIDivineWeaponBreakSuccess = UIViewClass() local SkillIconPath = ConstAssetPathConfig.SkillImagePath local EffectPath = ConstAssetPathConfig.EffectPath function UIDivineWeaponBreakSuccess:OnOpened(context) --self.effect_BigSuccess:PlayUIEffect(EffectPath, -1) UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_MagicWeapon_SmallStar) local weaponId = context.weaponId local heroInfo = MDL.HeroSelect.GetHeroInfo(weaponId) local starLevel = heroInfo.magicWeaponLevel weaponId = heroInfo.curWeaponAppearanceId local data = DataSheetManager.MagicWeaponStar:GetDataByMagicWeaponID_Star(weaponId, starLevel) self.txt_OldStar.text = string.FormatByIdsId(Const_IDS.IDS_HeroStarLevel, starLevel - 1) self.txt_NewStar.text = string.FormatByIdsId(Const_IDS.IDS_HeroStarLevel, starLevel) UIUtils.SetActive(self.group_OnlySkill.gameObject, false) UIUtils.SetActive(self.group_Attr.gameObject, false) UIUtils.SetActive(self.group_SkillWithAttr.gameObject, false) UIUtils.SetActive(self.img_FetterBg, false) if data.StarType == LuaConst.UIBreakStarType.Skill then self:SetSkillInfo(data, self.group_OnlySkill.img_Skill, self.group_OnlySkill.txt_Skill) UIUtils.SetActive(self.group_OnlySkill.txt_Skill, true) UIUtils.SetActive(self.group_OnlySkill.gameObject, true) else local oldData for i = starLevel - 1, 0, -1 do local tempData = DataSheetManager.MagicWeaponStar:GetDataByMagicWeaponID_Star(weaponId, i) if tempData.StarType == LuaConst.UIBreakStarType.Attrs or tempData.StarType == LuaConst.UIBreakStarType.Both then oldData = tempData break end end if data.StarType == LuaConst.UIBreakStarType.Attrs then self:SetAttrInfo(data.AttrSpecial, oldData) UIUtils.SetActive(self.group_Attr.gameObject, true) elseif data.StarType == LuaConst.UIBreakStarType.Both then self:SetSkillInfo(data, self.group_SkillWithAttr.img_SkillIcon, self.group_SkillWithAttr.txt_SkillDesc) self:SetAttrInfo(data.AttrSpecial, oldData) UIUtils.SetActive(self.group_Attr.gameObject, true) UIUtils.SetActive(self.group_SkillWithAttr.gameObject, true) end end CTL.Sound.PlayGameSound("UI_breakout_03") end function UIDivineWeaponBreakSuccess:OnClosed() CTL.FormationResonance.OpenSubResonanceLevelUp() end function UIDivineWeaponBreakSuccess:SetSkillInfo(weaponStarData, icon, text) local skillText = UTL.String.FormatCombineTextByID(weaponStarData.SkillDevelopDes) text.text = skillText local weaponData = DataSheetManager.MagicWeaponData:GetDataByMagicWeaponID(self.context.weaponId) local skillData = DataSheetManager.SkillData:GetDataByID(weaponData.ActivationMusouSkillID)--不需要通过entity获取,因为这是战斗外的 UIUtils.SetImageByAssetBundle(icon, string.format(SkillIconPath, skillData.Icon)) end function UIDivineWeaponBreakSuccess:SetAttrInfo(attrSpecialId, oldData) for i = 1, #self.group_AttrInfo do UIUtils.SetActive(self.group_AttrInfo[i].gameObject, false) end local attrData = DataSheetManager.MagicWeaponStarAttr:GetDataByAttrRepeatID(attrSpecialId).Attr_Table local oldAttrData if oldData ~= nil then oldAttrData = DataSheetManager.MagicWeaponStarAttr:GetDataByAttrRepeatID(oldData.AttrSpecial).Attr_Table end for i = 1, #attrData do local divLine = self.group_AttrInfo[(i - 1) * 2] if divLine then UIUtils.SetActive(divLine.gameObject, true) end local cell = self.group_AttrInfo[i] local attr = attrData[i] local oldAttr = oldAttrData ~= nil and oldAttrData[i].AttrNum or 0 if attr then UTL.Attr.SetAttrItemByCompName(cell, attr.AttrType, attr.AttrNum, true, true, oldAttr) UIUtils.SetActive(cell.gameObject, true) end end end function UIDivineWeaponBreakSuccess:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.Bottom then self:CloseView() end end return UIDivineWeaponBreakSuccess