Ejemplo n.º 1
0
        public static void SyncSDKs()
        {
            if (TBEditorSDKSettings.GetNumActiveSDKs() == 0)
            {
                Debug.LogError("No platforms are currently enabled in TButt Core Settings. Please enable at least one platform in the Core Settings menu.");
            }
            else
            {
                _sdks = TBEditorSDKSettings.GetEditorSDKs();

                if (!_sdks.forceSync)
                {
                    return;
                }
                else
                {
                    TBEditorSDKSettings.SetScriptingDefines(_sdks);
                }

                if (!PlayerSettings.virtualRealitySupported)
                {
                    PlayerSettings.virtualRealitySupported = true;
                }

                TBEditorDefines.SetUnityVirtualRealitySDKs(_sdks);
            }
        }
Ejemplo n.º 2
0
        public static void ShowControllerMatrix()
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("", TBEditorStyles.h3, new GUILayoutOption[3] {
                GUILayout.Width(controllerLabelColumnWidth + controllerLabelColumnWidthRemainder + 2), GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false)
            });

            //EditorGUILayout.LabelField("", new GUILayoutOption[1]{ GUILayout.Width(controllerLabelColumnWidth + controllerLabelColumnWidthRemainder) });

            ShowControllerMatrixHeader(TBEditorSDKSettings.GetActiveSDKs().oculus, VRPlatform.OculusPC, TBEditorStyles.sectionOverlayOculus);
            ShowControllerMatrixHeader(TBEditorSDKSettings.GetActiveSDKs().steamVR, VRPlatform.SteamVR, TBEditorStyles.sectionOverlaySteam);
            ShowControllerMatrixHeader(TBEditorSDKSettings.GetActiveSDKs().googleVR, VRPlatform.Daydream, TBEditorStyles.sectionOverlayGoogle);
            ShowControllerMatrixHeader(TBEditorSDKSettings.GetActiveSDKs().psvr, VRPlatform.PlayStationVR, TBEditorStyles.sectionOverlayPSVR);
            ShowControllerMatrixHeader(TBEditorSDKSettings.GetActiveSDKs().windows, VRPlatform.WindowsMR, TBEditorStyles.sectionOverlayWindows);
            EditorGUILayout.EndHorizontal();

            // Hand Controllers
            EditorGUILayout.BeginHorizontal(TBEditorStyles.tableEvenRow);
            ShowControllerGroup(controlSettings.supportsHandControllers, TBInput.ControlType.HandControllers);
            EditorGUILayout.EndHorizontal();

            // 3DOF Controllers
            EditorGUILayout.BeginHorizontal(TBEditorStyles.tableOddRow);
            ShowControllerGroup(controlSettings.supports3DOFControllers, TBInput.ControlType.Mobile3DOFController);
            EditorGUILayout.EndHorizontal();

            // Gamepads
            EditorGUILayout.BeginHorizontal(TBEditorStyles.tableEvenRow);
            ShowControllerGroup(controlSettings.supportsGamepad, TBInput.ControlType.Gamepad);
            EditorGUILayout.EndHorizontal();

            // Click Remote
            EditorGUILayout.BeginHorizontal(TBEditorStyles.tableOddRow);
            ShowControllerGroup(controlSettings.supportsClickRemote, TBInput.ControlType.ClickRemote);
            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 3
0
        void OnGUI()
        {
            // Don't edit settings in play mode.
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                EditorGUILayout.HelpBox("Cannot edit input settings while in play mode.", MessageType.Error);
                return;
            }

            // Waiting for it to recompile...
            if (EditorApplication.isCompiling || hasCompiled)
            {
                if (!hasCompiled)
                {
                    hasCompiled = true;
                    CloseControllerWindows();   // close windows if we're compiling
                }
                EditorGUILayout.HelpBox("Wait for compiling to finish...", MessageType.Warning);
                return;
            }

            if (window == null)
            {
                ShowWindow();
            }

            window.minSize = new Vector2(1024, 768);
            controllerLabelColumnWidthRemainder = (window.position.width - controllerLabelColumnWidth) % TBEditorSDKSettings.GetNumActiveSDKs();
            controllerColumnWidth = (window.position.width - controllerLabelColumnWidth - controllerLabelColumnWidthRemainder - 10) / TBEditorSDKSettings.GetNumActiveSDKs();
            EditorGUILayout.BeginVertical();
            ShowGlobalControlSettings();
            ShowControllerMatrix();
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal(new GUILayoutOption[1] {
                GUILayout.Height(70)
            });
            GUI.backgroundColor = Color.green;
            if (GUILayout.Button("Save and Close", new GUILayoutOption[1] {
                GUILayout.Height(40)
            }))
            {
                SaveSettings();
                window.Close();
            }

            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("Close Without Saving", new GUILayoutOption[1] {
                GUILayout.Height(40)
            }))
            {
                CloseControllerWindows();
                window.Close();
            }
            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 4
0
        public static void ShowControllerGroup(bool active, TBInput.ControlType controlType)
        {
            EditorGUILayout.BeginVertical();
            switch (controlType)
            {
            case TBInput.ControlType.HandControllers:
                ShowControllerGroupLabel("Hand Controllers", ref controlSettings.supportsHandControllers);
                break;

            case TBInput.ControlType.Mobile3DOFController:
                ShowControllerGroupLabel("3DOF Controllers", ref controlSettings.supports3DOFControllers);
                break;

            case TBInput.ControlType.Gamepad:
                ShowControllerGroupLabel("Gamepads", ref controlSettings.supportsGamepad);
                break;

            case TBInput.ControlType.ClickRemote:
                ShowControllerGroupLabel("Click Remotes", ref controlSettings.supportsClickRemote);
                break;
            }
            GUI.contentColor = Color.white;
            EditorGUILayout.EndVertical();

            if (TBEditorSDKSettings.GetActiveSDKs().oculus)
            {
                EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayOculus, new GUILayoutOption[2] {
                    GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true)
                });
                GUI.backgroundColor = TBEditorStyles.solidOculus;
                TBEditorInputOculus.ShowOculusControllerList(active, controlType);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }

            if (TBEditorSDKSettings.GetActiveSDKs().steamVR)
            {
                EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlaySteam, new GUILayoutOption[2] {
                    GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true)
                });
                GUI.backgroundColor = TBEditorStyles.solidSteam;
                TBEditorInputSteamVR.ShowSteamVRControllerList(active, controlType);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }

            if (TBEditorSDKSettings.GetActiveSDKs().googleVR)
            {
                EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayGoogle, new GUILayoutOption[2] {
                    GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true)
                });
                GUI.backgroundColor = TBEditorStyles.solidGoogle;
                TBEditorInputGoogle.ShowGoogleControllerList(active, controlType);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }

            if (TBEditorSDKSettings.GetActiveSDKs().psvr)
            {
                EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayPSVR, new GUILayoutOption[2] {
                    GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true)
                });
                GUI.backgroundColor = TBEditorStyles.solidPSVR;
#if UNITY_PS4
                TBEditorInputPSVR.ShowPSVRControllerList(active, controlType);
#else
                EditorGUILayout.HelpBox("PSVR settings are only available when Unity platform is set to PS4 and the PS4 module is installed.", MessageType.Info);
#endif
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }

            if (TBEditorSDKSettings.GetActiveSDKs().windows)
            {
                EditorGUILayout.BeginVertical(TBEditorStyles.sectionOverlayWindows, new GUILayoutOption[2] {
                    GUILayout.Width(controllerColumnWidth), GUILayout.ExpandHeight(true)
                });
                GUI.backgroundColor = TBEditorStyles.solidWindows;
                TBEditorInputWindowsMR.ShowWindowsMRControllerList(active, controlType);
                GUI.backgroundColor = Color.white;
                EditorGUILayout.EndVertical();
            }
        }