示例#1
0
    public static VisualElement CreateInputActionInfoUi(InputActionInfo entry)
    {
        Label label = new();

        label.AddToClassList("inputLegendLabel");
        label.text = $"{entry.InputText}: {entry.ActionText}";
        return(label);
    }
示例#2
0
        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);
        }
示例#3
0
    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);
    }
示例#4
0
文件: Data.cs 项目: MrReBot/OpenVR2WS
        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);
        }
示例#5
0
文件: Data.cs 项目: MrReBot/OpenVR2WS
        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
            };
        }
示例#6
0
 public static int CompareByActionName(InputActionInfo a, InputActionInfo b)
 {
     return(string.Compare(a.ActionName, b.ActionName, StringComparison.InvariantCulture));
 }