Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 43f3947

Browse files
committed
AssetFilterEditor AssetGroupEditor
1 parent de2e8bd commit 43f3947

File tree

8 files changed

+676
-228
lines changed

8 files changed

+676
-228
lines changed

GameFramework/Editor/AssetGroupEditor/AssetFilterEditor.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class AssetFilterEditor : EditorWindow
2727
[MenuItem("Tools/Assets Management/Asset Filter")]
2828
private static void OpenWindow()
2929
{
30-
GetWindow<AssetFilterEditor>(true, "Asset Filter Editor",true).ShowModalUtility();
30+
GetWindow<AssetFilterEditor>(true, "Asset Filter Editor",true);
3131
}
3232

3333
public static List<string> GetAssetFilters()
@@ -47,6 +47,8 @@ public static List<string> GetAssetFilters()
4747
}
4848
else
4949
{
50+
AutomaticRefresh();
51+
5052
_config = new JsonData();
5153
_config.SetJsonType(JsonType.Array);
5254
}
@@ -84,16 +86,42 @@ private void SetReorderableList()
8486
_showAddItemWindow = true;
8587

8688
};
87-
8889
//_labelReorderableList.drawElementBackgroundCallback = (rect, index, isActive, isFocused) => { };
8990
//_labelReorderableList.elementHeightCallback = (index) => { return 80.0f; };
9091
}
9192

93+
private static void AutomaticRefresh()
94+
{
95+
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
96+
foreach (var item in assemblies)
97+
{
98+
foreach (var itemType in item.GetTypes())
99+
{
100+
if (!string.IsNullOrEmpty(itemType.Namespace))
101+
{
102+
if (itemType.Namespace.Contains("UnityEditor"))
103+
{
104+
continue;
105+
}
106+
}
107+
if (itemType.BaseType == typeof(ScriptableObject))
108+
{
109+
string labelName = itemType.Name;
110+
if (!_listLabels.Contains(labelName))
111+
_listLabels.Add(labelName);
112+
}
113+
}
114+
}
115+
}
92116

93117
private void OnGUI()
94118
{
95119
if (_config == null)
96120
return;
121+
if (GUILayout.Button("Automatic refresh of system type"))
122+
{
123+
AutomaticRefresh();
124+
}
97125
_scrollView = EditorGUILayout.BeginScrollView(_scrollView);
98126
//GUILayout.BeginVertical("HelpBox");
99127
_labelReorderableList?.DoLayoutList();
@@ -137,7 +165,7 @@ private void OnGUI()
137165

138166
}
139167
}
140-
168+
141169
//GUILayout.EndVertical();
142170
EditorGUILayout.EndScrollView();
143171
}

0 commit comments

Comments
 (0)