1.10.1: Fixed issue, where scene picker settings wouldn't save, if removing a group element

This commit is contained in:
Anders Ejlersen 2024-11-25 22:10:25 +01:00
parent c1e7044561
commit 6f657c4a71
10 changed files with 28 additions and 17 deletions

View file

@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.10.1] - 2024-11-25
### Fixed
- Fixed issue, where scene picker settings wouldn't save, if removing a group element
## [1.10.0] - 2024-11-17
### Added
- Added samples for burst and entities
## [1.9.5] - 2024-07-18 ## [1.9.5] - 2024-07-18
### Fixed ### Fixed

View file

@ -8,8 +8,8 @@ namespace Module.NavigationTool.Editor.Toolbar
public string Title => "Scene"; public string Title => "Scene";
public bool IsSettingsDirty { get; private set; } public bool IsSettingsDirty { get; private set; }
private StringReordableListDrawer assetLabelList; private StringReorderableListDrawer assetLabelList;
private SceneGroupReordableListDrawer sceneGroupList; private SceneGroupReorderableListDrawer sceneGroupList;
private ToolbarProjectSettings projectSettings; private ToolbarProjectSettings projectSettings;
private Settings settings; private Settings settings;
@ -19,10 +19,10 @@ namespace Module.NavigationTool.Editor.Toolbar
this.projectSettings = projectSettings; this.projectSettings = projectSettings;
settings = projectSettings.GetValueAs<Settings>(); settings = projectSettings.GetValueAs<Settings>();
assetLabelList = new StringReordableListDrawer(settings.labels, "Scene sorting by Asset label"); assetLabelList = new StringReorderableListDrawer(settings.labels, "Scene sorting by Asset label");
assetLabelList.onChanged += ToolScenePicker.SetAsDirty; assetLabelList.onChanged += ToolScenePicker.SetAsDirty;
sceneGroupList = new SceneGroupReordableListDrawer(settings.sceneGroups.groups, "Scene groups"); sceneGroupList = new SceneGroupReorderableListDrawer(settings.sceneGroups.groups, "Scene groups");
sceneGroupList.onChanged += ToolScenePicker.SetAsDirty; sceneGroupList.onChanged += ToolScenePicker.SetAsDirty;
} }

View file

@ -223,7 +223,6 @@ namespace Module.NavigationTool.Editor.Toolbar
public static readonly GUIContent LABEL_SCENE_SINGLE = new GUIContent(string.Empty, "Single scene loading (toggle to Additive)"); public static readonly GUIContent LABEL_SCENE_SINGLE = new GUIContent(string.Empty, "Single scene loading (toggle to Additive)");
#endif #endif
public static readonly GUIContent LABEL_SCENE_CREATE = new GUIContent(string.Empty, "Create a new scene"); public static readonly GUIContent LABEL_SCENE_CREATE = new GUIContent(string.Empty, "Create a new scene");
public const float BUTTON_WIDTH = 24.0f; public const float BUTTON_WIDTH = 24.0f;
} }

View file

@ -6,7 +6,7 @@ using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
internal abstract class AbstractReordableListDrawer<T> internal abstract class AbstractReorderableListDrawer<T>
{ {
public readonly List<T> list; public readonly List<T> list;
@ -15,11 +15,11 @@ namespace Module.NavigationTool.Editor.Toolbar
public bool IsDirty { get; private set; } public bool IsDirty { get; private set; }
protected AbstractReordableListDrawer(List<T> list, string header) protected AbstractReorderableListDrawer(List<T> list, string header)
{ {
this.list = list; this.list = list;
reorderableList = new ReorderableList(list, typeof(string), true, true, true, true); reorderableList = new ReorderableList(this.list, typeof(T), true, true, true, true);
reorderableList.drawElementCallback += (rect, index, isActive, isFocused) => reorderableList.drawElementCallback += (rect, index, isActive, isFocused) =>
{ {
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
@ -36,7 +36,7 @@ namespace Module.NavigationTool.Editor.Toolbar
}; };
reorderableList.onRemoveCallback += rl => reorderableList.onRemoveCallback += rl =>
{ {
list.RemoveAt(rl.index); this.list.RemoveAt(rl.index);
OnRemovedElementFromList(rl.index); OnRemovedElementFromList(rl.index);
InvokeChanged(); InvokeChanged();
}; };
@ -70,6 +70,7 @@ namespace Module.NavigationTool.Editor.Toolbar
protected void InvokeChanged() protected void InvokeChanged()
{ {
IsDirty = true;
onChanged?.Invoke(); onChanged?.Invoke();
} }
} }

View file

@ -4,16 +4,16 @@ using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
internal sealed class SceneGroupReordableListDrawer : AbstractReordableListDrawer<SceneGroup> internal sealed class SceneGroupReorderableListDrawer : AbstractReorderableListDrawer<SceneGroup>
{ {
private readonly List<StringReordableListDrawer> elements = new List<StringReordableListDrawer>(); private readonly List<StringReorderableListDrawer> elements = new List<StringReorderableListDrawer>();
public SceneGroupReordableListDrawer(List<SceneGroup> list, string header) public SceneGroupReorderableListDrawer(List<SceneGroup> list, string header)
: base(list, header) : base(list, header)
{ {
for (var i = 0; i < list.Count; i++) for (var i = 0; i < list.Count; i++)
{ {
elements.Add(new StringReordableListDrawer(list[i].filters, "Filters")); elements.Add(new StringReorderableListDrawer(list[i].filters, "Filters"));
} }
} }
@ -61,7 +61,7 @@ namespace Module.NavigationTool.Editor.Toolbar
filters = filters filters = filters
}); });
elements.Add(new StringReordableListDrawer(filters, "Filters")); elements.Add(new StringReorderableListDrawer(filters, "Filters"));
} }
protected override void OnRemovedElementFromList(int index) protected override void OnRemovedElementFromList(int index)

View file

@ -5,9 +5,9 @@ using UnityEngine;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {
internal sealed class StringReordableListDrawer : AbstractReordableListDrawer<string> internal sealed class StringReorderableListDrawer : AbstractReorderableListDrawer<string>
{ {
public StringReordableListDrawer(List<string> list, string header) public StringReorderableListDrawer(List<string> list, string header)
: base(list, header) : base(list, header)
{ {
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "com.module.navigationtool", "name": "com.module.navigationtool",
"version": "1.10.0", "version": "1.10.1",
"displayName": "Module.NavigationTool", "displayName": "Module.NavigationTool",
"description": "Support for navigation tools, like favorites, history and toolbars", "description": "Support for navigation tools, like favorites, history and toolbars",
"unity": "2019.2", "unity": "2019.2",