Esempio n. 1
0
    //protected abstract MonoBehaviour TargetController { get; }
    private void DrawGlobalUI()
    {
        DrawCustomGlobalUI();

        GUILayout.Label("SKS Global settings", EditorStyles.boldLabel);
        EditorGUI.indentLevel = EditorGUI.indentLevel + IndentSize;

        GUILayout.Space(BumperSize);
        if (_imageFoldout = EditorGUILayout.Foldout(_imageFoldout, "Image Settings", EditorStyles.foldout))
        {
            EditorGUI.indentLevel = EditorGUI.indentLevel + IndentSize;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(EditorGUI.indentLevel * 10);
#if SKS_VR
                GUILayout.Label("Single Pass Stereo Rendering: " + SKSGlobalRenderSettings.SinglePassStereo);
#endif
            }
            GUILayout.EndHorizontal();


            GUI.enabled = !Application.isPlaying;


#if SKS_VR
            GUILayout.BeginHorizontal();
            GUILayout.Space(EditorGUI.indentLevel * 10);
            GUILayout.Label("Recursion in VR is very expensive. 3 is the typically acceptable max (prefer 0 if possible)");
            GUILayout.EndHorizontal();
#endif

            SKSGlobalRenderSettings.RecursionNumber = EditorGUILayout.IntSlider(
                new GUIContent("Recursion Number",
                               "The number of times that EffectRenderers will draw through each other."),
                SKSGlobalRenderSettings.RecursionNumber, 0, 10);


            if (SKSGlobalRenderSettings.RecursionNumber > 1)
            {
                EditorGUILayout.HelpBox(
                    "Please be aware that recursion can get very expensive very quickly." +
                    " Consider making this scale with the Quality setting of your game.",
                    MessageType.Warning);
            }



            GUI.enabled = true;


            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.AggressiveRecursionOptimization = GUILayout.Toggle(
                    SKSGlobalRenderSettings.AggressiveRecursionOptimization,
                    new GUIContent("Enable Aggressive Optimization for Recursion",
                                   "Aggressive optimization will halt recursive rendering immediately if the " +
                                   "source EffectRenderer cannot raycast to the EffectRenderers it is trying to render. " +
                                   "Without Occlusion Culling (due to lack of Unity Support), this is a lifesaver for " +
                                   "large scenes."));
            }
            GUILayout.EndHorizontal();

            if (SKSGlobalRenderSettings.AggressiveRecursionOptimization)
            {
                EditorGUILayout.HelpBox(
                    "Enabling this option can save some serious performance, " +
                    "but it is possible for visual bugs to arise due to portals being partially inside walls. " +
                    "If you are seeing black EffectRenderers while recursing, try turning this option off " +
                    "and see if it helps. If it does, then please make sure that your EffectRenderers are not" +
                    "inside walls.",
                    MessageType.Warning);
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.AdaptiveQuality = GUILayout.Toggle(SKSGlobalRenderSettings.AdaptiveQuality,
                                                                           new GUIContent("Enable Adaptive Quality Optimization for Recursion",
                                                                                          "Adaptive quality rapidly degrades the quality of recursively " +
                                                                                          "rendered EffectRenderers. This is usually desirable."));
            }
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.CustomSkybox = GUILayout.Toggle(SKSGlobalRenderSettings.CustomSkybox,
                                                                        new GUIContent("Enable Skybox Override",
                                                                                       "Enable custom skybox rendering. This is needed for skyboxes to not look strange through" +
                                                                                       "SKSEffectCameras on some platforms when optimizations are enabled."));
            }
            GUILayout.EndHorizontal();
            EditorGUI.indentLevel = EditorGUI.indentLevel - IndentSize;
        }

        GUILayout.Space(BumperSize);
        if (_editorFoldout = EditorGUILayout.Foldout(_editorFoldout, "Editor Settings", EditorStyles.foldout))
        {
            EditorGUI.indentLevel = EditorGUI.indentLevel + IndentSize;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.Gizmos = GUILayout.Toggle(SKSGlobalRenderSettings.Gizmos,
                                                                  new GUIContent("Draw Gizmos",
                                                                                 "Draw SKS Gizmos when applicable assets are selected in the Editor"));
            }
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.Preview = GUILayout.Toggle(SKSGlobalRenderSettings.Preview,
                                                                   new GUIContent("Draw EffectRenderer Previews (experimental, buggy on many Unity versions)",
                                                                                  "Draw EffectRenderer Previews when selected in the Editor." +
                                                                                  " Experimental."));
            }
            GUILayout.EndHorizontal();
            EditorGUI.indentLevel = EditorGUI.indentLevel - IndentSize;
        }

        GUILayout.Label("Something doesn't look right!/I'm getting errors!");

        SKSGlobalRenderSettings.UvFlip = GUILayout.Toggle(SKSGlobalRenderSettings.UvFlip,
                                                          "My stuff is rendering upside down!");

        GUILayout.Label("Troubleshooting:");

        string path = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
        if (path == null)
        {
            return;
        }
        path = path.Substring(0, path.LastIndexOf(Path.DirectorySeparatorChar));
        string studioName = "SKStudios";
        string root       = path.Substring(0, path.LastIndexOf(studioName) + (studioName.Length + 1));
        string PDFPath    = Path.Combine(root, AssetName);
        PDFPath = Path.Combine(PDFPath, "README.pdf");
        GUILayout.BeginHorizontal();
        {
            if (GUILayout.Button(AssetName + " Manual"))
            {
                Application.OpenURL(PDFPath);
            }
            if (GUILayout.Button("Setup"))
            {
                SettingsWindow.Show();
            }
        }
        GUILayout.EndHorizontal();
        EditorGUI.indentLevel = EditorGUI.indentLevel - IndentSize;
    }