46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System;
|
|
|
|
namespace Module.NavigationTool.Editor.Toolbar
|
|
{
|
|
internal sealed class ToolbarScenePickerProjectSettings : IToolbarProjectSettings
|
|
{
|
|
public string Title => "Scene";
|
|
public bool IsSettingsDirty { get; private set; }
|
|
|
|
private SceneGroupReorderableListDrawer sceneGroupList;
|
|
|
|
private ToolbarProjectSettings projectSettings;
|
|
private Settings settings;
|
|
|
|
public void Initialize(ToolbarProjectSettings projectSettings)
|
|
{
|
|
this.projectSettings = projectSettings;
|
|
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()
|
|
{
|
|
sceneGroupList.DoLayoutList();
|
|
IsSettingsDirty = sceneGroupList.IsDirty;
|
|
}
|
|
|
|
public void SetSettingsValue()
|
|
{
|
|
projectSettings.SetValue(settings);
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class Settings
|
|
{
|
|
public SceneGroupArray sceneGroups = new();
|
|
}
|
|
}
|
|
} |