Exemplo n.º 1
0
            public override void    OnGUI(Rect r)
            {
                ScenesSettings settings = HQ.Settings.Get <ScenesSettings>();

                for (int i = 0; i < settings.profiles.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        using (BgColorContentRestorer.Get(i == this.animOn && this.anim.af.isAnimating, Color.Lerp(GUI.contentColor, OptionPopup.HighlightColor, this.anim.Value)))
                        {
                            if (GUILayout.Button("Save In", GeneralStyles.ToolbarButton, GUILayoutOptionPool.ExpandWidthFalse) == true)
                            {
                                this.animOn = i;
                                this.anim.Start();

                                settings.profiles[i].Save();
                                HQ.InvalidateSettings();
                                this.window.Repaint();
                            }

                            EditorGUI.BeginChangeCheck();
                            string name = EditorGUILayout.TextField(settings.profiles[i].name);
                            if (EditorGUI.EndChangeCheck() == true)
                            {
                                settings.profiles[i].name = name;
                                HQ.InvalidateSettings();
                            }
                        }

                        if (GUILayout.Button("X", GeneralStyles.ToolbarCloseButton, GUILayoutOptionPool.ExpandWidthFalse) == true)
                        {
                            settings.profiles.RemoveAt(i);
                            HQ.InvalidateSettings();
                            return;
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                if (GUILayout.Button("Add") == true &&
                    this.window.CheckMaxBuildSceneProfiles(settings.profiles.Count) == true)
                {
                    Profile p = new Profile()
                    {
                        name = "New"
                    };

                    p.Save();

                    settings.profiles.Add(p);

                    r.height = (settings.profiles.Count + 1) * 19F;
                    this.editorWindow.position = r;
                }
            }
Exemplo n.º 2
0
        protected virtual void  OnGUI()
        {
            if (this.maxSize == this.minSize)
            {
                if (GUI.Button(new Rect(this.position.width - 20F, 0F, 20F, 20F), "X") == true)
                {
                    this.Close();
                }
            }

            FreeLicenseOverlay.First(this, NGAssemblyInfo.Name + " Pro", NGScenesWindow.FreeAdContent);

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(5F);

                GUILayout.BeginVertical(GUILayoutOptionPool.MinWidth(200F));
                {
                    GUILayout.Label("Recent Scenes:", GeneralStyles.Title1);
                    this.recentListDrawer.OnGUI(GUILayoutUtility.GetRect(0F, 100F));

                    GUILayout.Label("All Scenes:", GeneralStyles.Title1);
                    this.allListDrawer.OnGUI(GUILayoutUtility.GetRect(0F, 0F, GUILayoutOptionPool.ExpandHeightTrue));
                }
                GUILayout.EndVertical();

                GUILayout.Space(2F);

                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Build Scenes:", GeneralStyles.Title1);

                        if (HQ.Settings != null)
                        {
                            Utility.content.text = "Load profile";
                            Rect r = GUILayoutUtility.GetRect(Utility.content, "ToolbarDropDown");
                            if (GUI.Button(r, Utility.content, "ToolbarDropDown") == true)
                            {
                                GenericMenu    menu     = new GenericMenu();
                                ScenesSettings settings = HQ.Settings.Get <ScenesSettings>();

                                if (settings.profiles.Count > 0)
                                {
                                    for (int i = 0; i < settings.profiles.Count; i++)
                                    {
                                        menu.AddItem(new GUIContent((i + 1) + " - " + settings.profiles[i].name + " (" + settings.profiles[i].scenes.Count + ")"), false, this.LoadProfile, i);
                                    }
                                }
                                else
                                {
                                    menu.AddItem(new GUIContent("No profile available."), false, null);
                                }

                                menu.DropDown(r);
                            }

                            Utility.content.text = "☰";
                            r = GUILayoutUtility.GetRect(Utility.content, "GV Gizmo DropDown", GUILayoutOptionPool.ExpandWidthFalse);
                            if (GUI.Button(r, Utility.content, "GV Gizmo DropDown") == true)
                            {
                                PopupWindow.Show(r, new OptionPopup(this));
                            }

                            if (this.maxSize == this.minSize)
                            {
                                GUILayout.Space(20F);
                            }
                        }
                    }
                    GUILayout.EndHorizontal();

                    this.enabledScenesCounter  = 0;
                    this.buildListDrawer.array = EditorBuildSettings.scenes;
                    this.buildListDrawer.OnGUI(GUILayoutUtility.GetRect(0F, 0F, GUILayoutOptionPool.ExpandHeightTrue));

                    GUILayout.Space(5F);
                }
                GUILayout.EndVertical();

                GUILayout.Space(5F);
            }
            GUILayout.EndHorizontal();

            if (Event.current.type == EventType.MouseDown)
            {
                if (this.lastClick + Constants.DoubleClickTime > EditorApplication.timeSinceStartup)
                {
                    this.Close();
                }
                this.lastClick = EditorApplication.timeSinceStartup;
                Event.current.Use();
            }

            FreeLicenseOverlay.Last(NGAssemblyInfo.Name + " Pro");
        }