diff --git a/Types/TypeFilters.Unity.cs b/Types/TypeFilters.Unity.cs new file mode 100644 index 0000000..6f192e9 --- /dev/null +++ b/Types/TypeFilters.Unity.cs @@ -0,0 +1,40 @@ +#if UNITY_2021_3_OR_NEWER +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; +using Object = UnityEngine.Object; + +namespace Exanite.Core.Types +{ + public static partial class TypeFilters + { + /// + /// Types ignored by the . + /// + public static IReadOnlyCollection UnityIgnoredTypes { get; } + + public static ITypeFilter UnitySmart { get; } + + static TypeFilters() + { + UnityIgnoredTypes = new HashSet + { + typeof(MonoBehaviour), + typeof(Behaviour), + typeof(Component), + typeof(ScriptableObject), + typeof(Object), + typeof(UIBehaviour), + typeof(Graphic), + typeof(MaskableGraphic), + }; + + UnitySmart = new TypeFilter() + .Add(new InheritanceHierarchyTypeFilter(UnityIgnoredTypes, false, false)) + .Interfaces(); + } + } +} +#endif diff --git a/Types/TypeFilters.cs b/Types/TypeFilters.cs index f3f769b..1cc1f8e 100644 --- a/Types/TypeFilters.cs +++ b/Types/TypeFilters.cs @@ -1,47 +1,10 @@ -using System; -using System.Collections.Generic; -#if UNITY_2021_3_OR_NEWER -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; -using Object = UnityEngine.Object; -#endif - namespace Exanite.Core.Types { - public static class TypeFilters + public static partial class TypeFilters { public static ITypeFilter Self { get; } = new SelfTypeFilter(); public static ITypeFilter Interface { get; } = new InterfaceTypeFilter(); public static ITypeFilter InheritanceHierarchy { get; } = new InheritanceHierarchyTypeFilter(); public static ITypeFilter Smart { get; } = new TypeFilter().InheritanceHierarchy().Interfaces(); - -#if UNITY_2021_3_OR_NEWER - /// - /// Types ignored by the . - /// - public static IReadOnlyCollection UnityIgnoredTypes { get; } - - public static ITypeFilter UnitySmart { get; } - - static TypeFilters() - { - UnityIgnoredTypes = new HashSet - { - typeof(MonoBehaviour), - typeof(Behaviour), - typeof(Component), - typeof(ScriptableObject), - typeof(Object), - typeof(UIBehaviour), - typeof(Graphic), - typeof(MaskableGraphic), - }; - - UnitySmart = new TypeFilter() - .Add(new InheritanceHierarchyTypeFilter(UnityIgnoredTypes, false, false)) - .Interfaces(); - } -#endif } }