-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from arimger/develop
Develop - 0.12.10
- Loading branch information
Showing
26 changed files
with
250 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 3 additions & 21 deletions
24
Assets/Editor Toolbox/Editor/Drawers/Helpers/DrawerDataStorageBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Assets/Editor Toolbox/Editor/Drawers/Helpers/DrawerStorageManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Toolbox.Editor.Drawers | ||
{ | ||
internal static class DrawerStorageManager | ||
{ | ||
static DrawerStorageManager() | ||
{ | ||
ToolboxEditorHandler.OnEditorReload -= ClearStorages; | ||
ToolboxEditorHandler.OnEditorReload += ClearStorages; | ||
} | ||
|
||
private static readonly List<DrawerDataStorageBase> storages = new List<DrawerDataStorageBase>(); | ||
|
||
internal static void ClearStorages() | ||
{ | ||
ClearStorages(null); | ||
} | ||
|
||
internal static void ClearStorages(Func<DrawerDataStorageBase, bool> predicate) | ||
{ | ||
for (var i = 0; i < storages.Count; i++) | ||
{ | ||
var storage = storages[i]; | ||
if (predicate != null && !predicate(storage)) | ||
{ | ||
continue; | ||
} | ||
|
||
storage.ClearItems(); | ||
} | ||
} | ||
|
||
internal static void AppendStorage(DrawerDataStorageBase storage) | ||
{ | ||
storages.Add(storage); | ||
} | ||
|
||
internal static bool RemoveStorage(DrawerDataStorageBase storage) | ||
{ | ||
return storages.Remove(storage); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Editor Toolbox/Editor/Drawers/Helpers/DrawerStorageManager.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Assets/Editor Toolbox/Editor/Internal/ChangeIndentScope.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using UnityEditor; | ||
|
||
namespace Toolbox.Editor.Internal | ||
{ | ||
internal class ChangeIndentScope : IDisposable | ||
{ | ||
private readonly int indentChange; | ||
|
||
public ChangeIndentScope(int indentChange) | ||
{ | ||
this.indentChange = indentChange; | ||
Prepare(indentChange); | ||
} | ||
|
||
public void Prepare(int indentChange) | ||
{ | ||
EditorGUI.indentLevel += indentChange; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
EditorGUI.indentLevel -= indentChange; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Editor Toolbox/Editor/Internal/ChangeIndentScope.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.