local UIHorseEquipRelegate = UIViewClass() local LvStr1 = "%s/%s" function UIHorseEquipRelegate:OnOpened(context) self.oldArmorLv = context.tempOptEquipData.oldArmorLv self.oldLimitLv = context.tempOptEquipData.oldLimitLv self.horseId = context.tempOptEquipData.horseId self.backItemNum = context.backItemNum self.armorInfo = MDL.HorseEquip.GetArmorInfo(self.horseId) UIUtils.SetLabelText(self.UITemplatePopUpZero.lab_Title, Const_IDS.IDS_HorseEquip_Hint_9) UIUtils.SetActive(self.UITemplatePopUpZero.btn_2, false) UIUtils.SetActive(self.UITemplatePopUpZero.btn_1, false) self:RefreshInfo() end function UIHorseEquipRelegate:RefreshInfo() local isActive, limitLv = MDL.HorseEquip.GetArmorLimitLv(self.horseId) local str1 = string.format(LvStr1, self.oldArmorLv, self.oldLimitLv) self.txt_Before.text = string.FormatByIdsKey("IDS_HorseSoul_Button3", str1) local horseEquipEnhance1 = DataSheetManager.HorseEquipEnhance:GetDataByEnhanceLevel(self.oldArmorLv) UIUtils.SetImageByAssetBundle(self.img_Armor1, horseEquipEnhance1.Icon) if isActive then local str2 = string.format(LvStr1, self.armorInfo.level, limitLv) self.txt_After.text = string.FormatByIdsKey("IDS_HorseSoul_Button3", str2) local horseEquipEnhance2 = DataSheetManager.HorseEquipEnhance:GetDataByEnhanceLevel(limitLv) UIUtils.SetImageByAssetBundle(self.img_Armor2, horseEquipEnhance2.Icon) UIUtils.SetGray(self.img_Armor2, false) else local horseEquipEnhance2 = DataSheetManager.HorseEquipEnhance:GetDataByEnhanceLevel(0) UIUtils.SetImageByAssetBundle(self.img_Armor2, horseEquipEnhance2.Icon) UIUtils.SetGray(self.img_Armor2, true) UIUtils.SetLabelText(self.txt_After, Const_IDS.IDS_Store_Opt_NotActivate) end local itemId = CTL.HorseEquip.GetGeneralMaterialItem() self.loop_Item:AddData({ItemId = itemId, ItemCount = self.backItemNum},0) end function UIHorseEquipRelegate:OnCellInit(scrollRect, index, cellTable, data) self:SetRewardCell(cellTable,data) end function UIHorseEquipRelegate:OnCellClicked(scrollRect, index, cellTable, target, data) UTL.ItemTips.ShowCommonTipsById(data.ItemId) end function UIHorseEquipRelegate:SetRewardCell(cellTable,data) UTL.Item.SetItemCell(cellTable.item, data.ItemId, data.ItemCount) end function UIHorseEquipRelegate:OnClosed() UIUtils.SetActive(self.UITemplatePopUpZero.btn_2, true) UIUtils.SetActive(self.UITemplatePopUpZero.btn_1, true) end function UIHorseEquipRelegate:OnButtonClicked(comp) if comp == self.UITemplatePopUpZero.img_Bg then self:CloseView() end end return UIHorseEquipRelegate