using JetBrains.Annotations; using UnityEditor; using UnityEngine; using UTools = UnityEditor.Tools; namespace Module.NavigationTool.Editor.Toolbar { [UsedImplicitly] internal sealed class ToolTimeScale : AbstractToolbarDrawer { public override bool Visible => ToolbarSettings.IsTimeScaleEnabled; public override bool Enabled => true; public override EToolbarPlacement Placement => EToolbarPlacement.Left; public override int Priority => (int)EToolbarPriority.Low; protected override void Draw(Rect rect) { var r0 = new Rect(rect.x, rect.y, rect.width, rect.height * 0.5f); EditorGUI.LabelField(r0, "Time scale", EditorStyles.centeredGreyMiniLabel); var r1 = new Rect(rect.x + 4.0f, rect.y + rect.height * 0.25f, rect.width - 8.0f, rect.height * 0.5f); float value = Time.timeScale; float temp = GUI.HorizontalSlider(r1, value, 0.0f, 1.0f); if (!Mathf.Approximately(value, temp) && value > -0.001f && value < 1.001f) Time.timeScale = temp; } public override float CalculateWidth() { return 100.0f; } } }