Renamed all attributes and drawers to have postfix of either Attribute or AttributeDrawer
This commit is contained in:
parent
81bac32538
commit
dc15bfec81
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Disable))]
|
[CustomPropertyDrawer(typeof(DisableAttribute))]
|
||||||
internal sealed class DrawerDisable : AccessModifierPropertyDrawer
|
internal sealed class DisableAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(DisableField))]
|
[CustomPropertyDrawer(typeof(DisableFieldAttribute))]
|
||||||
internal sealed class DrawerDisableField : AccessModifierPropertyDrawer
|
internal sealed class DisableFieldAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
var att = (DisableField)attribute;
|
var att = (DisableFieldAttribute)attribute;
|
||||||
|
|
||||||
if (currentAccessType == EAccessType.Enabled && property.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue))
|
if (currentAccessType == EAccessType.Enabled && property.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue))
|
||||||
currentAccessType = EAccessType.ReadOnly;
|
currentAccessType = EAccessType.ReadOnly;
|
||||||
|
|
@ -3,8 +3,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(DisableFieldInPlayMode))]
|
[CustomPropertyDrawer(typeof(DisableFieldInPlayModeAttribute))]
|
||||||
internal sealed class DrawerDisableFieldInPlayMode : AccessModifierPropertyDrawer
|
internal sealed class DisableFieldInPlayModeAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -4,12 +4,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(DisableMethod))]
|
[CustomMethodDrawer(typeof(DisableMethodAttribute))]
|
||||||
internal sealed class DrawerDisableMethod : AccessModifierMethodDrawer
|
internal sealed class DisableMethodAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
var att = (DisableMethod)attribute;
|
var att = (DisableMethodAttribute)attribute;
|
||||||
|
|
||||||
if (currentAccessType == EAccessType.Enabled && EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue))
|
if (currentAccessType == EAccessType.Enabled && EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue))
|
||||||
currentAccessType = EAccessType.ReadOnly;
|
currentAccessType = EAccessType.ReadOnly;
|
||||||
|
|
@ -3,8 +3,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(DisableMethodInPlayMode))]
|
[CustomMethodDrawer(typeof(DisableMethodInPlayModeAttribute))]
|
||||||
internal sealed class DrawerDisableMethodInPlayMode : AccessModifierMethodDrawer
|
internal sealed class DisableMethodInPlayModeAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(EnableField))]
|
[CustomPropertyDrawer(typeof(EnableFieldAttribute))]
|
||||||
internal sealed class DrawerEnableField : AccessModifierPropertyDrawer
|
internal sealed class EnableFieldAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
var att = (EnableField)attribute;
|
var att = (EnableFieldAttribute)attribute;
|
||||||
|
|
||||||
if (currentAccessType == EAccessType.Enabled && !property.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue))
|
if (currentAccessType == EAccessType.Enabled && !property.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue))
|
||||||
currentAccessType = EAccessType.ReadOnly;
|
currentAccessType = EAccessType.ReadOnly;
|
||||||
|
|
@ -3,8 +3,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(EnableFieldInPlayMode))]
|
[CustomPropertyDrawer(typeof(EnableFieldInPlayModeAttribute))]
|
||||||
internal sealed class DrawerEnableFieldInPlayMode : AccessModifierPropertyDrawer
|
internal sealed class EnableFieldInPlayModeAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -4,12 +4,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(EnableMethod))]
|
[CustomMethodDrawer(typeof(EnableMethodAttribute))]
|
||||||
internal sealed class DrawerEnableMethod : AccessModifierMethodDrawer
|
internal sealed class EnableMethodAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
var att = (EnableMethod)attribute;
|
var att = (EnableMethodAttribute)attribute;
|
||||||
|
|
||||||
if (currentAccessType == EAccessType.Enabled && !EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue))
|
if (currentAccessType == EAccessType.Enabled && !EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue))
|
||||||
currentAccessType = EAccessType.ReadOnly;
|
currentAccessType = EAccessType.ReadOnly;
|
||||||
|
|
@ -3,8 +3,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(EnableMethodInPlayMode))]
|
[CustomMethodDrawer(typeof(EnableMethodInPlayModeAttribute))]
|
||||||
internal sealed class DrawerEnableMethodInPlayMode : AccessModifierMethodDrawer
|
internal sealed class EnableMethodInPlayModeAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(HideField))]
|
[CustomPropertyDrawer(typeof(HideFieldAttribute))]
|
||||||
internal sealed class DrawerHideField : AccessModifierPropertyDrawer
|
internal sealed class HideFieldAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
private static bool GetHideValue(AccessModifierPropertyAttribute attribute, SerializedProperty sp)
|
private static bool GetHideValue(AccessModifierPropertyAttribute attribute, SerializedProperty sp)
|
||||||
{
|
{
|
||||||
var att = (HideField)attribute;
|
var att = (HideFieldAttribute)attribute;
|
||||||
return string.IsNullOrEmpty(att.fieldName) || sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
|
return string.IsNullOrEmpty(att.fieldName) || sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,8 +3,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(HideInNormalInspector))]
|
[CustomMethodDrawer(typeof(HideInNormalInspectorAttribute))]
|
||||||
internal sealed class DrawerHideInNormalInspector : AccessModifierMethodDrawer
|
internal sealed class HideInNormalInspectorAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -4,8 +4,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(HideMethod))]
|
[CustomMethodDrawer(typeof(HideMethodAttribute))]
|
||||||
internal sealed class DrawerHideMethod : AccessModifierMethodDrawer
|
internal sealed class HideMethodAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
private static bool GetHideValue(AccessModifierMethodAttribute attribute, Object target)
|
private static bool GetHideValue(AccessModifierMethodAttribute attribute, Object target)
|
||||||
{
|
{
|
||||||
var att = (HideMethod)attribute;
|
var att = (HideMethodAttribute)attribute;
|
||||||
return string.IsNullOrEmpty(att.fieldName) || EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue);
|
return string.IsNullOrEmpty(att.fieldName) || EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(ShowField))]
|
[CustomPropertyDrawer(typeof(ShowFieldAttribute))]
|
||||||
internal sealed class DrawerShowField : AccessModifierPropertyDrawer
|
internal sealed class ShowFieldAttributeDrawer : AccessModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
private static bool GetVisibleValue(AccessModifierPropertyAttribute attribute, SerializedProperty sp)
|
private static bool GetVisibleValue(AccessModifierPropertyAttribute attribute, SerializedProperty sp)
|
||||||
{
|
{
|
||||||
var att = (ShowField)attribute;
|
var att = (ShowFieldAttribute)attribute;
|
||||||
return sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
|
return sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,8 +4,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(ShowMethod))]
|
[CustomMethodDrawer(typeof(ShowMethodAttribute))]
|
||||||
internal sealed class DrawerShowMethod : AccessModifierMethodDrawer
|
internal sealed class ShowMethodAttributeDrawer : AccessModifierMethodDrawer
|
||||||
{
|
{
|
||||||
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
|
||||||
{
|
{
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
private static bool GetVisibleValue(AccessModifierMethodAttribute attribute, Object target)
|
private static bool GetVisibleValue(AccessModifierMethodAttribute attribute, Object target)
|
||||||
{
|
{
|
||||||
var att = (ShowMethod)attribute;
|
var att = (ShowMethodAttribute)attribute;
|
||||||
return EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue);
|
return EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,15 +3,15 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(HorizontalLine))]
|
[CustomPropertyDrawer(typeof(HorizontalLineAttribute))]
|
||||||
public sealed class DrawerHorizontalLine : DecoratorDrawer
|
public sealed class HorizontalLineAttributeDrawer : DecoratorDrawer
|
||||||
{
|
{
|
||||||
private const float LINE_HEIGHT = 1.0f;
|
private const float LINE_HEIGHT = 1.0f;
|
||||||
private const float VERTICAL_SPACING = 4.0f;
|
private const float VERTICAL_SPACING = 4.0f;
|
||||||
|
|
||||||
public override void OnGUI(Rect position)
|
public override void OnGUI(Rect position)
|
||||||
{
|
{
|
||||||
var att = (HorizontalLine)attribute;
|
var att = (HorizontalLineAttribute)attribute;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
if (!string.IsNullOrEmpty(att.title))
|
if (!string.IsNullOrEmpty(att.title))
|
||||||
|
|
@ -3,12 +3,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(MethodHeader))]
|
[CustomMethodDrawer(typeof(MethodHeaderAttribute))]
|
||||||
public sealed class DrawerMethodHeader : DecoratorMethodDrawer
|
public sealed class MethodHeaderAttributeDrawer : DecoratorMethodDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DecoratorMethodAttribute attribute)
|
public override bool Draw(Rect position, DecoratorMethodAttribute attribute)
|
||||||
{
|
{
|
||||||
var att = (MethodHeader)attribute;
|
var att = (MethodHeaderAttribute)attribute;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(att.title))
|
if (string.IsNullOrEmpty(att.title))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
public override float GetHeight(DecoratorMethodAttribute attribute)
|
public override float GetHeight(DecoratorMethodAttribute attribute)
|
||||||
{
|
{
|
||||||
var att = (MethodHeader)attribute;
|
var att = (MethodHeaderAttribute)attribute;
|
||||||
return !string.IsNullOrEmpty(att.title) ? EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing : 0.0f;
|
return !string.IsNullOrEmpty(att.title) ? EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,8 +5,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(EnumFlag))]
|
[CustomPropertyDrawer(typeof(EnumFlagAttribute))]
|
||||||
internal sealed class DrawerEnumFlag : DrawerPropertyDrawer
|
internal sealed class EnumFlagAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
|
|
@ -4,15 +4,15 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(FilePath))]
|
[CustomPropertyDrawer(typeof(FilePathAttribute))]
|
||||||
internal sealed class DrawerFilePath : DrawerPropertyDrawer
|
internal sealed class FilePathAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (FilePath)attribute;
|
var att = (FilePathAttribute)attribute;
|
||||||
|
|
||||||
EditorGUI.BeginProperty(position, label, property);
|
EditorGUI.BeginProperty(position, label, property);
|
||||||
{
|
{
|
||||||
|
|
@ -4,15 +4,15 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(FolderPath))]
|
[CustomPropertyDrawer(typeof(FolderPathAttribute))]
|
||||||
internal sealed class DrawerFolderPath : DrawerPropertyDrawer
|
internal sealed class FolderPathAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (FolderPath)attribute;
|
var att = (FolderPathAttribute)attribute;
|
||||||
|
|
||||||
EditorGUI.BeginProperty(position, label, property);
|
EditorGUI.BeginProperty(position, label, property);
|
||||||
{
|
{
|
||||||
|
|
@ -5,8 +5,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(IntToAnimatorParameter))]
|
[CustomPropertyDrawer(typeof(IntToAnimatorParameterAttribute))]
|
||||||
internal sealed class DrawerIntToAnimatorParameter : DrawerPropertyDrawer
|
internal sealed class IntToAnimatorParameterAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private readonly List<string> names = new List<string>();
|
private readonly List<string> names = new List<string>();
|
||||||
private readonly List<int> hashes = new List<int>();
|
private readonly List<int> hashes = new List<int>();
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Module.Inspector.Editor
|
||||||
if (property.propertyType != SerializedPropertyType.Integer)
|
if (property.propertyType != SerializedPropertyType.Integer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (IntToAnimatorParameter)attribute;
|
var att = (IntToAnimatorParameterAttribute)attribute;
|
||||||
SerializedProperty spSibling = property.GetSibling(att.animatorFieldName);
|
SerializedProperty spSibling = property.GetSibling(att.animatorFieldName);
|
||||||
|
|
||||||
if (spSibling == null)
|
if (spSibling == null)
|
||||||
|
|
@ -50,7 +50,7 @@ namespace Module.Inspector.Editor
|
||||||
if (property.propertyType != SerializedPropertyType.Integer)
|
if (property.propertyType != SerializedPropertyType.Integer)
|
||||||
return "Only supports integers";
|
return "Only supports integers";
|
||||||
|
|
||||||
var att = (IntToAnimatorParameter)attribute;
|
var att = (IntToAnimatorParameterAttribute)attribute;
|
||||||
return $"Missing field: {att.animatorFieldName}";
|
return $"Missing field: {att.animatorFieldName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5,8 +5,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(IntToEnum))]
|
[CustomPropertyDrawer(typeof(IntToEnumAttribute))]
|
||||||
internal sealed class DrawerIntToEnum : DrawerPropertyDrawer
|
internal sealed class IntToEnumAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private GUIContent[] names;
|
private GUIContent[] names;
|
||||||
private int[] values;
|
private int[] values;
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Module.Inspector.Editor
|
||||||
if (property.propertyType != SerializedPropertyType.Integer)
|
if (property.propertyType != SerializedPropertyType.Integer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (IntToEnum)attribute;
|
var att = (IntToEnumAttribute)attribute;
|
||||||
FetchLayerNames(att);
|
FetchLayerNames(att);
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Module.Inspector.Editor
|
||||||
return "Only supports integers";
|
return "Only supports integers";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FetchLayerNames(IntToEnum attribute)
|
private void FetchLayerNames(IntToEnumAttribute attribute)
|
||||||
{
|
{
|
||||||
if (names != null)
|
if (names != null)
|
||||||
return;
|
return;
|
||||||
|
|
@ -6,8 +6,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(IntToLayer))]
|
[CustomPropertyDrawer(typeof(IntToLayerAttribute))]
|
||||||
internal sealed class DrawerIntToLayer : DrawerPropertyDrawer
|
internal sealed class IntToLayerAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private static GUIContent[] NAMES;
|
private static GUIContent[] NAMES;
|
||||||
private static int[] INDICES;
|
private static int[] INDICES;
|
||||||
|
|
@ -3,12 +3,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomMethodDrawer(typeof(MethodButton))]
|
[CustomMethodDrawer(typeof(MethodButtonAttribute))]
|
||||||
internal sealed class DrawerMethodButton : DrawerMethodDrawer
|
internal sealed class MethodButtonAttributeDrawer : DrawerMethodDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerMethodAttribute attribute, Object target, MethodInfo methodInfo)
|
public override bool Draw(Rect position, DrawerMethodAttribute attribute, Object target, MethodInfo methodInfo)
|
||||||
{
|
{
|
||||||
var att = (MethodButton)attribute;
|
var att = (MethodButtonAttribute)attribute;
|
||||||
string name = string.IsNullOrEmpty(att.name) ? methodInfo.Name : att.name;
|
string name = string.IsNullOrEmpty(att.name) ? methodInfo.Name : att.name;
|
||||||
|
|
||||||
if (GUI.Button(position, name))
|
if (GUI.Button(position, name))
|
||||||
|
|
@ -4,15 +4,15 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Naming))]
|
[CustomPropertyDrawer(typeof(NamingAttribute))]
|
||||||
internal sealed class DrawerNaming : DrawerPropertyDrawer
|
internal sealed class NamingAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (Naming)attribute;
|
var att = (NamingAttribute)attribute;
|
||||||
|
|
||||||
EditorGUI.BeginProperty(position, label, property);
|
EditorGUI.BeginProperty(position, label, property);
|
||||||
{
|
{
|
||||||
|
|
@ -4,8 +4,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Percentage))]
|
[CustomPropertyDrawer(typeof(PercentageAttribute))]
|
||||||
internal sealed class DrawerPercentage : DrawerPropertyDrawer
|
internal sealed class PercentageAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
|
|
@ -7,8 +7,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(PopupFromConst))]
|
[CustomPropertyDrawer(typeof(PopupFromConstAttribute))]
|
||||||
internal sealed class DrawerPopupFromConst : DrawerPropertyDrawer
|
internal sealed class PopupFromConstAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private GUIContent[] names;
|
private GUIContent[] names;
|
||||||
private string[] values;
|
private string[] values;
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Module.Inspector.Editor
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (PopupFromConst)attribute;
|
var att = (PopupFromConstAttribute)attribute;
|
||||||
FetchConstArray(att);
|
FetchConstArray(att);
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Module.Inspector.Editor
|
||||||
return "Only supports integers";
|
return "Only supports integers";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FetchConstArray(PopupFromConst attribute)
|
private void FetchConstArray(PopupFromConstAttribute attribute)
|
||||||
{
|
{
|
||||||
if (names != null)
|
if (names != null)
|
||||||
return;
|
return;
|
||||||
|
|
@ -4,8 +4,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(QuaternionToEuler))]
|
[CustomPropertyDrawer(typeof(QuaternionToEulerAttribute))]
|
||||||
internal sealed class DrawerQuaternionToEuler : DrawerPropertyDrawer
|
internal sealed class QuaternionToEulerAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
|
|
@ -6,8 +6,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(SceneDropdown))]
|
[CustomPropertyDrawer(typeof(SceneDropdownAttribute))]
|
||||||
internal sealed class DrawerSceneDropdown : DrawerPropertyDrawer
|
internal sealed class SceneDropdownAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private static GUIContent[] NAMES;
|
private static GUIContent[] NAMES;
|
||||||
private static string[] PATHS;
|
private static string[] PATHS;
|
||||||
|
|
@ -4,13 +4,13 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Slider))]
|
[CustomPropertyDrawer(typeof(SliderAttribute))]
|
||||||
internal sealed class DrawerSlider : DrawerPropertyDrawer
|
internal sealed class SliderAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
var min = result.GetValueModifier<MinValue>();
|
var min = result.GetValueModifier<MinValueAttribute>();
|
||||||
var max = result.GetValueModifier<MaxValue>();
|
var max = result.GetValueModifier<MaxValueAttribute>();
|
||||||
|
|
||||||
if (min == null || max == null)
|
if (min == null || max == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Module.Inspector.Editor
|
||||||
return "Only supports integer, float, vector2 and vector2int";
|
return "Only supports integer, float, vector2 and vector2int";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawRange(Rect position, SerializedProperty property, GUIContent label, MinValue minValue, MaxValue maxValue)
|
private void DrawRange(Rect position, SerializedProperty property, GUIContent label, MinValueAttribute minValueAttribute, MaxValueAttribute maxValueAttribute)
|
||||||
{
|
{
|
||||||
int indentLevel = EditorGUI.indentLevel;
|
int indentLevel = EditorGUI.indentLevel;
|
||||||
float indentSpacing = indentLevel * 15.0f;
|
float indentSpacing = indentLevel * 15.0f;
|
||||||
|
|
@ -63,10 +63,10 @@ namespace Module.Inspector.Editor
|
||||||
switch (property.propertyType)
|
switch (property.propertyType)
|
||||||
{
|
{
|
||||||
case SerializedPropertyType.Integer:
|
case SerializedPropertyType.Integer:
|
||||||
property.intValue = EditorGUI.IntSlider(r1, property.intValue, minValue.intValue, maxValue.intValue);
|
property.intValue = EditorGUI.IntSlider(r1, property.intValue, minValueAttribute.intValue, maxValueAttribute.intValue);
|
||||||
break;
|
break;
|
||||||
case SerializedPropertyType.Float:
|
case SerializedPropertyType.Float:
|
||||||
property.floatValue = EditorGUI.Slider(r1, property.floatValue, minValue.floatValue, maxValue.floatValue);
|
property.floatValue = EditorGUI.Slider(r1, property.floatValue, minValueAttribute.floatValue, maxValueAttribute.floatValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Module.Inspector.Editor
|
||||||
EditorGUI.indentLevel = indentLevel;
|
EditorGUI.indentLevel = indentLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawerMinMax(Rect position, SerializedProperty property, GUIContent label, MinValue min, MaxValue max)
|
private void DrawerMinMax(Rect position, SerializedProperty property, GUIContent label, MinValueAttribute min, MaxValueAttribute max)
|
||||||
{
|
{
|
||||||
const float FLOAT_WIDTH = 50.0f;
|
const float FLOAT_WIDTH = 50.0f;
|
||||||
const float FLOAT_SPACING = 8.0f;
|
const float FLOAT_SPACING = 8.0f;
|
||||||
|
|
@ -5,8 +5,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(StringToAnimatorParameter))]
|
[CustomPropertyDrawer(typeof(StringToAnimatorParameterAttribute))]
|
||||||
internal sealed class DrawerStringToAnimatorParameter : DrawerPropertyDrawer
|
internal sealed class StringToAnimatorParameterAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private readonly List<string> names = new List<string>();
|
private readonly List<string> names = new List<string>();
|
||||||
private GUIContent[] contentArr;
|
private GUIContent[] contentArr;
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Module.Inspector.Editor
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (StringToAnimatorParameter)attribute;
|
var att = (StringToAnimatorParameterAttribute)attribute;
|
||||||
SerializedProperty spSibling = property.GetSibling(att.animatorFieldName);
|
SerializedProperty spSibling = property.GetSibling(att.animatorFieldName);
|
||||||
|
|
||||||
if (spSibling == null)
|
if (spSibling == null)
|
||||||
|
|
@ -49,7 +49,7 @@ namespace Module.Inspector.Editor
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return "Only supports strings";
|
return "Only supports strings";
|
||||||
|
|
||||||
var att = (StringToAnimatorParameter)attribute;
|
var att = (StringToAnimatorParameterAttribute)attribute;
|
||||||
return $"Missing field: {att.animatorFieldName}";
|
return $"Missing field: {att.animatorFieldName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4,15 +4,15 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(StringToField))]
|
[CustomPropertyDrawer(typeof(StringToFieldAttribute))]
|
||||||
internal sealed class DrawerStringToField : DrawerPropertyDrawer
|
internal sealed class StringToFieldAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (StringToField)attribute;
|
var att = (StringToFieldAttribute)attribute;
|
||||||
|
|
||||||
EditorGUI.BeginProperty(position, label, property);
|
EditorGUI.BeginProperty(position, label, property);
|
||||||
{
|
{
|
||||||
|
|
@ -4,15 +4,15 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(StringToType))]
|
[CustomPropertyDrawer(typeof(StringToTypeAttribute))]
|
||||||
internal sealed class DrawerStringToType : DrawerPropertyDrawer
|
internal sealed class StringToTypeAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
if (property.propertyType != SerializedPropertyType.String)
|
if (property.propertyType != SerializedPropertyType.String)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var att = (StringToType)attribute;
|
var att = (StringToTypeAttribute)attribute;
|
||||||
|
|
||||||
EditorGUI.BeginProperty(position, label, property);
|
EditorGUI.BeginProperty(position, label, property);
|
||||||
{
|
{
|
||||||
|
|
@ -5,8 +5,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(Tag))]
|
[CustomPropertyDrawer(typeof(TagAttribute))]
|
||||||
internal sealed class DrawerTag : DrawerPropertyDrawer
|
internal sealed class TagAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
private string[] names;
|
private string[] names;
|
||||||
private GUIContent[] contentArr;
|
private GUIContent[] contentArr;
|
||||||
|
|
@ -4,8 +4,8 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(UrlGoTo))]
|
[CustomPropertyDrawer(typeof(UrlGoToAttribute))]
|
||||||
internal sealed class DrawerUrlGoTo : DrawerPropertyDrawer
|
internal sealed class UrlGoToAttributeDrawer : DrawerPropertyDrawer
|
||||||
{
|
{
|
||||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||||
{
|
{
|
||||||
|
|
@ -6,21 +6,21 @@ namespace Module.Inspector.Editor.Utilities
|
||||||
{
|
{
|
||||||
public static class EditorNamingUtility
|
public static class EditorNamingUtility
|
||||||
{
|
{
|
||||||
public static string ConvertTo(Naming.EPatternType type, string str)
|
public static string ConvertTo(NamingAttribute.EPatternType type, string str)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case Naming.EPatternType.CamelCasing:
|
case NamingAttribute.EPatternType.CamelCasing:
|
||||||
return ToCamel(str);
|
return ToCamel(str);
|
||||||
case Naming.EPatternType.PascalCasing:
|
case NamingAttribute.EPatternType.PascalCasing:
|
||||||
return ToPascal(str);
|
return ToPascal(str);
|
||||||
case Naming.EPatternType.SnakeCasing:
|
case NamingAttribute.EPatternType.SnakeCasing:
|
||||||
return ToSnake(str);
|
return ToSnake(str);
|
||||||
case Naming.EPatternType.SnakeCasingAllCaps:
|
case NamingAttribute.EPatternType.SnakeCasingAllCaps:
|
||||||
return ToSnake(str).ToUpper();
|
return ToSnake(str).ToUpper();
|
||||||
case Naming.EPatternType.KebabCasing:
|
case NamingAttribute.EPatternType.KebabCasing:
|
||||||
return ToKebab(str);
|
return ToKebab(str);
|
||||||
case Naming.EPatternType.KebabCasingAllCaps:
|
case NamingAttribute.EPatternType.KebabCasingAllCaps:
|
||||||
return ToKebab(str).ToUpper();
|
return ToKebab(str).ToUpper();
|
||||||
default:
|
default:
|
||||||
return str;
|
return str;
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(ArrayIndex))]
|
[CustomPropertyDrawer(typeof(ArrayIndexAttribute))]
|
||||||
internal sealed class DrawerArrayIndex : ValueModifierPropertyDrawer
|
internal sealed class ArrayIndexAttributeDrawer : ValueModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
||||||
{
|
{
|
||||||
var att = (ArrayIndex)attribute;
|
var att = (ArrayIndexAttribute)attribute;
|
||||||
|
|
||||||
int arraySize = GetSiblingArraySize(property, att);
|
int arraySize = GetSiblingArraySize(property, att);
|
||||||
int max = arraySize > 0 ? arraySize - 1 : 0;
|
int max = arraySize > 0 ? arraySize - 1 : 0;
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Module.Inspector.Editor
|
||||||
property.intValue = value;
|
property.intValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetSiblingArraySize(SerializedProperty sp, ArrayIndex att)
|
private static int GetSiblingArraySize(SerializedProperty sp, ArrayIndexAttribute att)
|
||||||
{
|
{
|
||||||
SerializedProperty spSibling = sp.GetSibling(att.fieldName);
|
SerializedProperty spSibling = sp.GetSibling(att.fieldName);
|
||||||
return spSibling != null && spSibling.isArray ? spSibling.arraySize : 0;
|
return spSibling != null && spSibling.isArray ? spSibling.arraySize : 0;
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(LargerThanField))]
|
[CustomPropertyDrawer(typeof(LargerThanFieldAttribute))]
|
||||||
internal sealed class DrawerLargerThanField : ValueModifierPropertyDrawer
|
internal sealed class LargerThanFieldAttributeDrawer : ValueModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
||||||
{
|
{
|
||||||
var att = (LargerThanField)attribute;
|
var att = (LargerThanFieldAttribute)attribute;
|
||||||
SerializedPropertyExtension.ECompareType compareType = property.IsGreaterOrEqualToSiblingValue(att.fieldName);
|
SerializedPropertyExtension.ECompareType compareType = property.IsGreaterOrEqualToSiblingValue(att.fieldName);
|
||||||
|
|
||||||
if (compareType == SerializedPropertyExtension.ECompareType.False)
|
if (compareType == SerializedPropertyExtension.ECompareType.False)
|
||||||
|
|
@ -3,12 +3,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(MaxValue))]
|
[CustomPropertyDrawer(typeof(MaxValueAttribute))]
|
||||||
internal sealed class DrawerMaxValue : ValueModifierPropertyDrawer
|
internal sealed class MaxValueAttributeDrawer : ValueModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
||||||
{
|
{
|
||||||
var max = (MaxValue)attribute;
|
var max = (MaxValueAttribute)attribute;
|
||||||
|
|
||||||
switch (property.propertyType)
|
switch (property.propertyType)
|
||||||
{
|
{
|
||||||
|
|
@ -3,12 +3,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(MinValue))]
|
[CustomPropertyDrawer(typeof(MinValueAttribute))]
|
||||||
internal sealed class DrawerMinValue : ValueModifierPropertyDrawer
|
internal sealed class MinValueAttributeDrawer : ValueModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
||||||
{
|
{
|
||||||
var min = (MinValue)attribute;
|
var min = (MinValueAttribute)attribute;
|
||||||
|
|
||||||
switch (property.propertyType)
|
switch (property.propertyType)
|
||||||
{
|
{
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
namespace Module.Inspector.Editor
|
namespace Module.Inspector.Editor
|
||||||
{
|
{
|
||||||
[CustomPropertyDrawer(typeof(SmallerThanField))]
|
[CustomPropertyDrawer(typeof(SmallerThanFieldAttribute))]
|
||||||
internal sealed class DrawerSmallerThanField : ValueModifierPropertyDrawer
|
internal sealed class SmallerThanFieldAttributeDrawer : ValueModifierPropertyDrawer
|
||||||
{
|
{
|
||||||
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
|
||||||
{
|
{
|
||||||
var att = (SmallerThanField)attribute;
|
var att = (SmallerThanFieldAttribute)attribute;
|
||||||
SerializedPropertyExtension.ECompareType compareType = property.IsSmallerOrEqualToSiblingValue(att.fieldName);
|
SerializedPropertyExtension.ECompareType compareType = property.IsSmallerOrEqualToSiblingValue(att.fieldName);
|
||||||
|
|
||||||
if (compareType == SerializedPropertyExtension.ECompareType.False)
|
if (compareType == SerializedPropertyExtension.ECompareType.False)
|
||||||
14
Runtime/AccessModifiers/DisableAttribute.cs
Normal file
14
Runtime/AccessModifiers/DisableAttribute.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine.Scripting;
|
||||||
|
|
||||||
|
namespace Module.Inspector
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||||
|
public sealed class DisableAttribute : AccessModifierPropertyAttribute
|
||||||
|
{
|
||||||
|
[Preserve]
|
||||||
|
public DisableAttribute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,18 +3,18 @@
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class ShowField : AccessModifierPropertyAttribute
|
public sealed class DisableFieldAttribute : AccessModifierPropertyAttribute
|
||||||
{
|
{
|
||||||
public readonly string fieldName;
|
public readonly string fieldName;
|
||||||
public readonly bool useFieldValue;
|
public readonly bool useFieldValue;
|
||||||
public readonly object fieldValue;
|
public readonly object fieldValue;
|
||||||
|
|
||||||
public ShowField(string fieldName)
|
public DisableFieldAttribute(string fieldName)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShowField(string fieldName, object fieldValue)
|
public DisableFieldAttribute(string fieldName, object fieldValue)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.fieldValue = fieldValue;
|
this.fieldValue = fieldValue;
|
||||||
14
Runtime/AccessModifiers/DisableFieldInPlayModeAttribute.cs
Normal file
14
Runtime/AccessModifiers/DisableFieldInPlayModeAttribute.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine.Scripting;
|
||||||
|
|
||||||
|
namespace Module.Inspector
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||||
|
public sealed class DisableFieldInPlayModeAttribute : AccessModifierPropertyAttribute
|
||||||
|
{
|
||||||
|
[Preserve]
|
||||||
|
public DisableFieldInPlayModeAttribute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,18 +3,18 @@
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class EnableMethod : AccessModifierMethodAttribute
|
public sealed class DisableMethodAttribute : AccessModifierMethodAttribute
|
||||||
{
|
{
|
||||||
public readonly string fieldName;
|
public readonly string fieldName;
|
||||||
public readonly bool useFieldValue;
|
public readonly bool useFieldValue;
|
||||||
public readonly object fieldValue;
|
public readonly object fieldValue;
|
||||||
|
|
||||||
public EnableMethod(string fieldName)
|
public DisableMethodAttribute(string fieldName)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnableMethod(string fieldName, object fieldValue)
|
public DisableMethodAttribute(string fieldName, object fieldValue)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.fieldValue = fieldValue;
|
this.fieldValue = fieldValue;
|
||||||
|
|
@ -4,10 +4,10 @@ using UnityEngine.Scripting;
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class EnableFieldInPlayMode : AccessModifierPropertyAttribute
|
public sealed class DisableMethodInPlayModeAttribute : AccessModifierMethodAttribute
|
||||||
{
|
{
|
||||||
[Preserve]
|
[Preserve]
|
||||||
public EnableFieldInPlayMode()
|
public DisableMethodInPlayModeAttribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,18 +3,18 @@
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class EnableField : AccessModifierPropertyAttribute
|
public sealed class EnableFieldAttribute : AccessModifierPropertyAttribute
|
||||||
{
|
{
|
||||||
public readonly string fieldName;
|
public readonly string fieldName;
|
||||||
public readonly bool useFieldValue;
|
public readonly bool useFieldValue;
|
||||||
public readonly object fieldValue;
|
public readonly object fieldValue;
|
||||||
|
|
||||||
public EnableField(string fieldName)
|
public EnableFieldAttribute(string fieldName)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnableField(string fieldName, object fieldValue)
|
public EnableFieldAttribute(string fieldName, object fieldValue)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.fieldValue = fieldValue;
|
this.fieldValue = fieldValue;
|
||||||
|
|
@ -4,10 +4,10 @@ using UnityEngine.Scripting;
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class EnableMethodInPlayMode : AccessModifierMethodAttribute
|
public sealed class EnableFieldInPlayModeAttribute : AccessModifierPropertyAttribute
|
||||||
{
|
{
|
||||||
[Preserve]
|
[Preserve]
|
||||||
public EnableMethodInPlayMode()
|
public EnableFieldInPlayModeAttribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,18 +3,18 @@
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class ShowMethod : AccessModifierMethodAttribute
|
public sealed class EnableMethodAttribute : AccessModifierMethodAttribute
|
||||||
{
|
{
|
||||||
public readonly string fieldName;
|
public readonly string fieldName;
|
||||||
public readonly bool useFieldValue;
|
public readonly bool useFieldValue;
|
||||||
public readonly object fieldValue;
|
public readonly object fieldValue;
|
||||||
|
|
||||||
public ShowMethod(string fieldName)
|
public EnableMethodAttribute(string fieldName)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShowMethod(string fieldName, object fieldValue)
|
public EnableMethodAttribute(string fieldName, object fieldValue)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.fieldValue = fieldValue;
|
this.fieldValue = fieldValue;
|
||||||
|
|
@ -4,10 +4,10 @@ using UnityEngine.Scripting;
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class DisableMethodInPlayMode : AccessModifierMethodAttribute
|
public sealed class EnableMethodInPlayModeAttribute : AccessModifierMethodAttribute
|
||||||
{
|
{
|
||||||
[Preserve]
|
[Preserve]
|
||||||
public DisableMethodInPlayMode()
|
public EnableMethodInPlayModeAttribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,23 +4,23 @@ using UnityEngine.Scripting;
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||||
public sealed class HideField : AccessModifierPropertyAttribute
|
public sealed class HideFieldAttribute : AccessModifierPropertyAttribute
|
||||||
{
|
{
|
||||||
public readonly string fieldName;
|
public readonly string fieldName;
|
||||||
public readonly bool useFieldValue;
|
public readonly bool useFieldValue;
|
||||||
public readonly object fieldValue;
|
public readonly object fieldValue;
|
||||||
|
|
||||||
[Preserve]
|
[Preserve]
|
||||||
public HideField()
|
public HideFieldAttribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public HideField(string fieldName)
|
public HideFieldAttribute(string fieldName)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HideField(string fieldName, object fieldValue)
|
public HideFieldAttribute(string fieldName, object fieldValue)
|
||||||
{
|
{
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
this.fieldValue = fieldValue;
|
this.fieldValue = fieldValue;
|
||||||
|
|
@ -4,10 +4,10 @@ using UnityEngine.Scripting;
|
||||||
namespace Module.Inspector
|
namespace Module.Inspector
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
|
||||||
public sealed class HideInNormalInspector : AccessModifierPropertyAttribute
|
public sealed class HideInNormalInspectorAttribute : AccessModifierPropertyAttribute
|
||||||
{
|
{
|
||||||
[Preserve]
|
[Preserve]
|
||||||
public HideInNormalInspector()
|
public HideInNormalInspectorAttribute()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue