public bool DoTimeline(Rect timeRect) { bool result = false; this.Init(); this.m_Rect = timeRect; float num = this.m_TimeArea.PixelToTime(timeRect.xMin, timeRect); float num2 = this.m_TimeArea.PixelToTime(timeRect.xMax, timeRect); if (!Mathf.Approximately(num, this.StartTime)) { this.StartTime = num; GUI.changed = true; } if (!Mathf.Approximately(num2, this.StopTime)) { this.StopTime = num2; GUI.changed = true; } this.Time = Mathf.Max(this.Time, 0f); if (Event.current.type == EventType.Repaint) { this.m_TimeArea.rect = timeRect; } this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); GUI.BeginGroup(timeRect); Event current = Event.current; Rect rect = new Rect(0f, 0f, timeRect.width, timeRect.height); Rect position = new Rect(0f, 0f, timeRect.width, 18f); Rect position2 = new Rect(0f, 18f, timeRect.width, 132f); float num3 = this.m_TimeArea.TimeToPixel(this.SrcStartTime, rect); float num4 = this.m_TimeArea.TimeToPixel(this.SrcStopTime, rect); float num5 = this.m_TimeArea.TimeToPixel(this.DstStartTime, rect) + this.m_DstDragOffset; float num6 = this.m_TimeArea.TimeToPixel(this.DstStopTime, rect) + this.m_DstDragOffset; float num7 = this.m_TimeArea.TimeToPixel(this.TransitionStartTime, rect) + this.m_LeftThumbOffset; float num8 = this.m_TimeArea.TimeToPixel(this.TransitionStopTime, rect) + this.m_RightThumbOffset; float num9 = this.m_TimeArea.TimeToPixel(this.Time, rect); Rect rect2 = new Rect(num3, 85f, num4 - num3, 32f); Rect rect3 = new Rect(num5, 117f, num6 - num5, 32f); Rect position3 = new Rect(num7, 0f, num8 - num7, 18f); Rect position4 = new Rect(num7, 18f, num8 - num7, rect.height - 18f); Rect position5 = new Rect(num7 - 9f, 5f, 9f, 15f); Rect position6 = new Rect(num8, 5f, 9f, 15f); Rect position7 = new Rect(num9 - 7f, 4f, 15f, 15f); if (current.type == EventType.KeyDown) { if (GUIUtility.keyboardControl == this.id && this.m_DragState == Timeline.DragStates.Destination) { this.m_DstDragOffset = 0f; } if (this.m_DragState == Timeline.DragStates.LeftSelection) { this.m_LeftThumbOffset = 0f; } if (this.m_DragState == Timeline.DragStates.RightSelection) { this.m_RightThumbOffset = 0f; } if (this.m_DragState == Timeline.DragStates.FullSelection) { this.m_LeftThumbOffset = 0f; this.m_RightThumbOffset = 0f; } } if (current.type == EventType.MouseDown) { if (rect.Contains(current.mousePosition)) { GUIUtility.hotControl = this.id; GUIUtility.keyboardControl = this.id; if (position7.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.Playhead; } else if (rect2.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.Source; } else if (rect3.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.Destination; } else if (position5.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.LeftSelection; } else if (position6.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.RightSelection; } else if (position3.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.FullSelection; } else if (position.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.TimeArea; } else if (position2.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.TimeArea; } else { this.m_DragState = Timeline.DragStates.None; } current.Use(); } } if (current.type == EventType.MouseDrag) { if (GUIUtility.hotControl == this.id) { switch (this.m_DragState) { case Timeline.DragStates.LeftSelection: if ((current.delta.x > 0f && current.mousePosition.x > num3) || (current.delta.x < 0f && current.mousePosition.x < num8)) { this.m_LeftThumbOffset += current.delta.x; } this.EnforceConstraints(); break; case Timeline.DragStates.RightSelection: if ((current.delta.x > 0f && current.mousePosition.x > num7) || current.delta.x < 0f) { this.m_RightThumbOffset += current.delta.x; } this.EnforceConstraints(); break; case Timeline.DragStates.FullSelection: this.m_RightThumbOffset += current.delta.x; this.m_LeftThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Destination: this.m_DstDragOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Source: { TimeArea expr_4A9_cp_0 = this.m_TimeArea; expr_4A9_cp_0.m_Translation.x = expr_4A9_cp_0.m_Translation.x + current.delta.x; break; } case Timeline.DragStates.Playhead: if ((current.delta.x > 0f && current.mousePosition.x > num3) || (current.delta.x < 0f && current.mousePosition.x <= this.m_TimeArea.TimeToPixel(this.SampleStopTime, rect))) { this.Time = this.m_TimeArea.PixelToTime(num9 + current.delta.x, rect); } break; case Timeline.DragStates.TimeArea: { TimeArea expr_4D4_cp_0 = this.m_TimeArea; expr_4D4_cp_0.m_Translation.x = expr_4D4_cp_0.m_Translation.x + current.delta.x; break; } } current.Use(); GUI.changed = true; } } if (Event.current.GetTypeForControl(this.id) == EventType.MouseUp) { this.SrcStartTime = this.m_TimeArea.PixelToTime(num3, rect); this.SrcStopTime = this.m_TimeArea.PixelToTime(num4, rect); this.DstStartTime = this.m_TimeArea.PixelToTime(num5, rect); this.DstStopTime = this.m_TimeArea.PixelToTime(num6, rect); this.TransitionStartTime = this.m_TimeArea.PixelToTime(num7, rect); this.TransitionStopTime = this.m_TimeArea.PixelToTime(num8, rect); GUI.changed = true; this.m_DragState = Timeline.DragStates.None; result = this.WasDraggingData(); this.m_LeftThumbOffset = 0f; this.m_RightThumbOffset = 0f; this.m_DstDragOffset = 0f; GUIUtility.hotControl = 0; current.Use(); } GUI.Box(position, GUIContent.none, this.styles.header); GUI.Box(position2, GUIContent.none, this.styles.background); this.m_TimeArea.DrawMajorTicks(position2, 30f); GUIContent content = EditorGUIUtility.TempContent(this.SrcName); int num10 = (!this.srcLoop) ? 1 : (1 + (int)((num8 - rect2.xMin) / (rect2.xMax - rect2.xMin))); Rect position8 = rect2; if (rect2.width < 10f) { position8 = new Rect(rect2.x, rect2.y, (rect2.xMax - rect2.xMin) * (float)num10, rect2.height); num10 = 1; } for (int i = 0; i < num10; i++) { GUI.BeginGroup(position8, GUIContent.none, this.styles.leftBlock); float num11 = num7 - position8.xMin; float num12 = num8 - num7; float num13 = position8.xMax - position8.xMin - (num11 + num12); if (num11 > 0f) { GUI.Box(new Rect(0f, 0f, num11, rect2.height), GUIContent.none, this.styles.onLeft); } if (num12 > 0f) { GUI.Box(new Rect(num11, 0f, num12, rect2.height), GUIContent.none, this.styles.onOff); } if (num13 > 0f) { GUI.Box(new Rect(num11 + num12, 0f, num13, rect2.height), GUIContent.none, this.styles.offRight); } float b = 1f; float x = this.styles.block.CalcSize(content).x; float num14 = Mathf.Max(0f, num11) - 20f; float num15 = num14 + 15f; if (num14 < x && num15 > 0f && this.m_DragState == Timeline.DragStates.LeftSelection) { b = 0f; } GUI.EndGroup(); float a = this.styles.leftBlock.normal.textColor.a; if (!Mathf.Approximately(a, b) && Event.current.type == EventType.Repaint) { a = Mathf.Lerp(a, b, 0.1f); this.styles.leftBlock.normal.textColor = new Color(this.styles.leftBlock.normal.textColor.r, this.styles.leftBlock.normal.textColor.g, this.styles.leftBlock.normal.textColor.b, a); HandleUtility.Repaint(); } GUI.Box(position8, content, this.styles.leftBlock); position8 = new Rect(position8.xMax, 85f, position8.xMax - position8.xMin, 32f); } GUIContent content2 = EditorGUIUtility.TempContent(this.DstName); int num16 = (!this.dstLoop) ? 1 : (1 + (int)((num8 - rect3.xMin) / (rect3.xMax - rect3.xMin))); position8 = rect3; if (rect3.width < 10f) { position8 = new Rect(rect3.x, rect3.y, (rect3.xMax - rect3.xMin) * (float)num16, rect3.height); num16 = 1; } for (int j = 0; j < num16; j++) { GUI.BeginGroup(position8, GUIContent.none, this.styles.rightBlock); float num17 = num7 - position8.xMin; float num18 = num8 - num7; float num19 = position8.xMax - position8.xMin - (num17 + num18); if (num17 > 0f) { GUI.Box(new Rect(0f, 0f, num17, rect3.height), GUIContent.none, this.styles.offLeft); } if (num18 > 0f) { GUI.Box(new Rect(num17, 0f, num18, rect3.height), GUIContent.none, this.styles.offOn); } if (num19 > 0f) { GUI.Box(new Rect(num17 + num18, 0f, num19, rect3.height), GUIContent.none, this.styles.onRight); } float b2 = 1f; float x2 = this.styles.block.CalcSize(content2).x; float num20 = Mathf.Max(0f, num17) - 20f; float num21 = num20 + 15f; if (num20 < x2 && num21 > 0f && (this.m_DragState == Timeline.DragStates.LeftSelection || this.m_DragState == Timeline.DragStates.Destination)) { b2 = 0f; } GUI.EndGroup(); float a2 = this.styles.rightBlock.normal.textColor.a; if (!Mathf.Approximately(a2, b2) && Event.current.type == EventType.Repaint) { a2 = Mathf.Lerp(a2, b2, 0.1f); this.styles.rightBlock.normal.textColor = new Color(this.styles.rightBlock.normal.textColor.r, this.styles.rightBlock.normal.textColor.g, this.styles.rightBlock.normal.textColor.b, a2); HandleUtility.Repaint(); } GUI.Box(position8, content2, this.styles.rightBlock); position8 = new Rect(position8.xMax, position8.yMin, position8.xMax - position8.xMin, 32f); } GUI.Box(position4, GUIContent.none, this.styles.select); GUI.Box(position3, GUIContent.none, this.styles.selectHead); this.m_TimeArea.TimeRuler(position, 30f); GUI.Box(position5, GUIContent.none, (!this.m_HasExitTime) ? this.styles.handLeftPrev : this.styles.handLeft); GUI.Box(position6, GUIContent.none, this.styles.handRight); GUI.Box(position7, GUIContent.none, this.styles.playhead); Color color = Handles.color; Handles.color = Color.white; Handles.DrawLine(new Vector3(num9, 19f, 0f), new Vector3(num9, rect.height, 0f)); Handles.color = color; bool flag = this.SrcStopTime - this.SrcStartTime < 0.0333333351f; bool flag2 = this.DstStopTime - this.DstStartTime < 0.0333333351f; if (this.m_DragState == Timeline.DragStates.Destination && !flag2) { Rect position9 = new Rect(num7 - 50f, rect3.y, 45f, rect3.height); string t = string.Format("{0:0%}", (num7 - num5) / (num6 - num5)); GUI.Box(position9, EditorGUIUtility.TempContent(t), this.styles.timeBlockRight); } if (this.m_DragState == Timeline.DragStates.LeftSelection) { if (!flag) { Rect position10 = new Rect(num7 - 50f, rect2.y, 45f, rect2.height); string t2 = string.Format("{0:0%}", (num7 - num3) / (num4 - num3)); GUI.Box(position10, EditorGUIUtility.TempContent(t2), this.styles.timeBlockRight); } if (!flag2) { Rect position11 = new Rect(num7 - 50f, rect3.y, 45f, rect3.height); string t3 = string.Format("{0:0%}", (num7 - num5) / (num6 - num5)); GUI.Box(position11, EditorGUIUtility.TempContent(t3), this.styles.timeBlockRight); } } if (this.m_DragState == Timeline.DragStates.RightSelection) { if (!flag) { Rect position12 = new Rect(num8 + 5f, rect2.y, 45f, rect2.height); string t4 = string.Format("{0:0%}", (num8 - num3) / (num4 - num3)); GUI.Box(position12, EditorGUIUtility.TempContent(t4), this.styles.timeBlockLeft); } if (!flag2) { Rect position13 = new Rect(num8 + 5f, rect3.y, 45f, rect3.height); string t5 = string.Format("{0:0%}", (num8 - num5) / (num6 - num5)); GUI.Box(position13, EditorGUIUtility.TempContent(t5), this.styles.timeBlockLeft); } } this.DoPivotCurves(); GUI.EndGroup(); return(result); }
public bool DoTimeline(Rect timeRect) { bool flag1 = false; this.Init(); this.m_Rect = timeRect; float time1 = this.m_TimeArea.PixelToTime(timeRect.xMin, timeRect); float time2 = this.m_TimeArea.PixelToTime(timeRect.xMax, timeRect); if (!Mathf.Approximately(time1, this.StartTime)) { this.StartTime = time1; GUI.changed = true; } if (!Mathf.Approximately(time2, this.StopTime)) { this.StopTime = time2; GUI.changed = true; } this.Time = Mathf.Max(this.Time, 0.0f); if (Event.current.type == EventType.Repaint) this.m_TimeArea.rect = timeRect; this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); GUI.BeginGroup(timeRect); Event current = Event.current; Rect rect1 = new Rect(0.0f, 0.0f, timeRect.width, timeRect.height); Rect position1 = new Rect(0.0f, 0.0f, timeRect.width, 18f); Rect position2 = new Rect(0.0f, 18f, timeRect.width, 132f); float pixel1 = this.m_TimeArea.TimeToPixel(this.SrcStartTime, rect1); float pixel2 = this.m_TimeArea.TimeToPixel(this.SrcStopTime, rect1); float num1 = this.m_TimeArea.TimeToPixel(this.DstStartTime, rect1) + this.m_DstDragOffset; float pixelX = this.m_TimeArea.TimeToPixel(this.DstStopTime, rect1) + this.m_DstDragOffset; float num2 = this.m_TimeArea.TimeToPixel(this.TransitionStartTime, rect1) + this.m_LeftThumbOffset; float num3 = this.m_TimeArea.TimeToPixel(this.TransitionStopTime, rect1) + this.m_RightThumbOffset; float pixel3 = this.m_TimeArea.TimeToPixel(this.Time, rect1); Rect rect2 = new Rect(pixel1, 85f, pixel2 - pixel1, 32f); Rect rect3 = new Rect(num1, 117f, pixelX - num1, 32f); Rect position3 = new Rect(num2, 0.0f, num3 - num2, 18f); Rect position4 = new Rect(num2, 18f, num3 - num2, rect1.height - 18f); Rect position5 = new Rect(num2 - 9f, 5f, 9f, 15f); Rect position6 = new Rect(num3, 5f, 9f, 15f); Rect position7 = new Rect(pixel3 - 7f, 4f, 15f, 15f); if (current.type == EventType.KeyDown) { if (GUIUtility.keyboardControl == this.id && this.m_DragState == Timeline.DragStates.Destination) this.m_DstDragOffset = 0.0f; if (this.m_DragState == Timeline.DragStates.LeftSelection) this.m_LeftThumbOffset = 0.0f; if (this.m_DragState == Timeline.DragStates.RightSelection) this.m_RightThumbOffset = 0.0f; if (this.m_DragState == Timeline.DragStates.FullSelection) { this.m_LeftThumbOffset = 0.0f; this.m_RightThumbOffset = 0.0f; } } if (current.type == EventType.MouseDown && rect1.Contains(current.mousePosition)) { GUIUtility.hotControl = this.id; GUIUtility.keyboardControl = this.id; this.m_DragState = !position7.Contains(current.mousePosition) ? (!rect2.Contains(current.mousePosition) ? (!rect3.Contains(current.mousePosition) ? (!position5.Contains(current.mousePosition) ? (!position6.Contains(current.mousePosition) ? (!position3.Contains(current.mousePosition) ? (!position1.Contains(current.mousePosition) ? (!position2.Contains(current.mousePosition) ? Timeline.DragStates.None : Timeline.DragStates.TimeArea) : Timeline.DragStates.TimeArea) : Timeline.DragStates.FullSelection) : Timeline.DragStates.RightSelection) : Timeline.DragStates.LeftSelection) : Timeline.DragStates.Destination) : Timeline.DragStates.Source) : Timeline.DragStates.Playhead; current.Use(); } if (current.type == EventType.MouseDrag && GUIUtility.hotControl == this.id) { switch (this.m_DragState) { case Timeline.DragStates.LeftSelection: if ((double) current.delta.x > 0.0 && (double) current.mousePosition.x > (double) pixel1 || (double) current.delta.x < 0.0 && (double) current.mousePosition.x < (double) num3) this.m_LeftThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.RightSelection: if ((double) current.delta.x > 0.0 && (double) current.mousePosition.x > (double) num2 || (double) current.delta.x < 0.0) this.m_RightThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.FullSelection: this.m_RightThumbOffset += current.delta.x; this.m_LeftThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Destination: this.m_DstDragOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Source: this.m_TimeArea.m_Translation.x += current.delta.x; break; case Timeline.DragStates.Playhead: if ((double) current.delta.x > 0.0 && (double) current.mousePosition.x > (double) pixel1 || (double) current.delta.x < 0.0 && (double) current.mousePosition.x <= (double) this.m_TimeArea.TimeToPixel(this.SampleStopTime, rect1)) { this.Time = this.m_TimeArea.PixelToTime(pixel3 + current.delta.x, rect1); break; } break; case Timeline.DragStates.TimeArea: this.m_TimeArea.m_Translation.x += current.delta.x; break; } current.Use(); GUI.changed = true; } if (current.type == EventType.MouseUp && GUIUtility.hotControl == this.id) { this.SrcStartTime = this.m_TimeArea.PixelToTime(pixel1, rect1); this.SrcStopTime = this.m_TimeArea.PixelToTime(pixel2, rect1); this.DstStartTime = this.m_TimeArea.PixelToTime(num1, rect1); this.DstStopTime = this.m_TimeArea.PixelToTime(pixelX, rect1); this.TransitionStartTime = this.m_TimeArea.PixelToTime(num2, rect1); this.TransitionStopTime = this.m_TimeArea.PixelToTime(num3, rect1); GUI.changed = true; this.m_DragState = Timeline.DragStates.None; flag1 = this.WasDraggingData(); this.m_LeftThumbOffset = 0.0f; this.m_RightThumbOffset = 0.0f; this.m_DstDragOffset = 0.0f; GUIUtility.hotControl = 0; current.Use(); } GUI.Box(position1, GUIContent.none, this.styles.header); GUI.Box(position2, GUIContent.none, this.styles.background); this.m_TimeArea.DrawMajorTicks(position2, 30f); GUIContent content1 = EditorGUIUtility.TempContent(this.SrcName); int num4 = !this.srcLoop ? 1 : 1 + (int) (((double) num3 - (double) rect2.xMin) / ((double) rect2.xMax - (double) rect2.xMin)); Rect position8 = rect2; if ((double) rect2.width < 10.0) { position8 = new Rect(rect2.x, rect2.y, (rect2.xMax - rect2.xMin) * (float) num4, rect2.height); num4 = 1; } for (int index = 0; index < num4; ++index) { GUI.BeginGroup(position8, GUIContent.none, this.styles.leftBlock); float num5 = num2 - position8.xMin; float width1 = num3 - num2; float width2 = (float) ((double) position8.xMax - (double) position8.xMin - ((double) num5 + (double) width1)); if ((double) num5 > 0.0) GUI.Box(new Rect(0.0f, 0.0f, num5, rect2.height), GUIContent.none, this.styles.onLeft); if ((double) width1 > 0.0) GUI.Box(new Rect(num5, 0.0f, width1, rect2.height), GUIContent.none, this.styles.onOff); if ((double) width2 > 0.0) GUI.Box(new Rect(num5 + width1, 0.0f, width2, rect2.height), GUIContent.none, this.styles.offRight); float b = 1f; float x = this.styles.block.CalcSize(content1).x; float num6 = Mathf.Max(0.0f, num5) - 20f; float num7 = num6 + 15f; if ((double) num6 < (double) x && (double) num7 > 0.0 && this.m_DragState == Timeline.DragStates.LeftSelection) b = 0.0f; GUI.EndGroup(); float a = this.styles.leftBlock.normal.textColor.a; if (!Mathf.Approximately(a, b) && Event.current.type == EventType.Repaint) { this.styles.leftBlock.normal.textColor = new Color(this.styles.leftBlock.normal.textColor.r, this.styles.leftBlock.normal.textColor.g, this.styles.leftBlock.normal.textColor.b, Mathf.Lerp(a, b, 0.1f)); HandleUtility.Repaint(); } GUI.Box(position8, content1, this.styles.leftBlock); position8 = new Rect(position8.xMax, 85f, position8.xMax - position8.xMin, 32f); } GUIContent content2 = EditorGUIUtility.TempContent(this.DstName); int num8 = !this.dstLoop ? 1 : 1 + (int) (((double) num3 - (double) rect3.xMin) / ((double) rect3.xMax - (double) rect3.xMin)); position8 = rect3; if ((double) rect3.width < 10.0) { position8 = new Rect(rect3.x, rect3.y, (rect3.xMax - rect3.xMin) * (float) num8, rect3.height); num8 = 1; } for (int index = 0; index < num8; ++index) { GUI.BeginGroup(position8, GUIContent.none, this.styles.rightBlock); float num5 = num2 - position8.xMin; float width1 = num3 - num2; float width2 = (float) ((double) position8.xMax - (double) position8.xMin - ((double) num5 + (double) width1)); if ((double) num5 > 0.0) GUI.Box(new Rect(0.0f, 0.0f, num5, rect3.height), GUIContent.none, this.styles.offLeft); if ((double) width1 > 0.0) GUI.Box(new Rect(num5, 0.0f, width1, rect3.height), GUIContent.none, this.styles.offOn); if ((double) width2 > 0.0) GUI.Box(new Rect(num5 + width1, 0.0f, width2, rect3.height), GUIContent.none, this.styles.onRight); float b = 1f; float x = this.styles.block.CalcSize(content2).x; float num6 = Mathf.Max(0.0f, num5) - 20f; float num7 = num6 + 15f; if ((double) num6 < (double) x && (double) num7 > 0.0 && (this.m_DragState == Timeline.DragStates.LeftSelection || this.m_DragState == Timeline.DragStates.Destination)) b = 0.0f; GUI.EndGroup(); float a = this.styles.rightBlock.normal.textColor.a; if (!Mathf.Approximately(a, b) && Event.current.type == EventType.Repaint) { this.styles.rightBlock.normal.textColor = new Color(this.styles.rightBlock.normal.textColor.r, this.styles.rightBlock.normal.textColor.g, this.styles.rightBlock.normal.textColor.b, Mathf.Lerp(a, b, 0.1f)); HandleUtility.Repaint(); } GUI.Box(position8, content2, this.styles.rightBlock); position8 = new Rect(position8.xMax, position8.yMin, position8.xMax - position8.xMin, 32f); } GUI.Box(position4, GUIContent.none, this.styles.select); GUI.Box(position3, GUIContent.none, this.styles.selectHead); this.m_TimeArea.TimeRuler(position1, 30f); GUI.Box(position5, GUIContent.none, !this.m_HasExitTime ? this.styles.handLeftPrev : this.styles.handLeft); GUI.Box(position6, GUIContent.none, this.styles.handRight); GUI.Box(position7, GUIContent.none, this.styles.playhead); Color color = Handles.color; Handles.color = Color.white; Handles.DrawLine(new Vector3(pixel3, 19f, 0.0f), new Vector3(pixel3, rect1.height, 0.0f)); Handles.color = color; bool flag2 = (double) this.SrcStopTime - (double) this.SrcStartTime < 0.0333333350718021; bool flag3 = (double) this.DstStopTime - (double) this.DstStartTime < 0.0333333350718021; if (this.m_DragState == Timeline.DragStates.Destination && !flag3) GUI.Box(new Rect(num2 - 50f, rect3.y, 45f, rect3.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object) (float) (((double) num2 - (double) num1) / ((double) pixelX - (double) num1)))), this.styles.timeBlockRight); if (this.m_DragState == Timeline.DragStates.LeftSelection) { if (!flag2) GUI.Box(new Rect(num2 - 50f, rect2.y, 45f, rect2.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object) (float) (((double) num2 - (double) pixel1) / ((double) pixel2 - (double) pixel1)))), this.styles.timeBlockRight); if (!flag3) GUI.Box(new Rect(num2 - 50f, rect3.y, 45f, rect3.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object) (float) (((double) num2 - (double) num1) / ((double) pixelX - (double) num1)))), this.styles.timeBlockRight); } if (this.m_DragState == Timeline.DragStates.RightSelection) { if (!flag2) GUI.Box(new Rect(num3 + 5f, rect2.y, 45f, rect2.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object) (float) (((double) num3 - (double) pixel1) / ((double) pixel2 - (double) pixel1)))), this.styles.timeBlockLeft); if (!flag3) GUI.Box(new Rect(num3 + 5f, rect3.y, 45f, rect3.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object) (float) (((double) num3 - (double) num1) / ((double) pixelX - (double) num1)))), this.styles.timeBlockLeft); } this.DoPivotCurves(); GUI.EndGroup(); return flag1; }
public bool DoTimeline(Rect timeRect) { bool result = false; this.Init(); this.m_Rect = timeRect; float num = this.m_TimeArea.PixelToTime(timeRect.xMin, timeRect); float num2 = this.m_TimeArea.PixelToTime(timeRect.xMax, timeRect); if (num != this.StartTime) { this.StartTime = num; GUI.changed = true; } if (num2 != this.StopTime) { this.StopTime = num2; GUI.changed = true; } this.Time = ((this.Time >= this.StartTime) ? this.Time : this.StartTime); this.Time = ((this.Time <= this.StopTime) ? this.Time : this.StartTime); this.Time = Mathf.Max(this.Time, 0f); if (Event.current.type == EventType.Repaint) { this.m_TimeArea.rect = timeRect; } this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); GUI.BeginGroup(timeRect); Event current = Event.current; Rect rect = new Rect(0f, 0f, timeRect.width, timeRect.height); Rect position = new Rect(0f, 0f, timeRect.width, 18f); Rect position2 = new Rect(0f, 18f, timeRect.width, 132f); float num3 = this.m_TimeArea.TimeToPixel(this.SrcStartTime, timeRect); float num4 = this.m_TimeArea.TimeToPixel(this.SrcStopTime, timeRect); float num5 = this.m_TimeArea.TimeToPixel(this.DstStartTime, timeRect) + this.m_DstDragOffset; float num6 = this.m_TimeArea.TimeToPixel(this.DstStopTime, timeRect) + this.m_DstDragOffset; float num7 = this.m_TimeArea.TimeToPixel(this.TransitionStartTime, timeRect) + this.m_LeftThumbOffset; float num8 = this.m_TimeArea.TimeToPixel(this.TransitionStopTime, timeRect) + this.m_RightThumbOffset; float num9 = this.m_TimeArea.TimeToPixel(this.Time, timeRect); Rect rect2 = new Rect(num3, 85f, num4 - num3, 32f); Rect rect3 = new Rect(num5, 117f, num6 - num5, 32f); Rect position3 = new Rect(num7, 0f, num8 - num7, 18f); Rect position4 = new Rect(num7, 18f, num8 - num7, timeRect.height - 18f); Rect position5 = new Rect(num7 - 9f, 5f, 9f, 15f); Rect position6 = new Rect(num8, 5f, 9f, 15f); Rect position7 = new Rect(num9 - 7f, 4f, 15f, 15f); if (current.type == EventType.KeyDown) { if (GUIUtility.keyboardControl == this.id && this.m_DragState == Timeline.DragStates.Destination) { this.m_DstDragOffset = 0f; } if (this.m_DragState == Timeline.DragStates.LeftSelection) { this.m_LeftThumbOffset = 0f; } if (this.m_DragState == Timeline.DragStates.RightSelection) { this.m_RightThumbOffset = 0f; } if (this.m_DragState == Timeline.DragStates.FullSelection) { this.m_LeftThumbOffset = 0f; this.m_RightThumbOffset = 0f; } } if (current.type == EventType.MouseDown && rect.Contains(current.mousePosition)) { GUIUtility.hotControl = this.id; GUIUtility.keyboardControl = this.id; if (position7.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.Playhead; } else { if (rect2.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.Source; } else { if (rect3.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.Destination; } else { if (position5.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.LeftSelection; } else { if (position6.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.RightSelection; } else { if (position3.Contains(current.mousePosition)) { this.m_DragState = Timeline.DragStates.FullSelection; } else { this.m_DragState = Timeline.DragStates.None; } } } } } } current.Use(); } if (current.type == EventType.MouseDrag && GUIUtility.hotControl == this.id) { switch (this.m_DragState) { case Timeline.DragStates.LeftSelection: this.m_LeftThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.RightSelection: this.m_RightThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.FullSelection: this.m_RightThumbOffset += current.delta.x; this.m_LeftThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Destination: this.m_DstDragOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Source: { TimeArea expr_498_cp_0 = this.m_TimeArea; expr_498_cp_0.m_Translation.x = expr_498_cp_0.m_Translation.x + current.delta.x; break; } case Timeline.DragStates.Playhead: this.Time = this.m_TimeArea.PixelToTime(num9 + current.delta.x, timeRect); break; } current.Use(); GUI.changed = true; } if (current.type == EventType.MouseUp && GUIUtility.hotControl == this.id) { this.SrcStartTime = this.m_TimeArea.PixelToTime(num3, timeRect); this.SrcStopTime = this.m_TimeArea.PixelToTime(num4, timeRect); this.DstStartTime = this.m_TimeArea.PixelToTime(num5, timeRect); this.DstStopTime = this.m_TimeArea.PixelToTime(num6, timeRect); this.TransitionStartTime = this.m_TimeArea.PixelToTime(num7, timeRect); this.TransitionStopTime = this.m_TimeArea.PixelToTime(num8, timeRect); GUI.changed = true; this.m_DragState = Timeline.DragStates.None; result = this.WasDraggingData(); this.m_LeftThumbOffset = 0f; this.m_RightThumbOffset = 0f; this.m_DstDragOffset = 0f; GUIUtility.hotControl = 0; current.Use(); } GUI.Box(position, GUIContent.none, this.styles.header); GUI.Box(position2, GUIContent.none, this.styles.background); this.m_TimeArea.DrawMajorTicks(position2, 30f); GUIContent content = EditorGUIUtility.TempContent(this.SrcName); int num10 = (!this.srcLoop) ? 1 : (1 + (int)((num8 - rect2.xMin) / (rect2.xMax - rect2.xMin))); Rect position8 = rect2; if (rect2.width < 10f) { position8 = new Rect(rect2.x, rect2.y, (rect2.xMax - rect2.xMin) * (float)num10, rect2.height); num10 = 1; } for (int i = 0; i < num10; i++) { GUI.BeginGroup(position8, GUIContent.none, this.styles.leftBlock); float num11 = num7 - position8.xMin; float num12 = num8 - num7; float num13 = position8.xMax - position8.xMin - (num11 + num12); if (num11 > 0f) { GUI.Box(new Rect(0f, 0f, num11, rect2.height), GUIContent.none, this.styles.onLeft); } if (num12 > 0f) { GUI.Box(new Rect(num11, 0f, num12, rect2.height), GUIContent.none, this.styles.onOff); } if (num13 > 0f) { GUI.Box(new Rect(num11 + num12, 0f, num13, rect2.height), GUIContent.none, this.styles.offRight); } float num14 = 1f; float x = this.styles.block.CalcSize(content).x; float num15 = Mathf.Max(0f, num11) - 20f; float num16 = num15 + 15f; if (num15 < x && num16 > 0f && this.m_DragState == Timeline.DragStates.LeftSelection) { num14 = 0f; } GUI.EndGroup(); float num17 = this.styles.leftBlock.normal.textColor.a; if (!Mathf.Approximately(num17, num14) && Event.current.type == EventType.Repaint) { num17 = Mathf.Lerp(num17, num14, 0.1f); this.styles.leftBlock.normal.textColor = new Color(this.styles.leftBlock.normal.textColor.r, this.styles.leftBlock.normal.textColor.g, this.styles.leftBlock.normal.textColor.b, num17); HandleUtility.Repaint(); } GUI.Box(position8, content, this.styles.leftBlock); position8 = new Rect(position8.xMax, 85f, position8.xMax - position8.xMin, 32f); } GUIContent content2 = EditorGUIUtility.TempContent(this.DstName); int num18 = (!this.dstLoop) ? 1 : (1 + (int)((num8 - rect3.xMin) / (rect3.xMax - rect3.xMin))); position8 = rect3; if (rect3.width < 10f) { position8 = new Rect(rect3.x, rect3.y, (rect3.xMax - rect3.xMin) * (float)num18, rect3.height); num18 = 1; } for (int j = 0; j < num18; j++) { GUI.BeginGroup(position8, GUIContent.none, this.styles.rightBlock); float num19 = num7 - position8.xMin; float num20 = num8 - num7; float num21 = position8.xMax - position8.xMin - (num19 + num20); if (num19 > 0f) { GUI.Box(new Rect(0f, 0f, num19, rect3.height), GUIContent.none, this.styles.offLeft); } if (num20 > 0f) { GUI.Box(new Rect(num19, 0f, num20, rect3.height), GUIContent.none, this.styles.offOn); } if (num21 > 0f) { GUI.Box(new Rect(num19 + num20, 0f, num21, rect3.height), GUIContent.none, this.styles.onRight); } float num22 = 1f; float x2 = this.styles.block.CalcSize(content2).x; float num23 = Mathf.Max(0f, num19) - 20f; float num24 = num23 + 15f; if (num23 < x2 && num24 > 0f && (this.m_DragState == Timeline.DragStates.LeftSelection || this.m_DragState == Timeline.DragStates.Destination)) { num22 = 0f; } GUI.EndGroup(); float num25 = this.styles.rightBlock.normal.textColor.a; if (!Mathf.Approximately(num25, num22) && Event.current.type == EventType.Repaint) { num25 = Mathf.Lerp(num25, num22, 0.1f); this.styles.rightBlock.normal.textColor = new Color(this.styles.rightBlock.normal.textColor.r, this.styles.rightBlock.normal.textColor.g, this.styles.rightBlock.normal.textColor.b, num25); HandleUtility.Repaint(); } GUI.Box(position8, content2, this.styles.rightBlock); position8 = new Rect(position8.xMax, position8.yMin, position8.xMax - position8.xMin, 32f); } GUI.Box(position4, GUIContent.none, this.styles.select); GUI.Box(position3, GUIContent.none, this.styles.selectHead); this.m_TimeArea.TimeRuler(position, 30f); GUI.Box(position5, GUIContent.none, (!this.m_HasExitTime) ? this.styles.handLeftPrev : this.styles.handLeft); GUI.Box(position6, GUIContent.none, this.styles.handRight); GUI.Box(position7, GUIContent.none, this.styles.playhead); Color color = Handles.color; Handles.color = Color.white; Handles.DrawLine(new Vector3(num9, 19f, 0f), new Vector3(num9, timeRect.height, 0f)); Handles.color = color; bool flag = this.SrcStopTime - this.SrcStartTime < 0.0333333351f; bool flag2 = this.DstStopTime - this.DstStartTime < 0.0333333351f; if (this.m_DragState == Timeline.DragStates.Destination && !flag2) { Rect position9 = new Rect(num7 - 50f, rect3.y, 45f, rect3.height); string t = string.Format("{0:0%}", (num7 - num5) / (num6 - num5)); GUI.Box(position9, EditorGUIUtility.TempContent(t), this.styles.timeBlockRight); } if (this.m_DragState == Timeline.DragStates.LeftSelection) { if (!flag) { Rect position10 = new Rect(num7 - 50f, rect2.y, 45f, rect2.height); string t2 = string.Format("{0:0%}", (num7 - num3) / (num4 - num3)); GUI.Box(position10, EditorGUIUtility.TempContent(t2), this.styles.timeBlockRight); } if (!flag2) { Rect position11 = new Rect(num7 - 50f, rect3.y, 45f, rect3.height); string t3 = string.Format("{0:0%}", (num7 - num5) / (num6 - num5)); GUI.Box(position11, EditorGUIUtility.TempContent(t3), this.styles.timeBlockRight); } } if (this.m_DragState == Timeline.DragStates.RightSelection) { if (!flag) { Rect position12 = new Rect(num8 + 5f, rect2.y, 45f, rect2.height); string t4 = string.Format("{0:0%}", (num8 - num3) / (num4 - num3)); GUI.Box(position12, EditorGUIUtility.TempContent(t4), this.styles.timeBlockLeft); } if (!flag2) { Rect position13 = new Rect(num8 + 5f, rect3.y, 45f, rect3.height); string t5 = string.Format("{0:0%}", (num8 - num5) / (num6 - num5)); GUI.Box(position13, EditorGUIUtility.TempContent(t5), this.styles.timeBlockLeft); } } this.DoPivotCurves(); GUI.EndGroup(); return result; }
public void DoTimeline(Rect rectArea) { Init(); if (Event.current.type == EventType.Repaint) { m_TimeArea.rect = rectArea; } m_TimeArea.BeginViewGUI(); m_TimeArea.EndViewGUI(); GUI.BeginGroup(rectArea); Rect rect = new Rect(0f, 0f, rectArea.width, rectArea.height); m_HeaderRect = new Rect(0f, 0f, rectArea.width, 18f); m_ContentRect = new Rect(0f, 18f, rectArea.width, rectArea.height - m_HeaderRect.height); float playHeadPosX = m_TimeArea.TimeToPixel(Time, rectArea); Rect playHeadRect = new Rect(playHeadPosX - styles.playhead.fixedWidth * 0.5f - 4f, 4f, styles.playhead.fixedWidth, styles.playhead.fixedHeight); if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { GUIUtility.hotControl = id; GUIUtility.keyboardControl = id; if (playHeadRect.Contains(Event.current.mousePosition)) { m_StartValue = playHeadPosX; m_DragState = Timeline.DragStates.Playhead; } else if (m_HeaderRect.Contains(Event.current.mousePosition)) { m_DragState = Timeline.DragStates.TimeLine; Time = SnapToFrame(m_TimeArea.PixelToTime(Event.current.mousePosition.x, rectArea)); GUI.changed = true; } else { for (var i = dopeElements.GetEnumerator(); i.MoveNext();) { IDopeElement element = i.Current; Rect position = GetDopeElementRect(element); if (position.Contains(Event.current.mousePosition)) { m_DragState = DragStates.Element; m_StartValue = m_TimeArea.TimeToPixel(element.time, rectArea); Time = SnapToFrame(element.time); selectedElement = element; GUI.changed = true; } } } Event.current.Use(); } if (Event.current.type == EventType.MouseDrag && GUIUtility.hotControl == this.id) { switch (m_DragState) { case Timeline.DragStates.Playhead: m_StartValue += Event.current.delta.x; Time = SnapToFrame(m_TimeArea.PixelToTime(m_StartValue, rectArea)); break; case Timeline.DragStates.TimeLine: Time = SnapToFrame(m_TimeArea.PixelToTime(Event.current.mousePosition.x, rectArea)); break; case Timeline.DragStates.Element: if (canEditDopeElements) { m_StartValue += Event.current.delta.x; selectedElement.time = SnapToFrame(m_TimeArea.PixelToTime(m_StartValue, rectArea)); } break; } Event.current.Use(); GUI.changed = true; } if (Event.current.type == EventType.MouseUp && GUIUtility.hotControl == this.id) { switch (m_DragState) { case Timeline.DragStates.Playhead: break; case Timeline.DragStates.TimeLine: break; case Timeline.DragStates.Element: if (canEditDopeElements) { selectedElement.Flush(); selectedElement = null; } break; } GUI.changed = true; m_DragState = Timeline.DragStates.None; GUIUtility.hotControl = 0; Event.current.Use(); } GUI.Box(m_HeaderRect, GUIContent.none, this.styles.header); GUI.Box(m_ContentRect, GUIContent.none, this.styles.background); m_TimeArea.TimeRuler(m_HeaderRect, FrameRate); GUI.Box(playHeadRect, GUIContent.none, styles.playhead); DopeLineRepaint(); GUI.EndGroup(); }
public bool DoTimeline(Rect timeRect) { bool flag1 = false; this.Init(); this.m_Rect = timeRect; float time1 = this.m_TimeArea.PixelToTime(timeRect.xMin, timeRect); float time2 = this.m_TimeArea.PixelToTime(timeRect.xMax, timeRect); if (!Mathf.Approximately(time1, this.StartTime)) { this.StartTime = time1; GUI.changed = true; } if (!Mathf.Approximately(time2, this.StopTime)) { this.StopTime = time2; GUI.changed = true; } this.Time = Mathf.Max(this.Time, 0.0f); if (Event.current.type == EventType.Repaint) { this.m_TimeArea.rect = timeRect; } this.m_TimeArea.BeginViewGUI(); this.m_TimeArea.EndViewGUI(); GUI.BeginGroup(timeRect); Event current = Event.current; Rect rect1 = new Rect(0.0f, 0.0f, timeRect.width, timeRect.height); Rect position1 = new Rect(0.0f, 0.0f, timeRect.width, 18f); Rect position2 = new Rect(0.0f, 18f, timeRect.width, 132f); float pixel1 = this.m_TimeArea.TimeToPixel(this.SrcStartTime, rect1); float pixel2 = this.m_TimeArea.TimeToPixel(this.SrcStopTime, rect1); float num1 = this.m_TimeArea.TimeToPixel(this.DstStartTime, rect1) + this.m_DstDragOffset; float pixelX = this.m_TimeArea.TimeToPixel(this.DstStopTime, rect1) + this.m_DstDragOffset; float num2 = this.m_TimeArea.TimeToPixel(this.TransitionStartTime, rect1) + this.m_LeftThumbOffset; float num3 = this.m_TimeArea.TimeToPixel(this.TransitionStopTime, rect1) + this.m_RightThumbOffset; float pixel3 = this.m_TimeArea.TimeToPixel(this.Time, rect1); Rect rect2 = new Rect(pixel1, 85f, pixel2 - pixel1, 32f); Rect rect3 = new Rect(num1, 117f, pixelX - num1, 32f); Rect position3 = new Rect(num2, 0.0f, num3 - num2, 18f); Rect position4 = new Rect(num2, 18f, num3 - num2, rect1.height - 18f); Rect position5 = new Rect(num2 - 9f, 5f, 9f, 15f); Rect position6 = new Rect(num3, 5f, 9f, 15f); Rect position7 = new Rect(pixel3 - 7f, 4f, 15f, 15f); if (current.type == EventType.KeyDown) { if (GUIUtility.keyboardControl == this.id && this.m_DragState == Timeline.DragStates.Destination) { this.m_DstDragOffset = 0.0f; } if (this.m_DragState == Timeline.DragStates.LeftSelection) { this.m_LeftThumbOffset = 0.0f; } if (this.m_DragState == Timeline.DragStates.RightSelection) { this.m_RightThumbOffset = 0.0f; } if (this.m_DragState == Timeline.DragStates.FullSelection) { this.m_LeftThumbOffset = 0.0f; this.m_RightThumbOffset = 0.0f; } } if (current.type == EventType.MouseDown && rect1.Contains(current.mousePosition)) { GUIUtility.hotControl = this.id; GUIUtility.keyboardControl = this.id; this.m_DragState = !position7.Contains(current.mousePosition) ? (!rect2.Contains(current.mousePosition) ? (!rect3.Contains(current.mousePosition) ? (!position5.Contains(current.mousePosition) ? (!position6.Contains(current.mousePosition) ? (!position3.Contains(current.mousePosition) ? (!position1.Contains(current.mousePosition) ? (!position2.Contains(current.mousePosition) ? Timeline.DragStates.None : Timeline.DragStates.TimeArea) : Timeline.DragStates.TimeArea) : Timeline.DragStates.FullSelection) : Timeline.DragStates.RightSelection) : Timeline.DragStates.LeftSelection) : Timeline.DragStates.Destination) : Timeline.DragStates.Source) : Timeline.DragStates.Playhead; current.Use(); } if (current.type == EventType.MouseDrag && GUIUtility.hotControl == this.id) { switch (this.m_DragState) { case Timeline.DragStates.LeftSelection: if ((double)current.delta.x > 0.0 && (double)current.mousePosition.x > (double)pixel1 || (double)current.delta.x < 0.0 && (double)current.mousePosition.x < (double)num3) { this.m_LeftThumbOffset += current.delta.x; } this.EnforceConstraints(); break; case Timeline.DragStates.RightSelection: if ((double)current.delta.x > 0.0 && (double)current.mousePosition.x > (double)num2 || (double)current.delta.x < 0.0) { this.m_RightThumbOffset += current.delta.x; } this.EnforceConstraints(); break; case Timeline.DragStates.FullSelection: this.m_RightThumbOffset += current.delta.x; this.m_LeftThumbOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Destination: this.m_DstDragOffset += current.delta.x; this.EnforceConstraints(); break; case Timeline.DragStates.Source: this.m_TimeArea.m_Translation.x += current.delta.x; break; case Timeline.DragStates.Playhead: if ((double)current.delta.x > 0.0 && (double)current.mousePosition.x > (double)pixel1 || (double)current.delta.x < 0.0 && (double)current.mousePosition.x <= (double)this.m_TimeArea.TimeToPixel(this.SampleStopTime, rect1)) { this.Time = this.m_TimeArea.PixelToTime(pixel3 + current.delta.x, rect1); break; } break; case Timeline.DragStates.TimeArea: this.m_TimeArea.m_Translation.x += current.delta.x; break; } current.Use(); GUI.changed = true; } if (current.type == EventType.MouseUp && GUIUtility.hotControl == this.id) { this.SrcStartTime = this.m_TimeArea.PixelToTime(pixel1, rect1); this.SrcStopTime = this.m_TimeArea.PixelToTime(pixel2, rect1); this.DstStartTime = this.m_TimeArea.PixelToTime(num1, rect1); this.DstStopTime = this.m_TimeArea.PixelToTime(pixelX, rect1); this.TransitionStartTime = this.m_TimeArea.PixelToTime(num2, rect1); this.TransitionStopTime = this.m_TimeArea.PixelToTime(num3, rect1); GUI.changed = true; this.m_DragState = Timeline.DragStates.None; flag1 = this.WasDraggingData(); this.m_LeftThumbOffset = 0.0f; this.m_RightThumbOffset = 0.0f; this.m_DstDragOffset = 0.0f; GUIUtility.hotControl = 0; current.Use(); } GUI.Box(position1, GUIContent.none, this.styles.header); GUI.Box(position2, GUIContent.none, this.styles.background); this.m_TimeArea.DrawMajorTicks(position2, 30f); GUIContent content1 = EditorGUIUtility.TempContent(this.SrcName); int num4 = !this.srcLoop ? 1 : 1 + (int)(((double)num3 - (double)rect2.xMin) / ((double)rect2.xMax - (double)rect2.xMin)); Rect position8 = rect2; if ((double)rect2.width < 10.0) { position8 = new Rect(rect2.x, rect2.y, (rect2.xMax - rect2.xMin) * (float)num4, rect2.height); num4 = 1; } for (int index = 0; index < num4; ++index) { GUI.BeginGroup(position8, GUIContent.none, this.styles.leftBlock); float num5 = num2 - position8.xMin; float width1 = num3 - num2; float width2 = (float)((double)position8.xMax - (double)position8.xMin - ((double)num5 + (double)width1)); if ((double)num5 > 0.0) { GUI.Box(new Rect(0.0f, 0.0f, num5, rect2.height), GUIContent.none, this.styles.onLeft); } if ((double)width1 > 0.0) { GUI.Box(new Rect(num5, 0.0f, width1, rect2.height), GUIContent.none, this.styles.onOff); } if ((double)width2 > 0.0) { GUI.Box(new Rect(num5 + width1, 0.0f, width2, rect2.height), GUIContent.none, this.styles.offRight); } float b = 1f; float x = this.styles.block.CalcSize(content1).x; float num6 = Mathf.Max(0.0f, num5) - 20f; float num7 = num6 + 15f; if ((double)num6 < (double)x && (double)num7 > 0.0 && this.m_DragState == Timeline.DragStates.LeftSelection) { b = 0.0f; } GUI.EndGroup(); float a = this.styles.leftBlock.normal.textColor.a; if (!Mathf.Approximately(a, b) && Event.current.type == EventType.Repaint) { this.styles.leftBlock.normal.textColor = new Color(this.styles.leftBlock.normal.textColor.r, this.styles.leftBlock.normal.textColor.g, this.styles.leftBlock.normal.textColor.b, Mathf.Lerp(a, b, 0.1f)); HandleUtility.Repaint(); } GUI.Box(position8, content1, this.styles.leftBlock); position8 = new Rect(position8.xMax, 85f, position8.xMax - position8.xMin, 32f); } GUIContent content2 = EditorGUIUtility.TempContent(this.DstName); int num8 = !this.dstLoop ? 1 : 1 + (int)(((double)num3 - (double)rect3.xMin) / ((double)rect3.xMax - (double)rect3.xMin)); position8 = rect3; if ((double)rect3.width < 10.0) { position8 = new Rect(rect3.x, rect3.y, (rect3.xMax - rect3.xMin) * (float)num8, rect3.height); num8 = 1; } for (int index = 0; index < num8; ++index) { GUI.BeginGroup(position8, GUIContent.none, this.styles.rightBlock); float num5 = num2 - position8.xMin; float width1 = num3 - num2; float width2 = (float)((double)position8.xMax - (double)position8.xMin - ((double)num5 + (double)width1)); if ((double)num5 > 0.0) { GUI.Box(new Rect(0.0f, 0.0f, num5, rect3.height), GUIContent.none, this.styles.offLeft); } if ((double)width1 > 0.0) { GUI.Box(new Rect(num5, 0.0f, width1, rect3.height), GUIContent.none, this.styles.offOn); } if ((double)width2 > 0.0) { GUI.Box(new Rect(num5 + width1, 0.0f, width2, rect3.height), GUIContent.none, this.styles.onRight); } float b = 1f; float x = this.styles.block.CalcSize(content2).x; float num6 = Mathf.Max(0.0f, num5) - 20f; float num7 = num6 + 15f; if ((double)num6 < (double)x && (double)num7 > 0.0 && (this.m_DragState == Timeline.DragStates.LeftSelection || this.m_DragState == Timeline.DragStates.Destination)) { b = 0.0f; } GUI.EndGroup(); float a = this.styles.rightBlock.normal.textColor.a; if (!Mathf.Approximately(a, b) && Event.current.type == EventType.Repaint) { this.styles.rightBlock.normal.textColor = new Color(this.styles.rightBlock.normal.textColor.r, this.styles.rightBlock.normal.textColor.g, this.styles.rightBlock.normal.textColor.b, Mathf.Lerp(a, b, 0.1f)); HandleUtility.Repaint(); } GUI.Box(position8, content2, this.styles.rightBlock); position8 = new Rect(position8.xMax, position8.yMin, position8.xMax - position8.xMin, 32f); } GUI.Box(position4, GUIContent.none, this.styles.select); GUI.Box(position3, GUIContent.none, this.styles.selectHead); this.m_TimeArea.TimeRuler(position1, 30f); GUI.Box(position5, GUIContent.none, !this.m_HasExitTime ? this.styles.handLeftPrev : this.styles.handLeft); GUI.Box(position6, GUIContent.none, this.styles.handRight); GUI.Box(position7, GUIContent.none, this.styles.playhead); Color color = Handles.color; Handles.color = Color.white; Handles.DrawLine(new Vector3(pixel3, 19f, 0.0f), new Vector3(pixel3, rect1.height, 0.0f)); Handles.color = color; bool flag2 = (double)this.SrcStopTime - (double)this.SrcStartTime < 0.0333333350718021; bool flag3 = (double)this.DstStopTime - (double)this.DstStartTime < 0.0333333350718021; if (this.m_DragState == Timeline.DragStates.Destination && !flag3) { GUI.Box(new Rect(num2 - 50f, rect3.y, 45f, rect3.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object)(float)(((double)num2 - (double)num1) / ((double)pixelX - (double)num1)))), this.styles.timeBlockRight); } if (this.m_DragState == Timeline.DragStates.LeftSelection) { if (!flag2) { GUI.Box(new Rect(num2 - 50f, rect2.y, 45f, rect2.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object)(float)(((double)num2 - (double)pixel1) / ((double)pixel2 - (double)pixel1)))), this.styles.timeBlockRight); } if (!flag3) { GUI.Box(new Rect(num2 - 50f, rect3.y, 45f, rect3.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object)(float)(((double)num2 - (double)num1) / ((double)pixelX - (double)num1)))), this.styles.timeBlockRight); } } if (this.m_DragState == Timeline.DragStates.RightSelection) { if (!flag2) { GUI.Box(new Rect(num3 + 5f, rect2.y, 45f, rect2.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object)(float)(((double)num3 - (double)pixel1) / ((double)pixel2 - (double)pixel1)))), this.styles.timeBlockLeft); } if (!flag3) { GUI.Box(new Rect(num3 + 5f, rect3.y, 45f, rect3.height), EditorGUIUtility.TempContent(string.Format("{0:0%}", (object)(float)(((double)num3 - (double)num1) / ((double)pixelX - (double)num1)))), this.styles.timeBlockLeft); } } this.DoPivotCurves(); GUI.EndGroup(); return(flag1); }