1
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user