1.10.1: Fixed issue, where scene picker settings wouldn't save, if removing a group element
This commit is contained in:
parent
c1e7044561
commit
6f657c4a71
10 changed files with 28 additions and 17 deletions
|
|
@ -6,7 +6,7 @@ using UnityEngine;
|
|||
|
||||
namespace Module.NavigationTool.Editor.Toolbar
|
||||
{
|
||||
internal abstract class AbstractReordableListDrawer<T>
|
||||
internal abstract class AbstractReorderableListDrawer<T>
|
||||
{
|
||||
public readonly List<T> list;
|
||||
|
||||
|
|
@ -15,11 +15,11 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
public bool IsDirty { get; private set; }
|
||||
|
||||
protected AbstractReordableListDrawer(List<T> list, string header)
|
||||
protected AbstractReorderableListDrawer(List<T> list, string header)
|
||||
{
|
||||
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) =>
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
|
@ -36,7 +36,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
};
|
||||
reorderableList.onRemoveCallback += rl =>
|
||||
{
|
||||
list.RemoveAt(rl.index);
|
||||
this.list.RemoveAt(rl.index);
|
||||
OnRemovedElementFromList(rl.index);
|
||||
InvokeChanged();
|
||||
};
|
||||
|
|
@ -70,6 +70,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
protected void InvokeChanged()
|
||||
{
|
||||
IsDirty = true;
|
||||
onChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,16 +4,16 @@ using UnityEngine;
|
|||
|
||||
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)
|
||||
{
|
||||
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
|
||||
});
|
||||
|
||||
elements.Add(new StringReordableListDrawer(filters, "Filters"));
|
||||
elements.Add(new StringReorderableListDrawer(filters, "Filters"));
|
||||
}
|
||||
|
||||
protected override void OnRemovedElementFromList(int index)
|
||||
|
|
@ -5,9 +5,9 @@ using UnityEngine;
|
|||
|
||||
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)
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue