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); }
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) }; }
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"); } }
private bool IsOppositeHandWithSameName(VRActionInput other) { if (other == this) { return(false); } if (_hand != other._hand && _source == other._source) { return(true); } return(false); }
public bool IsOppositeHandWithSameName(VRActionInput other) { if (other == this) { return(false); } if (Hand != other.Hand && Source == other.Source) { return(true); } return(false); }
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); }
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; } } }
private static void AddTextIfNotExisting(string text, HashSet <string> actionTexts, VRActionInput actionInput) { var actionInputText = actionInput.GetText(); if (!text.Contains(actionInputText)) { actionTexts.Add(actionInputText); } }
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); } } }
public VRActionInput(ISteamVR_Action_In action, VRActionInput holdActionInput) : this(action, TextHelper.ORANGE, false, holdActionInput) { }
public VRActionInput(ISteamVR_Action_In action, bool isLongPress = false, VRActionInput holdActionInput = null) : this(action, TextHelper.ORANGE, isLongPress, holdActionInput) { }