Inheritance: UIBehaviour
        protected PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
        {        /*	called from in StandaloneInputModule.ProcessTouchEvents()
                  *     creates a new PointerEventData with input.fingerId if there isn't one already
                  *     pressed is assigned true if newly created or TouchPhase.Began
                  *     released is assigned true if TouchPhase.Canceled or Ended
                  *     and rest of PointerEventData fields are initialized
                  */
            PointerEventData pointerEventData;
            bool             pointerData = this.GetPointerData(input.fingerId, out pointerEventData, true);

            pointerEventData.Reset();
            pressed  = (pointerData /*newly created*/ || input.phase == TouchPhase.Began);
            released = (input.phase == TouchPhase.Canceled || input.phase == TouchPhase.Ended);
            if (pointerData /*newly created*/)
            {
                pointerEventData.position = input.position;
            }
            if (pressed)
            {
                pointerEventData.delta = Vector2.zero;
            }
            else
            {
                pointerEventData.delta = input.position - pointerEventData.position;
            }
            pointerEventData.position = input.position;
            pointerEventData.button   = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(pointerEventData, this.m_RaycastResultCache);
            RaycastResult pointerCurrentRaycast = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);

            pointerEventData.pointerCurrentRaycast = pointerCurrentRaycast;
            this.m_RaycastResultCache.Clear();
            return(pointerEventData);
        }
Beispiel #2
0
        protected virtual MouseState GetMousePointerEventData(int id)
        {
            PointerEventData data;
            bool             pointerData = GetPointerData(-1, out data, create: true);

            data.Reset();
            if (pointerData)
            {
                data.position = Input.mousePosition;
            }
            Vector2 vector = Input.mousePosition;

            data.delta       = vector - data.position;
            data.position    = vector;
            data.scrollDelta = Input.mouseScrollDelta;
            data.button      = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(data, m_RaycastResultCache);
            RaycastResult raycastResult2 = data.pointerCurrentRaycast = BaseInputModule.FindFirstRaycast(m_RaycastResultCache);

            m_RaycastResultCache.Clear();
            GetPointerData(-2, out PointerEventData data2, create: true);
            CopyFromTo(data, data2);
            data2.button = PointerEventData.InputButton.Right;
            GetPointerData(-3, out PointerEventData data3, create: true);
            CopyFromTo(data, data3);
            data3.button = PointerEventData.InputButton.Middle;
            m_MouseState.SetButtonState(PointerEventData.InputButton.Left, StateForMouseButton(0), data);
            m_MouseState.SetButtonState(PointerEventData.InputButton.Right, StateForMouseButton(1), data2);
            m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, StateForMouseButton(2), data3);
            return(m_MouseState);
        }
Beispiel #3
0
        protected PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
        {
            PointerEventData pointerEventData;
            bool             pointerData = this.GetPointerData(input.fingerId, out pointerEventData, true);

            pointerEventData.Reset();
            pressed  = (pointerData || input.phase == TouchPhase.Began);
            released = (input.phase == TouchPhase.Canceled || input.phase == TouchPhase.Ended);
            if (pointerData)
            {
                pointerEventData.position = input.position;
            }
            if (pressed)
            {
                pointerEventData.delta = Vector2.zero;
            }
            else
            {
                pointerEventData.delta = input.position - pointerEventData.position;
            }
            pointerEventData.position = input.position;
            pointerEventData.button   = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(pointerEventData, this.m_RaycastResultCache);
            RaycastResult pointerCurrentRaycast = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);

            pointerEventData.pointerCurrentRaycast = pointerCurrentRaycast;
            this.m_RaycastResultCache.Clear();
            return(pointerEventData);
        }
Beispiel #4
0
        protected virtual MouseState GetMousePointerEventData(int id)
        {
            PointerEventData data;
            PointerEventData data2;
            PointerEventData data3;
            bool             flag = this.GetPointerData(-1, out data, true);

            data.Reset();
            if (flag)
            {
                data.position = Input.mousePosition;
            }
            Vector2 mousePosition = Input.mousePosition;

            data.delta       = mousePosition - data.position;
            data.position    = mousePosition;
            data.scrollDelta = Input.mouseScrollDelta;
            data.button      = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(data, base.m_RaycastResultCache);
            RaycastResult result = BaseInputModule.FindFirstRaycast(base.m_RaycastResultCache);

            data.pointerCurrentRaycast = result;
            base.m_RaycastResultCache.Clear();
            this.GetPointerData(-2, out data2, true);
            this.CopyFromTo(data, data2);
            data2.button = PointerEventData.InputButton.Right;
            this.GetPointerData(-3, out data3, true);
            this.CopyFromTo(data, data3);
            data3.button = PointerEventData.InputButton.Middle;
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Left, StateForMouseButton(0), data);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Right, StateForMouseButton(1), data2);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, StateForMouseButton(2), data3);
            return(this.m_MouseState);
        }
Beispiel #5
0
        protected PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
        {
            PointerEventData data;
            bool             flag = this.GetPointerData(input.fingerId, out data, true);

            data.Reset();
            pressed  = flag || (input.phase == TouchPhase.Began);
            released = (input.phase == TouchPhase.Canceled) || (input.phase == TouchPhase.Ended);
            if (flag)
            {
                data.position = input.position;
            }
            if (pressed)
            {
                data.delta = Vector2.zero;
            }
            else
            {
                data.delta = input.position - data.position;
            }
            data.position = input.position;
            data.button   = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(data, base.m_RaycastResultCache);
            RaycastResult result = BaseInputModule.FindFirstRaycast(base.m_RaycastResultCache);

            data.pointerCurrentRaycast = result;
            base.m_RaycastResultCache.Clear();
            return(data);
        }
Beispiel #6
0
 protected void HandlePointerExitAndEnter(PointerEventData currentPointerData, GameObject newEnterTarget)
 {        /*	called in
           *     StandaloneInputModule
           *             ProcessTouchPress
           *             ProcessMousePress
           *     PointerInputModule
           *             ProcessMove
           *             ClearSelection
           *     sets PointerEventData.pointerEnter
           *     call OnPointerEnter and/or OnPointerExit depending on what is under the pointer
           *     OnPointerEnter is called on only the first one that catches raycast
           *     OnPointerExit is called either on the fist or all of in the stack
           *     update hovered stack
           */
     if (newEnterTarget == null || currentPointerData.pointerEnter == null)
     {
         for (int i = 0; i < currentPointerData.hovered.Count; i++)
         {
             ExecuteEvents.Execute <IPointerExitHandler>(currentPointerData.hovered[i], currentPointerData, ExecuteEvents.pointerExitHandler);
         }
         currentPointerData.hovered.Clear();
         if (newEnterTarget == null)
         {
             currentPointerData.pointerEnter = newEnterTarget;
             return;
         }
     }
     /*newEnterTarget != null*/
     if (!(currentPointerData.pointerEnter == newEnterTarget) || !newEnterTarget)
     /*pointerEnter is something other than newEnter target, or null*/
     {
         GameObject gameObject = BaseInputModule.FindCommonRoot(currentPointerData.pointerEnter, newEnterTarget);
         if (currentPointerData.pointerEnter != null)
         {
             Transform transform = currentPointerData.pointerEnter.transform;
             while (transform != null)
             {
                 if (gameObject != null && gameObject.transform == transform)
                 {
                     break;
                 }
                 ExecuteEvents.Execute <IPointerExitHandler>(transform.gameObject, currentPointerData, ExecuteEvents.pointerExitHandler);
                 currentPointerData.hovered.Remove(transform.gameObject);
                 transform = transform.parent;
             }
         }
         currentPointerData.pointerEnter = newEnterTarget;
         if (newEnterTarget != null)
         {
             Transform transform2 = newEnterTarget.transform;
             while (transform2 != null && transform2.gameObject != gameObject)
             {
                 ExecuteEvents.Execute <IPointerEnterHandler>(transform2.gameObject, currentPointerData, ExecuteEvents.pointerEnterHandler);
                 currentPointerData.hovered.Add(transform2.gameObject);
                 transform2 = transform2.parent;
             }
         }
     }
 }
Beispiel #7
0
 protected override void OnDisable()
 {
     if (this.m_CurrentInputModule != null)
     {
         this.m_CurrentInputModule.DeactivateModule();
         this.m_CurrentInputModule = null;
     }
     EventSystem.m_EventSystems.Remove(this);
     base.OnDisable();
 }
 /// <summary>
 ///
 /// <para>
 /// Given some input data generate an AxisEventData that can be used by the event system.
 /// </para>
 ///
 /// </summary>
 /// <param name="x">X movement.</param><param name="y">Y movement.</param><param name="moveDeadZone">Dead Zone.</param>
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir    = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
     return(this.m_AxisEventData);
 }
        protected virtual PointerInputModule.MouseState GetMousePointerEventData(int id)
        {        /*
                  * id is never used!
                  *     used in StandaloneInputModule.ProcessMouseEvents(int id)
                  *     creates a new PointerEventData with -1 for pointerId, if there isn't one already
                  *     initialize the rest of PointerEventData fields
                  *     creates or gets PointerEventData with -2 and -3, values copied from -1
                  *     assign button fields of each of three PointerEventData with appropriate InputButton(Left,Right,Middle)
                  *     Get StateForMouseButton for each PointerEvent, make 3 pairs and store them in m_MouseState and return it
                  */
            PointerEventData pointerEventData;
            bool             pointerData = this.GetPointerData(-1, out pointerEventData, true);

            pointerEventData.Reset();
            if (pointerData /*newly created*/)
            {
                pointerEventData.position = base.input.mousePosition;
            }
            Vector2 mousePosition = base.input.mousePosition;

            if (Cursor.lockState == CursorLockMode.Locked)
            {
                pointerEventData.position = new Vector2(-1f, -1f);
                pointerEventData.delta    = Vector2.zero;
            }
            else
            {
                pointerEventData.delta    = mousePosition - pointerEventData.position;
                pointerEventData.position = mousePosition;
            }
            pointerEventData.scrollDelta = base.input.mouseScrollDelta;
            pointerEventData.button      = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(pointerEventData, this.m_RaycastResultCache);
            RaycastResult pointerCurrentRaycast = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);

            pointerEventData.pointerCurrentRaycast = pointerCurrentRaycast;
            this.m_RaycastResultCache.Clear();
            PointerEventData pointerEventData2;

            this.GetPointerData(-2, out pointerEventData2, true);
            this.CopyFromTo(pointerEventData, pointerEventData2);
            pointerEventData2.button = PointerEventData.InputButton.Right;
            PointerEventData pointerEventData3;

            this.GetPointerData(-3, out pointerEventData3, true);
            this.CopyFromTo(pointerEventData, pointerEventData3);
            pointerEventData3.button = PointerEventData.InputButton.Middle;
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Left, this.StateForMouseButton(0), pointerEventData);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Right, this.StateForMouseButton(1), pointerEventData2);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, this.StateForMouseButton(2), pointerEventData3);
            return(this.m_MouseState);
        }
Beispiel #10
0
        public void Process(VRInputModule vrInputModule)
        {
            VRController offHandController = _laserPointer.OffHandController;

            if (!_laserPointer.IsInitialized || offHandController == null)
            {
                return;
            }

            BaseInputModule baseInputModule = vrInputModule as BaseInputModule;
            EventSystem     eventSystem     = EventSystemAccessor(ref baseInputModule);

            if (_pointerEventData == null)
            {
                _pointerEventData = new PointerEventData(eventSystem)
                {
                    pointerId = OffHandPointerId
                }
            }
            ;

            // perform raycast
            _pointerEventData.Reset();
            _pointerEventData.pointerCurrentRaycast = new RaycastResult
            {
                worldPosition = offHandController.position,
                worldNormal   = offHandController.forward
            };
            _pointerEventData.scrollDelta = Vector2.zero;

            eventSystem.RaycastAll(_pointerEventData, _raycastResults);

            // reimplementation of FindFirstRaycast
            _pointerEventData.pointerCurrentRaycast = default;
            for (int i = 0; i < _raycastResults.Count; ++i)
            {
                if (_raycastResults[i].gameObject != null)
                {
                    _pointerEventData.pointerCurrentRaycast = _raycastResults[i];
                    break;
                }
            }

            _pointerEventData.delta    = _pointerEventData.pointerCurrentRaycast.screenPosition - _pointerEventData.position;
            _pointerEventData.position = _pointerEventData.pointerCurrentRaycast.screenPosition;

            // handle pointer enter/exit on gameobjects
            HandlePointerExitAndEnter(vrInputModule, _pointerEventData, _pointerEventData.pointerCurrentRaycast.gameObject);

            // send raycast results to laser pointer
            _laserPointer.Process(_pointerEventData);
        }
Beispiel #11
0
 /// <summary>
 ///   <para>See MonoBehaviour.OnDisable.</para>
 /// </summary>
 protected override void OnDisable()
 {
     if ((UnityEngine.Object) this.m_CurrentInputModule != (UnityEngine.Object)null)
     {
         this.m_CurrentInputModule.DeactivateModule();
         this.m_CurrentInputModule = (BaseInputModule)null;
     }
     if ((UnityEngine.Object)EventSystem.current == (UnityEngine.Object) this)
     {
         EventSystem.current = (EventSystem)null;
     }
     base.OnDisable();
 }
 static public int ShouldActivateModule(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.BaseInputModule self = (UnityEngine.EventSystems.BaseInputModule)checkSelf(l);
         var ret = self.ShouldActivateModule();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #13
0
 protected override void OnDisable()
 {
     if (m_CurrentInputModule != null)
     {
         m_CurrentInputModule.DeactivateModule();
         m_CurrentInputModule = null;
     }
     if (current == this)
     {
         current = null;
     }
     base.OnDisable();
 }
Beispiel #14
0
 protected override void OnDisable()
 {
     if (this.m_CurrentInputModule != null)
     {
         this.m_CurrentInputModule.DeactivateModule();
         this.m_CurrentInputModule = null;
     }
     if (current == this)
     {
         current = null;
     }
     base.OnDisable();
 }
Beispiel #15
0
 protected override void OnDisable()
 {
     if (this.m_CurrentInputModule != null)
     {
         this.m_CurrentInputModule.DeactivateModule();
         this.m_CurrentInputModule = null;
     }
     if (EventSystem.current == this)
     {
         EventSystem.current = null;
     }
     base.OnDisable();
 }
Beispiel #16
0
        protected override void OnDisable()
        {
            if (m_CurrentInputModule != null)
            {
                m_CurrentInputModule.DeactivateModule();
                m_CurrentInputModule = null;
            }

            // if (EventSystem.current == this)
            //     EventSystem.current = null;

            base.OnDisable();
        }
 static int ActivateModule(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.EventSystems.BaseInputModule obj = (UnityEngine.EventSystems.BaseInputModule)ToLua.CheckObject <UnityEngine.EventSystems.BaseInputModule>(L, 1);
         obj.ActivateModule();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int set_inputOverride(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.BaseInputModule self = (UnityEngine.EventSystems.BaseInputModule)checkSelf(l);
         UnityEngine.EventSystems.BaseInput       v;
         checkType(l, 2, out v);
         self.inputOverride = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #19
0
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {        /*	used in StandaloneInputModule.SendMoveEventToSelectedObject()
           *     create new AxisEventData and assign m_AxisEventData to it
           *     update its fields
           */
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir    = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
     return(this.m_AxisEventData);
 }
 static public int IsPointerOverGameObject(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.BaseInputModule self = (UnityEngine.EventSystems.BaseInputModule)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));
     }
 }
    static int QPYX_get_currentInputModule_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.EventSystems.BaseEventData QPYX_obj_YXQP = (UnityEngine.EventSystems.BaseEventData)QPYX_o_YXQP;
            UnityEngine.EventSystems.BaseInputModule QPYX_ret_YXQP = QPYX_obj_YXQP.currentInputModule;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index currentInputModule on a nil value"));
        }
    }
 static int ShouldActivateModule(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.EventSystems.BaseInputModule obj = (UnityEngine.EventSystems.BaseInputModule)ToLua.CheckObject <UnityEngine.EventSystems.BaseInputModule>(L, 1);
         bool o = obj.ShouldActivateModule();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #23
0
 private void ChangeEventModule(BaseInputModule module)
 {
     if (this.m_CurrentInputModule != module)
     {
         if (this.m_CurrentInputModule != null)
         {
             this.m_CurrentInputModule.DeactivateModule();
         }
         if (module != null)
         {
             module.ActivateModule();
         }
         this.m_CurrentInputModule = module;
     }
 }
Beispiel #24
0
 private void ChangeEventModule(BaseInputModule module)
 {
     if (!(this.m_CurrentInputModule == module))
     {
         if (this.m_CurrentInputModule != null)
         {
             this.m_CurrentInputModule.DeactivateModule();
         }
         if (module != null)
         {
             module.ActivateModule();
         }
         this.m_CurrentInputModule = module;
     }
 }
        protected override void OnDisable()
        {
#if PACKAGE_UITOOLKIT
            UIElementsRuntimeUtility.UnregisterEventSystem(this);
#endif

            if (m_CurrentInputModule != null)
            {
                m_CurrentInputModule.DeactivateModule();
                m_CurrentInputModule = null;
            }

            m_EventSystems.Remove(this);

            base.OnDisable();
        }
Beispiel #26
0
 private void ChangeEventModule(BaseInputModule module)
 {
     if ((UnityEngine.Object) this.m_CurrentInputModule == (UnityEngine.Object)module)
     {
         return;
     }
     if ((UnityEngine.Object) this.m_CurrentInputModule != (UnityEngine.Object)null)
     {
         this.m_CurrentInputModule.DeactivateModule();
     }
     if ((UnityEngine.Object)module != (UnityEngine.Object)null)
     {
         module.ActivateModule();
     }
     this.m_CurrentInputModule = module;
 }
 static int IsPointerOverGameObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.EventSystems.BaseInputModule obj = (UnityEngine.EventSystems.BaseInputModule)ToLua.CheckObject <UnityEngine.EventSystems.BaseInputModule>(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));
     }
 }
    static int get_currentInputModule(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.EventSystems.BaseEventData   obj = (UnityEngine.EventSystems.BaseEventData)o;
            UnityEngine.EventSystems.BaseInputModule ret = obj.currentInputModule;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index currentInputModule on a nil value"));
        }
    }
Beispiel #29
0
    static int set_inputOverride(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.EventSystems.BaseInputModule obj  = (UnityEngine.EventSystems.BaseInputModule)o;
            UnityEngine.EventSystems.BaseInput       arg0 = (UnityEngine.EventSystems.BaseInput)ToLua.CheckObject <UnityEngine.EventSystems.BaseInput>(L, 2);
            obj.inputOverride = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index inputOverride on a nil value"));
        }
    }
 protected void HandlePointerExitAndEnter(PointerEventData currentPointerData, GameObject newEnterTarget)
 {
     if (newEnterTarget == null || currentPointerData.pointerEnter == null)
     {
         for (int i = 0; i < currentPointerData.hovered.Count; i++)
         {
             ExecuteEvents.Execute <IPointerExitHandler>(currentPointerData.hovered[i], currentPointerData, ExecuteEvents.pointerExitHandler);
         }
         currentPointerData.hovered.Clear();
         if (newEnterTarget == null)
         {
             currentPointerData.pointerEnter = newEnterTarget;
             return;
         }
     }
     if (!(currentPointerData.pointerEnter == newEnterTarget) || !newEnterTarget)
     {
         GameObject gameObject = BaseInputModule.FindCommonRoot(currentPointerData.pointerEnter, newEnterTarget);
         if (currentPointerData.pointerEnter != null)
         {
             Transform transform = currentPointerData.pointerEnter.transform;
             while (transform != null)
             {
                 if (gameObject != null && gameObject.transform == transform)
                 {
                     break;
                 }
                 ExecuteEvents.Execute <IPointerExitHandler>(transform.gameObject, currentPointerData, ExecuteEvents.pointerExitHandler);
                 currentPointerData.hovered.Remove(transform.gameObject);
                 transform = transform.parent;
             }
         }
         currentPointerData.pointerEnter = newEnterTarget;
         if (newEnterTarget != null)
         {
             Transform transform2 = newEnterTarget.transform;
             while (transform2 != null && transform2.gameObject != gameObject)
             {
                 ExecuteEvents.Execute <IPointerEnterHandler>(transform2.gameObject, currentPointerData, ExecuteEvents.pointerEnterHandler);
                 currentPointerData.hovered.Add(transform2.gameObject);
                 transform2 = transform2.parent;
             }
         }
     }
 }
        private void ChangeEventModule(BaseInputModule module)
        {
            if (m_CurrentInputModule == module)
            {
                return;
            }

            if (m_CurrentInputModule != null)
            {
                m_CurrentInputModule.DeactivateModule();
            }

            if (module != null)
            {
                module.ActivateModule();
            }
            m_CurrentInputModule = module;
        }
Beispiel #32
0
        protected virtual PointerInputModule.MouseState GetMousePointerEventData(int id)
        {
            PointerEventData pointerEventData;
            bool             pointerData = this.GetPointerData(-1, out pointerEventData, true);

            pointerEventData.Reset();
            if (pointerData)
            {
                pointerEventData.position = base.input.mousePosition;
            }
            Vector2 mousePosition = base.input.mousePosition;

            if (Cursor.lockState == CursorLockMode.Locked)
            {
                pointerEventData.position = new Vector2(-1f, -1f);
                pointerEventData.delta    = Vector2.zero;
            }
            else
            {
                pointerEventData.delta    = mousePosition - pointerEventData.position;
                pointerEventData.position = mousePosition;
            }
            pointerEventData.scrollDelta = base.input.mouseScrollDelta;
            pointerEventData.button      = PointerEventData.InputButton.Left;
            base.eventSystem.RaycastAll(pointerEventData, this.m_RaycastResultCache);
            RaycastResult pointerCurrentRaycast = BaseInputModule.FindFirstRaycast(this.m_RaycastResultCache);

            pointerEventData.pointerCurrentRaycast = pointerCurrentRaycast;
            this.m_RaycastResultCache.Clear();
            PointerEventData pointerEventData2;

            this.GetPointerData(-2, out pointerEventData2, true);
            this.CopyFromTo(pointerEventData, pointerEventData2);
            pointerEventData2.button = PointerEventData.InputButton.Right;
            PointerEventData pointerEventData3;

            this.GetPointerData(-3, out pointerEventData3, true);
            this.CopyFromTo(pointerEventData, pointerEventData3);
            pointerEventData3.button = PointerEventData.InputButton.Middle;
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Left, this.StateForMouseButton(0), pointerEventData);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Right, this.StateForMouseButton(1), pointerEventData2);
            this.m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, this.StateForMouseButton(2), pointerEventData3);
            return(this.m_MouseState);
        }
Beispiel #33
0
 /// <summary>
 /// 
 /// <para>
 /// See MonoBehaviour.OnDisable.
 /// </para>
 /// 
 /// </summary>
 protected override void OnDisable()
 {
   if ((UnityEngine.Object) this.m_CurrentInputModule != (UnityEngine.Object) null)
   {
     this.m_CurrentInputModule.DeactivateModule();
     this.m_CurrentInputModule = (BaseInputModule) null;
   }
   if ((UnityEngine.Object) EventSystem.current == (UnityEngine.Object) this)
     EventSystem.current = (EventSystem) null;
   base.OnDisable();
 }
Beispiel #34
0
 private void ChangeEventModule(BaseInputModule module)
 {
   if ((UnityEngine.Object) this.m_CurrentInputModule == (UnityEngine.Object) module)
     return;
   if ((UnityEngine.Object) this.m_CurrentInputModule != (UnityEngine.Object) null)
     this.m_CurrentInputModule.DeactivateModule();
   if ((UnityEngine.Object) module != (UnityEngine.Object) null)
     module.ActivateModule();
   this.m_CurrentInputModule = module;
 }
Beispiel #35
0
        protected override void OnDisable()
        {
            if (m_CurrentInputModule != null)
            {
                m_CurrentInputModule.DeactivateModule();
                m_CurrentInputModule = null;
            }

            if (EventSystem.current == this)
                EventSystem.current = null;

            base.OnDisable();
        }
Beispiel #36
0
        private void ChangeEventModule(BaseInputModule module)
        {
            if (m_CurrentInputModule == module)
                return;

            if (m_CurrentInputModule != null)
                m_CurrentInputModule.DeactivateModule();

            if (module != null)
                module.ActivateModule();
            m_CurrentInputModule = module;
        }