コード例 #1
0
 private void OnEnable()
 {
     StylizedWaterEditor.DWP2.CheckInstallation();
     ShaderConfigurator.RefreshShaderFilePaths();
     ShaderConfigurator.GetCurrentFogConfiguration();
     fogConfig = ShaderConfigurator.CurrentFogConfiguration;
 }
コード例 #2
0
        void DrawInstallation()
        {
            //Testing
            //AssetInfo.compatibleVersion = false;
            //AssetInfo.alphaVersion = true;
            //AssetInfo.IS_UPDATED = false;

            Texture2D dot = null;

            if (AssetInfo.compatibleVersion && !AssetInfo.alphaVersion)
            {
                dot = UI.Styles.SmallGreenDot;
            }
            if (AssetInfo.alphaVersion || !AssetInfo.IS_UPDATED)
            {
                dot = UI.Styles.SmallOrangeDot;
            }
            if (!AssetInfo.compatibleVersion)
            {
                dot = UI.Styles.SmallRedDot;
            }

            EditorGUILayout.LabelField(new GUIContent(" Installation", dot), UI.Styles.Tab);

            using (new EditorGUILayout.VerticalScope(UI.Styles.Section))
            {
                if (EditorApplication.isCompiling)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(new GUIContent(" Compiling scripts...", EditorGUIUtility.FindTexture("cs Script Icon")), UI.Styles.Header);
                    EditorGUILayout.Space();
                    return;
                }

                Color defaultColor = GUI.contentColor;

                if (AssetInfo.compatibleVersion == false)
                {
                    UI.DrawNotification("This version of Unity is not supported.", MessageType.Error);
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Please upgrade to at least Unity " + AssetInfo.MIN_UNITY_VERSION);
                    return;
                }

                //Version
                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Version " + AssetInfo.INSTALLED_VERSION);

                    using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
                    {
                        if (AssetInfo.IS_UPDATED)
                        {
                            GUI.contentColor = Color.green;
                            EditorGUILayout.LabelField("Latest");
                            GUI.contentColor = defaultColor;
                        }
                        else
                        {
                            GUI.contentColor = new Color(1f, 0.65f, 0f);
                            EditorGUILayout.LabelField("Outdated", EditorStyles.boldLabel);
                            GUI.contentColor = defaultColor;
                        }

                        GUILayout.Space(-100f);
                        if (GUILayout.Button("View changelog"))
                        {
                            ChangelogWindow.Open();
                        }
                    }
                }

                UI.DrawNotification(!AssetInfo.IS_UPDATED, "Asset can be updated through the Package Manager", "Open", () => AssetInfo.OpenStorePage());

                //Unity version
                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Unity " + AssetInfo.VersionChecking.GetUnityVersion());

                    using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
                    {
                        if (AssetInfo.compatibleVersion && !AssetInfo.alphaVersion)
                        {
                            GUI.contentColor = Color.green;
                            EditorGUILayout.LabelField("Compatible");
                            GUI.contentColor = defaultColor;
                        }
                        if (AssetInfo.alphaVersion)
                        {
                            GUI.contentColor = new Color(1f, 0.65f, 0f);
                            EditorGUILayout.LabelField("Alpha/beta", EditorStyles.boldLabel);
                            GUI.contentColor = defaultColor;
                        }
                    }
                }

                UI.DrawNotification(AssetInfo.alphaVersion, "Only release Unity versions are subject to support and fixes. You may run into issues at own risk.", MessageType.Warning);

                //Mobile only
                if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android || EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
                {
                    using (new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField("Target graphics API");

                        using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
                        {
                            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+");
                                GUI.contentColor = defaultColor;
                            }
                            else
                            {
                                GUI.contentColor = Color.red;
                                EditorGUILayout.LabelField("OpenGL ES 2.0 (Not supported)", EditorStyles.boldLabel);
                                GUI.contentColor = defaultColor;
                            }
                        }
                    }
                }

                EditorGUILayout.Separator();

                EditorGUILayout.LabelField("Third-party integrations", EditorStyles.boldLabel);

                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Dynamic Water Physics 2");

                    using (new EditorGUILayout.HorizontalScope(EditorStyles.textField))
                    {
                        EditorGUILayout.LabelField(StylizedWaterEditor.DWP2.isInstalled ? "Installed" : "Not Installed", GUILayout.MaxWidth((75f)));
                        GUILayout.FlexibleSpace();

                        using (new EditorGUI.DisabledScope(!StylizedWaterEditor.DWP2.isInstalled || StylizedWaterEditor.DWP2.dataProviderUnlocked))
                        {
                            if (GUILayout.Button("Install integration"))
                            {
                                StylizedWaterEditor.DWP2.UnlockDataProvider();
                                StylizedWaterEditor.DWP2.CheckInstallation();
                            }
                        }
                    }
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Fog integration");

                    using (new EditorGUILayout.HorizontalScope())
                    {
                        fogConfig = (ShaderConfigurator.FogConfiguration)EditorGUILayout.EnumPopup(fogConfig);
                        if (GUILayout.Button("Change"))
                        {
                            ShaderConfigurator.SetFogConfiguration(fogConfig);
                            fogConfig = ShaderConfigurator.CurrentFogConfiguration;
                        }
                    }
                }
            }
        }