Exemplo n.º 1
0
        private void OnGUI()
        {
            if (INSTALLATION_TAB < 0)
            {
                INSTALLATION_TAB = 0;
            }

            if (EditorApplication.isCompiling)
            {
                this.ShowNotification(new GUIContent(" Compiling...", EditorGUIUtility.IconContent("cs Script Icon").image));
            }
            else
            {
                this.RemoveNotification();
            }

            //Header
            {
                if (SCPE_GUI.HeaderImg)
                {
                    Rect headerRect = new Rect(0, -5, width, SCPE_GUI.HeaderImg.height);
                    UnityEngine.GUI.DrawTexture(headerRect, SCPE_GUI.HeaderImg, ScaleMode.ScaleToFit);
                    GUILayout.Space(SCPE_GUI.HeaderImg.height - 10);
                }
                else
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("<b><size=24>SC Post Effects</size></b>\n<size=16>For Post Processing Stack</size>", SCPE_GUI.Header);
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    using (new EditorGUI.DisabledGroupScope((int)INSTALLATION_TAB != 0))
                    {
                        GUILayout.Toggle((INSTALLATION_TAB == 0), new GUIContent("Pre-install"), SCPE_GUI.ProgressTab);
                    }
                    using (new EditorGUI.DisabledGroupScope((int)INSTALLATION_TAB != 1))
                    {
                        GUILayout.Toggle(((int)INSTALLATION_TAB == 1), "Installation", SCPE_GUI.ProgressTab);
                    }
                    using (new EditorGUI.DisabledGroupScope((int)INSTALLATION_TAB != 2))
                    {
                        GUILayout.Toggle(((int)INSTALLATION_TAB == 2), "Finish", SCPE_GUI.ProgressTab);
                    }
                }
            }

            GUILayout.Space(5f);

            //Body
            Rect oRect    = EditorGUILayout.GetControlRect();
            Rect bodyRect = new Rect(oRect.x + 10, 115, width - 20, height);

            GUILayout.BeginArea(bodyRect);
            {
                switch (INSTALLATION_TAB)
                {
                case (Tab)0:
                    StartScreen();
                    break;

                case (Tab)1:
                    InstallScreen();
                    break;

                case (Tab)2:
                    FinalScreen();
                    break;
                }
            }
            GUILayout.EndArea();

            //Progress buttons

            Rect errorRect = new Rect(225, height - 95, width * 2.2f, 25);

            GUILayout.BeginArea(errorRect);

            if (hasError)
            {
                SCPE_GUI.DrawStatusString("Correct any errors to continue", SCPE_GUI.Status.Error, false);
            }
            GUILayout.EndArea();

            Rect buttonRect = new Rect(width / 2, height - 70, width / 2.2f, height - 25);

            GUILayout.BeginArea(buttonRect);

            using (new EditorGUILayout.HorizontalScope())
            {
                //EditorGUILayout.PrefixLabel(" ");

                //Disable buttons when installing
                using (new EditorGUI.DisabledGroupScope(Installer.CURRENTLY_INSTALLING))
                {
                    //Disable back button on first screen
                    using (new EditorGUI.DisabledGroupScope(INSTALLATION_TAB == Tab.Start))
                    {
                        if (GUILayout.Button("<size=16>‹</size> Back", SCPE_GUI.ProgressButtonLeft))
                        {
                            INSTALLATION_TAB--;
                        }
                    }
                    using (new EditorGUI.DisabledGroupScope(hasError))
                    {
                        string btnLabel = string.Empty;
                        if (INSTALLATION_TAB == Tab.Start)
                        {
                            btnLabel = "Next <size=16>›</size>";
                        }
                        if (INSTALLATION_TAB == Tab.Install)
                        {
                            btnLabel = "Install <size=16>›</size>";
                        }
                        if (INSTALLATION_TAB == Tab.Install && Installer.IS_INSTALLED)
                        {
                            btnLabel = "Finish";
                        }
                        if (INSTALLATION_TAB == Tab.Finish)
                        {
                            btnLabel = "Close";
                        }

                        if (GUILayout.Button(btnLabel, SCPE_GUI.ProgressButtonRight))
                        {
                            if (INSTALLATION_TAB == Tab.Start)
                            {
                                INSTALLATION_TAB = Tab.Install;
                                return;
                            }

                            //When pressing install again
                            if (INSTALLATION_TAB == Tab.Install)
                            {
                                if (Installer.IS_INSTALLED == false)
                                {
                                    Installer.Install();
                                }
                                else
                                {
                                    INSTALLATION_TAB = Tab.Finish;
                                }

                                return;
                            }

                            if (INSTALLATION_TAB == Tab.Finish)
                            {
                                Installer.PostInstall();
                                this.Close();
                            }
                        }
                    }
                }
            }
            GUILayout.EndArea();

            //Footer
            buttonRect = new Rect(width / 4, height - 30, width / 2.1f, height - 25);
            GUILayout.BeginArea(buttonRect);
            EditorGUILayout.LabelField("- Staggart Creations -", SCPE_GUI.Footer);
            GUILayout.EndArea();
        }
Exemplo n.º 2
0
 private static void Init()
 {
     Installer.Initialize();
     INSTALLATION_TAB = Tab.Start;
 }