コード例 #1
0
        protected override void OnEnableAfterStart()
        {
            base.OnEnableAfterStart();

#if UNITY_WSA
            if (RecognizerStart == RecognizerStartBehavior.AutoStart)
            {
                StartGestureRecognizers();
            }

            foreach (InteractionSourceState state in InteractionManager.GetCurrentReading())
            {
                GetOrAddSourceData(state.source);
                InputManager.Instance.RaiseSourceDetected(this, state.source.id);
            }

            InteractionManager.InteractionSourceUpdated += InteractionManager_InteractionSourceUpdated;

            InteractionManager.InteractionSourceReleased += InteractionManager_InteractionSourceReleased;
            InteractionManager.InteractionSourcePressed  += InteractionManager_InteractionSourcePressed;

            InteractionManager.InteractionSourceLost     += InteractionManager_InteractionSourceLost;
            InteractionManager.InteractionSourceDetected += InteractionManager_InteractionSourceDetected;
#else
            RecognizerStart = RecognizerStartBehavior.ManualStart;
#endif
        }
コード例 #2
0
        private void InitializeSources()
        {
            InputManager.AssertIsInitialized();

#if UNITY_WSA
            if (RecognizerStart == RecognizerStartBehavior.AutoStart)
            {
                StartGestureRecognizer();
            }

            InteractionSourceState[] states = InteractionManager.GetCurrentReading();
            for (var i = 0; i < states.Length; i++)
            {
                GetOrAddSourceData(states[i].source);
                InputManager.Instance.RaiseSourceDetected(this, states[i].source.id);
            }

#if UNITY_2017_2_OR_NEWER
            InteractionManager.InteractionSourceDetected += InteractionManager_InteractionSourceDetected;
            InteractionManager.InteractionSourcePressed  += InteractionManager_InteractionSourcePressed;
            InteractionManager.InteractionSourceUpdated  += InteractionManager_InteractionSourceUpdated;
            InteractionManager.InteractionSourceReleased += InteractionManager_InteractionSourceReleased;
            InteractionManager.InteractionSourceLost     += InteractionManager_InteractionSourceLost;
#else
            InteractionManager.SourceDetected += InteractionManager_InteractionSourceDetected;
            InteractionManager.SourcePressed  += InteractionManager_InteractionSourcePressed;
            InteractionManager.SourceUpdated  += InteractionManager_InteractionSourceUpdated;
            InteractionManager.SourceReleased += InteractionManager_InteractionSourceReleased;
            InteractionManager.SourceLost     += InteractionManager_InteractionSourceLost;
#endif
#else
            RecognizerStart = RecognizerStartBehavior.ManualStart;
#endif
        }
コード例 #3
0
        protected virtual void OnEnable()
        {
#if UNITY_WSA
            if (RecognizerStart == RecognizerStartBehavior.AutoStart)
            {
                StartGestureRecognizer();
            }

            InteractionSourceState[] states = InteractionManager.GetCurrentReading();
            for (var i = 0; i < states.Length; i++)
            {
                GetOrAddSourceData(states[i].source);
                InputManager.Instance.RaiseSourceDetected(this, states[i].source.id);
            }

            InteractionManager.SourceDetected += InteractionManager_InteractionSourceDetected;
            InteractionManager.SourcePressed  += InteractionManager_InteractionSourcePressed;
            InteractionManager.SourceUpdated  += InteractionManager_InteractionSourceUpdated;
            InteractionManager.SourceReleased += InteractionManager_InteractionSourceReleased;
            InteractionManager.SourceLost     += InteractionManager_InteractionSourceLost;
#else
            RecognizerStart = RecognizerStartBehavior.ManualStart;
#endif
        }