Navigation tools upgraded to use the new MainToolbarElement API

This commit is contained in:
Anders Ejlersen 2025-12-06 15:17:30 +01:00
parent 708b99f763
commit 3e1602162c
52 changed files with 837 additions and 66 deletions

View file

@ -7,15 +7,24 @@ namespace Module.NavigationTool.Editor.Toolbar
{
public string Title => "Time";
#if !UNITY_6000_3_OR_NEWER
private const string PREF_IS_TIME_SCALE_ENABLED = "ToolbarSettings.IsTimeScaleEnabled";
#endif
private const string PREF_TIME_SCALE_MIN = "ToolbarSettings.TimeScaleMin";
private const string PREF_TIME_SCALE_MAX = "ToolbarSettings.TimeScaleMax";
#if UNITY_6000_3_OR_NEWER
public bool EnableDraw => true;
#endif
#if !UNITY_6000_3_OR_NEWER
public static bool IsTimeScaleEnabled
{
get => EditorPrefs.GetBool(PREF_IS_TIME_SCALE_ENABLED, false);
set => EditorPrefs.SetBool(PREF_IS_TIME_SCALE_ENABLED, value);
}
#endif
public static float TimeScaleMinValue
{
@ -35,9 +44,11 @@ namespace Module.NavigationTool.Editor.Toolbar
public void Draw()
{
#if !UNITY_6000_3_OR_NEWER
IsTimeScaleEnabled = EditorGUILayout.Toggle("Enable Time slider", IsTimeScaleEnabled);
GUI.enabled = IsTimeScaleEnabled;
#endif
float timeScaleMinValue = EditorGUILayout.FloatField("Min Value", TimeScaleMinValue);
float timeScaleMaxValue = EditorGUILayout.FloatField("Max Value", TimeScaleMaxValue);