Exemplo n.º 1
0
        public void OnGUI(Event current, GUISkin skin, int indentPixels)
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(indentPixels);
                using (new GUI.ColorBlock(Color.Lerp(UnityEngine.GUI.color, Color.red, 0.1f)))
                    foreach (var button in m_buttons)
                    {
                        bool pressed = button.Update(Event.current, skin);
                        if (pressed)
                        {
                            Selected = button.State.DropdownEnabled ? button : null;
                        }
                    }
            }
            GUILayout.EndHorizontal();

            foreach (var button in m_buttons)
            {
                button.UpdateDropdown(current, skin);
            }
        }
Exemplo n.º 2
0
        public void OnGUI(Event current)
        {
            var rect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(false));

            rect.width = 36.0f;
            foreach (var button in m_buttons)
            {
                rect.xMin = rect.x;
                rect.xMax = rect.x + rect.width;
                bool pressed = button.Update(rect,
                                             button == m_buttons.First(),
                                             button == m_buttons.Last());
                if (pressed)
                {
                    Selected = button.State.DropdownEnabled ? button : null;
                }
                rect.x += rect.width;
            }

            foreach (var button in m_buttons)
            {
                button.UpdateDropdown(current);
            }
        }