Optimize class type search code

优化类型搜索方式,改为全域搜索类型。
This commit is contained in:
hevinci
2022-04-26 18:24:14 +08:00
parent e9d31bbf94
commit 5484b604a7
3 changed files with 10 additions and 141 deletions
@@ -198,8 +198,9 @@ namespace YooAsset.Editor
/// 获取加密类的类型列表
/// </summary>
private List<Type> GetEncryptionServicesClassTypes()
{
List<Type> classTypes = AssemblyUtility.GetAssignableTypes(AssemblyUtility.UnityDefaultAssemblyEditorName, typeof(IEncryptionServices));
{
TypeCache.TypeCollection collection = TypeCache.GetTypesDerivedFrom<IEncryptionServices>();
List<Type> classTypes = collection.ToList();
return classTypes;
}
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
@@ -110,7 +111,9 @@ namespace YooAsset.Editor
typeof(PackGrouper),
typeof(PackRawFile),
};
var customTypes = AssemblyUtility.GetAssignableTypes(AssemblyUtility.UnityDefaultAssemblyEditorName, typeof(IPackRule));
TypeCache.TypeCollection collection = TypeCache.GetTypesDerivedFrom<IPackRule>();
var customTypes = collection.ToList();
types.AddRange(customTypes);
for (int i = 0; i < types.Count; i++)
{
@@ -134,7 +137,9 @@ namespace YooAsset.Editor
typeof(CollectPrefab),
typeof(CollectSprite)
};
var customTypes = AssemblyUtility.GetAssignableTypes(AssemblyUtility.UnityDefaultAssemblyEditorName, typeof(IFilterRule));
TypeCache.TypeCollection collection = TypeCache.GetTypesDerivedFrom<IFilterRule>();
var customTypes = collection.ToList();
types.AddRange(customTypes);
for (int i = 0; i < types.Count; i++)
{