This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -10,6 +10,17 @@ namespace BITKit
[AttributeUsage(AttributeTargets.Field)]
public class InjectAttribute : System.Attribute
{
public static void Clear(object obj)
{
var fields = obj.GetType().GetFields(ReflectionHelper.Flags);
foreach (var field in fields)
{
if (field.GetCustomAttributes(typeof(InjectAttribute), true).Length > 0)
{
field.SetValue(obj, null);
}
}
}
public readonly bool CanBeNull;
public InjectAttribute()
{
@@ -20,21 +31,41 @@ namespace BITKit
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
public class CustomTypeAttribute : System.Attribute
{
public readonly Type Type;
public readonly bool AsGlobal;
public CustomTypeAttribute(Type type)
{
Type = type;
}
public CustomTypeAttribute(Type type, bool asGlobal)
{
Type = type;
AsGlobal = asGlobal;
}
public CustomTypeAttribute(bool asGlobal)
{
AsGlobal = asGlobal;
}
}
#if UNITY_64
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class ExportAttribute : System.Attribute
{
public readonly string Name;
public readonly IExportSetting Settings;
public ExportAttribute(){}
public ExportAttribute(IExportSetting settings)
{
Settings = settings;
}
public ExportAttribute(string name)
{
Name = name;
}
}
public interface IExportSetting{}
#endif
}