GetColor() public static method

public static GetColor ( int index ) : Color
index int
return Color
Example #1
0
        public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused)
        {
            Event current = Event.current;

            this.DoNodeGUI(rowRect, row, node, selected, focused, false);
            if ((UnityEngine.Object) this.m_Controller == (UnityEngine.Object)null)
            {
                return;
            }
            AudioMixerTreeViewNode audioNode = node as AudioMixerTreeViewNode;

            if (audioNode == null)
            {
                return;
            }
            bool  visible        = this.m_Controller.CurrentViewContainsGroup(audioNode.group.groupID);
            float num            = 3f;
            Rect  position       = new Rect(rowRect.x + num, rowRect.y, 16f, 16f);
            Rect  rect1          = new Rect(position.x + 1f, position.y + 1f, position.width - 2f, position.height - 2f);
            int   userColorIndex = audioNode.group.userColorIndex;

            if (userColorIndex > 0)
            {
                EditorGUI.DrawRect(new Rect(rowRect.x, rect1.y, 2f, rect1.height), AudioMixerColorCodes.GetColor(userColorIndex));
            }
            EditorGUI.DrawRect(rect1, new Color(0.5f, 0.5f, 0.5f, 0.2f));
            if (visible)
            {
                GUI.DrawTexture(position, (Texture)this.k_VisibleON);
            }
            Rect rect2 = new Rect(2f, rowRect.y, rowRect.height, rowRect.height);

            if (current.type == EventType.MouseUp && current.button == 0 && (rect2.Contains(current.mousePosition) && this.NodeWasToggled != null))
            {
                this.NodeWasToggled(audioNode, !visible);
            }
            if (current.type != EventType.ContextClick || !position.Contains(current.mousePosition))
            {
                return;
            }
            this.OpenGroupContextMenu(audioNode, visible);
            current.Use();
        }
Example #2
0
        public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused)
        {
            Event current = Event.current;
            Rect  rect    = new Rect(0f, (float)row * this.k_LineHeight + this.k_TopRowMargin, rowWidth, this.k_LineHeight);

            this.DoNodeGUI(rect, node, selected, focused, false);
            if (this.m_Controller == null)
            {
                return(rect);
            }
            AudioMixerTreeViewNode audioMixerTreeViewNode = node as AudioMixerTreeViewNode;

            if (audioMixerTreeViewNode != null)
            {
                bool  flag           = this.m_Controller.CurrentViewContainsGroup(audioMixerTreeViewNode.group.groupID);
                float num            = 3f;
                Rect  position       = new Rect(rect.x + num, rect.y, 16f, 16f);
                Rect  rect2          = new Rect(position.x + 1f, position.y + 1f, position.width - 2f, position.height - 2f);
                int   userColorIndex = audioMixerTreeViewNode.group.userColorIndex;
                if (userColorIndex > 0)
                {
                    EditorGUI.DrawRect(new Rect(rect.x, rect2.y, 2f, rect2.height), AudioMixerColorCodes.GetColor(userColorIndex));
                }
                EditorGUI.DrawRect(rect2, new Color(0.5f, 0.5f, 0.5f, 0.2f));
                if (flag)
                {
                    GUI.DrawTexture(position, this.k_VisibleON);
                }
                Rect rect3 = new Rect(2f, rect.y, rect.height, rect.height);
                if (current.type == EventType.MouseDown && current.button == 0 && rect3.Contains(current.mousePosition) && this.NodeWasToggled != null)
                {
                    this.NodeWasToggled(audioMixerTreeViewNode, !flag);
                }
                if (current.type == EventType.ContextClick && position.Contains(current.mousePosition))
                {
                    this.OpenGroupContextMenu(audioMixerTreeViewNode, flag);
                    current.Use();
                }
            }
            return(rect);
        }
        public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused)
        {
            Event current = Event.current;
            Rect  rect    = new Rect(0f, (row * base.k_LineHeight) + base.k_TopRowMargin, rowWidth, base.k_LineHeight);

            this.DoNodeGUI(rect, node, selected, focused, false);
            if (this.m_Controller != null)
            {
                AudioMixerTreeViewNode node2 = node as AudioMixerTreeViewNode;
                if (node2 == null)
                {
                    return(rect);
                }
                bool  visible        = this.m_Controller.CurrentViewContainsGroup(node2.group.groupID);
                float num2           = 3f;
                Rect  position       = new Rect(rect.x + num2, rect.y, 16f, 16f);
                Rect  rect3          = new Rect(position.x + 1f, position.y + 1f, position.width - 2f, position.height - 2f);
                int   userColorIndex = node2.group.userColorIndex;
                if (userColorIndex > 0)
                {
                    EditorGUI.DrawRect(new Rect(rect.x, rect3.y, 2f, rect3.height), AudioMixerColorCodes.GetColor(userColorIndex));
                }
                EditorGUI.DrawRect(rect3, new Color(0.5f, 0.5f, 0.5f, 0.2f));
                if (visible)
                {
                    GUI.DrawTexture(position, this.k_VisibleON);
                }
                Rect rect4 = new Rect(2f, rect.y, rect.height, rect.height);
                if (((current.type == EventType.MouseUp) && (current.button == 0)) && (rect4.Contains(current.mousePosition) && (this.NodeWasToggled != null)))
                {
                    this.NodeWasToggled(node2, !visible);
                }
                if ((current.type == EventType.ContextClick) && position.Contains(current.mousePosition))
                {
                    this.OpenGroupContextMenu(node2, visible);
                    current.Use();
                }
            }
            return(rect);
        }
Example #4
0
        override public void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused)
        {
            Event evt = Event.current;

            DoItemGUI(rowRect, row, node, selected, focused, false);

            if (m_Controller == null)
            {
                return;
            }

            var audioNode = node as AudioMixerTreeViewNode;

            if (audioNode != null)
            {
                bool        oldSelected = m_Controller.CurrentViewContainsGroup(audioNode.group.groupID);
                const float kIconSize   = 16f;

                float xMargin    = 3f;
                Rect  iconRect   = new Rect(rowRect.x + xMargin, rowRect.y, kIconSize, kIconSize);
                Rect  iconBgRect = new Rect(iconRect.x + 1, iconRect.y + 1, iconRect.width - 2, iconRect.height - 2);

                int colorIndex = audioNode.group.userColorIndex;
                if (colorIndex > 0)
                {
                    EditorGUI.DrawRect(new Rect(rowRect.x, iconBgRect.y, 2, iconBgRect.height), AudioMixerColorCodes.GetColor(colorIndex));
                }

                if (oldSelected)
                {
                    GUI.DrawTexture(iconRect, k_VisibleON.image);
                }
                else
                {
                    GUI.DrawTexture(iconRect, k_VisibleOFF.image);
                }

                Rect toggleRect = new Rect(2, rowRect.y, rowRect.height, rowRect.height);
                if (evt.type == EventType.MouseUp && evt.button == 0 && toggleRect.Contains(evt.mousePosition))
                {
                    if (NodeWasToggled != null)
                    {
                        NodeWasToggled(audioNode, !oldSelected);
                    }
                }

                if (evt.type == EventType.ContextClick && iconRect.Contains(evt.mousePosition))
                {
                    OpenGroupContextMenu(audioNode, oldSelected);
                    evt.Use();
                }
            }
        }