DrawGradientRect() public static method

public static DrawGradientRect ( Rect r, Color c1, Color c2 ) : void
r UnityEngine.Rect
c1 Color
c2 Color
return void
            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;
                }
            }
 public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
 {
     if (this.isDragging)
     {
         Event     current        = Event.current;
         EventType typeForControl = current.GetTypeForControl(this.m_DragControlID);
         if (typeForControl != EventType.MouseDrag)
         {
             if (typeForControl != EventType.MouseUp)
             {
                 if (typeForControl == EventType.Repaint)
                 {
                     if (this.m_DragHighlightPos > 0f)
                     {
                         float width  = totalRect.width;
                         Color color  = (!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), color, color2);
                         AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos, width, 15f), color2, color);
                         AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - this.m_DragHighlightHeight / 2f, width, this.m_DragHighlightHeight), color3, color3);
                     }
                 }
             }
             else
             {
                 current.Use();
                 if (this.m_MovingSrcIndex != -1)
                 {
                     if (this.m_MovingDstIndex != -1 && this.m_MovingEffectAllowed)
                     {
                         List <AudioMixerEffectController> list = 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();
                 }
             }
         }
         else
         {
             this.m_MovingPos = current.mousePosition.y;
             current.Use();
         }
     }
 }
            // Called once per OnGUI
            public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
            {
                // Early out if we are not dragging
                if (!isDragging)
                {
                    return;
                }

                Event       evt        = Event.current;
                const float kMoveRange = 15;

                switch (evt.GetTypeForControl(m_DragControlID))
                {
                case EventType.MouseDrag:
                    m_MovingPos = evt.mousePosition.y;
                    evt.Use();
                    break;

                case EventType.MouseUp:
                    evt.Use();
                    if (m_MovingSrcIndex != -1)
                    {
                        if (m_MovingDstIndex != -1 && m_MovingEffectAllowed)
                        {
                            var effects = group.effects.ToList();
                            if (AudioMixerController.MoveEffect(ref effects, m_MovingSrcIndex, ref effects, m_MovingDstIndex))
                            {
                                group.effects = effects.ToArray();
                            }
                        }
                        m_MovingSrcIndex = -1;
                        m_MovingDstIndex = -1;
                        controller.m_HighlightEffectIndex = -1;
                        if (GUIUtility.hotControl == m_DragControlID)
                        {
                            GUIUtility.hotControl = 0;
                        }
                        EditorGUIUtility.SetWantsMouseJumping(0);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                        EditorGUIUtility.ExitGUI();     // Exit because we changed order of effects
                    }
                    break;

                case EventType.Repaint:
                    if (m_DragHighlightPos > 0.0f)
                    {
                        float w               = totalRect.width;
                        Color moveColorLo     = (m_MovingEffectAllowed) ? kMoveColorLoAllowed : kMoveColorLoDisallowed;
                        Color moveColorHi     = (m_MovingEffectAllowed) ? kMoveColorHiAllowed : kMoveColorHiDisallowed;
                        Color moveColorBorder = (m_MovingEffectAllowed) ? kMoveColorBorderAllowed : kMoveColorBorderDisallowed;
                        AudioMixerDrawUtils.DrawGradientRect(new Rect(m_MovingRect.x, m_DragHighlightPos - kMoveRange, w, kMoveRange), moveColorLo, moveColorHi);
                        AudioMixerDrawUtils.DrawGradientRect(new Rect(m_MovingRect.x, m_DragHighlightPos, w, kMoveRange), moveColorHi, moveColorLo);
                        AudioMixerDrawUtils.DrawGradientRect(new Rect(m_MovingRect.x, m_DragHighlightPos - m_DragHighlightHeight / 2, w, m_DragHighlightHeight), moveColorBorder, moveColorBorder);
                    }
                    break;
                }
            }