1.8.0: Added target frame rate and PlayerPrefs.Delete to toolbar

- Added: Tooltips on all buttons and labels in toolbar tools
- Added: Target frame rate with `[min;max]` slider in toolbar
- Added: `PlayerPrefs` delete button added to toolbar
- Added: Option to select Single/Additive scene load/unload to scene picker
- Added: All `IToolbarSettings` will be grouped with a foldout-toggle in Preferences
This commit is contained in:
Anders Ejlersen 2022-12-07 22:10:09 +01:00
parent 10d07b986f
commit fe82c5c9fa
22 changed files with 669 additions and 48 deletions

View file

@ -13,16 +13,21 @@ namespace Module.NavigationTool.Editor.Toolbar
public override EToolbarPlacement Placement => EToolbarPlacement.Left;
public override int Priority => (int)EToolbarPriority.Low;
private const string TOOLTIP = "Adjust Time.timeScale from [min;max] and snaps when value is approximately 1.0";
private static readonly GUIContent LABEL_TIME_SCALE = new GUIContent("Time scale", TOOLTIP);
private static readonly GUIContent LABEL_TIME_VALUE = new GUIContent("0.00", TOOLTIP);
protected override void Draw(Rect rect)
{
float value = Time.timeScale;
LABEL_TIME_VALUE.text = value.ToString("0.00");
var r0 = new Rect(rect.x, rect.y - 2.0f, rect.width, rect.height * 0.5f);
var r1 = new Rect(rect.x + 4.0f, rect.y + 2.0f, rect.width - 8.0f, rect.height * 0.5f);
var r2 = new Rect(rect.x, r1.yMax, rect.width, rect.height * 0.5f);
EditorGUI.LabelField(r0, "Time scale", EditorStyles.centeredGreyMiniLabel);
EditorGUI.LabelField(r2, value.ToString("0.00"), EditorStyles.centeredGreyMiniLabel);
EditorGUI.LabelField(r0, LABEL_TIME_SCALE, styles.centeredMiniLabel);
EditorGUI.LabelField(r2, LABEL_TIME_VALUE, styles.centeredMiniLabel);
float temp = GUI.HorizontalSlider(r1, value, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue);
temp = Mathf.Clamp(temp, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue);