Renamed all attributes and drawers to have postfix of either Attribute or AttributeDrawer

This commit is contained in:
Anders Ejlersen 2021-12-04 12:47:44 +01:00
parent 81bac32538
commit dc15bfec81
161 changed files with 265 additions and 265 deletions

View file

@ -2,8 +2,8 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(Disable))]
internal sealed class DrawerDisable : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(DisableAttribute))]
internal sealed class DisableAttributeDrawer : AccessModifierPropertyDrawer
{
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
{

View file

@ -2,12 +2,12 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(DisableField))]
internal sealed class DrawerDisableField : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(DisableFieldAttribute))]
internal sealed class DisableFieldAttributeDrawer : AccessModifierPropertyDrawer
{
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))
currentAccessType = EAccessType.ReadOnly;

View file

@ -3,8 +3,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(DisableFieldInPlayMode))]
internal sealed class DrawerDisableFieldInPlayMode : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(DisableFieldInPlayModeAttribute))]
internal sealed class DisableFieldInPlayModeAttributeDrawer : AccessModifierPropertyDrawer
{
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
{

View file

@ -4,12 +4,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(DisableMethod))]
internal sealed class DrawerDisableMethod : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(DisableMethodAttribute))]
internal sealed class DisableMethodAttributeDrawer : AccessModifierMethodDrawer
{
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))
currentAccessType = EAccessType.ReadOnly;

View file

@ -3,8 +3,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(DisableMethodInPlayMode))]
internal sealed class DrawerDisableMethodInPlayMode : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(DisableMethodInPlayModeAttribute))]
internal sealed class DisableMethodInPlayModeAttributeDrawer : AccessModifierMethodDrawer
{
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
{

View file

@ -2,12 +2,12 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(EnableField))]
internal sealed class DrawerEnableField : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(EnableFieldAttribute))]
internal sealed class EnableFieldAttributeDrawer : AccessModifierPropertyDrawer
{
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))
currentAccessType = EAccessType.ReadOnly;

View file

@ -3,8 +3,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(EnableFieldInPlayMode))]
internal sealed class DrawerEnableFieldInPlayMode : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(EnableFieldInPlayModeAttribute))]
internal sealed class EnableFieldInPlayModeAttributeDrawer : AccessModifierPropertyDrawer
{
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
{

View file

@ -4,12 +4,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(EnableMethod))]
internal sealed class DrawerEnableMethod : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(EnableMethodAttribute))]
internal sealed class EnableMethodAttributeDrawer : AccessModifierMethodDrawer
{
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))
currentAccessType = EAccessType.ReadOnly;

View file

@ -3,8 +3,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(EnableMethodInPlayMode))]
internal sealed class DrawerEnableMethodInPlayMode : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(EnableMethodInPlayModeAttribute))]
internal sealed class EnableMethodInPlayModeAttributeDrawer : AccessModifierMethodDrawer
{
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
{

View file

@ -2,8 +2,8 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(HideField))]
internal sealed class DrawerHideField : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(HideFieldAttribute))]
internal sealed class HideFieldAttributeDrawer : AccessModifierPropertyDrawer
{
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)
{
var att = (HideField)attribute;
var att = (HideFieldAttribute)attribute;
return string.IsNullOrEmpty(att.fieldName) || sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
}
}

View file

@ -3,8 +3,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(HideInNormalInspector))]
internal sealed class DrawerHideInNormalInspector : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(HideInNormalInspectorAttribute))]
internal sealed class HideInNormalInspectorAttributeDrawer : AccessModifierMethodDrawer
{
public override EAccessType GetAccessType(AccessModifierMethodAttribute attribute, Object target, MethodInfo methodInfo, EAccessType currentAccessType)
{

View file

@ -4,8 +4,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(HideMethod))]
internal sealed class DrawerHideMethod : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(HideMethodAttribute))]
internal sealed class HideMethodAttributeDrawer : AccessModifierMethodDrawer
{
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)
{
var att = (HideMethod)attribute;
var att = (HideMethodAttribute)attribute;
return string.IsNullOrEmpty(att.fieldName) || EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue);
}
}

View file

@ -2,8 +2,8 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(ShowField))]
internal sealed class DrawerShowField : AccessModifierPropertyDrawer
[CustomPropertyDrawer(typeof(ShowFieldAttribute))]
internal sealed class ShowFieldAttributeDrawer : AccessModifierPropertyDrawer
{
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)
{
var att = (ShowField)attribute;
var att = (ShowFieldAttribute)attribute;
return sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
}
}

View file

@ -4,8 +4,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(ShowMethod))]
internal sealed class DrawerShowMethod : AccessModifierMethodDrawer
[CustomMethodDrawer(typeof(ShowMethodAttribute))]
internal sealed class ShowMethodAttributeDrawer : AccessModifierMethodDrawer
{
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)
{
var att = (ShowMethod)attribute;
var att = (ShowMethodAttribute)attribute;
return EditorSerializedPropertyUtility.IsValue(target, att.fieldName, att.fieldValue, att.useFieldValue);
}
}

View file

@ -3,15 +3,15 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(HorizontalLine))]
public sealed class DrawerHorizontalLine : DecoratorDrawer
[CustomPropertyDrawer(typeof(HorizontalLineAttribute))]
public sealed class HorizontalLineAttributeDrawer : DecoratorDrawer
{
private const float LINE_HEIGHT = 1.0f;
private const float VERTICAL_SPACING = 4.0f;
public override void OnGUI(Rect position)
{
var att = (HorizontalLine)attribute;
var att = (HorizontalLineAttribute)attribute;
// Title
if (!string.IsNullOrEmpty(att.title))

View file

@ -3,12 +3,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(MethodHeader))]
public sealed class DrawerMethodHeader : DecoratorMethodDrawer
[CustomMethodDrawer(typeof(MethodHeaderAttribute))]
public sealed class MethodHeaderAttributeDrawer : DecoratorMethodDrawer
{
public override bool Draw(Rect position, DecoratorMethodAttribute attribute)
{
var att = (MethodHeader)attribute;
var att = (MethodHeaderAttribute)attribute;
if (string.IsNullOrEmpty(att.title))
return false;
@ -25,7 +25,7 @@ namespace Module.Inspector.Editor
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;
}
}

View file

@ -5,8 +5,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(EnumFlag))]
internal sealed class DrawerEnumFlag : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(EnumFlagAttribute))]
internal sealed class EnumFlagAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{

View file

@ -4,15 +4,15 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(FilePath))]
internal sealed class DrawerFilePath : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(FilePathAttribute))]
internal sealed class FilePathAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (FilePath)attribute;
var att = (FilePathAttribute)attribute;
EditorGUI.BeginProperty(position, label, property);
{

View file

@ -4,15 +4,15 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(FolderPath))]
internal sealed class DrawerFolderPath : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(FolderPathAttribute))]
internal sealed class FolderPathAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (FolderPath)attribute;
var att = (FolderPathAttribute)attribute;
EditorGUI.BeginProperty(position, label, property);
{

View file

@ -5,8 +5,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(IntToAnimatorParameter))]
internal sealed class DrawerIntToAnimatorParameter : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(IntToAnimatorParameterAttribute))]
internal sealed class IntToAnimatorParameterAttributeDrawer : DrawerPropertyDrawer
{
private readonly List<string> names = new List<string>();
private readonly List<int> hashes = new List<int>();
@ -17,7 +17,7 @@ namespace Module.Inspector.Editor
if (property.propertyType != SerializedPropertyType.Integer)
return false;
var att = (IntToAnimatorParameter)attribute;
var att = (IntToAnimatorParameterAttribute)attribute;
SerializedProperty spSibling = property.GetSibling(att.animatorFieldName);
if (spSibling == null)
@ -50,7 +50,7 @@ namespace Module.Inspector.Editor
if (property.propertyType != SerializedPropertyType.Integer)
return "Only supports integers";
var att = (IntToAnimatorParameter)attribute;
var att = (IntToAnimatorParameterAttribute)attribute;
return $"Missing field: {att.animatorFieldName}";
}

View file

@ -5,8 +5,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(IntToEnum))]
internal sealed class DrawerIntToEnum : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(IntToEnumAttribute))]
internal sealed class IntToEnumAttributeDrawer : DrawerPropertyDrawer
{
private GUIContent[] names;
private int[] values;
@ -16,7 +16,7 @@ namespace Module.Inspector.Editor
if (property.propertyType != SerializedPropertyType.Integer)
return false;
var att = (IntToEnum)attribute;
var att = (IntToEnumAttribute)attribute;
FetchLayerNames(att);
EditorGUI.BeginChangeCheck();
@ -42,7 +42,7 @@ namespace Module.Inspector.Editor
return "Only supports integers";
}
private void FetchLayerNames(IntToEnum attribute)
private void FetchLayerNames(IntToEnumAttribute attribute)
{
if (names != null)
return;

View file

@ -6,8 +6,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(IntToLayer))]
internal sealed class DrawerIntToLayer : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(IntToLayerAttribute))]
internal sealed class IntToLayerAttributeDrawer : DrawerPropertyDrawer
{
private static GUIContent[] NAMES;
private static int[] INDICES;

View file

@ -3,12 +3,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomMethodDrawer(typeof(MethodButton))]
internal sealed class DrawerMethodButton : DrawerMethodDrawer
[CustomMethodDrawer(typeof(MethodButtonAttribute))]
internal sealed class MethodButtonAttributeDrawer : DrawerMethodDrawer
{
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;
if (GUI.Button(position, name))

View file

@ -4,15 +4,15 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(Naming))]
internal sealed class DrawerNaming : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(NamingAttribute))]
internal sealed class NamingAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (Naming)attribute;
var att = (NamingAttribute)attribute;
EditorGUI.BeginProperty(position, label, property);
{

View file

@ -4,8 +4,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(Percentage))]
internal sealed class DrawerPercentage : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(PercentageAttribute))]
internal sealed class PercentageAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{

View file

@ -7,8 +7,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(PopupFromConst))]
internal sealed class DrawerPopupFromConst : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(PopupFromConstAttribute))]
internal sealed class PopupFromConstAttributeDrawer : DrawerPropertyDrawer
{
private GUIContent[] names;
private string[] values;
@ -18,7 +18,7 @@ namespace Module.Inspector.Editor
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (PopupFromConst)attribute;
var att = (PopupFromConstAttribute)attribute;
FetchConstArray(att);
EditorGUI.BeginChangeCheck();
@ -44,7 +44,7 @@ namespace Module.Inspector.Editor
return "Only supports integers";
}
private void FetchConstArray(PopupFromConst attribute)
private void FetchConstArray(PopupFromConstAttribute attribute)
{
if (names != null)
return;

View file

@ -4,8 +4,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(QuaternionToEuler))]
internal sealed class DrawerQuaternionToEuler : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(QuaternionToEulerAttribute))]
internal sealed class QuaternionToEulerAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{

View file

@ -6,8 +6,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(SceneDropdown))]
internal sealed class DrawerSceneDropdown : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(SceneDropdownAttribute))]
internal sealed class SceneDropdownAttributeDrawer : DrawerPropertyDrawer
{
private static GUIContent[] NAMES;
private static string[] PATHS;

View file

@ -4,13 +4,13 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(Slider))]
internal sealed class DrawerSlider : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(SliderAttribute))]
internal sealed class SliderAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{
var min = result.GetValueModifier<MinValue>();
var max = result.GetValueModifier<MaxValue>();
var min = result.GetValueModifier<MinValueAttribute>();
var max = result.GetValueModifier<MaxValueAttribute>();
if (min == null || max == null)
return false;
@ -46,7 +46,7 @@ namespace Module.Inspector.Editor
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;
float indentSpacing = indentLevel * 15.0f;
@ -63,10 +63,10 @@ namespace Module.Inspector.Editor
switch (property.propertyType)
{
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;
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;
}
}
@ -74,7 +74,7 @@ namespace Module.Inspector.Editor
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_SPACING = 8.0f;

View file

@ -5,8 +5,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(StringToAnimatorParameter))]
internal sealed class DrawerStringToAnimatorParameter : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(StringToAnimatorParameterAttribute))]
internal sealed class StringToAnimatorParameterAttributeDrawer : DrawerPropertyDrawer
{
private readonly List<string> names = new List<string>();
private GUIContent[] contentArr;
@ -16,7 +16,7 @@ namespace Module.Inspector.Editor
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (StringToAnimatorParameter)attribute;
var att = (StringToAnimatorParameterAttribute)attribute;
SerializedProperty spSibling = property.GetSibling(att.animatorFieldName);
if (spSibling == null)
@ -49,7 +49,7 @@ namespace Module.Inspector.Editor
if (property.propertyType != SerializedPropertyType.String)
return "Only supports strings";
var att = (StringToAnimatorParameter)attribute;
var att = (StringToAnimatorParameterAttribute)attribute;
return $"Missing field: {att.animatorFieldName}";
}

View file

@ -4,15 +4,15 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(StringToField))]
internal sealed class DrawerStringToField : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(StringToFieldAttribute))]
internal sealed class StringToFieldAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (StringToField)attribute;
var att = (StringToFieldAttribute)attribute;
EditorGUI.BeginProperty(position, label, property);
{

View file

@ -4,15 +4,15 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(StringToType))]
internal sealed class DrawerStringToType : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(StringToTypeAttribute))]
internal sealed class StringToTypeAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{
if (property.propertyType != SerializedPropertyType.String)
return false;
var att = (StringToType)attribute;
var att = (StringToTypeAttribute)attribute;
EditorGUI.BeginProperty(position, label, property);
{

View file

@ -5,8 +5,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(Tag))]
internal sealed class DrawerTag : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(TagAttribute))]
internal sealed class TagAttributeDrawer : DrawerPropertyDrawer
{
private string[] names;
private GUIContent[] contentArr;

View file

@ -4,8 +4,8 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(UrlGoTo))]
internal sealed class DrawerUrlGoTo : DrawerPropertyDrawer
[CustomPropertyDrawer(typeof(UrlGoToAttribute))]
internal sealed class UrlGoToAttributeDrawer : DrawerPropertyDrawer
{
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
{

View file

@ -6,21 +6,21 @@ namespace Module.Inspector.Editor.Utilities
{
public static class EditorNamingUtility
{
public static string ConvertTo(Naming.EPatternType type, string str)
public static string ConvertTo(NamingAttribute.EPatternType type, string str)
{
switch (type)
{
case Naming.EPatternType.CamelCasing:
case NamingAttribute.EPatternType.CamelCasing:
return ToCamel(str);
case Naming.EPatternType.PascalCasing:
case NamingAttribute.EPatternType.PascalCasing:
return ToPascal(str);
case Naming.EPatternType.SnakeCasing:
case NamingAttribute.EPatternType.SnakeCasing:
return ToSnake(str);
case Naming.EPatternType.SnakeCasingAllCaps:
case NamingAttribute.EPatternType.SnakeCasingAllCaps:
return ToSnake(str).ToUpper();
case Naming.EPatternType.KebabCasing:
case NamingAttribute.EPatternType.KebabCasing:
return ToKebab(str);
case Naming.EPatternType.KebabCasingAllCaps:
case NamingAttribute.EPatternType.KebabCasingAllCaps:
return ToKebab(str).ToUpper();
default:
return str;

View file

@ -3,12 +3,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(ArrayIndex))]
internal sealed class DrawerArrayIndex : ValueModifierPropertyDrawer
[CustomPropertyDrawer(typeof(ArrayIndexAttribute))]
internal sealed class ArrayIndexAttributeDrawer : ValueModifierPropertyDrawer
{
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
{
var att = (ArrayIndex)attribute;
var att = (ArrayIndexAttribute)attribute;
int arraySize = GetSiblingArraySize(property, att);
int max = arraySize > 0 ? arraySize - 1 : 0;
@ -18,7 +18,7 @@ namespace Module.Inspector.Editor
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);
return spSibling != null && spSibling.isArray ? spSibling.arraySize : 0;

View file

@ -2,12 +2,12 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(LargerThanField))]
internal sealed class DrawerLargerThanField : ValueModifierPropertyDrawer
[CustomPropertyDrawer(typeof(LargerThanFieldAttribute))]
internal sealed class LargerThanFieldAttributeDrawer : ValueModifierPropertyDrawer
{
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
{
var att = (LargerThanField)attribute;
var att = (LargerThanFieldAttribute)attribute;
SerializedPropertyExtension.ECompareType compareType = property.IsGreaterOrEqualToSiblingValue(att.fieldName);
if (compareType == SerializedPropertyExtension.ECompareType.False)

View file

@ -3,12 +3,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(MaxValue))]
internal sealed class DrawerMaxValue : ValueModifierPropertyDrawer
[CustomPropertyDrawer(typeof(MaxValueAttribute))]
internal sealed class MaxValueAttributeDrawer : ValueModifierPropertyDrawer
{
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
{
var max = (MaxValue)attribute;
var max = (MaxValueAttribute)attribute;
switch (property.propertyType)
{

View file

@ -3,12 +3,12 @@ using UnityEngine;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(MinValue))]
internal sealed class DrawerMinValue : ValueModifierPropertyDrawer
[CustomPropertyDrawer(typeof(MinValueAttribute))]
internal sealed class MinValueAttributeDrawer : ValueModifierPropertyDrawer
{
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
{
var min = (MinValue)attribute;
var min = (MinValueAttribute)attribute;
switch (property.propertyType)
{

View file

@ -2,12 +2,12 @@
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(SmallerThanField))]
internal sealed class DrawerSmallerThanField : ValueModifierPropertyDrawer
[CustomPropertyDrawer(typeof(SmallerThanFieldAttribute))]
internal sealed class SmallerThanFieldAttributeDrawer : ValueModifierPropertyDrawer
{
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
{
var att = (SmallerThanField)attribute;
var att = (SmallerThanFieldAttribute)attribute;
SerializedPropertyExtension.ECompareType compareType = property.IsSmallerOrEqualToSiblingValue(att.fieldName);
if (compareType == SerializedPropertyExtension.ECompareType.False)

View 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()
{
}
}
}

View file

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

View 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()
{
}
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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