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:
parent
10d07b986f
commit
fe82c5c9fa
22 changed files with 669 additions and 48 deletions
|
|
@ -27,7 +27,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
IsBuildEnabled = EditorGUILayout.Toggle("Enable Build Target picker", IsBuildEnabled);
|
||||
IsBuildEnabled = EditorGUILayout.Toggle("Enable Build Target", IsBuildEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Editor/Toolbar/Tools/Settings/ToolbarPlayerPrefsSettings.cs
Normal file
26
Editor/Toolbar/Tools/Settings/ToolbarPlayerPrefsSettings.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using UnityEditor;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
internal sealed class ToolbarPlayerPrefsSettings : IToolbarSettings
|
||||
{
|
||||
public string Title => "Player Prefs";
|
||||
|
||||
private const string PREF_PLAYER_PREFS_ENABLED = "ToolbarSettings.IsPlayerPrefsEnabled";
|
||||
|
||||
public static bool IsPlayerPrefsEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_PLAYER_PREFS_ENABLED, false);
|
||||
set => EditorPrefs.SetBool(PREF_PLAYER_PREFS_ENABLED, value);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
IsPlayerPrefsEnabled = EditorGUILayout.Toggle("Enable Player Prefs", IsPlayerPrefsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed84516c9799495c829d09ad6076124d
|
||||
timeCreated: 1670362850
|
||||
|
|
@ -13,6 +13,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
private const string PREF_IS_SCENE_ENABLED = "ToolbarSettings_IsSceneEnabled";
|
||||
private const string PREF_SCENE_ASSET_LABELS = "ToolbarSettings_SceneAssetLabels";
|
||||
private const string PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY = "ToolbarSettings_ScenePickerLoadSetAsAdditive";
|
||||
|
||||
public static bool IsSceneEnabled
|
||||
{
|
||||
|
|
@ -25,6 +26,12 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
get => EditorPrefs.GetString(PREF_SCENE_ASSET_LABELS).Split(',').ToList();
|
||||
private set => EditorPrefs.SetString(PREF_SCENE_ASSET_LABELS, string.Join(",", value));
|
||||
}
|
||||
|
||||
public static bool IsScenePickerSetAsAdditive
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY, false);
|
||||
set => EditorPrefs.SetBool(PREF_SCENE_PICKER_LOAD_SET_AS_ADDITIVE_KEY, value);
|
||||
}
|
||||
|
||||
private ReorderableList assetLabelList;
|
||||
private List<string> assetLabels;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
internal sealed class ToolbarTargetFrameRateSettings : IToolbarSettings
|
||||
{
|
||||
public string Title => "Target Frame Rate";
|
||||
|
||||
private const string PREF_IS_TARGET_FRAME_RATE_ENABLED = "ToolbarSettings.IsTargetFrameRateEnabled";
|
||||
private const string PREF_TARGET_FRAME_RATE_MIN = "ToolbarSettings.TargetFrameRateMin";
|
||||
private const string PREF_TARGET_FRAME_RATE_MAX = "ToolbarSettings.TargetFrameRateMax";
|
||||
|
||||
public static bool IsTargetFrameRateEnabled
|
||||
{
|
||||
get => EditorPrefs.GetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, false);
|
||||
set => EditorPrefs.SetBool(PREF_IS_TARGET_FRAME_RATE_ENABLED, value);
|
||||
}
|
||||
|
||||
public static int TargetFrameRateMinValue
|
||||
{
|
||||
get => EditorPrefs.GetInt(PREF_TARGET_FRAME_RATE_MIN, 10);
|
||||
set => EditorPrefs.SetInt(PREF_TARGET_FRAME_RATE_MIN, value);
|
||||
}
|
||||
|
||||
public static int TargetFrameRateMaxValue
|
||||
{
|
||||
get => EditorPrefs.GetInt(PREF_TARGET_FRAME_RATE_MAX, 144);
|
||||
set => EditorPrefs.SetInt(PREF_TARGET_FRAME_RATE_MAX, value);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
IsTargetFrameRateEnabled = EditorGUILayout.Toggle("Enable Frame Rate", IsTargetFrameRateEnabled);
|
||||
|
||||
GUI.enabled = IsTargetFrameRateEnabled;
|
||||
int minValue = EditorGUILayout.IntField("Min", TargetFrameRateMinValue);
|
||||
int maxValue = EditorGUILayout.IntField("Max", TargetFrameRateMaxValue);
|
||||
|
||||
if (minValue != TargetFrameRateMinValue)
|
||||
{
|
||||
if (minValue < 1)
|
||||
minValue = 1;
|
||||
|
||||
if (minValue > maxValue)
|
||||
maxValue = minValue;
|
||||
}
|
||||
else if (maxValue != TargetFrameRateMaxValue)
|
||||
{
|
||||
if (maxValue < 1)
|
||||
maxValue = 1;
|
||||
|
||||
if (maxValue < minValue)
|
||||
minValue = maxValue;
|
||||
}
|
||||
|
||||
TargetFrameRateMinValue = minValue;
|
||||
TargetFrameRateMaxValue = maxValue;
|
||||
GUI.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3f20d59ea6be4e4ab06ab8960c16fcd2
|
||||
timeCreated: 1670355420
|
||||
|
|
@ -35,7 +35,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
IsTimeScaleEnabled = EditorGUILayout.Toggle("Enable Time Scale slider", IsTimeScaleEnabled);
|
||||
IsTimeScaleEnabled = EditorGUILayout.Toggle("Enable Time slider", IsTimeScaleEnabled);
|
||||
|
||||
GUI.enabled = IsTimeScaleEnabled;
|
||||
float timeScaleMinValue = EditorGUILayout.FloatField("Min Value", TimeScaleMinValue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue