コード例 #1
0
        /// Lazy-init settings based on profile.
        /// This cannot happen in the constructor because the profile may not exist yet.
        private void EnsureProfileSettings()
        {
            if (initializedFromProfile)
            {
                return;
            }
            initializedFromProfile = true;

            MixedRealityGesturesProfile    gestureProfile     = null;
            MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile;

            if (inputSystemProfile != null)
            {
                gestureProfile = inputSystemProfile.GesturesProfile;
            }
            if (gestureProfile != null)
            {
                for (int i = 0; i < gestureProfile.Gestures.Length; i++)
                {
                    var gesture = gestureProfile.Gestures[i];
                    switch (gesture.GestureType)
                    {
                    case GestureInputType.Hold:
                        holdAction = gesture.Action;
                        break;

                    case GestureInputType.Manipulation:
                        manipulationAction = gesture.Action;
                        break;

                    case GestureInputType.Navigation:
                        navigationAction = gesture.Action;
                        break;

                    case GestureInputType.Select:
                        selectAction = gesture.Action;
                        break;
                    }
                }

                useRailsNavigation = gestureProfile.UseRailsNavigation;
            }

            MixedRealityInputSimulationProfile inputSimProfile = CoreServices.GetInputSystemDataProvider <IInputSimulationService>()?.InputSimulationProfile;

            if (inputSimProfile != null)
            {
                holdStartDuration        = inputSimProfile.HoldStartDuration;
                navigationStartThreshold = inputSimProfile.NavigationStartThreshold;
            }
        }
コード例 #2
0
        /// <summary>
        /// Used to initialize/reset the event and populate the data.
        /// </summary>
        public void Initialize(IMixedRealityPointer pointer, MixedRealityInputAction inputAction, Handedness handedness = Handedness.None, IMixedRealityInputSource inputSource = null, int count = 0)
        {
            if (inputSource != null)
            {
                Initialize(inputSource, handedness, inputAction);
            }
            else
            {
                Initialize(pointer.InputSourceParent, handedness, inputAction);
            }

            Pointer = pointer;
            Count   = count;
        }
コード例 #3
0
        /// Lazy-init settings based on profile.
        /// This cannot happen in the constructor because the profile may not exist yet.
        private void EnsureProfileSettings()
        {
            if (initializedFromProfile)
            {
                return;
            }
            initializedFromProfile = true;

            var gestureProfile = InputSystem?.InputSystemProfile?.GesturesProfile;

            if (gestureProfile != null)
            {
                for (int i = 0; i < gestureProfile.Gestures.Length; i++)
                {
                    var gesture = gestureProfile.Gestures[i];
                    switch (gesture.GestureType)
                    {
                    case GestureInputType.Hold:
                        holdAction = gesture.Action;
                        break;

                    case GestureInputType.Manipulation:
                        manipulationAction = gesture.Action;
                        break;

                    case GestureInputType.Navigation:
                        navigationAction = gesture.Action;
                        break;
                    }
                }

                useRailsNavigation = gestureProfile.UseRailsNavigation;
            }

            var inputSimProfile = MixedRealityToolkit.Instance?.GetService <IInputSimulationService>()?.InputSimulationProfile;

            if (inputSimProfile != null)
            {
                holdStartDuration        = inputSimProfile.HoldStartDuration;
                navigationStartThreshold = inputSimProfile.NavigationStartThreshold;
            }
        }
コード例 #4
0
        void Awake()
        {
            var gestureProfile = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile;

            if (gestureProfile != null)
            {
                for (int i = 0; i < gestureProfile.Gestures.Length; i++)
                {
                    var gesture = gestureProfile.Gestures[i];
                    switch (gesture.GestureType)
                    {
                    case GestureInputType.Hold:
                        holdAction = gesture.Action;
                        break;

                    case GestureInputType.Manipulation:
                        manipulationAction = gesture.Action;
                        break;

                    case GestureInputType.Navigation:
                        navigationAction = gesture.Action;
                        break;
                    }
                }

                useRailsNavigation = gestureProfile.UseRailsNavigation;
            }

            var inputSimProfile = MixedRealityToolkit.Instance?.GetService <InputSimulationService>()?.GetInputSimulationProfile();

            if (inputSimProfile != null)
            {
                holdStartDuration          = inputSimProfile.HoldStartDuration;
                manipulationStartThreshold = inputSimProfile.ManipulationStartThreshold;
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="baseAction">The Base Action that the rule will listen to.</param>
 /// <param name="ruleAction">The Action to raise if the criteria is met.</param>
 /// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
 public InputActionRulePoseAxis(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, MixedRealityPose criteria)
 {
     this.baseAction = baseAction;
     this.ruleAction = ruleAction;
     this.criteria   = criteria;
 }
コード例 #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="baseAction">The Base Action that the rule will listen to.</param>
 /// <param name="ruleAction">The Action to raise if the criteria is met.</param>
 /// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
 public InputActionRuleVectorAxis(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, Vector3 criteria)
 {
     this.baseAction = baseAction;
     this.ruleAction = ruleAction;
     this.criteria   = criteria;
 }
コード例 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public MixedRealityGestureMapping(string description, GestureInputType gestureType, MixedRealityInputAction action)
 {
     this.description = description;
     this.gestureType = gestureType;
     this.action      = action;
 }
コード例 #8
0
 /// <summary>
 /// Used to initialize/reset the event and populate the data.
 /// </summary>
 public void Initialize(IMixedRealityPointer pointer, Handedness handedness, MixedRealityInputAction inputAction, int count = 0)
 {
     Initialize(pointer.InputSourceParent, handedness, inputAction);
     Pointer = pointer;
     Count   = count;
 }
コード例 #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="baseAction">The Base Action that the rule will listen to.</param>
 /// <param name="ruleAction">The Action to raise if the criteria is met.</param>
 /// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
 public InputActionRuleSingleAxis(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, float criteria)
 {
     this.baseAction = baseAction;
     this.ruleAction = ruleAction;
     this.criteria   = criteria;
 }
コード例 #10
0
 /// <summary>
 /// Used to initialize/reset the event and populate the data.
 /// </summary>
 /// <param name="inputSource"></param>
 /// <param name="handedness"></param>
 /// <param name="inputAction"></param>
 public void Initialize(IMixedRealityInputSource inputSource, Handedness handedness, MixedRealityInputAction inputAction)
 {
     BaseInitialize(inputSource, inputAction);
     Handedness = handedness;
 }
        /// <summary>
        /// The constructor for a new Interaction Mapping definition
        /// </summary>
        /// <param name="id">Identity for mapping</param>
        /// <param name="description">The description of the interaction mapping.</param>
        /// <param name="axisType">The axis that the mapping operates on, also denotes the data type for the mapping</param>
        /// <param name="inputType">The physical input device / control</param>
        /// <param name="inputAction">The logical MixedRealityInputAction that this input performs</param>
        /// <param name="keyCode">Optional KeyCode value to get input from Unity's old input system</param>
        /// <param name="axisCodeX">Optional horizontal or single axis value to get axis data from Unity's old input system.</param>
        /// <param name="axisCodeY">Optional vertical axis value to get axis data from Unity's old input system.</param>
        /// <param name="invertXAxis">Optional horizontal axis invert option.</param>
        /// <param name="invertYAxis">Optional vertical axis invert option.</param>
        public MixedRealityInteractionMapping(uint id, string description, AxisType axisType, DeviceInputType inputType, MixedRealityInputAction inputAction, KeyCode keyCode = KeyCode.None, string axisCodeX = "", string axisCodeY = "", bool invertXAxis = false, bool invertYAxis = false)
        {
            this.id          = id;
            this.description = description;
            this.axisType    = axisType;
            this.inputType   = inputType;
            this.inputAction = inputAction;
            this.keyCode     = keyCode;
            this.axisCodeX   = axisCodeX;
            this.axisCodeY   = axisCodeY;
            this.invertXAxis = invertXAxis;
            this.invertYAxis = invertYAxis;

            rawData      = null;
            boolData     = false;
            floatData    = 0f;
            vector2Data  = Vector2.zero;
            positionData = Vector3.zero;
            rotationData = Quaternion.identity;
            poseData     = MixedRealityPose.ZeroIdentity;
            changed      = false;
        }
コード例 #12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="baseAction">The Base Action that the rule will listen to.</param>
 /// <param name="ruleAction">The Action to raise if the criteria is met.</param>
 /// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
 public InputActionRuleQuaternionAxis(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, Quaternion criteria)
 {
     this.baseAction = baseAction;
     this.ruleAction = ruleAction;
     this.criteria   = criteria;
 }
コード例 #13
0
 public bool Equals(MixedRealityInputAction other)
 {
     return(Id == other.Id &&
            AxisConstraint == other.AxisConstraint);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="baseAction">The Base Action that the rule will listen to.</param>
 /// <param name="ruleAction">The Action to raise if the criteria is met.</param>
 /// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
 public InputActionRuleDigital(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, bool criteria)
 {
     this.baseAction = baseAction;
     this.ruleAction = ruleAction;
     this.criteria   = criteria;
 }
コード例 #15
0
 /// <summary>
 /// Used to initialize/reset the event and populate the data.
 /// </summary>
 /// <param name="inputSource"></param>
 /// <param name="inputAction"></param>
 public void Initialize(IMixedRealityInputSource inputSource, MixedRealityInputAction inputAction)
 {
     BaseInitialize(inputSource, inputAction);
     Handedness = Handedness.None;
 }
コード例 #16
0
 /// <summary>
 /// Release this pointer. This sends pointer clicked and pointer up events across the input system.
 /// </summary>
 /// <param name="mixedRealityInputAction">The input action that corresponds to the released button or axis.</param>
 /// <param name="handedness">Optional handedness of the source that released the pointer.</param>
 /// <param name="inputSource"></param>
 public void RaisePointerUp(MixedRealityInputAction mixedRealityInputAction, Handedness handedness = Handedness.None, IMixedRealityInputSource inputSource = null)
 {
     gazeProvider.InputSystem?.RaisePointerClicked(this, mixedRealityInputAction, 0, handedness, inputSource);
     gazeProvider.InputSystem?.RaisePointerUp(this, mixedRealityInputAction, handedness, inputSource);
 }
コード例 #17
0
 /// <summary>
 /// The constructor for a new MixedRealityInputActionMapping definition
 /// </summary>
 /// <param name="description">The description of the interaction mapping.</param>
 /// <param name="inputAction">The logical MixedRealityInputAction that this input performs</param>
 public MixedRealityInputActionMapping(string description, AxisType axisType, DeviceInputType inputType, MixedRealityInputAction inputAction)
 {
     this.description = description;
     this.axisType    = axisType;
     this.inputType   = inputType;
     this.inputAction = inputAction;
 }
コード例 #18
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="inputAction"></param>
 /// <param name="unityEvent"></param>
 public InputActionEventPair(MixedRealityInputAction inputAction, UnityEvent unityEvent)
 {
     this.inputAction = inputAction;
     this.unityEvent  = unityEvent;
 }
コード例 #19
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="keyword">The Keyword.</param>
 /// <param name="keyCode">The KeyCode.</param>
 /// <param name="action">The Action to perform when Keyword or KeyCode is recognized.</param>
 public SpeechCommands(string keyword, KeyCode keyCode, MixedRealityInputAction action)
 {
     this.keyword = keyword;
     this.keyCode = keyCode;
     this.action  = action;
 }