示例#1
0
        private void OnGUI()
        {
            //Can't use SessionState in 5.4, so needs to check every frame
            StylizedWaterCore.CheckUnityVersion();

            DrawHeader();

            GUILayout.Space(5);
            DrawTabs();
            GUILayout.Space(5);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            if (isTabInstallation)
            {
                DrawInstallation();
            }

            if (isTabDocumentation)
            {
                DrawDocumentation();
            }

            if (isTabSupport)
            {
                DrawSupport();
            }

            //DrawActionButtons();

            EditorGUILayout.EndVertical();

            DrawFooter();
        }
示例#2
0
            static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
            {
                foreach (string str in importedAssets)
                {
                    if (str.Contains("StylizedWaterCore.cs"))
                    {
                        StylizedWaterCore.CheckUnityVersion();

                        if (!compatibleVersion || untestedVersion)
                        {
                            SWS_Window.ShowWindow();
                        }
                    }
                }
            }
示例#3
0
        public static void ShowWindow()
        {
            EditorWindow editorWindow = EditorWindow.GetWindow <SWS_Window>(true, "Help", true);

            editorWindow.titleContent             = new GUIContent("Help");
            editorWindow.autoRepaintOnSceneChange = true;

            //Open somewhat in the center of the screen
            editorWindow.position = new Rect((Screen.width) / 2f, (Screen.height) / 2f, (width * 2), height);

            //Fixed size
            editorWindow.maxSize = new Vector2(width, height);
            editorWindow.minSize = new Vector2(width, 200);

            //Init();
            //StylizedWaterCore.VersionChecking.CheckForUpdate();

            StylizedWaterCore.CheckUnityVersion();

            editorWindow.Show();
        }
示例#4
0
        void DrawInstallation()
        {
            SetWindowHeight(300f);

            if (EditorApplication.isCompiling)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(new GUIContent(" Compiling scripts...", EditorGUIUtility.FindTexture("cs Script Icon")), Header);

                EditorGUILayout.Space();
                return;
            }

            if (StylizedWaterCore.compatibleVersion == false && StylizedWaterCore.untestedVersion == false)
            {
                GUI.contentColor = Color.red;
                EditorGUILayout.LabelField("This version of Unity is not supported.", EditorStyles.boldLabel);
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Please upgrade to at least Unity " + StylizedWaterCore.MIN_UNITY_VERSION);
                return;
            }

            //Folder
            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Unity version");

            Color defaultColor = GUI.contentColor;

            if (StylizedWaterCore.compatibleVersion)
            {
                GUI.contentColor = Color.green;
                EditorGUILayout.LabelField("Compatible");
                GUI.contentColor = defaultColor;
            }
            else if (StylizedWaterCore.untestedVersion)
            {
                GUI.contentColor = new Color(1f, 0.65f, 0f);
                EditorGUILayout.LabelField("Untested", EditorStyles.boldLabel);
                GUI.contentColor = defaultColor;
            }

            EditorGUILayout.EndHorizontal();
            if (StylizedWaterCore.untestedVersion)
            {
                EditorGUILayout.LabelField("The current Unity version has not been tested yet, or compatibility is being worked on. You may run into errors. \n\n" +
                                           "Please view the forum thread for more information", EditorStyles.helpBox);
                EditorGUILayout.Space();
            }

            if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android ||
                EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
            {
                //PPSv2
                EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
#if !UNITY_2018_1_OR_NEWER
                EditorGUILayout.LabelField("Target graphics API");
#else
                EditorGUILayout.LabelField("Post Processing");
#endif

                if (PlayerSettings.GetGraphicsAPIs(BuildTarget.Android)[0] != UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2 || PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS)[0] != UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2)
                {
                    GUI.contentColor = Color.green;
                    EditorGUILayout.LabelField("OpenGL ES 3.0 or better");
                    GUI.contentColor = defaultColor;
                }
                else
                {
                    GUI.contentColor = Color.red;
                    EditorGUILayout.LabelField("OpenGL ES 2.0", EditorStyles.boldLabel);
                    GUI.contentColor = defaultColor;
                }
                EditorGUILayout.EndHorizontal();
            }

            //Version
            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Package version");

            defaultColor = GUI.contentColor;
            if (StylizedWaterCore.IsUpToDate)
            {
                GUI.contentColor = Color.green;
                EditorGUILayout.LabelField("Up-to-date");
                GUI.contentColor = defaultColor;
            }
            else
            {
                GUILayout.FlexibleSpace();
                GUI.contentColor = new Color(1f, 0.65f, 0f);
                EditorGUILayout.LabelField("Outdated", EditorStyles.boldLabel);

                GUI.contentColor = defaultColor;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("");
            if (!StylizedWaterCore.IsUpToDate)
            {
                if (GUILayout.Button(new GUIContent("Update package"), UpdateText))
                {
                    StylizedWaterCore.OpenStorePage();
                }
            }
            else
            {
                if (GUI.Button(EditorGUILayout.GetControlRect(), "Check for update"))
                {
                    StylizedWaterCore.VersionChecking.GetLatestVersionPopup();
                }
            }
            EditorGUILayout.EndHorizontal();
        }