Skip to content

Commit

Permalink
Naughty attributes added as a dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuhpik committed May 15, 2022
1 parent dfa02ba commit d2ced16
Show file tree
Hide file tree
Showing 245 changed files with 7,354 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Assets/Kuhpik's Bootstrap/Thirdparty/NaughtyAttributes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class AllowNestingAttribute : DrawerAttribute
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using UnityEngine;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class AnimatorParamAttribute : DrawerAttribute
{
public string AnimatorName { get; private set; }
public AnimatorControllerParameterType? AnimatorParamType { get; private set; }

public AnimatorParamAttribute(string animatorName)
{
AnimatorName = animatorName;
AnimatorParamType = null;
}

public AnimatorParamAttribute(string animatorName, AnimatorControllerParameterType animatorParamType)
{
AnimatorName = animatorName;
AnimatorParamType = animatorParamType;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using UnityEngine;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class CurveRangeAttribute : DrawerAttribute
{
public Vector2 Min { get; private set; }
public Vector2 Max { get; private set; }
public EColor Color { get; private set; }

public CurveRangeAttribute(Vector2 min, Vector2 max, EColor color = EColor.Clear)
{
Min = min;
Max = max;
Color = color;
}

public CurveRangeAttribute(EColor color)
: this(Vector2.zero, Vector2.one, color)
{
}

public CurveRangeAttribute(float minX, float minY, float maxX, float maxY, EColor color = EColor.Clear)
: this(new Vector2(minX, minY), new Vector2(maxX, maxY), color)
{
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using UnityEngine;

namespace NaughtyAttributes
{
/// <summary>
/// Base class for all drawer attributes
/// </summary>
public class DrawerAttribute : PropertyAttribute, INaughtyAttribute
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Collections;
using System;
using System.Collections.Generic;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class DropdownAttribute : DrawerAttribute
{
public string ValuesName { get; private set; }

public DropdownAttribute(string valuesName)
{
ValuesName = valuesName;
}
}

public interface IDropdownList : IEnumerable<KeyValuePair<string, object>>
{
}

public class DropdownList<T> : IDropdownList
{
private List<KeyValuePair<string, object>> _values;

public DropdownList()
{
_values = new List<KeyValuePair<string, object>>();
}

public void Add(string displayName, T value)
{
_values.Add(new KeyValuePair<string, object>(displayName, value));
}

public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
return _values.GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}

public static explicit operator DropdownList<object>(DropdownList<T> target)
{
DropdownList<object> result = new DropdownList<object>();
foreach (var kvp in target)
{
result.Add(kvp.Key, kvp.Value);
}

return result;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class EnumFlagsAttribute : DrawerAttribute
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ExpandableAttribute : DrawerAttribute
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class HorizontalLineAttribute : DrawerAttribute
{
public const float DefaultHeight = 2.0f;
public const EColor DefaultColor = EColor.Gray;

public float Height { get; private set; }
public EColor Color { get; private set; }

public HorizontalLineAttribute(float height = DefaultHeight, EColor color = DefaultColor)
{
Height = height;
Color = color;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

namespace NaughtyAttributes
{
public enum EInfoBoxType
{
Normal,
Warning,
Error
}

[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class InfoBoxAttribute : DrawerAttribute
{
public string Text { get; private set; }
public EInfoBoxType Type { get; private set; }

public InfoBoxAttribute(string text, EInfoBoxType type = EInfoBoxType.Normal)
{
Text = text;
Type = type;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class InputAxisAttribute : DrawerAttribute
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class LayerAttribute : DrawerAttribute
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d2ced16

Please sign in to comment.