UnityEditor.AudioMixerColorCodes.GetColor C# (CSharp) Method

GetColor() public static method

public static GetColor ( int index ) : Color
index int
return Color
        public static Color GetColor(int index)
        {
            Color[] colors = GetColors();
            if ((index >= 0) && (index < colors.Length))
            {
                return colors[index];
            }
            Debug.LogError("Invalid color code index: " + index);
            return Color.white;
        }

Usage 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();
        }
All Usage Examples Of UnityEditor.AudioMixerColorCodes::GetColor