local UIHorseSoulUpgradeSuccess = UIViewClass() function UIHorseSoulUpgradeSuccess:OnOpened(context) self.soulInfo = context.soulInfo self.nowLevelData = self.soulInfo.levelInfo self.oldLevelData = context.oldLevelData if self.nowLevelData.breakLevel > self.oldLevelData.breakLevel then UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_HorseSoul_PopoutHint4) self.isBreak = true else UIUtils.SetLabelText(self.UITemplatePopUpZero.txt_Title, Const_IDS.IDS_HorseSoul_LevelHint2) self.isBreak = false end self:SetShowInfo(self.group_illustratedHandbook, self.nowLevelData, self.oldLevelData) end function UIHorseSoulUpgradeSuccess:SetShowInfo(comp, nowData, oldData) local nextLevel = nowData.level if self.isBreak then nextLevel = CTL.HorseSoul.GetSoulNextMaxLevel(self.soulInfo.id) end comp.txt_Before.text = string.FormatByIdsKey("IDS_HorseSoul_Button3", oldData.level) comp.txt_After.text = string.FormatByIdsKey("IDS_HorseSoul_Button3", nextLevel) local attrId = self.soulInfo.soulData.HorseSoulLevelAttrID local oldAttrTable = CTL.HorseSoul.GetSoulAttrTable(attrId, self.oldLevelData.level, self.oldLevelData.breakLevel) local nowAttrTable = CTL.HorseSoul.GetSoulAttrTable(attrId, self.nowLevelData.level, self.nowLevelData.breakLevel) for i, v in ipairs(comp.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.txt_Attr, Const_IDS[attrData.Name]) UTL.Item.SetAtlasSprite(v.img_AttrIcon,"UI_Common", attrData.Icon) v.txt_NumBefore.text = oldAttr and oldAttr.AttrNum or 0 v.txt_NumAfter.text = nowAttr.AttrNum end end end function UIHorseSoulUpgradeSuccess:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.Bottom then self:CloseView() end end return UIHorseSoulUpgradeSuccess