Esempio n. 1
0
        private void CreateNewCanvas()
        {
            MenuItemsExtention.CreatePanel(null);

            WooPanelsEngine.Instance.Rebuild();
            selectedRoot = allRootNodes.Count;
        }
Esempio n. 2
0
        private void DrawCreatePanelButton(string buttonName, int level, Transform parent, bool drawInSimulate = false)
        {
            if ((simulate || !createMode) && !drawInSimulate)
            {
                return;
            }

            var prevBackgroundColor = GUI.backgroundColor;

            GUILayout.Space(2.0f);
            GUILayout.BeginHorizontal();

            GUILayout.Space(45.0f + level * 30.0f);

            if (GUILayout.Button(buttonName, GUILayout.Width(150), GUILayout.Height(30)))
            {
                var panel = MenuItemsExtention.CreatePanel(parent);
                WooPanelsEngine.Instance.Rebuild();
                WooPanelsEngine.Instance.Open(panel, true, false);
            }

            GUILayout.EndHorizontal();
        }
Esempio n. 3
0
        private void DrawSecondaryToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            var selectedPanel = WooPanelsEngine.Instance.GetSelectedPanel(Selection.activeTransform);

            var buttonText    = "Open (Shift+W)";
            var buttonEnabled = false;

            if (selectedPanel != null)
            {
                if (selectedPanel.IsOpened() || selectedPanel.IsOpening())
                {
                    buttonText    = "Close (Shift+W)";
                    buttonEnabled = true;
                }
                else
                {
                    if (WooPanelsEngine.Instance.CanBeOpened(selectedPanel))
                    {
                        buttonEnabled = true;
                    }
                    else
                    {
                        buttonEnabled = false;
                    }
                }
            }

            if (!buttonEnabled)
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button(buttonText, EditorStyles.toolbarButton))
            {
                MenuItemsExtention.TriggerSelectedPanel();
            }
            if (!buttonEnabled)
            {
                GUI.enabled = true;
            }

            var closeAllEnabled = panelNodes.Count(panel => !panel.Value.IsClosed) > 0;

            if (!closeAllEnabled)
            {
                GUI.enabled = false;
            }
                        #if UNITY_EDITOR_OSX
            if (GUILayout.Button("Close All (Cmd+Shift+W)", EditorStyles.toolbarButton))
                        #else
            if (GUILayout.Button("Close All (Ctrl+Shift+W)", EditorStyles.toolbarButton))
                        #endif
            {
                MenuItemsExtention.CloseAllPanels();
            }
            if (!closeAllEnabled)
            {
                GUI.enabled = true;
            }

            GUILayout.FlexibleSpace();
            if (!Application.isPlaying)
            {
                if (panelNodes.Count(panel => panel.Value.Panel != null && !panel.Value.Panel.gameObject.activeInHierarchy) > 0)
                {
                    if (GUILayout.Button("Enable All", EditorStyles.toolbarButton))
                    {
                        WooPanelsEngine.Instance.EnableAll();
                    }
                }
                if (panelNodes.Count(panel => panel.Value.Panel != null && panel.Value.Panel.gameObject.activeInHierarchy) == panelNodes.Count)
                {
                    if (GUILayout.Button("Disable All", EditorStyles.toolbarButton))
                    {
                        WooPanelsEngine.Instance.DisableAll();
                    }
                }
            }

            GUILayout.EndHorizontal();
        }