Example #1
0
 private bool HasOppositeHandButtonWithSameName(VRActionInput actionInput)
 {
     foreach (var buttonEntry in buttonActions)
     {
         if (actionInput.IsOppositeHandWithSameName(buttonEntry.Value))
         {
             return(true);
         }
     }
     foreach (var axisEntry in axisActions)
     {
         if (actionInput.IsOppositeHandWithSameName(axisEntry.Value))
         {
             return(true);
         }
     }
     foreach (var otherAction in otherActions)
     {
         if (actionInput.IsOppositeHandWithSameName(otherAction))
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
            private static void SetUpActionInputs()
            {
                var actionSet = SteamVR_Actions._default;

                buttonActions = new Dictionary <JoystickButton, VRActionInput>
                {
                    [JoystickButton.FaceDown]     = new VRActionInput(actionSet.Jump, TextHelper.GREEN),
                    [JoystickButton.FaceRight]    = new VRActionInput(actionSet.Back, TextHelper.RED),
                    [JoystickButton.FaceLeft]     = new VRActionInput(actionSet.Interact, TextHelper.BLUE),
                    [JoystickButton.RightBumper]  = new VRActionInput(actionSet.Interact, TextHelper.BLUE),
                    [JoystickButton.FaceUp]       = new VRActionInput(actionSet.Interact, TextHelper.BLUE, true),
                    [JoystickButton.LeftBumper]   = new VRActionInput(actionSet.RollMode),
                    [JoystickButton.Start]        = new VRActionInput(actionSet.Menu),
                    [JoystickButton.Select]       = new VRActionInput(actionSet.Map),
                    [JoystickButton.LeftTrigger]  = new VRActionInput(actionSet.ThrustDown),
                    [JoystickButton.RightTrigger] = new VRActionInput(actionSet.ThrustUp)
                };

                axisActions = new Dictionary <AxisIdentifier, VRActionInput>
                {
                    [AxisIdentifier.CTRLR_LTRIGGER] = new VRActionInput(actionSet.ThrustDown),
                    [AxisIdentifier.CTRLR_RTRIGGER] = new VRActionInput(actionSet.ThrustUp),
                    [AxisIdentifier.CTRLR_LSTICK]   = new VRActionInput(actionSet.Move),
                    [AxisIdentifier.CTRLR_LSTICKX]  = new VRActionInput(actionSet.Move),
                    [AxisIdentifier.CTRLR_LSTICKY]  = new VRActionInput(actionSet.Move),
                    [AxisIdentifier.CTRLR_RSTICK]   = new VRActionInput(actionSet.Look),
                    [AxisIdentifier.CTRLR_RSTICKX]  = new VRActionInput(actionSet.Look),
                    [AxisIdentifier.CTRLR_RSTICKY]  = new VRActionInput(actionSet.Look)
                };

                otherActions = new VRActionInput[]
                {
                    new VRActionInput(actionSet.Grip)
                };
            }
Example #3
0
        public VRActionInput(ISteamVR_Action_In action, string color, bool isLongPress = false, VRActionInput holdActionInput = null)
        {
            _color           = color;
            _action          = action;
            _holdActionInput = holdActionInput;

            if (isLongPress)
            {
                _prefixes.Add("Long Press");
            }
        }
Example #4
0
 private bool IsOppositeHandWithSameName(VRActionInput other)
 {
     if (other == this)
     {
         return(false);
     }
     if (_hand != other._hand && _source == other._source)
     {
         return(true);
     }
     return(false);
 }
Example #5
0
 public bool IsOppositeHandWithSameName(VRActionInput other)
 {
     if (other == this)
     {
         return(false);
     }
     if (Hand != other.Hand && Source == other.Source)
     {
         return(true);
     }
     return(false);
 }
Example #6
0
 private bool HasAxisWithSameName(VRActionInput button)
 {
     foreach (var axisEntry in axisActions)
     {
         var axis = axisEntry.Value;
         if (button.Hand == axis.Hand && button.Source == axis.Source)
         {
             return(true);
         }
     }
     return(false);
 }
Example #7
0
            public void SetUpActionInputs()
            {
                var actionSet = SteamVR_Actions._default;

                buttonActions = new Dictionary <JoystickButton, VRActionInput>
                {
                    [JoystickButton.FaceDown]     = new VRActionInput(actionSet.Jump, TextHelper.GREEN),
                    [JoystickButton.FaceRight]    = new VRActionInput(actionSet.Back, TextHelper.RED),
                    [JoystickButton.FaceLeft]     = new VRActionInput(actionSet.Interact, TextHelper.BLUE),
                    [JoystickButton.RightBumper]  = new VRActionInput(actionSet.Interact, TextHelper.BLUE),
                    [JoystickButton.FaceUp]       = new VRActionInput(actionSet.Interact, TextHelper.BLUE, true),
                    [JoystickButton.LeftBumper]   = new VRActionInput(actionSet.RollMode),
                    [JoystickButton.Start]        = new VRActionInput(actionSet.Menu),
                    [JoystickButton.Select]       = new VRActionInput(actionSet.Map),
                    [JoystickButton.LeftTrigger]  = new VRActionInput(actionSet.ThrustDown),
                    [JoystickButton.RightTrigger] = new VRActionInput(actionSet.ThrustUp)
                };

                axisActions = new Dictionary <AxisIdentifier, VRActionInput>
                {
                    [AxisIdentifier.CTRLR_LTRIGGER] = new VRActionInput(actionSet.ThrustDown),
                    [AxisIdentifier.CTRLR_RTRIGGER] = new VRActionInput(actionSet.ThrustUp),
                    [AxisIdentifier.CTRLR_LSTICK]   = new VRActionInput(actionSet.Move),
                    [AxisIdentifier.CTRLR_LSTICKX]  = new VRActionInput(actionSet.Move),
                    [AxisIdentifier.CTRLR_LSTICKY]  = new VRActionInput(actionSet.Move),
                    [AxisIdentifier.CTRLR_RSTICK]   = new VRActionInput(actionSet.Look),
                    [AxisIdentifier.CTRLR_RSTICKX]  = new VRActionInput(actionSet.Look),
                    [AxisIdentifier.CTRLR_RSTICKY]  = new VRActionInput(actionSet.Look)
                };

                otherActions = new VRActionInput[]
                {
                    new VRActionInput(actionSet.Grip)
                };

                foreach (var buttonEntry in buttonActions)
                {
                    var button = buttonEntry.Value;
                    if (HasAxisWithSameName(button))
                    {
                        button.Prefixes.Add("Click");
                    }

                    if (!HasOppositeHandButtonWithSameName(button))
                    {
                        button.HideHand = true;
                    }
                }
            }
Example #8
0
                private static void AddTextIfNotExisting(string text, HashSet <string> actionTexts, VRActionInput actionInput)
                {
                    var actionInputText = actionInput.GetText();

                    if (!text.Contains(actionInputText))
                    {
                        actionTexts.Add(actionInputText);
                    }
                }
Example #9
0
                private static void AddTextIfNotExisting(string text, HashSet <string> actionTexts, VRActionInput actionInput)
                {
                    var actionInputTexts = actionInput.GetText();

                    foreach (var inputText in actionInputTexts)
                    {
                        if (!text.Contains(inputText))
                        {
                            actionTexts.Add(inputText);
                        }
                    }
                }
Example #10
0
 public VRActionInput(ISteamVR_Action_In action, VRActionInput holdActionInput) : this(action, TextHelper.ORANGE, false, holdActionInput)
 {
 }
Example #11
0
 public VRActionInput(ISteamVR_Action_In action, bool isLongPress = false, VRActionInput holdActionInput = null) : this(action, TextHelper.ORANGE, isLongPress, holdActionInput)
 {
 }