Пример #1
0
        public static string GetKeyName(int index, XR_Enum.DefaultController defaultController, XR_Enum.InputType inputType)
        {
            switch (defaultController)
            {
            case XR_Enum.DefaultController.Vive:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.HTC_Vive_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.HTC_Vive_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.HTC_Vive_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.GearVR:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.GearVR_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.GearVR_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.GearVR_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.Oculus:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.Oculus_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.Oculus_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.Oculus_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.WMR:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.WMR_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.WMR_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.WMR_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.OpenVR_Full:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.OpenVRFull_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.OpenVRFull_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.OpenVRFull_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.OpenVR_Oculus:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.OpenVR_Oculus_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.OpenVR_Oculus_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.OpenVR_Oculus_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.OpenVR_MWR:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.OpenVR_WMR_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.OpenVR_WMR_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.OpenVR_WMR_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            case XR_Enum.DefaultController.Daydream:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(((XR_Enum.Daydream_Button)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(((XR_Enum.Daydream_Axis)index).ToString());
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(((XR_Enum.Daydream_2DAxis)index).ToString());
                }
                else
                {
                    return("None");
                }
            }

            default: return("None");
            }
        }
Пример #2
0
        public static int[] GetDeviceControllerKeysValues(XR_Enum.DefaultController defaultController, XR_Enum.InputType inputType)
        {
            switch (defaultController)
            {
            case XR_Enum.DefaultController.Vive:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.HTC_Vive_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.HTC_Vive_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.HTC_Vive_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.GearVR:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.GearVR_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.GearVR_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.GearVR_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.Oculus:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.Oculus_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.Oculus_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.Oculus_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.WMR:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.WMR_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.WMR_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.WMR_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.OpenVR_Full:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVRFull_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVRFull_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVRFull_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.OpenVR_Oculus:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVR_Oculus_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVR_Oculus_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVR_Oculus_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.OpenVR_MWR:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVR_WMR_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVR_WMR_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.OpenVR_WMR_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            case XR_Enum.DefaultController.Daydream:
            {
                if (inputType == XR_Enum.InputType.Bool)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.Daydream_Button)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis1D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.Daydream_Axis)) as int[]);
                }
                else if (inputType == XR_Enum.InputType.Axis2D)
                {
                    return(System.Enum.GetValues(typeof(XR_Enum.Daydream_2DAxis)) as int[]);
                }
                else
                {
                    return(null);
                }
            }

            default: return(null);
            }
        }