UnityEditor.AudioMixerDrawUtils.DrawGradientRect C# (CSharp) Method

DrawGradientRect() public static method

public static DrawGradientRect ( Rect r, Color c1, Color c2 ) : void
r UnityEngine.Rect
c1 Color
c2 Color
return void
        public static void DrawGradientRect(Rect r, Color c1, Color c2)
        {
            if (Event.current.type == EventType.Repaint)
            {
                HandleUtility.ApplyWireMaterial();
                GL.Begin(7);
                GL.Color(new Color(c1.r, c1.g, c1.b, c1.a * GetAlpha()));
                Vertex(r.x, r.y);
                Vertex(r.x + r.width, r.y);
                GL.Color(new Color(c2.r, c2.g, c2.b, c2.a * GetAlpha()));
                Vertex(r.x + r.width, r.y + r.height);
                Vertex(r.x, r.y + r.height);
                GL.End();
            }
        }

Usage Example

            public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
            {
                if (!this.isDragging)
                {
                    return;
                }
                Event     current        = Event.current;
                EventType typeForControl = current.GetTypeForControl(this.m_DragControlID);

                switch (typeForControl)
                {
                case EventType.MouseUp:
                    current.Use();
                    if (this.m_MovingSrcIndex == -1)
                    {
                        break;
                    }
                    if (this.m_MovingDstIndex != -1 && this.m_MovingEffectAllowed)
                    {
                        List <AudioMixerEffectController> list = ((IEnumerable <AudioMixerEffectController>)group.effects).ToList <AudioMixerEffectController>();
                        if (AudioMixerController.MoveEffect(ref list, this.m_MovingSrcIndex, ref list, this.m_MovingDstIndex))
                        {
                            group.effects = list.ToArray();
                        }
                    }
                    this.m_MovingSrcIndex             = -1;
                    this.m_MovingDstIndex             = -1;
                    controller.m_HighlightEffectIndex = -1;
                    if (GUIUtility.hotControl == this.m_DragControlID)
                    {
                        GUIUtility.hotControl = 0;
                    }
                    EditorGUIUtility.SetWantsMouseJumping(0);
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    GUIUtility.ExitGUI();
                    break;

                case EventType.MouseDrag:
                    this.m_MovingPos = current.mousePosition.y;
                    current.Use();
                    break;

                default:
                    if (typeForControl != EventType.Repaint || (double)this.m_DragHighlightPos <= 0.0)
                    {
                        break;
                    }
                    float width  = totalRect.width;
                    Color color1 = !this.m_MovingEffectAllowed ? this.kMoveColorLoDisallowed : this.kMoveColorLoAllowed;
                    Color color2 = !this.m_MovingEffectAllowed ? this.kMoveColorHiDisallowed : this.kMoveColorHiAllowed;
                    Color color3 = !this.m_MovingEffectAllowed ? this.kMoveColorBorderDisallowed : this.kMoveColorBorderAllowed;
                    AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - 15f, width, 15f), color1, color2);
                    AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos, width, 15f), color2, color1);
                    AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - this.m_DragHighlightHeight / 2f, width, this.m_DragHighlightHeight), color3, color3);
                    break;
                }
            }
All Usage Examples Of UnityEditor.AudioMixerDrawUtils::DrawGradientRect