--[[ 神兽激活成功界面 ]]-- local UIGodBeastSuccess = UIViewClass() function UIGodBeastSuccess:OnCreated() self.modelComponentDataHandle = UTL.UIRender.CreateModelComponentDatas(self.renderModel) end function UIGodBeastSuccess:OnOpened(context) self:RegistTriggerEvent(self.btn_Close, UIEventTriggerType.Drag) self:RegistTriggerEvent(self.btn_Close, UIEventTriggerType.EndDrag) self.isDrag = false local config = DataSheetManager.GodBeastData:GetDataByID(context.godBeastID) CTL.GodBeast.SetGodBeastName(self.txt_NameWarHorse, config.ID) self:ShowById(config) CTL.Sound.PlayGameSound("UI_breakout_03") end function UIGodBeastSuccess:OnClosed() UTL.UIRender.DisposeModelComponentData(self.modelComponentDataHandle) end function UIGodBeastSuccess:ShowById(config) local godBeastData = DataSheetManager.GodBeastData:GetDataByID(config.ID) local godBeastModelData = DataSheetManager.MonsterModelData:GetDataByID(godBeastData.GodBeastModelID) UTL.UIRender.CreateRTSceneTrans(self.modelComponentDataHandle, config.GodBeastPreviewModelLight) UTL.UIRender.CreateRTRenderModel( self.modelComponentDataHandle, godBeastModelData.Path, 1, nil, godBeastData.CameraRenderId, godBeastData.ModelIdleAnim ) UTL.UIRender.PlayModelPsEffect(self.modelComponentDataHandle, config.GodBeastShowEffect) end function UIGodBeastSuccess:OnDrag(comp, eventdata) if comp == self.btn_Close then self.isDrag = true UTL.UIRender.RotateEntity(self.modelComponentDataHandle, -eventdata.delta.x * 0.2) end end function UIGodBeastSuccess:OnEndDrag(comp, eventdata) if comp == self.btn_Close then self.isDrag = false end end function UIGodBeastSuccess:OnButtonClicked(comp) if comp == self.btn_Close then if self.isDrag == false then self:CloseView(true) end end end return UIGodBeastSuccess