0.2.0: Moved into inspector drawer from module.toolbox to module.inspector

This commit is contained in:
Anders Ejlersen 2021-09-18 15:48:14 +02:00
parent 5671c2c754
commit ffec2abdf4
227 changed files with 5306 additions and 29 deletions

View file

@ -0,0 +1,9 @@
using UnityEngine;
namespace Module.Inspector
{
public abstract class AbstractMethodAttribute : PropertyAttribute
{
public abstract EMethodType Type { get; }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 04377724af9c50941a4132e012a0304b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
using UnityEngine;
namespace Module.Inspector
{
public abstract class AbstractPropertyAttribute : PropertyAttribute
{
public abstract EPropertyType Type { get; }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fcc8a63054c4c0d4cbae89798c54514d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace Module.Inspector
{
public abstract class AccessModifierMethodAttribute : AbstractMethodAttribute
{
public override EMethodType Type => EMethodType.AccessModifier;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 04a29c505958a284b999d162c4a6b245
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace Module.Inspector
{
public abstract class AccessModifierPropertyAttribute : AbstractPropertyAttribute
{
public override EPropertyType Type => EPropertyType.AccessModifier;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d160dad70565d5142b47e2eb9d1f9fe1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c9b1735cf143c104f80cd60f19678e5b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class Disable : AccessModifierPropertyAttribute
{
[Preserve]
public Disable()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 37a1b5b78d13d24498eeb5c4eb638eaa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class DisableField : AccessModifierPropertyAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
public DisableField(string fieldName)
{
this.fieldName = fieldName;
}
public DisableField(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dc1cbe4502a3d8949b359c756b1b2d76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class DisableFieldInPlayMode : AccessModifierPropertyAttribute
{
[Preserve]
public DisableFieldInPlayMode()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 880b640fbf3cf924eb280d74e2c6c247
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class DisableMethod : AccessModifierMethodAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
public DisableMethod(string fieldName)
{
this.fieldName = fieldName;
}
public DisableMethod(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3bd54811567361b45b1c8943fd0a5b78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class DisableMethodInPlayMode : AccessModifierMethodAttribute
{
[Preserve]
public DisableMethodInPlayMode()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 591693d337f993c4db5f8aff7857e485
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class EnableField : AccessModifierPropertyAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
public EnableField(string fieldName)
{
this.fieldName = fieldName;
}
public EnableField(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8867c9625eae27745be94b8600b7a556
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class EnableFieldInPlayMode : AccessModifierPropertyAttribute
{
[Preserve]
public EnableFieldInPlayMode()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c2b1ef19f320274da63ac2b5bd52897
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class EnableMethod : AccessModifierMethodAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
public EnableMethod(string fieldName)
{
this.fieldName = fieldName;
}
public EnableMethod(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 097d79c03a17a8349a74c645f098b8fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class EnableMethodInPlayMode : AccessModifierMethodAttribute
{
[Preserve]
public EnableMethodInPlayMode()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5a066db4471bd1249a6f7efa5d6ccde8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,30 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class HideField : AccessModifierPropertyAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
[Preserve]
public HideField()
{
}
public HideField(string fieldName)
{
this.fieldName = fieldName;
}
public HideField(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 840e7f4913f24ef4b849a5dbba6d5e62
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public sealed class HideInNormalInspector : AccessModifierPropertyAttribute
{
[Preserve]
public HideInNormalInspector()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fedaa2e21153a9749b8e3267973ba1ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,30 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class HideMethod : AccessModifierMethodAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
[Preserve]
public HideMethod()
{
}
public HideMethod(string fieldName)
{
this.fieldName = fieldName;
}
public HideMethod(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b2557b3cc395e5747940128702bfbaac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class ShowField : AccessModifierPropertyAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
public ShowField(string fieldName)
{
this.fieldName = fieldName;
}
public ShowField(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6db89ad9a06f94d468f564b9b4866208
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class ShowMethod : AccessModifierMethodAttribute
{
public readonly string fieldName;
public readonly bool useFieldValue;
public readonly object fieldValue;
public ShowMethod(string fieldName)
{
this.fieldName = fieldName;
}
public ShowMethod(string fieldName, object fieldValue)
{
this.fieldName = fieldName;
this.fieldValue = fieldValue;
useFieldValue = true;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c133d0f0de53b74c9ddac89e5be9a9b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace Module.Inspector
{
public abstract class DecoratorMethodAttribute : AbstractMethodAttribute
{
public override EMethodType Type => EMethodType.Decorator;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bcb003fc832a59343bf474a0ec712288
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Decorators.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d33dd1df7b837144bb86f9322b67e1b2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
using System;
using UnityEngine;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class HorizontalLine : PropertyAttribute
{
public readonly string title;
[Preserve]
public HorizontalLine()
{
}
public HorizontalLine(string title)
{
this.title = title;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f60560b1c40c2234199477a1321eb1c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class MethodHeader : DecoratorMethodAttribute
{
public readonly string title;
[Preserve]
public MethodHeader()
{
}
public MethodHeader(string title)
{
this.title = title;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1387053ae5892314bb59f3a0d3769ea6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace Module.Inspector
{
public abstract class DrawerMethodAttribute : AbstractMethodAttribute
{
public override EMethodType Type => EMethodType.Drawer;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ddfbd813bee41bb4aaea197f66ceee5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,7 @@
namespace Module.Inspector
{
public abstract class DrawerPropertyAttribute : AbstractPropertyAttribute
{
public override EPropertyType Type => EPropertyType.Drawer;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a5f34a2a2293d584aa96e682ddb6233b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Drawers.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fbe40bd4dc6215f45af89fd2066fcada
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class EnumFlag : DrawerPropertyAttribute
{
[Preserve]
public EnumFlag()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a13196e6dff9404d81a3911bb06cc55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class FilePath : DrawerPropertyAttribute
{
public readonly bool useAbsolute;
public readonly string extension = "*";
public FilePath(bool useAbsolute = false)
{
this.useAbsolute = useAbsolute;
}
public FilePath(string extension, bool useAbsolute = false)
{
this.extension = extension;
this.useAbsolute = useAbsolute;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8d62b72f20cb29b4f9ba3774c21ea275
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class FolderPath : DrawerPropertyAttribute
{
public readonly bool useAbsolute;
public FolderPath(bool useAbsolute = false)
{
this.useAbsolute = useAbsolute;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 19f4936da040eda458dad2d7ac69efcb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,48 @@
using System;
using Module.Inspector.Utilities;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class IntToEnum : DrawerPropertyAttribute
{
private Type type;
private readonly string strTypeReplaceWith;
private bool hasTriedFetchReplaceType;
[Preserve]
public IntToEnum(Type type)
{
this.type = type;
hasTriedFetchReplaceType = true;
}
[Preserve]
public IntToEnum(Type type, string strTypeReplaceWith)
{
this.type = type;
this.strTypeReplaceWith = strTypeReplaceWith;
}
public Type GetValidType()
{
if (hasTriedFetchReplaceType)
return type;
#if UNITY_EDITOR
Type replaceType = ReflectionUtility.GetAnyTypeWithName(strTypeReplaceWith);
#else
Type replaceType = null;
#endif
hasTriedFetchReplaceType = true;
if (replaceType != null)
type = replaceType;
return type;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d54a749b500e802439618671a142c976
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class IntToLayer : DrawerPropertyAttribute
{
[Preserve]
public IntToLayer()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 210d910f4eeed444e876bfedd8f6967b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class MethodButton: DrawerMethodAttribute
{
public readonly string name;
[Preserve]
public MethodButton()
{
}
public MethodButton(string name)
{
this.name = name;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aa939647376a39e4dae0c9e54bba3133
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

43
Runtime/Drawers/Naming.cs Normal file
View file

@ -0,0 +1,43 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class Naming : DrawerPropertyAttribute
{
public enum EPatternType : byte
{
/// <summary>
/// Camel casing: thisIsCamelCasing
/// </summary>
CamelCasing,
/// <summary>
/// Pascal casing: ThisIsPascalCasing
/// </summary>
PascalCasing,
/// <summary>
/// Snake casing: this_is_snake_casing
/// </summary>
SnakeCasing,
/// <summary>
/// Snake casing: THIS_IS_SNAKE_CASING_WITH_ALL_CAPS
/// </summary>
SnakeCasingAllCaps,
/// <summary>
/// Kebab casing: this-is-kebab-casing
/// </summary>
KebabCasing,
/// <summary>
/// Kebab casing: THIS_IS_KEBAB_CASING_WITH_ALL_CAPS
/// </summary>
KebabCasingAllCaps
}
public readonly EPatternType type;
public Naming(EPatternType type)
{
this.type = type;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f99c4aa6447ed24787b1d125c4ae6bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class Percentage : DrawerPropertyAttribute
{
[Preserve]
public Percentage()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dfe545e7a0cb02148bd45f51f9474a43
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class PopupFromConst : DrawerPropertyAttribute
{
public readonly Type type;
public PopupFromConst(Type type)
{
this.type = type;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9d8559005b0cb44438da12adccfcaa5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class QuaternionToEuler : DrawerPropertyAttribute
{
[Preserve]
public QuaternionToEuler()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5639ab9888faa7943b8675eb61fa7f1f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class SceneDropdown : DrawerPropertyAttribute
{
[Preserve]
public SceneDropdown()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: adc159b87625ef3468b0877d5c1e88d9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

14
Runtime/Drawers/Slider.cs Normal file
View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class Slider : DrawerPropertyAttribute
{
[Preserve]
public Slider()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac2ff972f40468140919d5b8706cabff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class StringToField : DrawerPropertyAttribute
{
public readonly Type type;
public StringToField(Type type)
{
this.type = type;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dbd081def12467742a3bf05946dc5d40
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class StringToType : DrawerPropertyAttribute
{
public readonly Type assignableFrom;
public StringToType(Type assignableFrom)
{
this.assignableFrom = assignableFrom;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7870b2ad7f2ad67469d6787848cc70de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System;
using UnityEngine.Scripting;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class UrlGoTo : DrawerPropertyAttribute
{
[Preserve]
public UrlGoTo()
{
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac9efabc5f0547f43921c2804bb85220
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Enums.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9debf833b42a21c46b4835cd0c6b7fd6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
namespace Module.Inspector
{
public enum EMethodType : byte
{
Drawer,
AccessModifier,
Decorator
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9e2a688cc0dd10c4baccd1761f96e149
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
namespace Module.Inspector
{
public enum EPropertyType : byte
{
Drawer,
ValueModifier,
AccessModifier
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0103f9597762e174c9ad5b2917da82c1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
{
"name": "Module.Inspector",
"rootNamespace": "Module.Inspector",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a58be6d007e5e434ebc9bf7f902990a7
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Utilities.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b44fa4b849c82448a7c45c2c3cecd76
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,231 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace Module.Inspector.Utilities
{
internal static class ReflectionUtility
{
#if UNITY_EDITOR
public static T GetValue<T>(object obj, string name)
{
return GetValue<T>(obj, name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static T GetValue<T>(object obj, string name, BindingFlags flags)
{
FieldInfo field = obj.GetType().GetField(name, flags);
return field != null ? (T)field.GetValue(obj) : default;
}
public static T GetValue<T>(object obj, FieldInfo field)
{
return field != null ? (T)field.GetValue(obj) : default;
}
public static T[] GetArrayValue<T>(object obj, string name)
{
return GetArrayValue<T>(obj, name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static T[] GetArrayValue<T>(object obj, string name, BindingFlags flags)
{
FieldInfo field = obj.GetType().GetField(name, flags);
return field != null ? (T[])field.GetValue(obj) : default;
}
public static void SetValue<T>(object obj, string name, T value)
{
SetValue(obj, name, value, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static void SetValue<T>(object obj, string name, T value, BindingFlags flags)
{
FieldInfo field = obj.GetType().GetField(name, flags);
if (field != null)
field.SetValue(obj, value);
}
public static void SetValue<T>(object obj, T value, FieldInfo field)
{
field.SetValue(obj, value);
}
public static void SetValue<T>(object obj, string name, T[] value)
{
SetValue(obj, name, value, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static void SetValue<T>(object obj, string name, T[] value, BindingFlags flags)
{
FieldInfo field = obj.GetType().GetField(name, flags);
if (field != null)
field.SetValue(obj, value);
}
public static FieldInfo[] GetFields<T>(BindingFlags flags)
{
return typeof(T).GetFields(flags);
}
public static FieldInfo[] GetFields(Type type, BindingFlags flags)
{
return type.GetFields(flags);
}
public static FieldInfo[] GetFields(Type type, BindingFlags flags, string[] ignoreFields)
{
var fields = new List<FieldInfo>(GetFields(type, flags));
for (int i = fields.Count - 1; i >= 0; i--)
{
FieldInfo fi = fields[i];
for (var j = 0; j < ignoreFields.Length; j++)
{
if (!fi.Name.Equals(ignoreFields[j]))
continue;
fields.RemoveAt(i);
break;
}
}
return fields.ToArray();
}
public static bool HasField<T>(object obj, string name)
{
return HasField<T>(obj, name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static bool HasField<T>(object obj, string name, BindingFlags flags)
{
FieldInfo field = obj.GetType().GetField(name, flags);
return field != null && field.FieldType.IsAssignableFrom(typeof(T));
}
public static T GetPropertyValue<T>(object obj, string name)
{
return GetPropertyValue<T>(obj, name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static T GetPropertyValue<T>(object obj, string name, BindingFlags flags)
{
PropertyInfo pi = obj.GetType().GetProperty(name, flags);
return pi != null ? (T)pi.GetValue(obj, null) : default(T);
}
public static void SetPropertyValue<T>(object obj, string name, T value)
{
SetPropertyValue<T>(obj, name, value, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
}
public static void SetPropertyValue<T>(object obj, string name, T value, BindingFlags flags)
{
PropertyInfo pi = obj.GetType().GetProperty(name, flags);
if (pi != null)
pi.SetValue(obj, value, null);
}
public static bool HasAttribute(FieldInfo field, System.Type attributeType)
{
// WSU: Needs the explicit conversion
var objs = (object[])field.GetCustomAttributes(attributeType, true);
return objs.Length != 0;
}
public static bool HasAttributeTitle(FieldInfo field)
{
return HasAttribute(field, typeof(HeaderAttribute));
}
public static T GetAttribute<T>(FieldInfo field)
{
// WSU: Needs the explicit conversion
var objs = (object[])field.GetCustomAttributes(typeof(T), true);
if (objs.Length != 0)
return (T)objs[0];
return default;
}
public static string GetAttributeTitle(FieldInfo field)
{
// WSU: Needs the explicit conversion
var objs = (object[])field.GetCustomAttributes(typeof(HeaderAttribute), true);
if (objs.Length == 0)
return "Unknown";
Type type = objs[0].GetType();
return (string)type.GetFields()[0].GetValue(objs[0]);
}
public static Type[] GetTypesWith(System.Type type)
{
Type[] types = type.Assembly.GetTypes();
var arr = new List<Type>();
for (var i = 0; i < types.Length; i++)
{
Type t = types[i];
if (t == type || type.IsAssignableFrom(t))
arr.Add(t);
}
return arr.ToArray();
}
public static Type GetAnyTypeWithName(string typeName)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
for (var i = 0; i < assemblies.Length; i++)
{
Type type = assemblies[i].GetType(typeName);
if (type != null)
return type;
}
return null;
}
public static object Create(Type type)
{
return Activator.CreateInstance(type);
}
public static void CopyFields(object source, object destination)
{
// Get fields
FieldInfo[] sourceFields = GetFields(source.GetType(), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
FieldInfo[] destinationFields = GetFields(destination.GetType(), BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
// Start setting fields (if of same type)
for (var i = 0; i < sourceFields.Length; i++)
{
FieldInfo fiSource = sourceFields[i];
for (var j = 0; j < destinationFields.Length; j++)
{
FieldInfo fiDestination = destinationFields[j];
if (fiSource.Name.Equals(fiDestination.Name) && fiSource.FieldType == fiDestination.FieldType)
{
fiDestination.SetValue(destination, fiSource.GetValue(source));
break;
}
}
}
}
#endif
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 347153fa5a0849c6a320237332288c61
timeCreated: 1594144995

View file

@ -0,0 +1,7 @@
namespace Module.Inspector
{
public abstract class ValueModifierPropertyAttribute : AbstractPropertyAttribute
{
public override EPropertyType Type => EPropertyType.ValueModifier;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9d6d384fd2f87fa41ba6dfd9b200de3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9151495f1ed9ccb4391516420e50d18c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class ArrayIndex : ValueModifierPropertyAttribute
{
public readonly string fieldName;
public ArrayIndex(string fieldName)
{
this.fieldName = fieldName;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0582e0b83200e0f41a362856b299c773
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class LargerThanField : ValueModifierPropertyAttribute
{
public readonly string fieldName;
public LargerThanField(string fieldName)
{
this.fieldName = fieldName;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5852536dc58cd4d448cb4409df39bcf7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
using UnityEngine;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class MaxValue : ValueModifierPropertyAttribute
{
public readonly int intValue;
public readonly float floatValue;
public MaxValue(int value)
{
intValue = value;
floatValue = value;
}
public MaxValue(float value)
{
intValue = Mathf.RoundToInt(value);
floatValue = value;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa22cb1d8cf75d344b2da0b84e5439ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using System;
using UnityEngine;
namespace Module.Inspector
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class MinValue : ValueModifierPropertyAttribute
{
public readonly int intValue;
public readonly float floatValue;
public MinValue(int value)
{
intValue = value;
floatValue = value;
}
public MinValue(float value)
{
intValue = Mathf.RoundToInt(value);
floatValue = value;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c3c28b3d8c494014f9061e5af6800576
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show more