Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        protected void ProcessMousePress(PointerInputModule.MouseButtonEventData data)
        {
            PointerEventData buttonData            = (PointerEventData)data.buttonData;
            RaycastResult    pointerCurrentRaycast = buttonData.get_pointerCurrentRaycast();
            GameObject       gameObject1           = ((RaycastResult) ref pointerCurrentRaycast).get_gameObject();

            if (data.PressedThisFrame())
            {
                buttonData.set_eligibleForClick(true);
                buttonData.set_delta(Vector2.get_zero());
                buttonData.set_dragging(false);
                buttonData.set_useDragThreshold(true);
                buttonData.set_pressPosition(buttonData.get_position());
                buttonData.set_pointerPressRaycast(buttonData.get_pointerCurrentRaycast());
                this.DeselectIfSelectionChanged(gameObject1, (BaseEventData)buttonData);
                GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy <IPointerDownHandler>(gameObject1, (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerDownHandler());
                if (Object.op_Equality((Object)gameObject2, (Object)null))
                {
                    gameObject2 = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1);
                }
                float unscaledTime = Time.get_unscaledTime();
                if (Object.op_Equality((Object)gameObject2, (Object)buttonData.get_lastPress()))
                {
                    if ((double)(unscaledTime - buttonData.get_clickTime()) < 0.300000011920929)
                    {
                        PointerEventData pointerEventData = buttonData;
                        pointerEventData.set_clickCount(pointerEventData.get_clickCount() + 1);
                    }
                    else
                    {
                        buttonData.set_clickCount(1);
                    }
                    buttonData.set_clickTime(unscaledTime);
                }
                else
                {
                    buttonData.set_clickCount(1);
                }
                buttonData.set_pointerPress(gameObject2);
                buttonData.set_rawPointerPress(gameObject1);
                buttonData.set_clickTime(unscaledTime);
                buttonData.set_pointerDrag(ExecuteEvents.GetEventHandler <IDragHandler>(gameObject1));
                if (Object.op_Inequality((Object)buttonData.get_pointerDrag(), (Object)null))
                {
                    ExecuteEvents.Execute <IInitializePotentialDragHandler>(buttonData.get_pointerDrag(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_initializePotentialDrag());
                }
            }
            if (!data.ReleasedThisFrame())
            {
                return;
            }
            ExecuteEvents.Execute <IPointerUpHandler>(buttonData.get_pointerPress(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerUpHandler());
            GameObject eventHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1);

            if (Object.op_Equality((Object)buttonData.get_pointerPress(), (Object)eventHandler) && buttonData.get_eligibleForClick())
            {
                ExecuteEvents.Execute <IPointerClickHandler>(buttonData.get_pointerPress(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerClickHandler());
            }
            else if (Object.op_Inequality((Object)buttonData.get_pointerDrag(), (Object)null) && buttonData.get_dragging())
            {
                ExecuteEvents.ExecuteHierarchy <IDropHandler>(gameObject1, (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_dropHandler());
            }
            buttonData.set_eligibleForClick(false);
            buttonData.set_pointerPress((GameObject)null);
            buttonData.set_rawPointerPress((GameObject)null);
            if (Object.op_Inequality((Object)buttonData.get_pointerDrag(), (Object)null) && buttonData.get_dragging())
            {
                ExecuteEvents.Execute <IEndDragHandler>(buttonData.get_pointerDrag(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_endDragHandler());
            }
            buttonData.set_dragging(false);
            buttonData.set_pointerDrag((GameObject)null);
            if (!Object.op_Inequality((Object)gameObject1, (Object)buttonData.get_pointerEnter()))
            {
                return;
            }
            ((BaseInputModule)this).HandlePointerExitAndEnter(buttonData, (GameObject)null);
            ((BaseInputModule)this).HandlePointerExitAndEnter(buttonData, gameObject1);
        }
Exemplo n.º 3
0
 void IEndDragHandler.OnEndDrag(PointerEventData eventData)
 {
     if (!this.CanDrag)
     {
         ExecuteEvents.ExecuteHierarchy <IEndDragHandler>(((Component)((Component)this).get_transform().get_parent()).get_gameObject(), (BaseEventData)eventData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_endDragHandler());
     }
     else
     {
         if (VirtualizingItemContainer.EndDrag == null)
         {
             return;
         }
         VirtualizingItemContainer.EndDrag(this, eventData);
     }
 }
Exemplo n.º 4
0
        protected void ProcessTouchPress(PointerEventData pointerEvent, bool pressed, bool released)
        {
            RaycastResult pointerCurrentRaycast = pointerEvent.get_pointerCurrentRaycast();
            GameObject    gameObject1           = ((RaycastResult) ref pointerCurrentRaycast).get_gameObject();

            if (pressed)
            {
                pointerEvent.set_eligibleForClick(true);
                pointerEvent.set_delta(Vector2.get_zero());
                pointerEvent.set_dragging(false);
                pointerEvent.set_useDragThreshold(true);
                pointerEvent.set_pressPosition(pointerEvent.get_position());
                pointerEvent.set_pointerPressRaycast(pointerEvent.get_pointerCurrentRaycast());
                this.DeselectIfSelectionChanged(gameObject1, (BaseEventData)pointerEvent);
                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);
                }
                float unscaledTime = Time.get_unscaledTime();
                if (Object.op_Equality((Object)gameObject2, (Object)pointerEvent.get_lastPress()))
                {
                    if ((double)(unscaledTime - pointerEvent.get_clickTime()) < 0.3)
                    {
                        PointerEventData pointerEventData = pointerEvent;
                        pointerEventData.set_clickTime(pointerEventData.get_clickTime() + 1f);
                    }
                    else
                    {
                        pointerEvent.set_clickCount(1);
                    }
                    pointerEvent.set_clickTime(unscaledTime);
                }
                else
                {
                    pointerEvent.set_clickCount(1);
                }
                pointerEvent.set_pointerPress(gameObject2);
                pointerEvent.set_rawPointerPress(gameObject1);
                pointerEvent.set_clickTime(unscaledTime);
                pointerEvent.set_pointerDrag(ExecuteEvents.GetEventHandler <IDragHandler>(gameObject1));
                if (Object.op_Inequality((Object)pointerEvent.get_pointerDrag(), (Object)null))
                {
                    ExecuteEvents.Execute <IInitializePotentialDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_initializePotentialDrag());
                }
            }
            if (!released)
            {
                return;
            }
            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())
            {
                ExecuteEvents.Execute <IPointerClickHandler>(pointerEvent.get_pointerPress(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerClickHandler());
            }
            else if (Object.op_Inequality((Object)pointerEvent.get_pointerDrag(), (Object)null) && pointerEvent.get_dragging())
            {
                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) && pointerEvent.get_dragging())
            {
                ExecuteEvents.Execute <IEndDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_endDragHandler());
            }
            pointerEvent.set_dragging(false);
            pointerEvent.set_pointerDrag((GameObject)null);
            ExecuteEvents.ExecuteHierarchy <IPointerExitHandler>(pointerEvent.get_pointerEnter(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerExitHandler());
            pointerEvent.set_pointerEnter((GameObject)null);
        }