示例#1
0
 static void Show()
 {
     SettingsWindow.Show(true, 5);
 }
示例#2
0
 public FirstRunPanel(SettingsWindow window)
 {
     selector = new ProjectModeSelector(window);
 }
示例#3
0
 static void Show()
 {
     SettingsWindow.Show(true, SettingsWindow.EDITOR_SETTINGS);
 }
示例#4
0
        static void OnProjectReload()
        {
            // don't bother the user if they're playing
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }

            //Logger.Log( "Reload Fired" );

            if (projectInitialized)
            {
                if (!GlobalPortalSettings.Nagged &&
                    System.DateTime.UtcNow.Ticks - GlobalPortalSettings.TimeInstalled > 5.888e+12D)
                {
                    SettingsWindow.Show(true, 6);
                    GlobalPortalSettings.Nagged = true;
                }
                if (projectMode == ProjectMode.VR)
                {
                    //Logger.Log( "active project mode is VR" );
                    // check to see if we're currently trying to load vrtk
                    var importingStep = importingVRTK;
                    if (importingStep > 0)
                    {
                        if (importingStep == 2)
                        {
                            // has vrtk been imported successfully?
                            if (VRTKIsMaybeInstalled)
                            {
                                //Logger.Log( "vrtk import complete" );

                                // first reload of vrtk, wait out vrtk adding its own compile symbols
                                importingVRTK = 1;
                            }
                            else
                            {
                                // vrtk probably didn't install/run correctly... maybe detect improper import later
                                importingVRTK = 0;
                                CheckImportFlags();
                            }
                        }
                        else
                        {
                            //Logger.Log( "vrtk reimport" );
                            // second reload of vrtk, check the import flags
                            importingVRTK = 0;
                            CheckImportFlags();
                        }
                    }
                    else
                    {
                        // we're not importing vrtk
                        CheckImportFlags();
                    }
                }
                else
                {
                    //Logger.Log( "active project mode is non-VR" );
                    CheckImportFlags();
                }
            }
            else
            {
                // project is uninitialized, show the setup window
                if (!ignoringInitialSetup)
                {
                    EditorUtility.ClearProgressBar();
                    SettingsWindow.Show();
                }
            }
        }
示例#5
0
 static void Show()
 {
     SettingsWindow.Show(true, SettingsWindow.INTERACTION_SETTINGS);
 }
示例#6
0
 public InteractionSettingsPanel(SettingsWindow window)
 {
     fadePhysicsPassthroughWarning = new AnimBool(SKSGlobalRenderSettings.PhysicsPassthrough, window.Repaint);
 }
示例#7
0
 static void Show()
 {
     SettingsWindow.Show(true, SettingsWindow.GENERAL_SETTINGS);
 }
示例#8
0
 public ImageSettingsPanel(SettingsWindow window)
 {
     fadeAggressiveRecursionWarning = new AnimBool(SKSGlobalRenderSettings.AggressiveRecursionOptimization, window.Repaint);
     fadeRecursionNumberWarning     = new AnimBool(SKSGlobalRenderSettings.RecursionNumber > 1, window.Repaint);
 }
示例#9
0
 static void Show()
 {
     SettingsWindow.Show(true, SettingsWindow.FEEDBACK);
 }
示例#10
0
 public SetupPanel(SettingsWindow window)
 {
     this.window = window;
     selector    = new ProjectModeSelector(window);
 }
        /// <summary>
        /// Displays the window
        /// </summary>
        /// <param name="windowID">ID of the window</param>
        public static void DoMyWindow(int windowID)
        {
            UpdateRect();
            Undo.RecordObject(SKSGlobalRenderSettings.Instance, "SKSGlobalRenderSettings");
            //Header controls

            if (GUI.Button(new Rect(3, 3, 15, 15), "X", menuOptionsStyle))
            {
                Debug.LogWarning("Global Portal Settings menu closed. To restore it, go to Tools/SKStudios/PortalKitPro/Dock Portal Settings");
                SKSGlobalRenderSettings.MenuClosed = true;
                Disable();
            }
            if (!compatabilitymode)
            {
                if (GUI.Button(new Rect(20, 3, 15, 15), SKSGlobalRenderSettings.Minimized ? "□" : "_", menuOptionsStyle))
                {
                    SKSGlobalRenderSettings.Minimized = !SKSGlobalRenderSettings.Minimized;
                    startTime = EditorApplication.timeSinceStartup;
                }
            }

            //if (minimized) return;
            if (time >= 1)
            {
                try
                {
                    scrollPos = GUILayout.BeginScrollView(scrollPos, false, false,
                                                          GUILayout.Width(windowRect.width - 10), GUILayout.Height(windowRect.height - 20));
                }
                catch (System.InvalidCastException) { }
            }

            //Body controls

            if (importantUpdate)
            {
                EditorGUILayout.HelpBox(
                    importantUpdateString != null ? importantUpdateString : @"A new update marked as 'important' has been released. Please, unless you have serious reason not to, backup your project, remove the asset, and reinstall the new version. Make sure to follow the readme guide for updating if you are using VR.",
                    MessageType.Error);
            }
            if (!GlobalPortalSettings.PlayerTeleportable)
            {
                EditorGUILayout.HelpBox(
                    "No PlayerTeleportable set. Seamless passthrough will not function. Add a PlayerTeleportable script to your teleportable player object.",
                    MessageType.Warning);
            }
            else
            {
                GUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Player Teleportable", new GUIStyle()
                {
                    normal = new GUIStyleState()
                    {
                        textColor = Color.white
                    }
                });
                EditorGUILayout.ObjectField(GlobalPortalSettings.PlayerTeleportable.gameObject, typeof(object), true);
                GUILayout.EndHorizontal();
            }

            GUILayout.Space(bumperSize);
            if (ImageSettings = EditorGUILayout.Foldout(ImageSettings, "Image Settings", coloredFoldout))
            {
                EditorGUI.indentLevel = 2;

                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;

                //GUILayout.BeginHorizontal();
                // GUILayout.Space(EditorGUI.indentLevel * 5);
#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 Portals 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 portal cannot raycast to the portal 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 portals while recursing, try turning this option off and see if it helps. If it does, then please" +
                        "make sure that your portals are not inside walls.",
                        MessageType.Warning);
                }

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

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.Clipping = GUILayout.Toggle(SKSGlobalRenderSettings.Clipping,
                                                                    new GUIContent("Enable perfect object clipping", "Enable objects clipping as they enter portals. This is usually desirable."));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.ShouldOverrideMask = GUILayout.Toggle(SKSGlobalRenderSettings.ShouldOverrideMask,
                                                                              "Override Masks on all PortalSpawners");
                GUILayout.EndHorizontal();

                if (SKSGlobalRenderSettings.ShouldOverrideMask)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(EditorGUI.indentLevel * 10);
                    SKSGlobalRenderSettings.Mask =
                        (Texture2D)EditorGUILayout.ObjectField(SKSGlobalRenderSettings.Mask, typeof(Texture2D), false);
                    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."));
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel = 0;
            }



            GUILayout.Space(bumperSize);
            if (InteractionSettings = EditorGUILayout.Foldout(InteractionSettings, "Interaction Settings", coloredFoldout))
            {
                EditorGUI.indentLevel = 2;

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.PhysicsPassthrough = GUILayout.Toggle(SKSGlobalRenderSettings.PhysicsPassthrough,
                                                                              new GUIContent("Enable Physics Passthrough", "Enable collision with objects on the other side of portals"));
                GUILayout.EndHorizontal();


                if (SKSGlobalRenderSettings.PhysicsPassthrough)
                {
                    EditorGUILayout.HelpBox(
                        "This setting enables interaction with objects on the other side of portals. " +
                        "Objects can pass through portals without it, and it is not needed for most games. " +
                        "In extreme cases, it can cause a slight performance hit.",
                        MessageType.Info);
                }

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.PhysStyleB = GUILayout.Toggle(SKSGlobalRenderSettings.PhysStyleB,
                                                                      new GUIContent("Enable Physics Model B (More Accurate)", "Physics Model B maintains relative momentum between portals. This may or may not be desirable when the portals move."));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.NonScaledRenderers = GUILayout.Toggle(SKSGlobalRenderSettings.NonScaledRenderers,
                                                                              new GUIContent("Disable Portal scaling", "Disable portal scaling. This should be enabled if portals are never used to change object's size."));
                GUILayout.EndHorizontal();

                EditorGUI.indentLevel = 0;
            }

            GUILayout.Space(bumperSize);
            if (EditorSettings =
                    EditorGUILayout.Foldout(EditorSettings, "Editor Settings", coloredFoldout))
            {
                EditorGUI.indentLevel = 2;

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.Visualization = GUILayout.Toggle(SKSGlobalRenderSettings.Visualization,
                                                                         new GUIContent("Visualize Portal Connections", "Visualize all portal connections in the scene"));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.Gizmos = GUILayout.Toggle(SKSGlobalRenderSettings.Gizmos, new GUIContent("Draw Portal Gizmos", "Draw Portal Gizmos when selected in the Editor, and when all portals are Visualized."));
                GUILayout.EndHorizontal();


                GUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 10);
                SKSGlobalRenderSettings.Preview = GUILayout.Toggle(SKSGlobalRenderSettings.Preview, new GUIContent("Draw Portal Previews (experimental)", "Draw Portal Previews when selected in the Editor. Experimental, and only works with shallow viewing angles."));
                GUILayout.EndHorizontal();
            }

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

            SKSGlobalRenderSettings.UvFlip = GUILayout.Toggle(SKSGlobalRenderSettings.UvFlip,
                                                              "My portals are upside down!");

            GUILayout.Label("Troubleshooting:");

            string assetName = "PortalKit Pro";
            string path      = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
            if (path == null)
            {
                return;
            }
            path = path.Substring(0, path.LastIndexOf(Path.DirectorySeparatorChar));
            string root    = path.Substring(0, path.LastIndexOf(assetName) + (assetName.Length + 1));
            string PDFPath = root + "README.pdf";

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Click here to open the manual"))
            {
                Application.OpenURL(PDFPath);
            }
            if (GUILayout.Button("Setup"))
            {
                SettingsWindow.Show();
            }
            GUILayout.EndHorizontal();
            if (time >= 1)
            {
                GUILayout.EndScrollView();
            }
        }
        private static void OnScene(SceneView sceneview)
        {
            if (!texturePlaceholder)
            {
                texturePlaceholder = new Texture2D(1, 1);
            }
            if (!hasLoadedWebpage)
            {
                WebClient client = new WebClient();
                client.DownloadStringCompleted += NewVersion;
                client.DownloadStringAsync(new Uri("http://pastebin.com/raw/SeGjnLg5"));
                hasLoadedWebpage = true;
            }


#if SKS_VR
            SKSGlobalRenderSettings.SinglePassStereo = PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass;
#endif

            /*
             * //Visualize portal connections, and easily find portals that are not connected to anything
             * if (SKSGlobalRenderSettings.PortalVisualization)
             * {
             *  foreach (PortalController p in SKSGlobalRenderSettings.PortalControllers)
             *  {
             *      if (!p) continue;
             *      p.OnDrawGizmos();
             *      p.OnDrawGizmosSelected();
             *  }
             * }*/



            if (material == null)
            {
                material = Resources.Load <Material>("UI/blur");
            }

            if (Camera.current.name.Equals("SceneCamera"))
            {
                sceneCamera = Camera.current;
                UIBlurController.AddBlurToCamera(sceneCamera);
            }


            if (skin.button != null)
            {
                menuOptionsStyle = new GUIStyle(skin.button);
            }
            else
            {
                menuOptionsStyle = new GUIStyle();
            }

            if (EditorStyles.foldout != null)
            {
                coloredFoldout = new GUIStyle(EditorStyles.foldout);
            }
            else
            {
                coloredFoldout = new GUIStyle();
            }
            coloredFoldout.normal.textColor    = Color.white;
            coloredFoldout.hover.textColor     = Color.white;
            coloredFoldout.active.textColor    = Color.white;
            coloredFoldout.focused.textColor   = Color.white;
            coloredFoldout.active.textColor    = Color.white;
            coloredFoldout.onActive.textColor  = Color.white;
            coloredFoldout.onFocused.textColor = Color.white;
            coloredFoldout.onHover.textColor   = Color.white;
            coloredFoldout.onNormal.textColor  = Color.white;


            menuOptionsStyle.fontSize  = 10;
            menuOptionsStyle.fontStyle = FontStyle.Bold;
            menuOptionsStyle.wordWrap  = false;
            menuOptionsStyle.clipping  = TextClipping.Overflow;
            Handles.BeginGUI();



            GUI.skin = skin;
            //windowRect = new Rect (Screen.width - size.x - 100, Screen.height - size.y - 190, 200, 200);
            if (SetupUtility.projectInitialized)
            {
                if (SKSGlobalRenderSettings.MenuClosed)
                {
                    Handles.EndGUI();
                    return;
                }
                Graphics.DrawTexture(new Rect(windowRect.x, windowRect.y - 16, windowRect.width, windowRect.height),
                                     texturePlaceholder, material);
                GUI.Window(0, windowRect, DoMyWindow, "Global Portal Settings");
                GUI.skin = null;
                Handles.EndGUI();
            }
            else
            {
                Graphics.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texturePlaceholder, material);
                if (GUILayout.Button("Click here to re-open the import dialog"))
                {
                    SettingsWindow.Show();
                }
            }
        }
示例#13
0
 static void Show()
 {
     SettingsWindow.Show(true, SettingsWindow.ABOUT);
 }
示例#14
0
        static void OnProjectReload()
        {
            // don't bother the user if they're playing
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }

            try
            {
                if (Math.Abs(GlobalPortalSettings.TimeInstalled) < 100)
                {
                    GlobalPortalSettings.TimeInstalled = DateTime.UtcNow.Ticks;
                }
            }
            catch (NullReferenceException)
            {
                return;
            }


            if (projectInitialized)
            {
                if (projectMode == ProjectMode.VR)
                {
                    // check to see if we're currently trying to load vrtk
                    var importingStep = importingVRTK;
                    if (importingStep > 0)
                    {
                        if (importingStep == 2)
                        {
                            // has vrtk been imported successfully?
                            if (VRTKIsMaybeInstalled)
                            {
                                // first reload of vrtk, wait out vrtk adding its own compile symbols
                                importingVRTK = 1;
                            }
                            else
                            {
                                // vrtk probably didn't install/run correctly... maybe detect improper import later
                                importingVRTK = 0;
                                CheckImportFlags();
                            }
                        }
                        else
                        {
                            // second reload of vrtk, check the import flags
                            importingVRTK = 0;
                            CheckImportFlags();
                        }
                    }
                    else
                    {
                        // we're not importing vrtk
                        CheckImportFlags();
                    }
                }
                else
                {
                    CheckImportFlags();
                }

                if (!GlobalPortalSettings.Nagged)
                {
                    var timeSinceInstall = DateTime.UtcNow.Ticks - GlobalPortalSettings.TimeInstalled;

                    if (timeSinceInstall > 5.888e+12D)
                    {
                        GlobalPortalSettings.Nagged = true;
                        timedFeedbackPopupActive    = true;
                        SettingsWindow.Show(true, SettingsWindow.FEEDBACK);
                    }
                }
            }
            else
            {
                // project is uninitialized, show the setup window
                if (!ignoringInitialSetup)
                {
                    EditorUtility.ClearProgressBar();
                    SettingsWindow.Show();
                }
            }
        }
示例#15
0
        private static void OnScene(SceneView sceneview)
        {
            Styles.Init();
            if (!texturePlaceholder)
            {
                texturePlaceholder = new Texture2D(1, 1);
            }
            if (!hasLoadedWebpage)
            {
                _notificationInfo = new NotificationInfo();
                new Thread(GetNotifications).Start();
                hasLoadedWebpage = true;
            }

#if SKS_VR
            SKSGlobalRenderSettings.SinglePassStereo = PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass;
#endif

            if (Camera.current.name.Equals("SceneCamera"))
            {
                sceneCamera = Camera.current;
                UIBlurController.AddBlurToCamera(sceneCamera);
            }



            Handles.BeginGUI();



            GUI.skin = skin;
            //windowRect = new Rect (Screen.width - size.x - 100, Screen.height - size.y - 190, 200, 200);
            if (SetupUtility.projectInitialized)
            {
                if (SKSGlobalRenderSettings.MenuClosed)
                {
                    Handles.EndGUI(); return;
                }
                //Blur
                Graphics.DrawTexture(new Rect(windowRect.x, windowRect.y - 16, windowRect.width, windowRect.height),
                                     texturePlaceholder, Styles.blurMat);
                //Window Border
                //Graphics.DrawTexture(new Rect(windowRect.x, windowRect.y - 16, windowRect.width, windowRect.height),
                //    Styles.borderTex, Styles.borderMat);
                GUI.Window(0, windowRect, DoWindow, "<color=#2599f5>[PKPRO]</color> Notifications:");

                GUI.skin = null;
                Handles.EndGUI();
            }
            else
            {
                Graphics.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texturePlaceholder, Styles.blurMat);
                if (GUILayout.Button("Click here to re-open the import dialog"))
                {
                    SettingsWindow.Show();
                }
#if SKS_DEV
                if (GUILayout.Button(
                        "(Intended for the devs of the asset) Click here to reset the ScriptableObjects for deployment"))
                {
                    SKSGlobalRenderSettings.RecursionNumber = 0;
                    SKSGlobalRenderSettings.AggressiveRecursionOptimization = true;
                    SKSGlobalRenderSettings.AdaptiveQuality      = true;
                    SKSGlobalRenderSettings.CustomSkybox         = true;
                    SKSGlobalRenderSettings.Preview              = false;
                    SKSGlobalRenderSettings.PhysicsPassthrough   = false;
                    SKSGlobalRenderSettings.PhysStyleB           = true;
                    SKSGlobalRenderSettings.Gizmos               = true;
                    SKSGlobalRenderSettings.IgnoredNotifications = new List <int>();
                    SKSGlobalRenderSettings.MenuClosed           = false;
                    SKSGlobalRenderSettings.Minimized            = false;
                    GlobalPortalSettings.Nagged = false;
                }
#endif
            }
        }