コード例 #1
0
 public void OnGUI()
 {
     if (this.hasSelection && (Event.current.type == EventType.Repaint))
     {
         CurveEditorSettings.RectangleToolFlags rectangleToolFlags = this.m_CurveEditor.settings.rectangleToolFlags;
         if (rectangleToolFlags != CurveEditorSettings.RectangleToolFlags.NoRectangleTool)
         {
             Color color = GUI.color;
             GUI.color     = Color.white;
             this.m_Layout = this.CalculateLayout();
             if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.FullRectangleTool)
             {
                 GUI.Label(this.m_Layout.selectionLeftRect, GUIContent.none, base.styles.rectangleToolHighlight);
                 GUI.Label(this.m_Layout.selectionTopRect, GUIContent.none, base.styles.rectangleToolHighlight);
                 GUI.Label(this.m_Layout.underlayLeftRect, GUIContent.none, base.styles.rectangleToolHighlight);
                 GUI.Label(this.m_Layout.underlayTopRect, GUIContent.none, base.styles.rectangleToolHighlight);
             }
             this.m_SelectionBox.OnGUI(this.m_Layout.selectionRect);
             this.m_SelectionScaleTop.OnGUI(this.m_Layout.scaleTopRect);
             this.m_SelectionScaleBottom.OnGUI(this.m_Layout.scaleBottomRect);
             this.m_SelectionScaleLeft.OnGUI(this.m_Layout.scaleLeftRect);
             this.m_SelectionScaleRight.OnGUI(this.m_Layout.scaleRightRect);
             GUI.color = color;
         }
     }
 }
        public void OnGUI()
        {
            if (!hasSelection)
            {
                return;
            }

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            m_Layout = CalculateLayout();

            m_SelectionBoxes[0].OnGUI(m_Layout.summaryRect);
            m_SelectionBoxes[1].OnGUI(m_Layout.selectionRect);

            bool showRippleHandles = (rippleTime && !isDragging) || (m_RippleTime && isDragging);

            if (showRippleHandles)
            {
                m_SelectionRippleLeft.OnGUI(m_Layout.scaleLeftRect);
                m_SelectionRippleRight.OnGUI(m_Layout.scaleRightRect);
            }
            else
            {
                m_SelectionScaleLeft.OnGUI(m_Layout.scaleLeftRect);
                m_SelectionScaleRight.OnGUI(m_Layout.scaleRightRect);
            }

            DrawLabels();
        }
コード例 #3
0
        private ToolLayout CalculateLayout()
        {
            ToolLayout      layout          = new ToolLayout();
            Bounds          selectionBounds = this.selectionBounds;
            bool            flag            = !Mathf.Approximately(selectionBounds.size.x, 0f);
            float           x         = base.TimeToPixel(selectionBounds.min.x);
            float           num2      = base.TimeToPixel(selectionBounds.max.x);
            float           y         = 0f;
            float           num4      = 0f;
            bool            flag2     = true;
            float           num5      = 0f;
            List <DopeLine> dopelines = this.m_State.dopelines;

            for (int i = 0; i < dopelines.Count; i++)
            {
                DopeLine line = dopelines[i];
                float    num7 = !line.tallMode ? 16f : 32f;
                if (!line.isMasterDopeline)
                {
                    int count = line.keys.Count;
                    for (int j = 0; j < count; j++)
                    {
                        AnimationWindowKeyframe keyframe = line.keys[j];
                        if (this.m_State.KeyIsSelected(keyframe))
                        {
                            if (flag2)
                            {
                                y     = num5;
                                flag2 = false;
                            }
                            num4 = num5 + num7;
                            break;
                        }
                    }
                }
                num5 += num7;
            }
            layout.summaryRect   = new Rect(x, 0f, num2 - x, 16f);
            layout.selectionRect = new Rect(x, y, num2 - x, num4 - y);
            if (flag)
            {
                layout.scaleLeftRect  = new Rect(layout.selectionRect.xMin - 17f, layout.selectionRect.yMin + 4f, 17f, layout.selectionRect.height - 8f);
                layout.scaleRightRect = new Rect(layout.selectionRect.xMax, layout.selectionRect.yMin + 4f, 17f, layout.selectionRect.height - 8f);
            }
            else
            {
                layout.scaleLeftRect  = g_EmptyRect;
                layout.scaleRightRect = g_EmptyRect;
            }
            if (flag)
            {
                layout.leftLabelAnchor  = new Vector2(layout.summaryRect.xMin - 8f, base.contentRect.yMin + 1f);
                layout.rightLabelAnchor = new Vector2(layout.summaryRect.xMax + 8f, base.contentRect.yMin + 1f);
                return(layout);
            }
            layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.summaryRect.center.x + 8f, base.contentRect.yMin + 1f);
            return(layout);
        }
コード例 #4
0
 private ToolLayout CalculateLayout()
 {
     ToolLayout layout = new ToolLayout();
     Bounds selectionBounds = this.selectionBounds;
     bool flag = !Mathf.Approximately(selectionBounds.size.x, 0f);
     float x = base.TimeToPixel(selectionBounds.min.x);
     float num2 = base.TimeToPixel(selectionBounds.max.x);
     float y = 0f;
     float num4 = 0f;
     bool flag2 = true;
     float num5 = 0f;
     List<DopeLine> dopelines = this.m_State.dopelines;
     for (int i = 0; i < dopelines.Count; i++)
     {
         DopeLine line = dopelines[i];
         float num7 = !line.tallMode ? 16f : 32f;
         if (!line.isMasterDopeline)
         {
             int count = line.keys.Count;
             for (int j = 0; j < count; j++)
             {
                 AnimationWindowKeyframe keyframe = line.keys[j];
                 if (this.m_State.KeyIsSelected(keyframe))
                 {
                     if (flag2)
                     {
                         y = num5;
                         flag2 = false;
                     }
                     num4 = num5 + num7;
                     break;
                 }
             }
         }
         num5 += num7;
     }
     layout.summaryRect = new Rect(x, 0f, num2 - x, 16f);
     layout.selectionRect = new Rect(x, y, num2 - x, num4 - y);
     if (flag)
     {
         layout.scaleLeftRect = new Rect(layout.selectionRect.xMin - 17f, layout.selectionRect.yMin + 4f, 17f, layout.selectionRect.height - 8f);
         layout.scaleRightRect = new Rect(layout.selectionRect.xMax, layout.selectionRect.yMin + 4f, 17f, layout.selectionRect.height - 8f);
     }
     else
     {
         layout.scaleLeftRect = g_EmptyRect;
         layout.scaleRightRect = g_EmptyRect;
     }
     if (flag)
     {
         layout.leftLabelAnchor = new Vector2(layout.summaryRect.xMin - 8f, base.contentRect.yMin + 1f);
         layout.rightLabelAnchor = new Vector2(layout.summaryRect.xMax + 8f, base.contentRect.yMin + 1f);
         return layout;
     }
     layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.summaryRect.center.x + 8f, base.contentRect.yMin + 1f);
     return layout;
 }
コード例 #5
0
        public void OnGUI()
        {
            if (!hasSelection)
            {
                return;
            }

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            RectangleToolFlags flags = m_CurveEditor.settings.rectangleToolFlags;

            if (flags == RectangleToolFlags.NoRectangleTool)
            {
                return;
            }

            Color oldColor = GUI.color;

            GUI.color = Color.white;

            m_Layout = CalculateLayout();

            if (flags == RectangleToolFlags.FullRectangleTool)
            {
                GUI.Label(m_Layout.selectionLeftRect, GUIContent.none, styles.rectangleToolHighlight);
                GUI.Label(m_Layout.selectionTopRect, GUIContent.none, styles.rectangleToolHighlight);
                GUI.Label(m_Layout.underlayLeftRect, GUIContent.none, styles.rectangleToolHighlight);
                GUI.Label(m_Layout.underlayTopRect, GUIContent.none, styles.rectangleToolHighlight);
            }

            m_SelectionBox.OnGUI(m_Layout.selectionRect);

            m_SelectionScaleTop.OnGUI(m_Layout.scaleTopRect);
            m_SelectionScaleBottom.OnGUI(m_Layout.scaleBottomRect);

            bool showRippleHandles = (rippleTime && dragMode == DragMode.None) || (m_RippleTime && dragMode != DragMode.None);

            if (showRippleHandles)
            {
                m_SelectionRippleLeft.OnGUI(m_Layout.scaleLeftRect);
                m_SelectionRippleRight.OnGUI(m_Layout.scaleRightRect);
            }
            else
            {
                m_SelectionScaleLeft.OnGUI(m_Layout.scaleLeftRect);
                m_SelectionScaleRight.OnGUI(m_Layout.scaleRightRect);
            }

            GUI.color = oldColor;
        }
コード例 #6
0
 public void OnGUI()
 {
     if (this.hasSelection && (Event.current.type == EventType.Repaint))
     {
         this.m_Layout = this.CalculateLayout();
         this.m_SelectionBoxes[0].OnGUI(this.m_Layout.summaryRect);
         this.m_SelectionBoxes[1].OnGUI(this.m_Layout.selectionRect);
         this.m_SelectionScaleLeft.OnGUI(this.m_Layout.scaleLeftRect);
         this.m_SelectionScaleRight.OnGUI(this.m_Layout.scaleRightRect);
         this.DrawLabels();
     }
 }
コード例 #7
0
        public void OnGUI()
        {
            if (!hasSelection)
            {
                return;
            }

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            m_Layout = CalculateLayout();

            m_SelectionBoxes[0].OnGUI(m_Layout.summaryRect);
            m_SelectionBoxes[1].OnGUI(m_Layout.selectionRect);

            m_SelectionScaleLeft.OnGUI(m_Layout.scaleLeftRect);
            m_SelectionScaleRight.OnGUI(m_Layout.scaleRightRect);

            DrawLabels();
        }
コード例 #8
0
        private ToolLayout CalculateLayout()
        {
            ToolLayout layout = new ToolLayout();
            bool       flag   = !Mathf.Approximately(this.selectionBounds.size.x, 0f);
            bool       flag2  = !Mathf.Approximately(this.selectionBounds.size.y, 0f);
            float      x      = base.TimeToPixel(this.selectionBounds.min.x);
            float      num2   = base.TimeToPixel(this.selectionBounds.max.x);
            float      y      = base.ValueToPixel(this.selectionBounds.max.y);
            float      num4   = base.ValueToPixel(this.selectionBounds.min.y);

            layout.selectionRect = new Rect(x, y, num2 - x, num4 - y);
            layout.displayHScale = true;
            float width = (layout.selectionRect.width - 15f) - 15f;

            if (width < 14f)
            {
                layout.displayHScale = false;
                width = layout.selectionRect.width;
                if (width < 14f)
                {
                    layout.selectionRect.x     = layout.selectionRect.center.x - 7f;
                    layout.selectionRect.width = 14f;
                    width = 14f;
                }
            }
            if (layout.displayHScale)
            {
                layout.hBarLeftRect  = new Rect(layout.selectionRect.xMin, base.contentRect.yMin, 15f, 13f);
                layout.hBarRect      = new Rect(layout.hBarLeftRect.xMax, base.contentRect.yMin, width, 13f);
                layout.hBarRightRect = new Rect(layout.hBarRect.xMax, base.contentRect.yMin, 15f, 13f);
            }
            else
            {
                layout.hBarRect      = new Rect(layout.selectionRect.xMin, base.contentRect.yMin, width, 13f);
                layout.hBarLeftRect  = new Rect(0f, 0f, 0f, 0f);
                layout.hBarRightRect = new Rect(0f, 0f, 0f, 0f);
            }
            layout.displayVScale = true;
            float height = (layout.selectionRect.height - 15f) - 15f;

            if (height < 15f)
            {
                layout.displayVScale = false;
                height = layout.selectionRect.height;
                if (height < 15f)
                {
                    layout.selectionRect.y      = layout.selectionRect.center.y - 7.5f;
                    layout.selectionRect.height = 15f;
                    height = 15f;
                }
            }
            if (layout.displayVScale)
            {
                layout.vBarTopRect    = new Rect(base.contentRect.xMin, layout.selectionRect.yMin, 13f, 15f);
                layout.vBarRect       = new Rect(base.contentRect.xMin, layout.vBarTopRect.yMax, 13f, height);
                layout.vBarBottomRect = new Rect(base.contentRect.xMin, layout.vBarRect.yMax, 13f, 15f);
            }
            else
            {
                layout.vBarRect       = new Rect(base.contentRect.xMin, layout.selectionRect.yMin, 13f, height);
                layout.vBarTopRect    = g_EmptyRect;
                layout.vBarBottomRect = g_EmptyRect;
            }
            if (flag)
            {
                float num7 = 0.09999999f;
                float num8 = 0.09999999f;
                layout.scaleLeftRect  = new Rect(layout.selectionRect.xMin - 17f, layout.selectionRect.yMin + (layout.selectionRect.height * num7), 17f, layout.selectionRect.height * 0.8f);
                layout.scaleRightRect = new Rect(layout.selectionRect.xMax, layout.selectionRect.yMin + (layout.selectionRect.height * num8), 17f, layout.selectionRect.height * 0.8f);
            }
            else
            {
                layout.scaleLeftRect  = g_EmptyRect;
                layout.scaleRightRect = g_EmptyRect;
            }
            if (flag2)
            {
                float num9  = 0.09999999f;
                float num10 = 0.09999999f;
                layout.scaleTopRect    = new Rect(layout.selectionRect.xMin + (layout.selectionRect.width * num10), layout.selectionRect.yMin - 17f, layout.selectionRect.width * 0.8f, 17f);
                layout.scaleBottomRect = new Rect(layout.selectionRect.xMin + (layout.selectionRect.width * num9), layout.selectionRect.yMax, layout.selectionRect.width * 0.8f, 17f);
            }
            else
            {
                layout.scaleTopRect    = g_EmptyRect;
                layout.scaleBottomRect = g_EmptyRect;
            }
            if (flag)
            {
                layout.leftLabelAnchor  = new Vector2(layout.selectionRect.xMin - 3f, base.contentRect.yMin + 1f);
                layout.rightLabelAnchor = new Vector2(layout.selectionRect.xMax + 3f, base.contentRect.yMin + 1f);
            }
            else
            {
                layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.selectionRect.xMax + 3f, base.contentRect.yMin + 1f);
            }
            if (flag2)
            {
                layout.bottomLabelAnchor = new Vector2(base.contentRect.xMin + 1f, layout.selectionRect.yMax + 2f);
                layout.topLabelAnchor    = new Vector2(base.contentRect.xMin + 1f, layout.selectionRect.yMin - 2f);
            }
            else
            {
                layout.bottomLabelAnchor = layout.topLabelAnchor = new Vector2(base.contentRect.xMin + 1f, layout.selectionRect.yMin - 2f);
            }
            layout.selectionLeftRect = new Rect(base.contentRect.xMin + 13f, layout.selectionRect.yMin, layout.selectionRect.xMin - 13f, layout.selectionRect.height);
            layout.selectionTopRect  = new Rect(layout.selectionRect.xMin, base.contentRect.yMin + 13f, layout.selectionRect.width, layout.selectionRect.yMin - 13f);
            layout.underlayTopRect   = new Rect(base.contentRect.xMin, base.contentRect.yMin, base.contentRect.width, 13f);
            layout.underlayLeftRect  = new Rect(base.contentRect.xMin, base.contentRect.yMin + 13f, 13f, base.contentRect.height - 13f);
            return(layout);
        }
        private ToolLayout CalculateLayout()
        {
            ToolLayout layout = new ToolLayout();

            Bounds bounds = selectionBounds;

            bool canScaleX = !Mathf.Approximately(bounds.size.x, 0f);

            float xMin = TimeToPixel(bounds.min.x);
            float xMax = TimeToPixel(bounds.max.x);

            float yMin = 0f, yMax = 0f;
            bool  firstKey = true;

            float heightCumul = 0f;

            List <DopeLine> dopelines = m_State.dopelines;

            for (int i = 0; i < dopelines.Count; ++i)
            {
                DopeLine dopeline = dopelines[i];

                float dopelineHeight = (dopeline.tallMode ? AnimationWindowHierarchyGUI.k_DopeSheetRowHeightTall : AnimationWindowHierarchyGUI.k_DopeSheetRowHeight);

                if (!dopeline.isMasterDopeline)
                {
                    int length = dopeline.keys.Count;
                    for (int j = 0; j < length; j++)
                    {
                        AnimationWindowKeyframe keyframe = dopeline.keys[j];
                        if (m_State.KeyIsSelected(keyframe))
                        {
                            if (firstKey)
                            {
                                yMin     = heightCumul;
                                firstKey = false;
                            }

                            yMax = heightCumul + dopelineHeight;
                            break;
                        }
                    }
                }

                heightCumul += dopelineHeight;
            }

            layout.summaryRect   = new Rect(xMin, 0f, xMax - xMin, AnimationWindowHierarchyGUI.k_DopeSheetRowHeight);
            layout.selectionRect = new Rect(xMin, yMin, xMax - xMin, yMax - yMin);

            // Scale handles.
            if (canScaleX)
            {
                layout.scaleLeftRect  = new Rect(layout.selectionRect.xMin - kScaleLeftMarginHorizontal - kScaleLeftWidth, layout.selectionRect.yMin + kScaleLeftMarginVertical, kScaleLeftWidth, layout.selectionRect.height - kScaleLeftMarginVertical * 2);
                layout.scaleRightRect = new Rect(layout.selectionRect.xMax + kScaleRightMarginHorizontal, layout.selectionRect.yMin + kScaleRightMarginVertical, kScaleRightWidth, layout.selectionRect.height - kScaleRightMarginVertical * 2);
            }
            else
            {
                layout.scaleLeftRect  = g_EmptyRect;
                layout.scaleRightRect = g_EmptyRect;
            }

            if (canScaleX)
            {
                layout.leftLabelAnchor  = new Vector2(layout.summaryRect.xMin - kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical);
                layout.rightLabelAnchor = new Vector2(layout.summaryRect.xMax + kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical);
            }
            else
            {
                layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.summaryRect.center.x + kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical);
            }

            return(layout);
        }
コード例 #10
0
        private ToolLayout CalculateLayout()
        {
            ToolLayout layout = new ToolLayout();

            bool canScaleX = !Mathf.Approximately(selectionBounds.size.x, 0f);
            bool canScaleY = !Mathf.Approximately(selectionBounds.size.y, 0f);

            float xMin = TimeToPixel(selectionBounds.min.x);
            float xMax = TimeToPixel(selectionBounds.max.x);

            float yMin = ValueToPixel(selectionBounds.max.y);
            float yMax = ValueToPixel(selectionBounds.min.y);

            layout.selectionRect = new Rect(xMin, yMin, xMax - xMin, yMax - yMin);

            // Horizontal layout
            layout.displayHScale = true;
            float dragHorizWidth = layout.selectionRect.width - kHBarLeftWidth - kHBarRightWidth;

            if (dragHorizWidth < kHBarMinWidth)
            {
                layout.displayHScale = false;

                dragHorizWidth = layout.selectionRect.width;
                if (dragHorizWidth < kHBarMinWidth)
                {
                    layout.selectionRect.x     = layout.selectionRect.center.x - kHBarMinWidth * 0.5f;
                    layout.selectionRect.width = kHBarMinWidth;

                    dragHorizWidth = kHBarMinWidth;
                }
            }

            if (layout.displayHScale)
            {
                layout.hBarLeftRect  = new Rect(layout.selectionRect.xMin, contentRect.yMin, kHBarLeftWidth, kHBarLeftHeight);
                layout.hBarRect      = new Rect(layout.hBarLeftRect.xMax, contentRect.yMin, dragHorizWidth, kHBarHeight);
                layout.hBarRightRect = new Rect(layout.hBarRect.xMax, contentRect.yMin, kHBarLeftWidth, kHBarRightHeight);
            }
            else
            {
                layout.hBarRect = new Rect(layout.selectionRect.xMin, contentRect.yMin, dragHorizWidth, kHBarHeight);

                layout.hBarLeftRect  = new Rect(0f, 0f, 0f, 0f);
                layout.hBarRightRect = new Rect(0f, 0f, 0f, 0f);
            }

            // Vertical layout
            layout.displayVScale = true;
            float dragVertHeight = layout.selectionRect.height - kVBarBottomHeight - kVBarTopHeight;

            if (dragVertHeight < kVBarMinHeight)
            {
                layout.displayVScale = false;

                dragVertHeight = layout.selectionRect.height;
                if (dragVertHeight < kVBarMinHeight)
                {
                    layout.selectionRect.y      = layout.selectionRect.center.y - kVBarMinHeight * 0.5f;
                    layout.selectionRect.height = kVBarMinHeight;

                    dragVertHeight = kVBarMinHeight;
                }
            }

            if (layout.displayVScale)
            {
                layout.vBarTopRect    = new Rect(contentRect.xMin, layout.selectionRect.yMin, kVBarTopWidth, kVBarTopHeight);
                layout.vBarRect       = new Rect(contentRect.xMin, layout.vBarTopRect.yMax, kVBarWidth, dragVertHeight);
                layout.vBarBottomRect = new Rect(contentRect.xMin, layout.vBarRect.yMax, kVBarBottomWidth, kVBarBottomHeight);
            }
            else
            {
                layout.vBarRect = new Rect(contentRect.xMin, layout.selectionRect.yMin, kVBarWidth, dragVertHeight);

                layout.vBarTopRect    = g_EmptyRect;
                layout.vBarBottomRect = g_EmptyRect;
            }

            // Scale handles.
            if (canScaleX)
            {
                float leftRatio  = (1.0f - kScaleLeftRatio) * 0.5f;
                float rightRatio = (1.0f - kScaleRightRatio) * 0.5f;

                layout.scaleLeftRect  = new Rect(layout.selectionRect.xMin - kScaleLeftMarginHorizontal - kScaleLeftWidth, layout.selectionRect.yMin + layout.selectionRect.height * leftRatio, kScaleLeftWidth, layout.selectionRect.height * kScaleLeftRatio);
                layout.scaleRightRect = new Rect(layout.selectionRect.xMax + kScaleRightMarginHorizontal, layout.selectionRect.yMin + layout.selectionRect.height * rightRatio, kScaleRightWidth, layout.selectionRect.height * kScaleRightRatio);
            }
            else
            {
                layout.scaleLeftRect  = g_EmptyRect;
                layout.scaleRightRect = g_EmptyRect;
            }

            if (canScaleY)
            {
                float bottomRatio = (1.0f - kScaleBottomRatio) * 0.5f;
                float topRatio    = (1.0f - kScaleTopRatio) * 0.5f;

                layout.scaleTopRect    = new Rect(layout.selectionRect.xMin + layout.selectionRect.width * topRatio, layout.selectionRect.yMin - kScaleTopMarginVertical - kScaleTopHeight, layout.selectionRect.width * kScaleTopRatio, kScaleTopHeight);
                layout.scaleBottomRect = new Rect(layout.selectionRect.xMin + layout.selectionRect.width * bottomRatio, layout.selectionRect.yMax + kScaleBottomMarginVertical, layout.selectionRect.width * kScaleBottomRatio, kScaleBottomHeight);
            }
            else
            {
                layout.scaleTopRect    = g_EmptyRect;
                layout.scaleBottomRect = g_EmptyRect;
            }

            // Labels.
            if (canScaleX)
            {
                layout.leftLabelAnchor  = new Vector2(layout.selectionRect.xMin - kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical);
                layout.rightLabelAnchor = new Vector2(layout.selectionRect.xMax + kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical);
            }
            else
            {
                layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.selectionRect.xMax + kHLabelMarginHorizontal, contentRect.yMin + kHLabelMarginVertical);
            }

            if (canScaleY)
            {
                layout.bottomLabelAnchor = new Vector2(contentRect.xMin + kVLabelMarginHorizontal, layout.selectionRect.yMax + kVLabelMarginVertical);
                layout.topLabelAnchor    = new Vector2(contentRect.xMin + kVLabelMarginHorizontal, layout.selectionRect.yMin - kVLabelMarginVertical);
            }
            else
            {
                layout.bottomLabelAnchor = layout.topLabelAnchor = new Vector2(contentRect.xMin + kVLabelMarginHorizontal, layout.selectionRect.yMin - kVLabelMarginVertical);
            }

            // Extra ui.
            layout.selectionLeftRect = new Rect(contentRect.xMin + kVBarWidth, layout.selectionRect.yMin, layout.selectionRect.xMin - kVBarWidth, layout.selectionRect.height);
            layout.selectionTopRect  = new Rect(layout.selectionRect.xMin, contentRect.yMin + kHBarHeight, layout.selectionRect.width, layout.selectionRect.yMin - kHBarHeight);

            layout.underlayTopRect  = new Rect(contentRect.xMin, contentRect.yMin, contentRect.width, kHBarHeight);
            layout.underlayLeftRect = new Rect(contentRect.xMin, contentRect.yMin + kHBarHeight, kVBarWidth, contentRect.height - kHBarHeight);

            return(layout);
        }
コード例 #11
0
 private ToolLayout CalculateLayout()
 {
     ToolLayout layout = new ToolLayout();
     bool flag = !Mathf.Approximately(this.selectionBounds.size.x, 0f);
     bool flag2 = !Mathf.Approximately(this.selectionBounds.size.y, 0f);
     float x = base.TimeToPixel(this.selectionBounds.min.x);
     float num2 = base.TimeToPixel(this.selectionBounds.max.x);
     float y = base.ValueToPixel(this.selectionBounds.max.y);
     float num4 = base.ValueToPixel(this.selectionBounds.min.y);
     layout.selectionRect = new Rect(x, y, num2 - x, num4 - y);
     layout.displayHScale = true;
     float width = (layout.selectionRect.width - 15f) - 15f;
     if (width < 14f)
     {
         layout.displayHScale = false;
         width = layout.selectionRect.width;
         if (width < 14f)
         {
             layout.selectionRect.x = layout.selectionRect.center.x - 7f;
             layout.selectionRect.width = 14f;
             width = 14f;
         }
     }
     if (layout.displayHScale)
     {
         layout.hBarLeftRect = new Rect(layout.selectionRect.xMin, base.contentRect.yMin, 15f, 13f);
         layout.hBarRect = new Rect(layout.hBarLeftRect.xMax, base.contentRect.yMin, width, 13f);
         layout.hBarRightRect = new Rect(layout.hBarRect.xMax, base.contentRect.yMin, 15f, 13f);
     }
     else
     {
         layout.hBarRect = new Rect(layout.selectionRect.xMin, base.contentRect.yMin, width, 13f);
         layout.hBarLeftRect = new Rect(0f, 0f, 0f, 0f);
         layout.hBarRightRect = new Rect(0f, 0f, 0f, 0f);
     }
     layout.displayVScale = true;
     float height = (layout.selectionRect.height - 15f) - 15f;
     if (height < 15f)
     {
         layout.displayVScale = false;
         height = layout.selectionRect.height;
         if (height < 15f)
         {
             layout.selectionRect.y = layout.selectionRect.center.y - 7.5f;
             layout.selectionRect.height = 15f;
             height = 15f;
         }
     }
     if (layout.displayVScale)
     {
         layout.vBarTopRect = new Rect(base.contentRect.xMin, layout.selectionRect.yMin, 13f, 15f);
         layout.vBarRect = new Rect(base.contentRect.xMin, layout.vBarTopRect.yMax, 13f, height);
         layout.vBarBottomRect = new Rect(base.contentRect.xMin, layout.vBarRect.yMax, 13f, 15f);
     }
     else
     {
         layout.vBarRect = new Rect(base.contentRect.xMin, layout.selectionRect.yMin, 13f, height);
         layout.vBarTopRect = g_EmptyRect;
         layout.vBarBottomRect = g_EmptyRect;
     }
     if (flag)
     {
         float num7 = 0.09999999f;
         float num8 = 0.09999999f;
         layout.scaleLeftRect = new Rect(layout.selectionRect.xMin - 17f, layout.selectionRect.yMin + (layout.selectionRect.height * num7), 17f, layout.selectionRect.height * 0.8f);
         layout.scaleRightRect = new Rect(layout.selectionRect.xMax, layout.selectionRect.yMin + (layout.selectionRect.height * num8), 17f, layout.selectionRect.height * 0.8f);
     }
     else
     {
         layout.scaleLeftRect = g_EmptyRect;
         layout.scaleRightRect = g_EmptyRect;
     }
     if (flag2)
     {
         float num9 = 0.09999999f;
         float num10 = 0.09999999f;
         layout.scaleTopRect = new Rect(layout.selectionRect.xMin + (layout.selectionRect.width * num10), layout.selectionRect.yMin - 17f, layout.selectionRect.width * 0.8f, 17f);
         layout.scaleBottomRect = new Rect(layout.selectionRect.xMin + (layout.selectionRect.width * num9), layout.selectionRect.yMax, layout.selectionRect.width * 0.8f, 17f);
     }
     else
     {
         layout.scaleTopRect = g_EmptyRect;
         layout.scaleBottomRect = g_EmptyRect;
     }
     if (flag)
     {
         layout.leftLabelAnchor = new Vector2(layout.selectionRect.xMin - 3f, base.contentRect.yMin + 1f);
         layout.rightLabelAnchor = new Vector2(layout.selectionRect.xMax + 3f, base.contentRect.yMin + 1f);
     }
     else
     {
         layout.leftLabelAnchor = layout.rightLabelAnchor = new Vector2(layout.selectionRect.xMax + 3f, base.contentRect.yMin + 1f);
     }
     if (flag2)
     {
         layout.bottomLabelAnchor = new Vector2(base.contentRect.xMin + 1f, layout.selectionRect.yMax + 2f);
         layout.topLabelAnchor = new Vector2(base.contentRect.xMin + 1f, layout.selectionRect.yMin - 2f);
     }
     else
     {
         layout.bottomLabelAnchor = layout.topLabelAnchor = new Vector2(base.contentRect.xMin + 1f, layout.selectionRect.yMin - 2f);
     }
     layout.selectionLeftRect = new Rect(base.contentRect.xMin + 13f, layout.selectionRect.yMin, layout.selectionRect.xMin - 13f, layout.selectionRect.height);
     layout.selectionTopRect = new Rect(layout.selectionRect.xMin, base.contentRect.yMin + 13f, layout.selectionRect.width, layout.selectionRect.yMin - 13f);
     layout.underlayTopRect = new Rect(base.contentRect.xMin, base.contentRect.yMin, base.contentRect.width, 13f);
     layout.underlayLeftRect = new Rect(base.contentRect.xMin, base.contentRect.yMin + 13f, 13f, base.contentRect.height - 13f);
     return layout;
 }
コード例 #12
0
 public void OnGUI()
 {
     if (this.hasSelection && (Event.current.type == EventType.Repaint))
     {
         CurveEditorSettings.RectangleToolFlags rectangleToolFlags = this.m_CurveEditor.settings.rectangleToolFlags;
         if (rectangleToolFlags != CurveEditorSettings.RectangleToolFlags.NoRectangleTool)
         {
             Color color = GUI.color;
             GUI.color = Color.white;
             this.m_Layout = this.CalculateLayout();
             if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.FullRectangleTool)
             {
                 GUI.Label(this.m_Layout.selectionLeftRect, GUIContent.none, base.styles.rectangleToolHighlight);
                 GUI.Label(this.m_Layout.selectionTopRect, GUIContent.none, base.styles.rectangleToolHighlight);
                 GUI.Label(this.m_Layout.underlayLeftRect, GUIContent.none, base.styles.rectangleToolHighlight);
                 GUI.Label(this.m_Layout.underlayTopRect, GUIContent.none, base.styles.rectangleToolHighlight);
             }
             this.m_SelectionBox.OnGUI(this.m_Layout.selectionRect);
             this.m_SelectionScaleTop.OnGUI(this.m_Layout.scaleTopRect);
             this.m_SelectionScaleBottom.OnGUI(this.m_Layout.scaleBottomRect);
             this.m_SelectionScaleLeft.OnGUI(this.m_Layout.scaleLeftRect);
             this.m_SelectionScaleRight.OnGUI(this.m_Layout.scaleRightRect);
             GUI.color = color;
         }
     }
 }
コード例 #13
0
 public void OnGUI()
 {
     if (this.hasSelection && (Event.current.type == EventType.Repaint))
     {
         this.m_Layout = this.CalculateLayout();
         this.m_SelectionBoxes[0].OnGUI(this.m_Layout.summaryRect);
         this.m_SelectionBoxes[1].OnGUI(this.m_Layout.selectionRect);
         this.m_SelectionScaleLeft.OnGUI(this.m_Layout.scaleLeftRect);
         this.m_SelectionScaleRight.OnGUI(this.m_Layout.scaleRightRect);
         this.DrawLabels();
     }
 }