local UIHorseSoulTipBase = UIViewClass() local EventSystem = require('Event/EventSystem') function UIHorseSoulTipBase:OnCreated() self.isClosedByParent = false; end function UIHorseSoulTipBase:OnOpened(context) self:RegistSystemEvent(EventID.UI_ItemTips_Closed_Child, self.OnCloseChildItemTips) self:Init(context) end function UIHorseSoulTipBase:Init(context) local horseId = context.horseId local targetSoulId = context.targetSoulId local equippedSoulId = context.equippedSoulId if equippedSoulId ~= nil and equippedSoulId ~= targetSoulId then self.SoulTipsLeft:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIHorseSoulTip), { rootName = Const_UI_Lua.UIEnum.UIHorseSoulTipBase, soulId = equippedSoulId, horseId = horseId, isChildTips = isChildTips, }) end self.SoulTipsRight:OpenView(GetViewClass(Const_UI_Lua.UIEnum.UIHorseSoulTip), { rootName = Const_UI_Lua.UIEnum.UIHorseSoulTipBase, soulId = targetSoulId, isSingleTip = equippedSoulId == nil, horseId = horseId, isChildTips = isChildTips, }) UIUtils.SetActive(self.Bottom, not context.isChildTips); end function UIHorseSoulTipBase:OnCloseChildItemTips(isClosedByParent) if self.context.isChildTips then self.isClosedByParent = isClosedByParent; self:CloseView(); end end function UIHorseSoulTipBase:OnClosed() EventSystem.Dispatch(EventID.UI_CloseHorseSoulTips) if self.context.isChildTips and not self.isClosedByParent then EventSystem.Dispatch(EventID.UI_ItemTips_Closed) end end function UIHorseSoulTipBase:OnButtonClicked(comp) if comp == self.Bottom then self:CloseView() end end return UIHorseSoulTipBase