local UIHorseEquipLevelUpSuccess = UIViewClass() local LvStr1 = "%s/%s" function UIHorseEquipLevelUpSuccess:OnOpened(context) self.armorInfo = context.armorInfo self.oldArmorLv = context.oldArmorLv self.limitLv = context.limitLv UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_HorseEquip_Hint_11) self:RefreshInfo() end function UIHorseEquipLevelUpSuccess:RefreshInfo() local str1 = string.format(LvStr1, self.oldArmorLv, self.limitLv) self.txt_Before.text = string.FormatByIdsKey("IDS_HorseSoul_Button3", str1) local str2 = string.format(LvStr1, self.armorInfo.level, self.limitLv) self.txt_After.text = string.FormatByIdsKey("IDS_HorseSoul_Button3", str2) local horseEquipEnhance = DataSheetManager.HorseEquipEnhance:GetDataByEnhanceLevel(self.limitLv) UIUtils.SetImageByAssetBundle(self.img_Armor1, horseEquipEnhance.Icon) UIUtils.SetImageByAssetBundle(self.img_Armor2, horseEquipEnhance.Icon) self:RefreshAttrInfo() end function UIHorseEquipLevelUpSuccess:RefreshAttrInfo() local oldAttrTable = DataSheetManager.HorseEquipEnhance:GetDataByEnhanceLevel(self.oldArmorLv).Attr_Table local nowAttrTable = DataSheetManager.HorseEquipEnhance:GetDataByEnhanceLevel(self.armorInfo.level).Attr_Table for i, v in ipairs(self.group_Attrs) do local oldAttr = oldAttrTable[i] local nowAttr = nowAttrTable[i] if not oldAttr and not nowAttr then UIUtils.SetActive(v.gameObject, false) else UIUtils.SetActive(v.gameObject, true) local attrData = DataSheetManager.AttrData:GetDataByID(nowAttr.AttrType) UIUtils.SetLabelText(v.lab_Attr, Const_IDS[attrData.Name]) UTL.Item.SetAtlasSprite(v.img_Attr,"UI_Common", attrData.Icon) v.txt_Attr_Before.text = oldAttr.AttrNum v.txt_Attr.text = nowAttr.AttrNum end end end function UIHorseEquipLevelUpSuccess:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.Bottom then self:CloseView() end end return UIHorseEquipLevelUpSuccess