internal static void NotifyUpdate(NativeInputUpdateType updateType)
        {
            NativeUpdateCallback nativeUpdateCallback = NativeInputSystem.onUpdate;

            if (nativeUpdateCallback != null)
            {
                nativeUpdateCallback(updateType);
            }
        }
Example #2
0
        internal static void NotifyBeforeUpdate(NativeInputUpdateType updateType)
        {
            NativeBeforeUpdateCallback callback = onBeforeUpdate;

            if (callback != null)
            {
                callback(updateType);
            }
        }
Example #3
0
        internal static void NotifyUpdate(NativeInputUpdateType updateType, int eventCount, IntPtr eventData)
        {
            NativeUpdateCallback callback = onUpdate;

            if (callback != null)
            {
                callback(updateType, eventCount, eventData);
            }
        }
Example #4
0
        internal static void NotifyBeforeUpdate(NativeInputUpdateType updateType)
        {
            Action <NativeInputUpdateType> action = NativeInputSystem.onBeforeUpdate;
            bool flag = action != null;

            if (flag)
            {
                action(updateType);
            }
        }
Example #5
0
        internal static bool ShouldRunUpdate(NativeInputUpdateType updateType)
        {
            NativeShouldRunUpdateCallback callback = onShouldRunUpdate;

            if (callback != null)
            {
                return(callback(updateType));
            }

            return(false);
        }
Example #6
0
        internal static bool ShouldRunUpdate(NativeInputUpdateType updateType)
        {
            NativeShouldRunUpdateCallback callback = onShouldRunUpdate;

            if (callback != null)
            {
                return(callback(updateType));
            }

            // Transitional code path. Remove this when we have onShouldRunUpdate implemented
            // in the supported input package versions.
            return(ShouldUpdateFallback(updateType));
        }
Example #7
0
        internal static unsafe void NotifyUpdate(NativeInputUpdateType updateType, IntPtr eventBuffer)
        {
            NativeUpdateCallback callback = onUpdate;
            var eventBufferPtr            = (NativeInputEventBuffer *)eventBuffer.ToPointer();

            if (callback == null)
            {
                eventBufferPtr->eventCount  = 0;
                eventBufferPtr->sizeInBytes = 0;
            }
            else
            {
                callback(updateType, eventBufferPtr);
            }
        }
Example #8
0
        internal unsafe static void NotifyUpdate(NativeInputUpdateType updateType, IntPtr eventBuffer)
        {
            NativeUpdateCallback    nativeUpdateCallback = NativeInputSystem.onUpdate;
            NativeInputEventBuffer *ptr = (NativeInputEventBuffer *)eventBuffer.ToPointer();
            bool flag = nativeUpdateCallback == null;

            if (flag)
            {
                ptr->eventCount  = 0;
                ptr->sizeInBytes = 0;
            }
            else
            {
                nativeUpdateCallback(updateType, ptr);
            }
        }
Example #9
0
        internal static void ShouldRunUpdate(NativeInputUpdateType updateType, out bool retval)
        {
            NativeShouldRunUpdateCallback callback = onShouldRunUpdate;

            retval = callback != null?callback(updateType) : false;
        }
Example #10
0
        internal static void ShouldRunUpdate(NativeInputUpdateType updateType, out bool retval)
        {
            Func <NativeInputUpdateType, bool> func = NativeInputSystem.onShouldRunUpdate;

            retval = (func == null || func(updateType));
        }
        private void OnUpdate(NativeInputUpdateType requestedUpdateType)
        {
#if UNITY_EDITOR
            var gameIsPlayingAndHasFocus = UnityEditor.EditorApplication.isPlaying && Application.isFocused;
#endif
            currentUpdateType = requestedUpdateType;
            switch (currentUpdateType)
            {
            // NOTE: BeginFixed and BeginDynamic have to set InputSystem.isActive for the time period
            //       until the *next* BeginFixed/BeginDynamic and not just to EndFixed/EndDynamic. This
            //       is because the game code for fixed and dynamic updates runs *after* the respective
            //       end update notification.

            case NativeInputUpdateType.BeginFixed:
#if UNITY_EDITOR
                InputSystem.isActive = gameIsPlayingAndHasFocus;
#endif
                if (InputSystem.isActive)
                {
                    eventManager.handlerRoot.BeginUpdate();
                }
                break;

            case NativeInputUpdateType.EndFixed:
                if (InputSystem.isActive)
                {
                    eventManager.handlerRoot.EndUpdate();
                }
                break;

            case NativeInputUpdateType.BeginDynamic:
#if UNITY_EDITOR
                InputSystem.isActive = gameIsPlayingAndHasFocus;
#endif
                if (InputSystem.isActive)
                {
                    eventManager.handlerRoot.BeginUpdate();
                }
                break;

            case NativeInputUpdateType.EndDynamic:
                if (InputSystem.isActive)
                {
                    eventManager.handlerRoot.EndUpdate();
                }
                break;

            case NativeInputUpdateType.BeginBeforeRender:
                // we only require that the update type is correctly set BeginBeforeRender
                break;

            case NativeInputUpdateType.EndBeforeRender:
                deviceManager.PostProcess();
                break;

#if UNITY_EDITOR
            case NativeInputUpdateType.BeginEditor:
                InputSystem.isActive = !gameIsPlayingAndHasFocus;
                if (InputSystem.isActive)
                {
                    eventManager.handlerRoot.BeginUpdate();
                }
                break;

            case NativeInputUpdateType.EndEditor:
                if (InputSystem.isActive)
                {
                    eventManager.handlerRoot.EndUpdate();
                }
                break;
#endif
            }
        }
 private static extern void Update(NativeInputUpdateType updateType);
Example #13
0
 public static extern void SetUpdateMask(NativeInputUpdateType mask);
Example #14
0
 internal static void NotifyUpdate(NativeInputUpdateType updateType)
 {
     onUpdate?.Invoke(updateType);
 }
Example #15
0
 public static extern void Update(NativeInputUpdateType updateType);
Example #16
0
 public static void SetUpdateMask(NativeInputUpdateType mask)
 {
 }
Example #17
0
 internal static extern bool ShouldUpdateFallback(NativeInputUpdateType updateType);