private DopeSheetEditorRectangleTool.ToolLayout CalculateLayout() { DopeSheetEditorRectangleTool.ToolLayout result = default(DopeSheetEditorRectangleTool.ToolLayout); Bounds selectionBounds = this.selectionBounds; bool flag = !Mathf.Approximately(selectionBounds.size.x, 0f); float num = base.TimeToPixel(selectionBounds.min.x); float num2 = base.TimeToPixel(selectionBounds.max.x); float num3 = 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 dopeLine = dopelines[i]; float num6 = (!dopeLine.tallMode) ? 16f : 32f; if (!dopeLine.isMasterDopeline) { int count = dopeLine.keys.Count; for (int j = 0; j < count; j++) { AnimationWindowKeyframe keyframe = dopeLine.keys[j]; if (this.m_State.KeyIsSelected(keyframe)) { if (flag2) { num3 = num5; flag2 = false; } num4 = num5 + num6; break; } } } num5 += num6; } result.summaryRect = new Rect(num, 0f, num2 - num, 16f); result.selectionRect = new Rect(num, num3, num2 - num, num4 - num3); if (flag) { result.scaleLeftRect = new Rect(result.selectionRect.xMin - 17f, result.selectionRect.yMin + 4f, 17f, result.selectionRect.height - 8f); result.scaleRightRect = new Rect(result.selectionRect.xMax, result.selectionRect.yMin + 4f, 17f, result.selectionRect.height - 8f); } else { result.scaleLeftRect = DopeSheetEditorRectangleTool.g_EmptyRect; result.scaleRightRect = DopeSheetEditorRectangleTool.g_EmptyRect; } if (flag) { result.leftLabelAnchor = new Vector2(result.summaryRect.xMin - 8f, base.contentRect.yMin + 1f); result.rightLabelAnchor = new Vector2(result.summaryRect.xMax + 8f, base.contentRect.yMin + 1f); } else { result.leftLabelAnchor = (result.rightLabelAnchor = new Vector2(result.summaryRect.center.x + 8f, base.contentRect.yMin + 1f)); } return(result); }
public void OnGUI() { if (this.hasSelection) { if (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(); } } }