コード例 #1
0
 protected virtual void ProcessDrag(PlayerPointerEventData pointerEvent)
 {
     if (!pointerEvent.IsPointerMoving() || Object.op_Equality((Object)pointerEvent.get_pointerDrag(), (Object)null) || pointerEvent.sourceType == PointerEventType.Mouse && this.GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex).get_locked())
     {
         return;
     }
     if (!pointerEvent.get_dragging() && RewiredPointerInputModule.ShouldStartDrag(pointerEvent.get_pressPosition(), pointerEvent.get_position(), (float)this.get_eventSystem().get_pixelDragThreshold(), pointerEvent.get_useDragThreshold()))
     {
         ExecuteEvents.Execute <IBeginDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_beginDragHandler());
         pointerEvent.set_dragging(true);
     }
     if (!pointerEvent.get_dragging())
     {
         return;
     }
     if (Object.op_Inequality((Object)pointerEvent.get_pointerPress(), (Object)pointerEvent.get_pointerDrag()))
     {
         ExecuteEvents.Execute <IPointerUpHandler>(pointerEvent.get_pointerPress(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerUpHandler());
         pointerEvent.set_eligibleForClick(false);
         pointerEvent.set_pointerPress((GameObject)null);
         pointerEvent.set_rawPointerPress((GameObject)null);
     }
     ExecuteEvents.Execute <IDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_dragHandler());
 }
コード例 #2
0
        private void ProcessTouchPress(PointerEventData pointerEvent, bool pressed, bool released)
        {
            RaycastResult pointerCurrentRaycast = pointerEvent.get_pointerCurrentRaycast();
            // ISSUE: explicit reference operation
            GameObject gameObject1 = ((RaycastResult)@pointerCurrentRaycast).get_gameObject();

            if (pressed)
            {
                pointerEvent.set_eligibleForClick(true);
                pointerEvent.set_delta(Vector2.get_zero());
                pointerEvent.set_pressPosition(pointerEvent.get_position());
                pointerEvent.set_pointerPressRaycast(pointerEvent.get_pointerCurrentRaycast());
                if (Object.op_Inequality((Object)pointerEvent.get_pointerEnter(), (Object)gameObject1))
                {
                    ((BaseInputModule)this).HandlePointerExitAndEnter(pointerEvent, gameObject1);
                    pointerEvent.set_pointerEnter(gameObject1);
                }
                GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy <IPointerDownHandler>(gameObject1, (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerDownHandler());
                if (Object.op_Equality((Object)gameObject2, (Object)null))
                {
                    gameObject2 = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1);
                }
                if (Object.op_Inequality((Object)gameObject2, (Object)pointerEvent.get_pointerPress()))
                {
                    pointerEvent.set_pointerPress(gameObject2);
                    pointerEvent.set_rawPointerPress(gameObject1);
                    pointerEvent.set_clickCount(0);
                }
                pointerEvent.set_pointerDrag(ExecuteEvents.GetEventHandler <IDragHandler>(gameObject1));
                if (Object.op_Inequality((Object)pointerEvent.get_pointerDrag(), (Object)null))
                {
                    ExecuteEvents.Execute <IBeginDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_beginDragHandler());
                }
                ((BaseInputModule)this).get_eventSystem().SetSelectedGameObject(ExecuteEvents.GetEventHandler <ISelectHandler>(gameObject1), (BaseEventData)pointerEvent);
            }
            if (!released)
            {
                return;
            }
            float unscaledTime1 = Time.get_unscaledTime();

            if ((double)this.mDoubleTap1stReleasedTime < 0.0)
            {
                this.mDoubleTap1stReleasedTime = unscaledTime1;
            }
            else if ((double)unscaledTime1 - (double)this.mDoubleTap1stReleasedTime >= 0.300000011920929)
            {
                this.mDoubleTap1stReleasedTime = unscaledTime1;
            }
            else
            {
                this.OnDoubleTap(pointerEvent.get_position());
                this.mDoubleTap1stReleasedTime = -1f;
            }
            ExecuteEvents.Execute <IPointerUpHandler>(pointerEvent.get_pointerPress(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerUpHandler());
            GameObject eventHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1);

            if (Object.op_Equality((Object)pointerEvent.get_pointerPress(), (Object)eventHandler) && pointerEvent.get_eligibleForClick())
            {
                float unscaledTime2 = Time.get_unscaledTime();
                if ((double)unscaledTime2 - (double)pointerEvent.get_clickTime() < 0.300000011920929)
                {
                    PointerEventData pointerEventData = pointerEvent;
                    pointerEventData.set_clickCount(pointerEventData.get_clickCount() + 1);
                }
                else
                {
                    pointerEvent.set_clickCount(1);
                }
                pointerEvent.set_clickTime(unscaledTime2);
                ExecuteEvents.Execute <IPointerClickHandler>(pointerEvent.get_pointerPress(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerClickHandler());
                this.SpawnTouchEffect(pointerEvent.get_position());
            }
            else if (Object.op_Inequality((Object)pointerEvent.get_pointerDrag(), (Object)null))
            {
                ExecuteEvents.ExecuteHierarchy <IDropHandler>(gameObject1, (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_dropHandler());
            }
            pointerEvent.set_eligibleForClick(false);
            pointerEvent.set_pointerPress((GameObject)null);
            pointerEvent.set_rawPointerPress((GameObject)null);
            if (Object.op_Inequality((Object)pointerEvent.get_pointerDrag(), (Object)null))
            {
                ExecuteEvents.Execute <IEndDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_endDragHandler());
            }
            pointerEvent.set_pointerDrag((GameObject)null);
            ExecuteEvents.ExecuteHierarchy <IPointerExitHandler>(pointerEvent.get_pointerEnter(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerExitHandler());
            pointerEvent.set_pointerEnter((GameObject)null);
        }
コード例 #3
0
 void IBeginDragHandler.OnBeginDrag(PointerEventData eventData)
 {
     if (!this.CanDrag)
     {
         ExecuteEvents.ExecuteHierarchy <IBeginDragHandler>(((Component)((Component)this).get_transform().get_parent()).get_gameObject(), (BaseEventData)eventData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_beginDragHandler());
     }
     else
     {
         this.m_canBeginEdit = false;
         if (VirtualizingItemContainer.BeginDrag == null)
         {
             return;
         }
         VirtualizingItemContainer.BeginDrag(this, eventData);
     }
 }