Exemplo n.º 1
0
        private void OnGUI()
        {
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
            {
                Close();
            }
            Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f);

            rect.height = Editor_Shortcuts.BUTTON_HEIGHT;
            rect.y     += Editor_Shortcuts.BUTTON_PADDING;

            //Init special case
            if (GUI.Button(rect, "Init"))
            {
                Editor_Shortcuts.LoadInitScene();
                Close();
            }

            //Just some space between init and game scenes
            rect.y += Editor_Shortcuts.BUTTON_HEIGHT + Editor_Shortcuts.BUTTON_PADDING;
            //And the natural space for the next button
            rect.y += Editor_Shortcuts.BUTTON_HEIGHT + Editor_Shortcuts.BUTTON_PADDING;

            if (_names == null)
            {
                return;
            }

            for (int i = 0; i < _names.Length; i++)
            {
                if (GUI.Button(rect, _names[i]))
                {
                    PinouSceneManagerData.PinouSceneManager.E_LoadScene(_paths[i]);
                    Close();
                }

                rect.y += Editor_Shortcuts.BUTTON_HEIGHT + Editor_Shortcuts.BUTTON_PADDING;
            }
        }
Exemplo n.º 2
0
        private void OnGUI()
        {
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
            {
                Close();
            }
            Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f);

            rect.height = Editor_Shortcuts.BUTTON_HEIGHT;
            rect.y     += Editor_Shortcuts.BUTTON_PADDING;

            if (_data == null)
            {
                return;
            }

            for (int i = 0; i < _data.Shortcuts.Length; i++)
            {
                if (_data.Shortcuts[i].path == null || _data.Shortcuts[i].path.Length == 0)//Title
                {
                    TextAnchor old = GUI.skin.label.alignment;
                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                    GUI.Label(rect, _data.Shortcuts[i].name);
                    GUI.skin.label.alignment = old;
                }
                else
                {
                    rect.x = 0f;
                    if (GUI.Button(rect, _data.Shortcuts[i].name))
                    {
                        Editor_Shortcuts.OpenFolder(_data.Shortcuts[i].path);
                        Close();
                    }
                }

                rect.y += Editor_Shortcuts.BUTTON_HEIGHT + Editor_Shortcuts.BUTTON_PADDING;
            }
        }