コード例 #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;
         }
     }
 }
コード例 #2
0
 private void DrawLabels()
 {
     if (this.dragMode != CurveEditorRectangleTool.DragMode.None)
     {
         CurveEditorSettings.RectangleToolFlags rectangleToolFlags = this.m_CurveEditor.settings.rectangleToolFlags;
         bool flag  = !Mathf.Approximately(this.selectionBounds.size.x, 0f);
         bool flag2 = !Mathf.Approximately(this.selectionBounds.size.y, 0f);
         if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.FullRectangleTool)
         {
             if ((this.dragMode & CurveEditorRectangleTool.DragMode.MoveScaleHorizontal) != CurveEditorRectangleTool.DragMode.None)
             {
                 if (flag)
                 {
                     GUIContent content  = new GUIContent(string.Format("{0}", this.m_CurveEditor.FormatTime(this.selectionBounds.min.x, this.m_CurveEditor.invSnap, this.m_CurveEditor.timeFormat)));
                     GUIContent content2 = new GUIContent(string.Format("{0}", this.m_CurveEditor.FormatTime(this.selectionBounds.max.x, this.m_CurveEditor.invSnap, this.m_CurveEditor.timeFormat)));
                     Vector2    vector   = base.styles.dragLabel.CalcSize(content);
                     Vector2    vector2  = base.styles.dragLabel.CalcSize(content2);
                     EditorGUI.DoDropShadowLabel(new Rect(this.m_Layout.leftLabelAnchor.x - vector.x, this.m_Layout.leftLabelAnchor.y, vector.x, vector.y), content, base.styles.dragLabel, 0.3f);
                     EditorGUI.DoDropShadowLabel(new Rect(this.m_Layout.rightLabelAnchor.x, this.m_Layout.rightLabelAnchor.y, vector2.x, vector2.y), content2, base.styles.dragLabel, 0.3f);
                 }
                 else
                 {
                     GUIContent content3 = new GUIContent(string.Format("{0}", this.m_CurveEditor.FormatTime(this.selectionBounds.center.x, this.m_CurveEditor.invSnap, this.m_CurveEditor.timeFormat)));
                     Vector2    vector3  = base.styles.dragLabel.CalcSize(content3);
                     EditorGUI.DoDropShadowLabel(new Rect(this.m_Layout.leftLabelAnchor.x, this.m_Layout.leftLabelAnchor.y, vector3.x, vector3.y), content3, base.styles.dragLabel, 0.3f);
                 }
             }
             if ((this.dragMode & CurveEditorRectangleTool.DragMode.MoveScaleVertical) != CurveEditorRectangleTool.DragMode.None)
             {
                 if (flag2)
                 {
                     GUIContent content4 = new GUIContent(string.Format("{0}", this.m_CurveEditor.FormatValue(this.selectionBounds.min.y)));
                     GUIContent content5 = new GUIContent(string.Format("{0}", this.m_CurveEditor.FormatValue(this.selectionBounds.max.y)));
                     Vector2    vector4  = base.styles.dragLabel.CalcSize(content4);
                     Vector2    vector5  = base.styles.dragLabel.CalcSize(content5);
                     EditorGUI.DoDropShadowLabel(new Rect(this.m_Layout.bottomLabelAnchor.x, this.m_Layout.bottomLabelAnchor.y, vector4.x, vector4.y), content4, base.styles.dragLabel, 0.3f);
                     EditorGUI.DoDropShadowLabel(new Rect(this.m_Layout.topLabelAnchor.x, this.m_Layout.topLabelAnchor.y - vector5.y, vector5.x, vector5.y), content5, base.styles.dragLabel, 0.3f);
                 }
                 else
                 {
                     GUIContent content6 = new GUIContent(string.Format("{0}", this.m_CurveEditor.FormatValue(this.selectionBounds.center.y)));
                     Vector2    vector6  = base.styles.dragLabel.CalcSize(content6);
                     EditorGUI.DoDropShadowLabel(new Rect(this.m_Layout.topLabelAnchor.x, this.m_Layout.topLabelAnchor.y - vector6.y, vector6.x, vector6.y), content6, base.styles.dragLabel, 0.3f);
                 }
             }
         }
         else if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.MiniRectangleTool)
         {
             if ((this.dragMode & CurveEditorRectangleTool.DragMode.MoveBothAxis) != CurveEditorRectangleTool.DragMode.None)
             {
                 Vector2    vector7  = (!flag && !flag2) ? this.selectionBounds.center : new Vector2(base.PixelToTime(Event.current.mousePosition.x, this.frameRate), base.PixelToValue(Event.current.mousePosition.y));
                 Vector2    vector8  = new Vector2(base.TimeToPixel(vector7.x), base.ValueToPixel(vector7.y));
                 GUIContent content7 = new GUIContent(string.Format("{0}, {1}", this.m_CurveEditor.FormatTime(vector7.x, this.m_CurveEditor.invSnap, this.m_CurveEditor.timeFormat), this.m_CurveEditor.FormatValue(vector7.y)));
                 Vector2    vector9  = base.styles.dragLabel.CalcSize(content7);
                 EditorGUI.DoDropShadowLabel(new Rect(vector8.x, vector8.y - vector9.y, vector9.x, vector9.y), content7, base.styles.dragLabel, 0.3f);
             }
         }
     }
 }
コード例 #3
0
 public void HandleOverlayEvents()
 {
     base.HandleClutchKeys();
     CurveEditorSettings.RectangleToolFlags rectangleToolFlags = this.m_CurveEditor.settings.rectangleToolFlags;
     if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.FullRectangleTool)
     {
         this.m_VBarBottom.HandleEvents();
         this.m_VBarTop.HandleEvents();
         this.m_VBar.HandleEvents();
         this.m_HBarLeft.HandleEvents();
         this.m_HBarRight.HandleEvents();
         this.m_HBar.HandleEvents();
     }
 }
コード例 #4
0
 public void OverlayOnGUI()
 {
     if (this.hasSelection)
     {
         if (Event.current.type == EventType.Repaint)
         {
             Color color = GUI.color;
             CurveEditorSettings.RectangleToolFlags rectangleToolFlags = this.m_CurveEditor.settings.rectangleToolFlags;
             if (rectangleToolFlags == CurveEditorSettings.RectangleToolFlags.FullRectangleTool)
             {
                 GUI.color = Color.white;
                 this.m_HBar.OnGUI(this.m_Layout.hBarRect);
                 this.m_HBarLeft.OnGUI(this.m_Layout.hBarLeftRect);
                 this.m_HBarRight.OnGUI(this.m_Layout.hBarRightRect);
                 this.m_VBar.OnGUI(this.m_Layout.vBarRect);
                 this.m_VBarBottom.OnGUI(this.m_Layout.vBarBottomRect);
                 this.m_VBarTop.OnGUI(this.m_Layout.vBarTopRect);
             }
             this.DrawLabels();
             GUI.color = color;
         }
     }
 }