public static VisualElement CreateInputActionInfoUi(InputActionInfo entry) { Label label = new(); label.AddToClassList("inputLegendLabel"); label.text = $"{entry.InputText}: {entry.ActionText}"; return(label); }
private void SendInput(InputDigitalActionData_t data, InputActionInfo info) { var source = Data.handleToSource[info.sourceHandle]; var output = new Dictionary <string, dynamic>() { { "source", source }, { "input", info.pathEnd }, { "value", data.bState } }; SendResult("Input", output); }
private List <InputActionInfo> GetAvailableInputActionInfos() { List <InputActionInfo> infos = new List <InputActionInfo>(); foreach (ObservableCancelablePriorityInputAction observableInputAction in InputManager.GetBoundInputActions()) { if (ignoredInputActions.Contains(observableInputAction.InputAction.name)) { continue; } string displayString = GetBindingDisplayString(observableInputAction.InputAction); if (displayString.IsNullOrEmpty()) { continue; } string actionNameDisplayString = CamelCaseToDisplayName(observableInputAction.InputAction.name); string infoOfThisAction = GetBindingDisplayString(observableInputAction.InputAction); infos.Add(new InputActionInfo(actionNameDisplayString, infoOfThisAction)); } foreach (InputActionInfo additionalInputActionInfo in InputManager.AdditionalInputActionInfos) { InputActionInfo existingInfo = infos.FirstOrDefault(it => { string actionNameToLowerNoSpace = it.ActionName.ToLowerInvariant().Replace(" ", ""); string additionalInputActionNameToLowerNoSpace = additionalInputActionInfo.ActionName.ToLowerInvariant().Replace(" ", ""); return(actionNameToLowerNoSpace == additionalInputActionNameToLowerNoSpace); }); if (existingInfo == null) { infos.Add(additionalInputActionInfo); } else { existingInfo.AddInfoText(additionalInputActionInfo.InfoText); } } infos.Sort(InputActionInfo.CompareByActionName); return(infos); }
public static void UpdateOrAddPoseInputActionData(InputPoseActionData_t data, InputActionInfo info) { var source = handleToSource[info.sourceHandle]; if (!poseInputActionData.ContainsKey(source)) { poseInputActionData[source] = new ConcurrentDictionary <string, Pose>(); } poseInputActionData[source][info.pathEnd] = new Pose(data.pose); }
public static void UpdateOrAddAnalogInputActionData(InputAnalogActionData_t data, InputActionInfo info) { var source = handleToSource[info.sourceHandle]; if (!analogInputActionData.ContainsKey(source)) { analogInputActionData[source] = new ConcurrentDictionary <string, Vec3>(); } analogInputActionData[source][info.pathEnd] = new Vec3() { x = data.x, y = data.y, z = data.z }; }
public static int CompareByActionName(InputActionInfo a, InputActionInfo b) { return(string.Compare(a.ActionName, b.ActionName, StringComparison.InvariantCulture)); }