mirror of
https://github.com/maxartz15/UnitySerializedReferenceUI.git
synced 2025-07-04 01:46:09 +02:00
formatting
This commit is contained in:
@ -6,10 +6,10 @@ public static class SerializedReferenceUIDefaultTypeRestrictions
|
||||
{
|
||||
public static IEnumerable<Func<Type, bool>> GetAllBuiltInTypeRestrictions(FieldInfo fieldInfo)
|
||||
{
|
||||
var result = new List<Func<Type, bool>>();
|
||||
|
||||
var attributeObjects = fieldInfo.GetCustomAttributes(false);
|
||||
foreach (var attributeObject in attributeObjects)
|
||||
List<Func<Type, bool>> result = new List<Func<Type, bool>>();
|
||||
|
||||
object[] attributeObjects = fieldInfo.GetCustomAttributes(false);
|
||||
foreach (object attributeObject in attributeObjects)
|
||||
{
|
||||
switch (attributeObject)
|
||||
{
|
||||
|
@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public static class SerializeReferenceTypeRestrictionFilters
|
||||
{
|
||||
public static Func<Type, bool> TypeIsNotSubclassOrEqualOrHasInterface(Type[] types) => type =>
|
||||
TypeIsSubclassOrEqualOrHasInterface(types).Invoke(type) == false;
|
||||
|
||||
public static Func<Type, bool> TypeIsSubclassOrEqualOrHasInterface(Type[] types) => type =>
|
||||
types.Any(e => e.IsInterface ? TypeHasInterface(type, e) : TypeIsSubclassOrEqual(type, e));
|
||||
public static Func<Type, bool> TypeIsNotSubclassOrEqualOrHasInterface(Type[] types) => type => TypeIsSubclassOrEqualOrHasInterface(types).Invoke(type) == false;
|
||||
public static Func<Type, bool> TypeIsSubclassOrEqualOrHasInterface(Type[] types) => type => types.Any(e => e.IsInterface ? TypeHasInterface(type, e) : TypeIsSubclassOrEqual(type, e));
|
||||
|
||||
public static bool TypeIsSubclassOrEqual(Type type, Type comparator) => type.IsSubclassOf(comparator) || type == comparator;
|
||||
public static bool TypeHasInterface(this Type type, Type comparator) => type.GetInterface(comparator.ToString()) != null;
|
||||
|
Reference in New Issue
Block a user