Navigation tools upgraded to use the new MainToolbarElement API
This commit is contained in:
parent
708b99f763
commit
3e1602162c
52 changed files with 837 additions and 66 deletions
|
|
@ -5,15 +5,24 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
internal sealed class ToolbarBuildSettings : IToolbarSettings
|
||||
{
|
||||
public string Title => "Build";
|
||||
|
||||
private const string PREF_IS_BUILD_ENABLED = "ToolbarSettings.IsBuildEnabled";
|
||||
private const string PREF_IS_BUILD_AND_RUN_ENABLED = "ToolbarSettings.IsBuildAndRunEnabled";
|
||||
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
private const string PREF_IS_BUILD_ENABLED = "ToolbarSettings.IsBuildEnabled";
|
||||
#endif
|
||||
|
||||
private const string PREF_IS_BUILD_AND_RUN_ENABLED = "ToolbarSettings.IsBuildAndRunEnabled";
|
||||
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
public bool EnableDraw => false;
|
||||
#endif
|
||||
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
public static bool IsBuildEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_IS_BUILD_ENABLED, false);
|
||||
set => EditorPrefs.SetBool(PREF_IS_BUILD_ENABLED, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsBuildAndRunEnabled
|
||||
{
|
||||
|
|
@ -27,7 +36,9 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
IsBuildEnabled = EditorGUILayout.Toggle("Enable Build Target", IsBuildEnabled);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEditor;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
|
|
@ -23,4 +24,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
IsPlayerPrefsEnabled = EditorGUILayout.Toggle("Enable Player Prefs", IsPlayerPrefsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,7 +18,12 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
settings = projectSettings.GetValueAs<Settings>();
|
||||
|
||||
sceneGroupList = new SceneGroupReorderableListDrawer(settings.sceneGroups.groups, "Scene groups");
|
||||
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
sceneGroupList.onChanged += MainToolbarScenePickerElement.Refresh;
|
||||
#else
|
||||
sceneGroupList.onChanged += ToolScenePicker.SetAsDirty;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
|
|
|
|||
|
|
@ -5,15 +5,24 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
internal sealed class ToolbarScenePickerSettings : IToolbarSettings
|
||||
{
|
||||
public string Title => "Scene";
|
||||
|
||||
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
private const string PREF_IS_SCENE_ENABLED = "ToolbarSettings_IsSceneEnabled";
|
||||
private const string PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY = "ToolbarSettings_ScenePickerLoadSetAsAdditive";
|
||||
#endif
|
||||
|
||||
private const string PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY = "ToolbarSettings_ScenePickerLoadSetAsAdditive";
|
||||
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
public bool EnableDraw => false;
|
||||
#endif
|
||||
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
public static bool IsSceneEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_IS_SCENE_ENABLED, true);
|
||||
private set => EditorPrefs.SetBool(PREF_IS_SCENE_ENABLED, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsScenePickerSetAsAdditive
|
||||
{
|
||||
|
|
@ -27,7 +36,9 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
IsSceneEnabled = EditorGUILayout.Toggle("Enable Scene picker", IsSceneEnabled);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEditor;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
|
|
@ -7,15 +8,24 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
{
|
||||
public string Title => "Target Frame Rate";
|
||||
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
private const string PREF_IS_TARGET_FRAME_RATE_ENABLED = "ToolbarSettings.IsTargetFrameRateEnabled";
|
||||
#endif
|
||||
|
||||
private const string PREF_TARGET_FRAME_RATE_MIN = "ToolbarSettings.TargetFrameRateMin";
|
||||
private const string PREF_TARGET_FRAME_RATE_MAX = "ToolbarSettings.TargetFrameRateMax";
|
||||
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
public bool EnableDraw => true;
|
||||
#endif
|
||||
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
public static bool IsTargetFrameRateEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, false);
|
||||
set => EditorPrefs.SetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static int TargetFrameRateMinValue
|
||||
{
|
||||
|
|
@ -35,9 +45,11 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
IsTargetFrameRateEnabled = EditorGUILayout.Toggle("Enable Frame Rate", IsTargetFrameRateEnabled);
|
||||
|
||||
GUI.enabled = IsTargetFrameRateEnabled;
|
||||
#endif
|
||||
|
||||
int minValue = EditorGUILayout.IntField("Min", TargetFrameRateMinValue);
|
||||
int maxValue = EditorGUILayout.IntField("Max", TargetFrameRateMaxValue);
|
||||
|
||||
|
|
@ -63,4 +75,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
GUI.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEditor;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
|
|
@ -31,4 +32,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
IsUiLayerEnabled = EditorGUILayout.Toggle("Enable Layer toggle", IsUiLayerEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEditor;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
|
|
@ -31,4 +32,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
IsProjectSettingsEnabled = EditorGUILayout.Toggle("Enable Project Settings button", IsProjectSettingsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolBuild : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarBuildSettings.IsBuildEnabled;
|
||||
|
|
@ -80,4 +79,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 100.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
using System;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolBuildTargetPicker : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarBuildSettings.IsBuildEnabled;
|
||||
|
|
@ -145,4 +144,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return ((int)group << 16) + (int)target;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolPlayerPrefs : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarPlayerPrefsSettings.IsPlayerPrefsEnabled;
|
||||
|
|
@ -33,4 +32,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 24.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using System;
|
||||
using System.Text;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
|
@ -8,7 +8,6 @@ using UnityEngine.SceneManagement;
|
|||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolScenePicker : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarScenePickerSettings.IsSceneEnabled;
|
||||
|
|
@ -230,4 +229,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
public const float BUTTON_WIDTH = 24.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEditor;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
|
@ -59,4 +60,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
ToolScenePicker.SetAsDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Linq;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
|
|
@ -17,4 +18,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
assets.Any(s => s.EndsWith("EditorBuildSettings.asset"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolTargetFrameRate : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarTargetFrameRateSettings.IsTargetFrameRateEnabled;
|
||||
|
|
@ -42,4 +41,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 100.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolTimeScale : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarTimeSettings.IsTimeScaleEnabled;
|
||||
|
|
@ -53,4 +52,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 100.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
|
@ -13,7 +13,6 @@ using UnityEditor.Experimental.SceneManagement;
|
|||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolUICanvasPicker : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarUiSettings.IsUiEnabled;
|
||||
|
|
@ -129,4 +128,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
IS_DIRTY = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using UnityEditor;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
|
@ -43,4 +44,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
ToolUICanvasPicker.SetAsDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolUILayerToggle : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarUiSettings.IsUiLayerEnabled;
|
||||
|
|
@ -43,4 +42,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 30.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolUnityProjectOpenSettings : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarUnitySettings.IsProjectSettingsEnabled;
|
||||
|
|
@ -36,4 +35,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 24.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
#if !UNITY_6000_3_OR_NEWER
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolUnityProjectSave : AbstractToolbarDrawer
|
||||
{
|
||||
public override bool Visible => ToolbarUnitySettings.IsProjectSaveEnabled;
|
||||
|
|
@ -29,4 +28,5 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
return 24.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue