static float RotationSlider(int controlID, Vector3 cornerPos, float rotation, Vector3 pivot, Vector3 handleDir, Vector3 outwardsDir1, Vector3 outwardsDir2, float handleSize, HandlesExtra.CapFunction drawFunc, Vector2 snap) { EventType eventType = Event.current.GetTypeForControl(controlID); Vector3 b = outwardsDir1 + outwardsDir2; Vector3 guiCornerPos = HandleUtility.WorldToGUIPoint(cornerPos); Vector3 b2 = ((Vector3)HandleUtility.WorldToGUIPoint(cornerPos + b) - guiCornerPos).normalized * 15f; cornerPos = HandlesExtra.GUIToWorld(guiCornerPos + b2); Vector3 newPosition = HandlesExtra.Slider2D(controlID, cornerPos, drawFunc); rotation = rotation - AngleAroundAxis(newPosition - pivot, cornerPos - pivot, handleDir); if (eventType == EventType.Layout) { HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(cornerPos, HandleUtility.GetHandleSize(cornerPos + b) / 10f)); } if (eventType == EventType.Repaint) { if ((HandleUtility.nearestControl == controlID && GUIUtility.hotControl == 0) || GUIUtility.hotControl == controlID) { Rect cursorRect = new Rect(0, 0, 20f, 20f); cursorRect.center = Event.current.mousePosition; EditorGUIUtility.AddCursorRect(cursorRect, MouseCursor.RotateArrow, controlID); } } return(rotation); }
public static void DrawBoneOutline(Vector3 position, Vector3 endPoint, float radius, float outlineSize, Color color) { Handles.color = color; HandlesExtra.DrawLine(position, endPoint, Vector3.back, 2f * (radius + outlineSize), 2f * outlineSize); HandlesExtra.DrawCircle(position, radius + outlineSize); HandlesExtra.DrawCircle(position, outlineSize); }
public static void DrawBoneCap(Vector3 position, float radius, Color outer, Color inner) { Handles.color = outer; HandlesExtra.DrawCircle(position, radius); Handles.color = inner; HandlesExtra.DrawCircle(position, radius * 0.65f); }
static Vector3 SideSlider(int controlID, Vector3 position, Vector3 sideVector, Vector3 direction, HandlesExtra.CapFunction drawFunc) { Vector3 vector = HandlesExtra.Slider2D(controlID, position, drawFunc); vector = position + Vector3.Project(vector - position, direction); return(vector); }
static Rect MoveHandlesGUI(Rect rect, ref Vector3 position, Quaternion rotation, bool anchorPivot = false) { int controlID = GUIUtility.GetControlID("RectMoveHandles".GetHashCode(), FocusType.Passive); EventType eventType = Event.current.GetTypeForControl(controlID); if (eventType == EventType.MouseDown) { s_StartRect = rect; } EditorGUI.BeginChangeCheck(); Vector3 newPosition = HandlesExtra.Slider2D(controlID, position, null); if (EditorGUI.EndChangeCheck()) { if (anchorPivot) { Vector2 delta = Quaternion.Inverse(rotation) * (newPosition - position); rect.min = s_StartRect.min + delta; rect.max = s_StartRect.max + delta; } else { position = newPosition; } } if (eventType == EventType.Layout) { Vector2 mousePositionRectSpace = Vector2.zero; mousePositionRectSpace = Quaternion.Inverse(rotation) * (HandlesExtra.GUIToWorld(Event.current.mousePosition) - position); if (rect.Contains(mousePositionRectSpace, true)) { HandleUtility.AddControl(controlID, 0f); } } if (eventType == EventType.Repaint) { if ((!Event.current.alt && HandleUtility.nearestControl == controlID && GUIUtility.hotControl == 0) || GUIUtility.hotControl == controlID) { Rect cursorRect = new Rect(0f, 0f, 20f, 20f); cursorRect.center = Event.current.mousePosition; EditorGUIUtility.AddCursorRect(cursorRect, MouseCursor.MoveArrow, controlID); } } return(rect); }
public static void DrawBoneBody(Vector3 position, Vector3 childPosition, float radius, Color color) { Vector3 distance = position - childPosition; if (distance.magnitude > radius) { HandlesExtra.DrawLine(position, childPosition, Vector3.back, 2f * radius, 0f, color); } }
public static void DrawBoneBody(Vector3 position, Vector3 endPosition, float radius, Color color) { Vector3 distance = position - endPosition; if (distance.magnitude > radius && color.a > 0f) { HandlesExtra.DrawLine(position, endPosition, Vector3.back, 2f * radius, 0f, color); HandlesExtra.DrawSolidArc(position, Vector3.back, Vector3.Cross(endPosition - position, Vector3.forward), 180f, radius, color); } }
public static void DrawBoneOutline(Vector3 position, Vector3 endPoint, float radius, float outlineSize, Color color) { Handles.color = color; HandlesExtra.DrawLine(position, endPoint, Vector3.back, 2f * (radius + outlineSize), 2f * outlineSize); HandlesExtra.DrawSolidArc(position, Vector3.forward, Vector3.Cross(endPoint - position, Vector3.back), 180f, radius + outlineSize, color); if (outlineSize > 0f) { HandlesExtra.DrawSolidArc(endPoint, Vector3.back, Vector3.Cross(endPoint - position, Vector3.back), 180f, outlineSize, color); } }
public static Rect Do(int controlID) { EventType eventType = Event.current.GetTypeForControl(controlID); if (eventType == EventType.MouseDown) { s_StartPosition = HandlesExtra.GUIToWorld(Event.current.mousePosition); s_EndPosition = s_StartPosition; s_currentRect.position = s_StartPosition; s_currentRect.size = Vector2.zero; } if (eventType == EventType.Layout) { HandleUtility.AddDefaultControl(controlID); } if (eventType == EventType.Repaint) { if (GUIUtility.hotControl == controlID) { RectHandles.RenderRect(s_currentRect, Vector3.zero, Quaternion.identity, new Color(0f, 1f, 1f, 1f), 0.05f, 0.8f); } } if (Camera.current) { #if UNITY_5_6_OR_NEWER s_EndPosition = Handles.Slider2D(controlID, s_EndPosition, Vector3.forward, Vector3.right, Vector3.up, HandleUtility.GetHandleSize(s_EndPosition) / 4f, (id, pos, rot, size, evt) => { }, Vector2.zero); #else s_EndPosition = Handles.Slider2D(controlID, s_EndPosition, Vector3.forward, Vector3.right, Vector3.up, HandleUtility.GetHandleSize(s_EndPosition) / 4f, (id, pos, rot, size) => {}, Vector2.zero); #endif } else { s_EndPosition = HandlesExtra.Slider2D(controlID, s_EndPosition, null); } s_currentRect.min = s_StartPosition; s_currentRect.max = s_EndPosition; return(s_currentRect); }
static Rect PivotHandleGUI(Rect rect, ref Vector3 position, Quaternion rotation) { int controlID = GUIUtility.GetControlID("RectPivotHandle".GetHashCode(), FocusType.Passive); EventType eventType = Event.current.GetTypeForControl(controlID); EditorGUI.BeginChangeCheck(); Vector3 newPosition = HandlesExtra.Slider2D(controlID, position, HandlesExtra.PivotCap); if (EditorGUI.EndChangeCheck()) { Vector3 pivotDelta = (newPosition - position); Vector2 pivotDeltaLocal = Quaternion.Inverse(rotation) * pivotDelta; position = newPosition; rect.position -= pivotDeltaLocal; } if (eventType == EventType.Layout) { float radius = HandleUtility.GetHandleSize(position) / 2f; if (Camera.current) { radius = HandleUtility.GetHandleSize(position) / 10f; } HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(position, radius)); } if (eventType == EventType.Repaint) { if ((HandleUtility.nearestControl == controlID && GUIUtility.hotControl == 0) || GUIUtility.hotControl == controlID) { Rect cursorRect = new Rect(0, 0, 20f, 20f); cursorRect.center = Event.current.mousePosition; EditorGUIUtility.AddCursorRect(cursorRect, MouseCursor.Arrow, controlID); } } return(rect); }
static void DrawPolyLineWithOffset(Color lineColor, Vector2 screenOffset, params Vector3[] points) { if (Event.current.type != EventType.Repaint) { return; } if (s_TempVectors.Length != points.Length) { s_TempVectors = new Vector3[points.Length]; } for (int i = 0; i < points.Length; i++) { s_TempVectors[i] = (Vector3)HandlesExtra.GUIToWorld(HandleUtility.WorldToGUIPoint(points[i]) + screenOffset); } Color color = Handles.color; Handles.color = lineColor; DrawPolyLine(s_TempVectors); Handles.color = color; }
static void DrawPolyLine(params Vector3[] points) { if (Event.current.type != EventType.Repaint) { return; } Color c = Handles.color; HandlesExtra.ApplyWireMaterial(); GL.PushMatrix(); GL.MultMatrix(Handles.matrix); GL.Begin(1); GL.Color(c); for (int i = 1; i < points.Length; i++) { GL.Vertex(points [i]); GL.Vertex(points [i - 1]); } GL.End(); GL.PopMatrix(); }
public static void OnSceneGUI(SceneView sceneview) { for (int i = 0; i < s_Bones.Count; i++) { Bone2D bone = s_Bones[i]; if (bone && IsVisible(bone)) { int controlID = GUIUtility.GetControlID("BoneHandle".GetHashCode(), FocusType.Passive); EventType eventType = Event.current.GetTypeForControl(controlID); if (!IsLocked(bone)) { if (eventType == EventType.MouseDown) { if (HandleUtility.nearestControl == controlID && Event.current.button == 0) { GUIUtility.hotControl = controlID; Event.current.Use(); } } if (eventType == EventType.MouseUp) { if (GUIUtility.hotControl == controlID && Event.current.button == 0) { if (EditorGUI.actionKey) { List <Object> objects = new List <Object>(Selection.objects); objects.Add(bone.gameObject); Selection.objects = objects.ToArray(); } else { Selection.activeObject = bone; } GUIUtility.hotControl = 0; Event.current.Use(); } } if (eventType == EventType.MouseDrag) { if (GUIUtility.hotControl == controlID && Event.current.button == 0) { Handles.matrix = bone.transform.localToWorldMatrix; Vector3 position = HandlesExtra.GUIToWorld(Event.current.mousePosition); BoneUtils.OrientToLocalPosition(bone, position, Event.current.shift, "Rotate", true); EditorUpdater.SetDirty("Rotate"); GUI.changed = true; Event.current.Use(); } } } if (eventType == EventType.Repaint) { if ((HandleUtility.nearestControl == controlID && GUIUtility.hotControl == 0) || GUIUtility.hotControl == controlID || Selection.gameObjects.Contains(bone.gameObject)) { Color color = Color.yellow; float outlineSize = HandleUtility.GetHandleSize(bone.transform.position) * 0.015f * bone.color.a; BoneUtils.DrawBoneOutline(bone, outlineSize, color); Bone2D outlineBone = bone.child; color.a *= 0.5f; while (outlineBone) { if (Selection.gameObjects.Contains(outlineBone.gameObject)) { outlineBone = null; } else { if (outlineBone.color.a == 0f) { outlineSize = HandleUtility.GetHandleSize(outlineBone.transform.position) * 0.015f * outlineBone.color.a; BoneUtils.DrawBoneOutline(outlineBone, outlineSize, color); outlineBone = outlineBone.child; color.a *= 0.5f; } else { outlineBone = null; } } } } if (bone.parentBone && !bone.linkedParentBone) { Color color = bone.color; color.a *= 0.25f; Handles.matrix = Matrix4x4.identity; BoneUtils.DrawBoneBody(bone.transform.position, bone.parentBone.transform.position, BoneUtils.GetBoneRadius(bone), color); } BoneUtils.DrawBoneBody(bone); Color innerColor = bone.color * 0.25f; if (bone.attachedIK && bone.attachedIK.isActiveAndEnabled) { innerColor = new Color(0f, 0.75f, 0.75f, 1f); } innerColor.a = bone.color.a; BoneUtils.DrawBoneCap(bone, innerColor); } if (!IsLocked(bone) && eventType == EventType.Layout) { HandleUtility.AddControl(controlID, HandleUtility.DistanceToLine(bone.transform.position, bone.endPosition)); } } } foreach (Control control in s_Controls) { if (control && control.isActiveAndEnabled && IsVisible(control.gameObject)) { Transform transform = control.transform; if (Selection.activeTransform != transform) { if (!control.bone || (control.bone && !Selection.transforms.Contains(control.bone.transform))) { Handles.matrix = Matrix4x4.identity; Handles.color = control.color; if (Tools.current == Tool.Move) { EditorGUI.BeginChangeCheck(); Quaternion cameraRotation = UnityEngine.Camera.current.transform.rotation; if (Event.current.type == EventType.Repaint) { UnityEngine.Camera.current.transform.rotation = transform.rotation; } float size = HandleUtility.GetHandleSize(transform.position) / 5f; //Handles.DrawLine(transform.position + transform.rotation * new Vector3(size,0f,0f), transform.position + transform.rotation * new Vector3(-size,0f,0f)); //Handles.DrawLine(transform.position + transform.rotation * new Vector3(0f,size,0f), transform.position + transform.rotation * new Vector3(0f,-size,0f)); bool guiEnabled = GUI.enabled; GUI.enabled = !IsLocked(control.gameObject); #if UNITY_5_6_OR_NEWER Vector3 newPosition = Handles.FreeMoveHandle(transform.position, transform.rotation, size, Vector3.zero, Handles.RectangleHandleCap); #else Vector3 newPosition = Handles.FreeMoveHandle(transform.position, transform.rotation, size, Vector3.zero, Handles.RectangleCap); #endif GUI.enabled = guiEnabled; if (Event.current.type == EventType.Repaint) { UnityEngine.Camera.current.transform.rotation = cameraRotation; } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(transform, "Move"); transform.position = newPosition; if (control.bone) { Undo.RecordObject(control.bone.transform, "Move"); control.bone.transform.position = newPosition; BoneUtils.OrientToChild(control.bone.parentBone, Event.current.shift, "Move", true); EditorUpdater.SetDirty("Move"); } } } else if (Tools.current == Tool.Rotate) { EditorGUI.BeginChangeCheck(); float size = HandleUtility.GetHandleSize(transform.position) * 0.5f; //Handles.DrawLine(transform.position + transform.rotation * new Vector3(size,0f,0f), transform.position + transform.rotation * new Vector3(-size,0f,0f)); //Handles.DrawLine(transform.position + transform.rotation * new Vector3(0f,size,0f), transform.position + transform.rotation * new Vector3(0f,-size,0f)); bool guiEnabled = GUI.enabled; GUI.enabled = !IsLocked(control.gameObject); Quaternion newRotation = Handles.Disc(transform.rotation, transform.position, transform.forward, size, false, 0f); GUI.enabled = guiEnabled; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(transform, "Rotate"); transform.rotation = newRotation; if (control.bone) { Undo.RecordObject(control.bone.transform, "Rotate"); control.bone.transform.rotation = newRotation; EditorUpdater.SetDirty("Rotate"); } } } } } } } }
static Vector3 SideSlider(int id, Vector3 position, Vector3 sideVector, Vector3 direction, HandlesExtra.DrawCapFunction drawFunc) { Vector3 vector = HandlesExtra.Slider2D(id, position,drawFunc); vector = position + Vector3.Project(vector - position, direction); return vector; }
static float RotationSlider(int id, Vector3 cornerPos, float rotation, Vector3 pivot, Vector3 handleDir, Vector3 outwardsDir1, Vector3 outwardsDir2, float handleSize, HandlesExtra.DrawCapFunction drawFunc, Vector2 snap) { Vector3 b = outwardsDir1 + outwardsDir2; Vector3 screenCornerPos = Handles.matrix.MultiplyPoint(cornerPos); Vector3 b2 = (Handles.matrix.MultiplyPoint(cornerPos + b) - screenCornerPos).normalized * 15f; cornerPos = Handles.inverseMatrix.MultiplyPoint(screenCornerPos + b2); Vector3 newPosition = HandlesExtra.Slider2D(id, cornerPos, drawFunc); rotation = rotation - AngleAroundAxis(newPosition - pivot, cornerPos - pivot, handleDir); if (Event.current.type == EventType.Layout) { HandleUtility.AddControl(id, HandleUtility.DistanceToCircle(cornerPos + b,10f)); } if (Event.current.type == EventType.Repaint) { if ((HandleUtility.nearestControl == id && GUIUtility.hotControl == 0) || GUIUtility.hotControl == id) { Rect cursorRect = new Rect(0, 0, 20f, 20f); cursorRect.center = Event.current.mousePosition; EditorGUIUtility.AddCursorRect(cursorRect, MouseCursor.RotateArrow); } } return rotation; }
public static void DrawBoneCap(Vector3 position, float radius, Color color) { Handles.color = color; HandlesExtra.DrawCircle(position, radius * 0.65f); }
static Rect ResizeHandlesGUI(Rect rect, ref Vector3 position, Quaternion rotation, bool anchorPivot = false) { if (Event.current.type == EventType.MouseDown) { s_StartRect = rect; s_CurrentRect = rect; s_StartPosition = position; s_StartPivot = GetNormalizedPivot(rect); } Vector3 scale = Vector3.one; Quaternion inverseRotation = Quaternion.Inverse(rotation); for (int i = 0; i <= 2; i++) { for (int j = 0; j <= 2; j++) { if (i != 1 || j != 1) { Vector3 startWorldPoint = GetRectPointInWorld(s_StartRect, s_StartPosition, rotation, i, j); Vector3 currentWorldPoint = GetRectPointInWorld(s_CurrentRect, s_StartPosition, rotation, i, j); Vector3 rectWorldPoint = GetRectPointInWorld(rect, position, rotation, i, j); int controlID = GUIUtility.GetControlID("RectResizeHandles".GetHashCode(), FocusType.Passive); EventType eventType = Event.current.GetTypeForControl(controlID); if (GUI.color.a > 0f || GUIUtility.hotControl == controlID) { EditorGUI.BeginChangeCheck(); Vector3 newPosition = Vector3.zero; MouseCursor cursor = MouseCursor.Arrow; if (i == 1 || j == 1) { Vector3 sideVector = (i != 1) ? (rotation * Vector3.up * rect.height) : (rotation * Vector3.right * rect.width); Vector3 direction = (i != 1) ? (rotation * Vector3.right) : (rotation * Vector3.up); newPosition = SideSlider(controlID, currentWorldPoint, sideVector, direction, null); if (!Event.current.alt && eventType == EventType.Layout) { Vector3 normalized2 = sideVector.normalized; Vector3 p1 = rectWorldPoint + sideVector * 0.5f; Vector3 p2 = rectWorldPoint - sideVector * 0.5f; Vector3 offset = -normalized2 *HandleUtility.GetHandleSize(p1) / 20f; Vector3 offset2 = normalized2 * HandleUtility.GetHandleSize(p2) / 20f; HandleUtility.AddControl(controlID, HandleUtility.DistanceToLine(p1 + offset, p2 + offset2)); } cursor = GetScaleCursor(direction); } else { HandlesExtra.DotCap(controlID, rectWorldPoint, Quaternion.identity, 1f, eventType); newPosition = HandlesExtra.Slider2D(controlID, currentWorldPoint, null); if (!Event.current.alt && eventType == EventType.Layout) { HandleUtility.AddControl(controlID, HandleUtility.DistanceToCircle(rectWorldPoint, HandleUtility.GetHandleSize(rectWorldPoint) / 20f)); } Vector3 outwardsDir = rotation * Vector3.right * (float)(i - 1); Vector3 outwardsDir2 = rotation * Vector3.up * (float)(j - 1); cursor = GetScaleCursor(outwardsDir + outwardsDir2); } if (eventType == EventType.Repaint) { if ((HandleUtility.nearestControl == controlID && GUIUtility.hotControl == 0) || GUIUtility.hotControl == controlID) { Rect cursorRect = new Rect(0, 0, 20f, 20f); cursorRect.center = Event.current.mousePosition; EditorGUIUtility.AddCursorRect(cursorRect, cursor, controlID); } } if (EditorGUI.EndChangeCheck()) { Vector3 scalePivot = Vector3.zero; Vector2 scalePivotLocal = Vector2.one; bool alt = Event.current.alt; bool actionKey = EditorGUI.actionKey; bool shiftDown = Event.current.shift && !actionKey; if (!alt) { scalePivot = GetRectPointInWorld(s_StartRect, s_StartPosition, rotation, 2 - i, 2 - j); scalePivotLocal = inverseRotation * (scalePivot - s_StartPosition); } Vector3 localRectPoint = inverseRotation * (startWorldPoint - scalePivot); Vector3 localNewPosition = inverseRotation * (newPosition - scalePivot); if (i != 1) { scale.x = localNewPosition.x / localRectPoint.x; } if (j != 1) { scale.y = localNewPosition.y / localRectPoint.y; } if (shiftDown) { float d = (i != 1) ? scale.x : scale.y; scale = Vector3.one * d; } if (actionKey && i == 1) { if (Event.current.shift) { scale.x = (scale.z = 1f / Mathf.Sqrt(Mathf.Max(scale.y, 0.0001f))); } else { scale.x = 1f / Mathf.Max(scale.y, 0.0001f); } } if (shiftDown) { float d2 = (i != 1) ? scale.x : scale.y; scale = Vector3.one * d2; } if (actionKey && i == 1) { if (Event.current.shift) { scale.x = (scale.z = 1f / Mathf.Sqrt(Mathf.Max(scale.y, 0.0001f))); } else { scale.x = 1f / Mathf.Max(scale.y, 0.0001f); } } if (actionKey && j == 1) { if (Event.current.shift) { scale.y = (scale.z = 1f / Mathf.Sqrt(Mathf.Max(scale.x, 0.0001f))); } else { scale.y = 1f / Mathf.Max(scale.x, 0.0001f); } } s_CurrentRect.min = Vector2.Scale(scale, s_StartRect.min - scalePivotLocal) + scalePivotLocal; s_CurrentRect.max = Vector2.Scale(scale, s_StartRect.max - scalePivotLocal) + scalePivotLocal; if (anchorPivot) { rect.min = s_CurrentRect.min; rect.max = s_CurrentRect.max; } else { rect.position = Vector2.Scale(scale, s_StartRect.position); rect.size = Vector2.Scale(scale, s_StartRect.size); Vector2 newPivot = new Vector2(s_CurrentRect.xMin + (s_CurrentRect.xMax - s_CurrentRect.xMin) * s_StartPivot.x, s_CurrentRect.yMin + (s_CurrentRect.yMax - s_CurrentRect.yMin) * s_StartPivot.y); position = s_StartPosition + rotation * newPivot; } } } } } } return(rect); }
public void TimeRuler(Rect position, float frameRate) { Color color = GUI.color; GUI.BeginGroup(position); if (Event.current.type != EventType.Repaint) { GUI.EndGroup(); return; } TimeArea.InitStyles(); HandlesExtra.ApplyWireMaterial(); GL.Begin(1); Color backgroundColor = GUI.backgroundColor; this.SetTickMarkerRanges(); this.hTicks.SetTickStrengths(3f, 80f, true); Color textColor = TimeArea.styles.TimelineTick.normal.textColor; textColor.a = 0.75f; for (int i = 0; i < this.hTicks.tickLevels; i++) { float num = this.hTicks.GetStrengthOfLevel(i) * 0.9f; float[] ticksAtLevel = this.hTicks.GetTicksAtLevel(i, true); for (int j = 0; j < ticksAtLevel.Length; j++) { if (ticksAtLevel[j] >= base.hRangeMin && ticksAtLevel[j] <= base.hRangeMax) { int num2 = Mathf.RoundToInt(ticksAtLevel[j] * frameRate); float num3 = position.height * Mathf.Min(1f, num) * 0.7f; float num4 = this.FrameToPixel((float)num2, frameRate, position); GL.Color(new Color(1f, 1f, 1f, num / 0.5f) * textColor); GL.Vertex(new Vector3(num4, position.height - num3 + 0.5f, 0f)); GL.Vertex(new Vector3(num4, position.height - 0.5f, 0f)); if (num > 0.5f) { GL.Color(new Color(1f, 1f, 1f, num / 0.5f - 1f) * textColor); GL.Vertex(new Vector3(num4 + 1f, position.height - num3 + 0.5f, 0f)); GL.Vertex(new Vector3(num4 + 1f, position.height - 0.5f, 0f)); } } } } GL.End(); int levelWithMinSeparation = this.hTicks.GetLevelWithMinSeparation(40f); float[] ticksAtLevel2 = this.hTicks.GetTicksAtLevel(levelWithMinSeparation, false); for (int k = 0; k < ticksAtLevel2.Length; k++) { if (ticksAtLevel2[k] >= base.hRangeMin && ticksAtLevel2[k] <= base.hRangeMax) { int num5 = Mathf.RoundToInt(ticksAtLevel2[k] * frameRate); float num6 = Mathf.Floor(this.FrameToPixel((float)num5, frameRate, base.rect)); string text = this.FormatFrame(num5, frameRate); GUI.Label(new Rect(num6 + 3f, -3f, 40f, 20f), text, TimeArea.styles.TimelineTick); } } GUI.EndGroup(); GUI.backgroundColor = backgroundColor; GUI.color = color; }