local UIWarHorseSuccess = UIViewClass() local ANIM_TIMER = 2 function UIWarHorseSuccess:OnOpened(context) self:RegistTriggerEvent(self.btn_Close, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.btn_Close, UIEventTriggerType.EndDrag) self.isDrag = false self.enableClose = false local id = context.HorseID local config = DataSheetManager.HorseData:GetDataByHorseID(id) if config then UIUtils.SetLabelText(self.txt_NameWarHorse, Const_IDS[config.HorseName]) self:ShowHorseById(config) self:StartRepeatFunc(self.SetEnableClose, ANIM_TIMER, 1) end end function UIWarHorseSuccess:SetEnableClose() self.enableClose = true end function UIWarHorseSuccess:ShowHorseById(config) self.renderModel:ShowHorse(UTL.UIRender.LoadShowHorseRawTextureRender(config, nil, config.ActivationModelRot)) CTL.Sound.PlayGameSound(config.HorseShowAudio) end function UIWarHorseSuccess:OnDrag(comp, eventdata) if comp == self.btn_Close then self.isDrag = true self.renderModel:RotatingByManual(eventdata) end end function UIWarHorseSuccess:OnEndDrag(comp,eventdata) if comp == self.btn_Close then self.isDrag = false end end function UIWarHorseSuccess:OnButtonClicked(comp) if comp == self.btn_Close then if self.enableClose and self.isDrag == false then self:CloseView(true) end end end return UIWarHorseSuccess