コード例 #1
0
        void OnGUI()
        {
            if (s_EditorToolbar != null && s_EditorToolbar.isIconMode != s_IsIconGui.value)
            {
                IconModeChanged();
            }

            if (m_CommandStyle == null)
            {
                m_CommandStyle = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("Command");
            }

            Event e = Event.current;

            switch (e.type)
            {
            case EventType.ContextClick:
                var menu = new GenericMenu();
                AddItemsToMenu(menu);
                menu.ShowAsContext();
                break;

#if !SHORTCUT_MANAGER
            case EventType.KeyDown:
                if (s_Shortcuts.value.Any(x => x.Matches(e.keyCode, e.modifiers)))
                {
                    e.Use();
                }
                break;

            case EventType.KeyUp:
                ShortcutCheck(e);
                break;
#else
            case EventType.KeyUp:
                if (e.keyCode == KeyCode.Escape)
                {
                    selectMode = SelectMode.Object;
                    e.Use();
                }
                break;
#endif
            }

            if (s_EditorToolbar != null)
            {
                s_EditorToolbar.OnGUI();
            }
            else
            {
                try
                {
                    InitGUI();
                }
                catch (System.Exception exception)
                {
                    Debug.LogWarning(string.Format("Failed initializing ProBuilder Toolbar:\n{0}", exception.ToString()));
                }
            }
        }
コード例 #2
0
        void OnGUI()
        {
            if (m_Toolbar.isIconMode != s_IsIconGui.value)
            {
                IconModeChanged();
            }

            if (m_CommandStyle == null)
            {
                m_CommandStyle = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("Command");
            }

            Event e = Event.current;

            switch (e.type)
            {
            case EventType.ContextClick:
                var menu = new GenericMenu();
                AddItemsToMenu(menu);
                menu.ShowAsContext();
                break;

            case EventType.KeyUp:
                if (e.keyCode == KeyCode.Escape)
                {
                    selectMode = SelectMode.Object;
                    e.Use();
                }
                break;
            }

            m_Toolbar.OnGUI();
        }