A BaseInputModule for pointer input.

Inheritance: BaseInputModule
 static public int IsPointerOverGameObject(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.EventSystems.PointerInputModule self = (UnityEngine.EventSystems.PointerInputModule)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.IsPointerOverGameObject(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 protected virtual void ProcessDrag(PointerEventData pointerEvent)
 {        /*	used in StandaloneInputModule.ProcessToucheEvents() and StandaloneInputModule.ProcessMouseEvent(int id)
           *     call OnBeginDrag
           *     call OnPointerUp, if for some reason pointerPress != pointerDrag
           *     call OnDrag
           */
     if (pointerEvent.IsPointerMoving() && Cursor.lockState != CursorLockMode.Locked && !(pointerEvent.pointerDrag == null))
     {
         if (!pointerEvent.dragging && PointerInputModule.ShouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, (float)base.eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold))
         {
             ExecuteEvents.Execute <IBeginDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.beginDragHandler);
             pointerEvent.dragging = true;
         }
         if (pointerEvent.dragging)
         {
             if (pointerEvent.pointerPress != pointerEvent.pointerDrag)
             {
                 ExecuteEvents.Execute <IPointerUpHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
                 pointerEvent.eligibleForClick = false;
                 pointerEvent.pointerPress     = null;
                 pointerEvent.rawPointerPress  = null;
             }
             ExecuteEvents.Execute <IDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.dragHandler);
         }
     }
 }
Example #3
0
 static new public int ToString(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.PointerInputModule self = (UnityEngine.EventSystems.PointerInputModule)checkSelf(l);
         var ret = self.ToString();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
 static public int IsPointerOverGameObject(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.PointerInputModule self = (UnityEngine.EventSystems.PointerInputModule)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.IsPointerOverGameObject(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #5
0
 static public int IsPointerOverGameObject(IntPtr l)
 {
     try{
         UnityEngine.EventSystems.PointerInputModule self = (UnityEngine.EventSystems.PointerInputModule)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Boolean ret = self.IsPointerOverGameObject(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static int ToString(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.EventSystems.PointerInputModule obj = (UnityEngine.EventSystems.PointerInputModule)ToLua.CheckObject <UnityEngine.EventSystems.PointerInputModule>(L, 1);
         string o = obj.ToString();
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int IsPointerOverGameObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.EventSystems.PointerInputModule obj = (UnityEngine.EventSystems.PointerInputModule)ToLua.CheckObject <UnityEngine.EventSystems.PointerInputModule>(L, 1);
         int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         bool o    = obj.IsPointerOverGameObject(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #8
0
        /// <summary>
        ///
        /// <para>
        /// Return the current MouseState.
        /// </para>
        ///
        /// </summary>
        /// <param name="id"/>
        protected virtual PointerInputModule.MouseState GetMousePointerEventData(int id)
        {
            PointerEventData data1;
            bool             pointerData = this.GetPointerData(-1, out data1, true);

            data1.Reset();
            if (pointerData)
            {
                data1.position = (Vector2)Input.mousePosition;
            }
            Vector2 vector2 = (Vector2)Input.mousePosition;

            data1.delta       = vector2 - data1.position;
            data1.position    = vector2;
            data1.scrollDelta = Input.mouseScrollDelta;
            data1.button      = PointerEventData.InputButton.Left;
            this.eventSystem.RaycastAll(data1, this.m_RaycastResultCache);
            RaycastResult firstRaycast = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);

            data1.pointerCurrentRaycast = firstRaycast;
            this.m_RaycastResultCache.Clear();
            PointerEventData data2;

            this.GetPointerData(-2, out data2, true);
            this.CopyFromTo(data1, data2);
            data2.button = PointerEventData.InputButton.Right;
            PointerEventData data3;

            this.GetPointerData(-3, out data3, true);
            this.CopyFromTo(data1, data3);
            data3.button = PointerEventData.InputButton.Middle;
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Left, PointerInputModule.StateForMouseButton(0), data1);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Right, PointerInputModule.StateForMouseButton(1), data2);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, PointerInputModule.StateForMouseButton(2), data3);
            return(this.m_MouseState);
        }
 void ProcessMousePress( PointerInputModule.MouseButtonEventData data )
 {
     var buttonData = data.buttonData;
     var gameObject = buttonData.pointerCurrentRaycast.gameObject;
     if (data.PressedThisFrame())
     {
         buttonData.eligibleForClick = true;
         buttonData.delta = Vector2.zero;
         buttonData.dragging = false;
         buttonData.useDragThreshold = true;
         buttonData.pressPosition = buttonData.position;
         buttonData.pointerPressRaycast = buttonData.pointerCurrentRaycast;
         DeselectIfSelectionChanged( gameObject, buttonData );
         var gameObject2 = ExecuteEvents.ExecuteHierarchy<IPointerDownHandler>( gameObject, buttonData, ExecuteEvents.pointerDownHandler );
         if (gameObject2 == null)
         {
             gameObject2 = ExecuteEvents.GetEventHandler<IPointerClickHandler>( gameObject );
         }
         var unscaledTime = Time.unscaledTime;
         if (gameObject2 == buttonData.lastPress)
         {
             var num = unscaledTime - buttonData.clickTime;
             if (num < 0.3f)
             {
                 buttonData.clickCount++;
             }
             else
             {
                 buttonData.clickCount = 1;
             }
             buttonData.clickTime = unscaledTime;
         }
         else
         {
             buttonData.clickCount = 1;
         }
         buttonData.pointerPress = gameObject2;
         buttonData.rawPointerPress = gameObject;
         buttonData.clickTime = unscaledTime;
         buttonData.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>( gameObject );
         if (buttonData.pointerDrag != null)
         {
             ExecuteEvents.Execute<IInitializePotentialDragHandler>( buttonData.pointerDrag, buttonData, ExecuteEvents.initializePotentialDrag );
         }
     }
     if (data.ReleasedThisFrame())
     {
         ExecuteEvents.Execute<IPointerUpHandler>( buttonData.pointerPress, buttonData, ExecuteEvents.pointerUpHandler );
         var eventHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>( gameObject );
         if (buttonData.pointerPress == eventHandler && buttonData.eligibleForClick)
         {
             ExecuteEvents.Execute<IPointerClickHandler>( buttonData.pointerPress, buttonData, ExecuteEvents.pointerClickHandler );
         }
         else
         {
             if (buttonData.pointerDrag != null)
             {
                 ExecuteEvents.ExecuteHierarchy<IDropHandler>( gameObject, buttonData, ExecuteEvents.dropHandler );
             }
         }
         buttonData.eligibleForClick = false;
         buttonData.pointerPress = null;
         buttonData.rawPointerPress = null;
         if (buttonData.pointerDrag != null && buttonData.dragging)
         {
             ExecuteEvents.Execute<IEndDragHandler>( buttonData.pointerDrag, buttonData, ExecuteEvents.endDragHandler );
         }
         buttonData.dragging = false;
         buttonData.pointerDrag = null;
         if (gameObject != buttonData.pointerEnter)
         {
             HandlePointerExitAndEnter( buttonData, null );
             HandlePointerExitAndEnter( buttonData, gameObject );
         }
     }
 }
 protected void ProcessMousePress(PointerInputModule.MouseButtonEventData data)
 {
   PointerEventData currentPointerData = data.buttonData;
   GameObject gameObject1 = currentPointerData.pointerCurrentRaycast.gameObject;
   if (data.PressedThisFrame())
   {
     currentPointerData.eligibleForClick = true;
     currentPointerData.delta = Vector2.zero;
     currentPointerData.dragging = false;
     currentPointerData.useDragThreshold = true;
     currentPointerData.pressPosition = currentPointerData.position;
     currentPointerData.pointerPressRaycast = currentPointerData.pointerCurrentRaycast;
     this.DeselectIfSelectionChanged(gameObject1, (BaseEventData) currentPointerData);
     GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy<IPointerDownHandler>(gameObject1, (BaseEventData) currentPointerData, ExecuteEvents.pointerDownHandler);
     if ((UnityEngine.Object) gameObject2 == (UnityEngine.Object) null)
       gameObject2 = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject1);
     float unscaledTime = Time.unscaledTime;
     if ((UnityEngine.Object) gameObject2 == (UnityEngine.Object) currentPointerData.lastPress)
     {
       if ((double) (unscaledTime - currentPointerData.clickTime) < 0.300000011920929)
         ++currentPointerData.clickCount;
       else
         currentPointerData.clickCount = 1;
       currentPointerData.clickTime = unscaledTime;
     }
     else
       currentPointerData.clickCount = 1;
     currentPointerData.pointerPress = gameObject2;
     currentPointerData.rawPointerPress = gameObject1;
     currentPointerData.clickTime = unscaledTime;
     currentPointerData.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(gameObject1);
     if ((UnityEngine.Object) currentPointerData.pointerDrag != (UnityEngine.Object) null)
       ExecuteEvents.Execute<IInitializePotentialDragHandler>(currentPointerData.pointerDrag, (BaseEventData) currentPointerData, ExecuteEvents.initializePotentialDrag);
   }
   if (!data.ReleasedThisFrame())
     return;
   ExecuteEvents.Execute<IPointerUpHandler>(currentPointerData.pointerPress, (BaseEventData) currentPointerData, ExecuteEvents.pointerUpHandler);
   GameObject eventHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(gameObject1);
   if ((UnityEngine.Object) currentPointerData.pointerPress == (UnityEngine.Object) eventHandler && currentPointerData.eligibleForClick)
     ExecuteEvents.Execute<IPointerClickHandler>(currentPointerData.pointerPress, (BaseEventData) currentPointerData, ExecuteEvents.pointerClickHandler);
   else if ((UnityEngine.Object) currentPointerData.pointerDrag != (UnityEngine.Object) null && currentPointerData.dragging)
     ExecuteEvents.ExecuteHierarchy<IDropHandler>(gameObject1, (BaseEventData) currentPointerData, ExecuteEvents.dropHandler);
   currentPointerData.eligibleForClick = false;
   currentPointerData.pointerPress = (GameObject) null;
   currentPointerData.rawPointerPress = (GameObject) null;
   if ((UnityEngine.Object) currentPointerData.pointerDrag != (UnityEngine.Object) null && currentPointerData.dragging)
     ExecuteEvents.Execute<IEndDragHandler>(currentPointerData.pointerDrag, (BaseEventData) currentPointerData, ExecuteEvents.endDragHandler);
   currentPointerData.dragging = false;
   currentPointerData.pointerDrag = (GameObject) null;
   if (!((UnityEngine.Object) gameObject1 != (UnityEngine.Object) currentPointerData.pointerEnter))
     return;
   this.HandlePointerExitAndEnter(currentPointerData, (GameObject) null);
   this.HandlePointerExitAndEnter(currentPointerData, gameObject1);
 }
Example #11
0
        /// <summary>
        ///
        /// <para>
        /// Process the drag for the current frame with the given pointer event.
        /// </para>
        ///
        /// </summary>
        /// <param name="pointerEvent"/>
        protected virtual void ProcessDrag(PointerEventData pointerEvent)
        {
            bool flag = pointerEvent.IsPointerMoving();

            if (flag && (Object)pointerEvent.pointerDrag != (Object)null && (!pointerEvent.dragging && PointerInputModule.ShouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, (float)this.eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold)))
            {
                ExecuteEvents.Execute <IBeginDragHandler>(pointerEvent.pointerDrag, (BaseEventData)pointerEvent, ExecuteEvents.beginDragHandler);
                pointerEvent.dragging = true;
            }
            if (!pointerEvent.dragging || !flag || !((Object)pointerEvent.pointerDrag != (Object)null))
            {
                return;
            }
            if ((Object)pointerEvent.pointerPress != (Object)pointerEvent.pointerDrag)
            {
                ExecuteEvents.Execute <IPointerUpHandler>(pointerEvent.pointerPress, (BaseEventData)pointerEvent, ExecuteEvents.pointerUpHandler);
                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress     = (GameObject)null;
                pointerEvent.rawPointerPress  = (GameObject)null;
            }
            ExecuteEvents.Execute <IDragHandler>(pointerEvent.pointerDrag, (BaseEventData)pointerEvent, ExecuteEvents.dragHandler);
        }