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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue