Ejemplo n.º 1
0
        /// <summary>
        /// Draws the module in the header. The default behaviour is to draw a simple tab button.
        /// </summary>
        /// <param name="focusedModuleID">ID of the focused module.</param>
        public virtual Rect     DrawMenu(Rect r, int focusedModuleID)
        {
            GeneralSettings settings = HQ.Settings.Get <GeneralSettings>();

            Utility.content.text = this.name;
            r.width = settings.MenuButtonStyle.CalcSize(Utility.content).x;

            EditorGUI.BeginChangeCheck();
            NGEditorGUILayout.OutlineToggle(r, this.name, this.id == focusedModuleID, settings.MenuButtonStyle);
            if (EditorGUI.EndChangeCheck() == true)
            {
                if (Event.current.button == 1 ||
                    Event.current.control == true)
                {
                    ConsoleUtility.OpenModuleInWindow(this.console, this, Event.current.control);
                }
                else if (this.id != focusedModuleID)
                {
                    this.Focus();
                }
            }

            r.x += r.width;

            return(r);
        }