first commit
This commit is contained in:
commit
aa44d3ad70
1585 changed files with 277994 additions and 0 deletions
|
@ -0,0 +1,53 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class AnimatorParamTest : MonoBehaviour
|
||||
{
|
||||
public Animator animator0;
|
||||
|
||||
[AnimatorParam("animator0")]
|
||||
public int hash0;
|
||||
|
||||
[AnimatorParam("animator0")]
|
||||
public string name0;
|
||||
|
||||
public AnimatorParamNest1 nest1;
|
||||
|
||||
[Button("Log 'hash0' and 'name0'")]
|
||||
private void TestLog()
|
||||
{
|
||||
Debug.Log($"hash0 = {hash0}");
|
||||
Debug.Log($"name0 = {name0}");
|
||||
Debug.Log($"Animator.StringToHash(name0) = {Animator.StringToHash(name0)}");
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class AnimatorParamNest1
|
||||
{
|
||||
public Animator animator1;
|
||||
private Animator Animator1 => animator1;
|
||||
|
||||
[AnimatorParam("Animator1", AnimatorControllerParameterType.Bool)]
|
||||
public int hash1;
|
||||
|
||||
[AnimatorParam("Animator1", AnimatorControllerParameterType.Float)]
|
||||
public string name1;
|
||||
|
||||
public AnimatorParamNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class AnimatorParamNest2
|
||||
{
|
||||
public Animator animator2;
|
||||
private Animator GetAnimator2() => animator2;
|
||||
|
||||
[AnimatorParam("GetAnimator2", AnimatorControllerParameterType.Int)]
|
||||
public int hash1;
|
||||
|
||||
[AnimatorParam("GetAnimator2", AnimatorControllerParameterType.Trigger)]
|
||||
public string name1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9bff20ccdde00fc49a62bad6a4ef9982
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,32 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class BoxGroupTest : MonoBehaviour
|
||||
{
|
||||
[BoxGroup("Integers")]
|
||||
public int int0;
|
||||
[BoxGroup("Integers")]
|
||||
public int int1;
|
||||
|
||||
[BoxGroup("Floats")]
|
||||
public float float0;
|
||||
[BoxGroup("Floats")]
|
||||
public float float1;
|
||||
|
||||
[BoxGroup("Sliders")]
|
||||
[MinMaxSlider(0, 1)]
|
||||
public Vector2 slider0;
|
||||
[BoxGroup("Sliders")]
|
||||
[MinMaxSlider(0, 1)]
|
||||
public Vector2 slider1;
|
||||
|
||||
public string str0;
|
||||
public string str1;
|
||||
|
||||
[BoxGroup]
|
||||
public Transform trans0;
|
||||
[BoxGroup]
|
||||
public Transform trans1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3920f5ea384951b4990e4d9e8032d12e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
39
Assets/Vendors/NaughtyAttributes/Scripts/Test/ButtonTest.cs
Normal file
39
Assets/Vendors/NaughtyAttributes/Scripts/Test/ButtonTest.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ButtonTest : MonoBehaviour
|
||||
{
|
||||
public int myInt;
|
||||
|
||||
[Button(enabledMode: EButtonEnableMode.Always)]
|
||||
private void IncrementMyInt()
|
||||
{
|
||||
myInt++;
|
||||
}
|
||||
|
||||
[Button("Decrement My Int", EButtonEnableMode.Editor)]
|
||||
private void DecrementMyInt()
|
||||
{
|
||||
myInt--;
|
||||
}
|
||||
|
||||
[Button(enabledMode: EButtonEnableMode.Playmode)]
|
||||
private void LogMyInt(string prefix = "MyInt = ")
|
||||
{
|
||||
Debug.Log(prefix + myInt);
|
||||
}
|
||||
|
||||
[Button("StartCoroutine")]
|
||||
private IEnumerator IncrementMyIntCoroutine()
|
||||
{
|
||||
int seconds = 5;
|
||||
for (int i = 0; i < seconds; i++)
|
||||
{
|
||||
myInt++;
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b592f12a9f69ac3408f6f870762232c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,37 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class CurveRangeTest : MonoBehaviour
|
||||
{
|
||||
[CurveRange(0f, 0f, 1f, 1f, EColor.Yellow)]
|
||||
public AnimationCurve[] curves;
|
||||
|
||||
[CurveRange(-1, -1, 1, 1, EColor.Red)]
|
||||
public AnimationCurve curve;
|
||||
|
||||
[CurveRange(EColor.Orange)]
|
||||
public AnimationCurve curve1;
|
||||
|
||||
[CurveRange(0, 0, 10, 10)]
|
||||
public AnimationCurve curve2;
|
||||
|
||||
public CurveRangeNest1 nest1;
|
||||
|
||||
[System.Serializable]
|
||||
public class CurveRangeNest1
|
||||
{
|
||||
[CurveRange(0, 0, 1, 1, EColor.Green)]
|
||||
public AnimationCurve curve;
|
||||
|
||||
public CurveRangeNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class CurveRangeNest2
|
||||
{
|
||||
[CurveRange(0, 0, 5, 5, EColor.Blue)]
|
||||
public AnimationCurve curve;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6587b100d001e7e46b9aaae7f1180b40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
120
Assets/Vendors/NaughtyAttributes/Scripts/Test/DisableIfTest.cs
Normal file
120
Assets/Vendors/NaughtyAttributes/Scripts/Test/DisableIfTest.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class DisableIfTest : MonoBehaviour
|
||||
{
|
||||
public bool disable1;
|
||||
public bool disable2;
|
||||
public DisableIfEnum enum1;
|
||||
[EnumFlags] public DisableIfEnumFlag enum2;
|
||||
|
||||
[DisableIf(EConditionOperator.And, "disable1", "disable2")]
|
||||
[ReorderableList]
|
||||
public int[] disableIfAll;
|
||||
|
||||
[DisableIf(EConditionOperator.Or, "disable1", "disable2")]
|
||||
[ReorderableList]
|
||||
public int[] disableIfAny;
|
||||
|
||||
[DisableIf("enum1", DisableIfEnum.Case0)]
|
||||
[ReorderableList]
|
||||
public int[] disableIfEnum;
|
||||
|
||||
[DisableIf("enum2", DisableIfEnumFlag.Flag0)]
|
||||
[ReorderableList]
|
||||
public int[] disableIfEnumFlag;
|
||||
|
||||
[DisableIf("enum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)]
|
||||
[ReorderableList]
|
||||
public int[] disableIfEnumFlagMulti;
|
||||
|
||||
public DisableIfNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DisableIfNest1
|
||||
{
|
||||
public bool disable1;
|
||||
public bool disable2;
|
||||
public DisableIfEnum enum1;
|
||||
[EnumFlags] public DisableIfEnumFlag enum2;
|
||||
public bool Disable1 { get { return disable1; } }
|
||||
public bool Disable2 { get { return disable2; } }
|
||||
public DisableIfEnum Enum1 { get { return enum1; } }
|
||||
public DisableIfEnumFlag Enum2 { get { return enum2; } }
|
||||
|
||||
[DisableIf(EConditionOperator.And, "Disable1", "Disable2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int disableIfAll = 1;
|
||||
|
||||
[DisableIf(EConditionOperator.Or, "Disable1", "Disable2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int disableIfAny = 2;
|
||||
|
||||
[DisableIf("Enum1", DisableIfEnum.Case1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int disableIfEnum = 3;
|
||||
|
||||
[DisableIf("Enum2", DisableIfEnumFlag.Flag0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int disableIfEnumFlag;
|
||||
|
||||
[DisableIf("Enum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int disableIfEnumFlagMulti;
|
||||
|
||||
public DisableIfNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DisableIfNest2
|
||||
{
|
||||
public bool disable1;
|
||||
public bool disable2;
|
||||
public DisableIfEnum enum1;
|
||||
[EnumFlags] public DisableIfEnumFlag enum2;
|
||||
public bool GetDisable1() { return disable1; }
|
||||
public bool GetDisable2() { return disable2; }
|
||||
public DisableIfEnum GetEnum1() { return enum1; }
|
||||
public DisableIfEnumFlag GetEnum2() { return enum2; }
|
||||
|
||||
[DisableIf(EConditionOperator.And, "GetDisable1", "GetDisable2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfAll = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[DisableIf(EConditionOperator.Or, "GetDisable1", "GetDisable2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfAny = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[DisableIf("GetEnum1", DisableIfEnum.Case2)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfEnum = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[DisableIf("GetEnum2", DisableIfEnumFlag.Flag0)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 disableIfEnumFlag;
|
||||
|
||||
[DisableIf("GetEnum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 disableIfEnumFlagMulti;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public enum DisableIfEnum
|
||||
{
|
||||
Case0,
|
||||
Case1,
|
||||
Case2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum DisableIfEnumFlag
|
||||
{
|
||||
Flag0 = 1,
|
||||
Flag1 = 2,
|
||||
Flag2 = 4,
|
||||
Flag3 = 8
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0e48a088cb96287448c3be58932bfcb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,45 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class DropdownTest : MonoBehaviour
|
||||
{
|
||||
[Dropdown("intValues")]
|
||||
public int intValue;
|
||||
|
||||
#pragma warning disable 414
|
||||
private int[] intValues = new int[] { 1, 2, 3 };
|
||||
#pragma warning restore 414
|
||||
|
||||
public DropdownNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DropdownNest1
|
||||
{
|
||||
[Dropdown("StringValues")]
|
||||
public string stringValue;
|
||||
|
||||
private List<string> StringValues { get { return new List<string>() { "A", "B", "C" }; } }
|
||||
|
||||
public DropdownNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DropdownNest2
|
||||
{
|
||||
[Dropdown("GetVectorValues")]
|
||||
public Vector3 vectorValue;
|
||||
|
||||
private DropdownList<Vector3> GetVectorValues()
|
||||
{
|
||||
return new DropdownList<Vector3>()
|
||||
{
|
||||
{ "Right", Vector3.right },
|
||||
{ "Up", Vector3.up },
|
||||
{ "Forward", Vector3.forward }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3855e37cd6b01194e8166573c7c4b37d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
120
Assets/Vendors/NaughtyAttributes/Scripts/Test/EnableIfTest.cs
Normal file
120
Assets/Vendors/NaughtyAttributes/Scripts/Test/EnableIfTest.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class EnableIfTest : MonoBehaviour
|
||||
{
|
||||
public bool enable1;
|
||||
public bool enable2;
|
||||
public EnableIfEnum enum1;
|
||||
[EnumFlags] public EnableIfEnumFlag enum2;
|
||||
|
||||
[EnableIf(EConditionOperator.And, "enable1", "enable2")]
|
||||
[ReorderableList]
|
||||
public int[] enableIfAll;
|
||||
|
||||
[EnableIf(EConditionOperator.Or, "enable1", "enable2")]
|
||||
[ReorderableList]
|
||||
public int[] enableIfAny;
|
||||
|
||||
[EnableIf("enum1", EnableIfEnum.Case0)]
|
||||
[ReorderableList]
|
||||
public int[] enableIfEnum;
|
||||
|
||||
[EnableIf("enum2", EnableIfEnumFlag.Flag0)]
|
||||
[ReorderableList]
|
||||
public int[] enableIfEnumFlag;
|
||||
|
||||
[EnableIf("enum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)]
|
||||
[ReorderableList]
|
||||
public int[] enableIfEnumFlagMulti;
|
||||
|
||||
public EnableIfNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EnableIfNest1
|
||||
{
|
||||
public bool enable1;
|
||||
public bool enable2;
|
||||
public EnableIfEnum enum1;
|
||||
[EnumFlags] public EnableIfEnumFlag enum2;
|
||||
public bool Enable1 { get { return enable1; } }
|
||||
public bool Enable2 { get { return enable2; } }
|
||||
public EnableIfEnum Enum1 { get { return enum1; } }
|
||||
public EnableIfEnumFlag Enum2 { get { return enum2; } }
|
||||
|
||||
[EnableIf(EConditionOperator.And, "Enable1", "Enable2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int enableIfAll;
|
||||
|
||||
[EnableIf(EConditionOperator.Or, "Enable1", "Enable2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int enableIfAny;
|
||||
|
||||
[EnableIf("Enum1", EnableIfEnum.Case1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int enableIfEnum;
|
||||
|
||||
[EnableIf("Enum2", EnableIfEnumFlag.Flag0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int enableIfEnumFlag;
|
||||
|
||||
[EnableIf("Enum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int enableIfEnumFlagMulti;
|
||||
|
||||
public EnableIfNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EnableIfNest2
|
||||
{
|
||||
public bool enable1;
|
||||
public bool enable2;
|
||||
public EnableIfEnum enum1;
|
||||
[EnumFlags] public EnableIfEnumFlag enum2;
|
||||
public bool GetEnable1() { return enable1; }
|
||||
public bool GetEnable2() { return enable2; }
|
||||
public EnableIfEnum GetEnum1() { return enum1; }
|
||||
public EnableIfEnumFlag GetEnum2() { return enum2; }
|
||||
|
||||
[EnableIf(EConditionOperator.And, "GetEnable1", "GetEnable2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfAll = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[EnableIf(EConditionOperator.Or, "GetEnable1", "GetEnable2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfAny = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[EnableIf("GetEnum1", EnableIfEnum.Case2)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfEnum = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[EnableIf("GetEnum2", EnableIfEnumFlag.Flag0)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfEnumFlag;
|
||||
|
||||
[EnableIf("GetEnum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 enableIfEnumFlagMulti;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public enum EnableIfEnum
|
||||
{
|
||||
Case0,
|
||||
Case1,
|
||||
Case2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum EnableIfEnumFlag
|
||||
{
|
||||
Flag0 = 1,
|
||||
Flag1 = 2,
|
||||
Flag2 = 4,
|
||||
Flag3 = 8
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bed506d8be3a10f45bec4bf2237bec87
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,39 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public enum TestEnum
|
||||
{
|
||||
None = 0,
|
||||
B = 1 << 0,
|
||||
C = 1 << 1,
|
||||
D = 1 << 2,
|
||||
E = 1 << 3,
|
||||
F = 1 << 4,
|
||||
All = ~0
|
||||
}
|
||||
|
||||
public class EnumFlagsTest : MonoBehaviour
|
||||
{
|
||||
[EnumFlags]
|
||||
public TestEnum flags0;
|
||||
|
||||
public EnumFlagsNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EnumFlagsNest1
|
||||
{
|
||||
[EnumFlags]
|
||||
public TestEnum flags1;
|
||||
|
||||
public EnumFlagsNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class EnumFlagsNest2
|
||||
{
|
||||
[EnumFlags]
|
||||
public TestEnum flags2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7b7f6b84ce0d7674d8a386fde729279c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,31 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ExpandableTest : MonoBehaviour
|
||||
{
|
||||
// See #294
|
||||
public int precedingField = 5;
|
||||
|
||||
[Expandable]
|
||||
public ScriptableObject obj0;
|
||||
|
||||
public ExpandableScriptableObjectNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ExpandableScriptableObjectNest1
|
||||
{
|
||||
[Expandable]
|
||||
public ScriptableObject obj1;
|
||||
|
||||
public ExpandableScriptableObjectNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ExpandableScriptableObjectNest2
|
||||
{
|
||||
[Expandable]
|
||||
public ScriptableObject obj2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 64c4c9aee2b494d44be9bb0b7f12ed7c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
32
Assets/Vendors/NaughtyAttributes/Scripts/Test/FoldoutTest.cs
Normal file
32
Assets/Vendors/NaughtyAttributes/Scripts/Test/FoldoutTest.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class FoldoutTest : MonoBehaviour
|
||||
{
|
||||
[Foldout("Integers")]
|
||||
public int int0;
|
||||
[Foldout("Integers")]
|
||||
public int int1;
|
||||
|
||||
[Foldout("Floats")]
|
||||
public float float0;
|
||||
[Foldout("Floats")]
|
||||
public float float1;
|
||||
|
||||
[Foldout("Sliders")]
|
||||
[MinMaxSlider(0, 1)]
|
||||
public Vector2 slider0;
|
||||
[Foldout("Sliders")]
|
||||
[MinMaxSlider(0, 1)]
|
||||
public Vector2 slider1;
|
||||
|
||||
public string str0;
|
||||
public string str1;
|
||||
|
||||
[Foldout("Transforms")]
|
||||
public Transform trans0;
|
||||
[Foldout("Transforms")]
|
||||
public Transform trans1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3b437215d92efa74ea85ff726ca0dd09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
119
Assets/Vendors/NaughtyAttributes/Scripts/Test/HideIfTest.cs
Normal file
119
Assets/Vendors/NaughtyAttributes/Scripts/Test/HideIfTest.cs
Normal file
|
@ -0,0 +1,119 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class HideIfTest : MonoBehaviour
|
||||
{
|
||||
public bool hide1;
|
||||
public bool hide2;
|
||||
public HideIfEnum enum1;
|
||||
[EnumFlags] public HideIfEnumFlag enum2;
|
||||
|
||||
[HideIf(EConditionOperator.And, "hide1", "hide2")]
|
||||
[ReorderableList]
|
||||
public int[] hideIfAll;
|
||||
|
||||
[HideIf(EConditionOperator.Or, "hide1", "hide2")]
|
||||
[ReorderableList]
|
||||
public int[] hideIfAny;
|
||||
|
||||
[HideIf("enum1", HideIfEnum.Case0)]
|
||||
[ReorderableList]
|
||||
public int[] hideIfEnum;
|
||||
|
||||
[HideIf("enum2", HideIfEnumFlag.Flag0)]
|
||||
[ReorderableList]
|
||||
public int[] hideIfEnumFlag;
|
||||
|
||||
[HideIf("enum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)]
|
||||
[ReorderableList]
|
||||
public int[] hideIfEnumFlagMulti;
|
||||
|
||||
public HideIfNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class HideIfNest1
|
||||
{
|
||||
public bool hide1;
|
||||
public bool hide2;
|
||||
public HideIfEnum enum1;
|
||||
[EnumFlags] public HideIfEnumFlag enum2;
|
||||
public bool Hide1 { get { return hide1; } }
|
||||
public bool Hide2 { get { return hide2; } }
|
||||
public HideIfEnum Enum1 { get { return enum1; } }
|
||||
public HideIfEnumFlag Enum2 { get { return enum2; } }
|
||||
|
||||
[HideIf(EConditionOperator.And, "Hide1", "Hide2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int hideIfAll;
|
||||
|
||||
[HideIf(EConditionOperator.Or, "Hide1", "Hide2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int hideIfAny;
|
||||
|
||||
[HideIf("Enum1", HideIfEnum.Case1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int hideIfEnum;
|
||||
|
||||
[HideIf("Enum2", HideIfEnumFlag.Flag0)]
|
||||
[AllowNesting]
|
||||
public int hideIfEnumFlag;
|
||||
|
||||
[HideIf("Enum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)]
|
||||
[AllowNesting]
|
||||
public int hideIfEnumFlagMulti;
|
||||
|
||||
public HideIfNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class HideIfNest2
|
||||
{
|
||||
public bool hide1;
|
||||
public bool hide2;
|
||||
public HideIfEnum enum1;
|
||||
[EnumFlags] public HideIfEnumFlag enum2;
|
||||
public bool GetHide1() { return hide1; }
|
||||
public bool GetHide2() { return hide2; }
|
||||
public HideIfEnum GetEnum1() { return enum1; }
|
||||
public HideIfEnumFlag GetEnum2() { return enum2; }
|
||||
|
||||
[HideIf(EConditionOperator.And, "GetHide1", "GetHide2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 hideIfAll = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[HideIf(EConditionOperator.Or, "GetHide1", "GetHide2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 hideIfAny = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[HideIf("GetEnum1", HideIfEnum.Case2)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 hideIfEnum = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[HideIf("GetEnum2", HideIfEnumFlag.Flag0)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 hideIfEnumFlag;
|
||||
|
||||
[HideIf("GetEnum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 hideIfEnumFlagMulti;
|
||||
}
|
||||
|
||||
public enum HideIfEnum
|
||||
{
|
||||
Case0,
|
||||
Case1,
|
||||
Case2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum HideIfEnumFlag
|
||||
{
|
||||
Flag0 = 1,
|
||||
Flag1 = 2,
|
||||
Flag2 = 4,
|
||||
Flag3 = 8
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3cf166cb519e666419bb79b0c50c5ee1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,51 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class HorizontalLineTest : MonoBehaviour
|
||||
{
|
||||
[HorizontalLine(color: EColor.Black)]
|
||||
[Header("Black")]
|
||||
[HorizontalLine(color: EColor.Blue)]
|
||||
[Header("Blue")]
|
||||
[HorizontalLine(color: EColor.Gray)]
|
||||
[Header("Gray")]
|
||||
[HorizontalLine(color: EColor.Green)]
|
||||
[Header("Green")]
|
||||
[HorizontalLine(color: EColor.Indigo)]
|
||||
[Header("Indigo")]
|
||||
[HorizontalLine(color: EColor.Orange)]
|
||||
[Header("Orange")]
|
||||
[HorizontalLine(color: EColor.Pink)]
|
||||
[Header("Pink")]
|
||||
[HorizontalLine(color: EColor.Red)]
|
||||
[Header("Red")]
|
||||
[HorizontalLine(color: EColor.Violet)]
|
||||
[Header("Violet")]
|
||||
[HorizontalLine(color: EColor.White)]
|
||||
[Header("White")]
|
||||
[HorizontalLine(color: EColor.Yellow)]
|
||||
[Header("Yellow")]
|
||||
[HorizontalLine(10.0f)]
|
||||
[Header("Thick")]
|
||||
public int line0;
|
||||
|
||||
public HorizontalLineNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class HorizontalLineNest1
|
||||
{
|
||||
[HorizontalLine]
|
||||
public int line1;
|
||||
|
||||
public HorizontalLineNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class HorizontalLineNest2
|
||||
{
|
||||
[HorizontalLine]
|
||||
public int line2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5cc6d3f8d4a53374887b3d620a6972e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Assets/Vendors/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs
Normal file
28
Assets/Vendors/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class InfoBoxTest : MonoBehaviour
|
||||
{
|
||||
[InfoBox("Normal", EInfoBoxType.Normal)]
|
||||
public int normal;
|
||||
|
||||
public InfoBoxNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class InfoBoxNest1
|
||||
{
|
||||
[InfoBox("Warning", EInfoBoxType.Warning)]
|
||||
public int warning;
|
||||
|
||||
public InfoBoxNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class InfoBoxNest2
|
||||
{
|
||||
[InfoBox("Error", EInfoBoxType.Error)]
|
||||
public int error;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0dcb08e489c17644e9eacaa1ec5fe781
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,34 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class InputAxisTest : MonoBehaviour
|
||||
{
|
||||
[InputAxis]
|
||||
public string inputAxis0;
|
||||
|
||||
public InputAxisNest1 nest1;
|
||||
|
||||
[Button]
|
||||
private void LogInputAxis0()
|
||||
{
|
||||
Debug.Log(inputAxis0);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class InputAxisNest1
|
||||
{
|
||||
[InputAxis]
|
||||
public string inputAxis1;
|
||||
|
||||
public InputAxisNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct InputAxisNest2
|
||||
{
|
||||
[InputAxis]
|
||||
public string inputAxis2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0cc8a31c22090847b75538c0ed2d2fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
30
Assets/Vendors/NaughtyAttributes/Scripts/Test/LabelTest.cs
Normal file
30
Assets/Vendors/NaughtyAttributes/Scripts/Test/LabelTest.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class LabelTest : MonoBehaviour
|
||||
{
|
||||
[Label("Label 0")]
|
||||
public int int0;
|
||||
|
||||
public LabelNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class LabelNest1
|
||||
{
|
||||
[Label("Label 1")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int int1;
|
||||
|
||||
public LabelNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class LabelNest2
|
||||
{
|
||||
[Label("Label 2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 vector2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7488af014527ebf42af5c4fc4d5f4f5b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
46
Assets/Vendors/NaughtyAttributes/Scripts/Test/LayerTest.cs
Normal file
46
Assets/Vendors/NaughtyAttributes/Scripts/Test/LayerTest.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class LayerTest : MonoBehaviour
|
||||
{
|
||||
[Layer]
|
||||
public int layerNumber0;
|
||||
|
||||
[Layer]
|
||||
public string layerName0;
|
||||
|
||||
public LayerNest1 nest1;
|
||||
|
||||
[Button]
|
||||
public void DebugLog()
|
||||
{
|
||||
Debug.LogFormat("{0} = {1}", nameof(layerNumber0), layerNumber0);
|
||||
Debug.LogFormat("{0} = {1}", nameof(layerName0), layerName0);
|
||||
Debug.LogFormat("LayerToName({0}) = {1}", layerNumber0, LayerMask.LayerToName(layerNumber0));
|
||||
Debug.LogFormat("NameToLayer({0}) = {1}", layerName0, LayerMask.NameToLayer(layerName0));
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class LayerNest1
|
||||
{
|
||||
[Layer]
|
||||
public int layerNumber1;
|
||||
|
||||
[Layer]
|
||||
public string layerName1;
|
||||
|
||||
public LayerNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct LayerNest2
|
||||
{
|
||||
[Layer]
|
||||
public int layerNumber2;
|
||||
|
||||
[Layer]
|
||||
public string layerName2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 460459d6ac76acd4d872f94cf444e6fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,28 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class MinMaxSliderTest : MonoBehaviour
|
||||
{
|
||||
[MinMaxSlider(0.0f, 1.0f)]
|
||||
public Vector2 minMaxSlider0 = new Vector2(0.25f, 0.75f);
|
||||
|
||||
public MinMaxSliderNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MinMaxSliderNest1
|
||||
{
|
||||
[MinMaxSlider(0.0f, 1.0f)]
|
||||
public Vector2 minMaxSlider1 = new Vector2(0.25f, 0.75f);
|
||||
|
||||
public MinMaxSliderNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MinMaxSliderNest2
|
||||
{
|
||||
[MinMaxSlider(1, 11)]
|
||||
public Vector2Int minMaxSlider2 = new Vector2Int(6, 11);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fd67fbde6acdd6a44944f12e507067c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
129
Assets/Vendors/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs
Normal file
129
Assets/Vendors/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs
Normal file
|
@ -0,0 +1,129 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class MinMaxValueTest : MonoBehaviour
|
||||
{
|
||||
[MinValue(0)]
|
||||
public int min0Int;
|
||||
|
||||
[MaxValue(0)]
|
||||
public int max0Int;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
public float range01Float;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
public Vector2 range01Vector2;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
public Vector3 range01Vector3;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
public Vector4 range01Vector4;
|
||||
|
||||
[MinValue(0)]
|
||||
public Vector2Int min0Vector2Int;
|
||||
|
||||
[MaxValue(100)]
|
||||
public Vector2Int max100Vector2Int;
|
||||
|
||||
[MinValue(0)]
|
||||
public Vector3Int min0Vector3Int;
|
||||
|
||||
[MaxValue(100)]
|
||||
public Vector3Int max100Vector3Int;
|
||||
|
||||
public MinMaxValueNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MinMaxValueNest1
|
||||
{
|
||||
[MinValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int min0Int;
|
||||
|
||||
[MaxValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int max0Int;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public float range01Float;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector2 range01Vector2;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector3 range01Vector3;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector4 range01Vector4;
|
||||
|
||||
[MinValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector2Int min0Vector2Int;
|
||||
|
||||
[MaxValue(100)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector2Int max100Vector2Int;
|
||||
|
||||
[MinValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector3Int min0Vector3Int;
|
||||
|
||||
[MaxValue(100)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector3Int max100Vector3Int;
|
||||
|
||||
public MinMaxValueNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MinMaxValueNest2
|
||||
{
|
||||
[MinValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int min0Int;
|
||||
|
||||
[MaxValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int max0Int;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public float range01Float;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector2 range01Vector2;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector3 range01Vector3;
|
||||
|
||||
[MinValue(0), MaxValue(1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector4 range01Vector4;
|
||||
|
||||
[MinValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector2Int min0Vector2Int;
|
||||
|
||||
[MaxValue(100)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector2Int max100Vector2Int;
|
||||
|
||||
[MinValue(0)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector3Int min0Vector3Int;
|
||||
|
||||
[MaxValue(100)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Vector3Int max100Vector3Int;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 450a05787c54e6b4fa88ffe223bcee87
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "NaughtyAttributes.Test",
|
||||
"references": [
|
||||
"NaughtyAttributes.Core"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": []
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: df1dea26b8503004d92d621e88aa9421
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,51 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class OnValueChangedTest : MonoBehaviour
|
||||
{
|
||||
[OnValueChanged("OnValueChangedMethod1")]
|
||||
[OnValueChanged("OnValueChangedMethod2")]
|
||||
public int int0;
|
||||
|
||||
private void OnValueChangedMethod1()
|
||||
{
|
||||
Debug.LogFormat("int0: {0}", int0);
|
||||
}
|
||||
|
||||
private void OnValueChangedMethod2()
|
||||
{
|
||||
Debug.LogFormat("int0: {0}", int0);
|
||||
}
|
||||
|
||||
public OnValueChangedNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class OnValueChangedNest1
|
||||
{
|
||||
[OnValueChanged("OnValueChangedMethod")]
|
||||
[AllowNesting]
|
||||
public int int1;
|
||||
|
||||
private void OnValueChangedMethod()
|
||||
{
|
||||
Debug.LogFormat("int1: {0}", int1);
|
||||
}
|
||||
|
||||
public OnValueChangedNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class OnValueChangedNest2
|
||||
{
|
||||
[OnValueChanged("OnValueChangedMethod")]
|
||||
[AllowNesting]
|
||||
public int int2;
|
||||
|
||||
private void OnValueChangedMethod()
|
||||
{
|
||||
Debug.LogFormat("int2: {0}", int2);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ff1df679e5b32f64bb106752c63933fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,35 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ProgressBarTest : MonoBehaviour
|
||||
{
|
||||
[Header("Constant ProgressBar")]
|
||||
[ProgressBar("Health", 100, EColor.Red)]
|
||||
public float health = 50.0f;
|
||||
|
||||
[Header("Nested ProgressBar")]
|
||||
public ProgressBarNest1 nest1;
|
||||
|
||||
[Header("Dynamic ProgressBar")]
|
||||
[ProgressBar("Elixir", "maxElixir", color: EColor.Violet)]
|
||||
public int elixir = 50;
|
||||
public int maxElixir = 100;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ProgressBarNest1
|
||||
{
|
||||
[ProgressBar("Mana", 100, EColor.Blue)]
|
||||
public float mana = 25.0f;
|
||||
|
||||
public ProgressBarNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ProgressBarNest2
|
||||
{
|
||||
[ProgressBar("Stamina", 100, EColor.Green)]
|
||||
public float stamina = 75.0f;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96ca4c27fc649764b9d1625f1740cb9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,30 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ReadOnlyTest : MonoBehaviour
|
||||
{
|
||||
[ReadOnly]
|
||||
public int readOnlyInt = 5;
|
||||
|
||||
public ReadOnlyNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ReadOnlyNest1
|
||||
{
|
||||
[ReadOnly]
|
||||
[AllowNesting]
|
||||
public float readOnlyFloat = 3.14f;
|
||||
|
||||
public ReadOnlyNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct ReadOnlyNest2
|
||||
{
|
||||
[ReadOnly]
|
||||
[AllowNesting]
|
||||
public string readOnlyString;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5443d37a05e188846bda9b05b067184e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,34 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ReorderableListTest : MonoBehaviour
|
||||
{
|
||||
[ReorderableList]
|
||||
public int[] intArray;
|
||||
|
||||
[ReorderableList]
|
||||
public List<Vector3> vectorList;
|
||||
|
||||
[ReorderableList]
|
||||
public List<SomeStruct> structList;
|
||||
|
||||
[ReorderableList]
|
||||
public GameObject[] gameObjectsList;
|
||||
|
||||
[ReorderableList]
|
||||
public List<Transform> transformsList;
|
||||
|
||||
[ReorderableList]
|
||||
public List<MonoBehaviour> monoBehavioursList;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct SomeStruct
|
||||
{
|
||||
public int Int;
|
||||
public float Float;
|
||||
public Vector3 Vector;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c93fde7cd79390148ac576c3a159a77b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,30 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class RequiredTest : MonoBehaviour
|
||||
{
|
||||
[Required]
|
||||
public Transform trans0;
|
||||
|
||||
public RequiredNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class RequiredNest1
|
||||
{
|
||||
[Required]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Transform trans1;
|
||||
|
||||
public RequiredNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class RequiredNest2
|
||||
{
|
||||
[Required("trans2 is invalid custom message - hohoho")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public Transform trans2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c8c10b2234650d42b2a8efad6b413db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,28 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ResizableTextAreaTest : MonoBehaviour
|
||||
{
|
||||
[ResizableTextArea]
|
||||
public string text0;
|
||||
|
||||
public ResizableTextAreaNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ResizableTextAreaNest1
|
||||
{
|
||||
[ResizableTextArea]
|
||||
public string text1;
|
||||
|
||||
public ResizableTextAreaNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ResizableTextAreaNest2
|
||||
{
|
||||
[ResizableTextArea]
|
||||
public string text2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb4f4bb2e3e063340a24f4bb24528bb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Assets/Vendors/NaughtyAttributes/Scripts/Test/SceneTest.cs
Normal file
28
Assets/Vendors/NaughtyAttributes/Scripts/Test/SceneTest.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class SceneTest : MonoBehaviour
|
||||
{
|
||||
[Scene]
|
||||
public string scene0;
|
||||
|
||||
public SceneNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class SceneNest1
|
||||
{
|
||||
[Scene]
|
||||
public string scene1;
|
||||
|
||||
public SceneNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct SceneNest2
|
||||
{
|
||||
[Scene]
|
||||
public int scene2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 281a85803caf74a459439020a0840fa4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,37 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ShowAssetPreviewTest : MonoBehaviour
|
||||
{
|
||||
[ShowAssetPreview]
|
||||
public Sprite sprite0;
|
||||
|
||||
[ShowAssetPreview(96, 96)]
|
||||
public GameObject prefab0;
|
||||
|
||||
public ShowAssetPreviewNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ShowAssetPreviewNest1
|
||||
{
|
||||
[ShowAssetPreview]
|
||||
public Sprite sprite1;
|
||||
|
||||
[ShowAssetPreview(96, 96)]
|
||||
public GameObject prefab1;
|
||||
|
||||
public ShowAssetPreviewNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ShowAssetPreviewNest2
|
||||
{
|
||||
[ShowAssetPreview]
|
||||
public Sprite sprite2;
|
||||
|
||||
[ShowAssetPreview(96, 96)]
|
||||
public GameObject prefab2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 705c14aa9ecaa274289972381f471367
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
119
Assets/Vendors/NaughtyAttributes/Scripts/Test/ShowIfTest.cs
Normal file
119
Assets/Vendors/NaughtyAttributes/Scripts/Test/ShowIfTest.cs
Normal file
|
@ -0,0 +1,119 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ShowIfTest : MonoBehaviour
|
||||
{
|
||||
public bool show1;
|
||||
public bool show2;
|
||||
public ShowIfEnum enum1;
|
||||
[EnumFlags] public ShowIfEnumFlag enum2;
|
||||
|
||||
[ShowIf(EConditionOperator.And, "show1", "show2")]
|
||||
[ReorderableList]
|
||||
public int[] showIfAll;
|
||||
|
||||
[ShowIf(EConditionOperator.Or, "show1", "show2")]
|
||||
[ReorderableList]
|
||||
public int[] showIfAny;
|
||||
|
||||
[ShowIf("enum1", ShowIfEnum.Case0)]
|
||||
[ReorderableList]
|
||||
public int[] showIfEnum;
|
||||
|
||||
[ShowIf("enum2", ShowIfEnumFlag.Flag0)]
|
||||
[ReorderableList]
|
||||
public int[] showIfEnumFlag;
|
||||
|
||||
[ShowIf("enum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)]
|
||||
[ReorderableList]
|
||||
public int[] showIfEnumFlagMulti;
|
||||
|
||||
public ShowIfNest1 nest1;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ShowIfNest1
|
||||
{
|
||||
public bool show1;
|
||||
public bool show2;
|
||||
public ShowIfEnum enum1;
|
||||
[EnumFlags] public ShowIfEnumFlag enum2;
|
||||
public bool Show1 { get { return show1; } }
|
||||
public bool Show2 { get { return show2; } }
|
||||
public ShowIfEnum Enum1 { get { return enum1; } }
|
||||
public ShowIfEnumFlag Enum2 { get { return enum2; } }
|
||||
|
||||
[ShowIf(EConditionOperator.And, "Show1", "Show2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int showIfAll;
|
||||
|
||||
[ShowIf(EConditionOperator.Or, "Show1", "Show2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int showIfAny;
|
||||
|
||||
[ShowIf("Enum1", ShowIfEnum.Case1)]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int showIfEnum;
|
||||
|
||||
[ShowIf("Enum2", ShowIfEnumFlag.Flag0)]
|
||||
[AllowNesting]
|
||||
public int showIfEnumFlag;
|
||||
|
||||
[ShowIf("Enum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)]
|
||||
[AllowNesting]
|
||||
public int showIfEnumFlagMulti;
|
||||
|
||||
public ShowIfNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ShowIfNest2
|
||||
{
|
||||
public bool show1;
|
||||
public bool show2;
|
||||
public ShowIfEnum enum1;
|
||||
[EnumFlags] public ShowIfEnumFlag enum2;
|
||||
public bool GetShow1() { return show1; }
|
||||
public bool GetShow2() { return show2; }
|
||||
public ShowIfEnum GetEnum1() { return enum1; }
|
||||
public ShowIfEnumFlag GetEnum2() { return enum2; }
|
||||
|
||||
[ShowIf(EConditionOperator.And, "GetShow1", "GetShow2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 showIfAll = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[ShowIf(EConditionOperator.Or, "GetShow1", "GetShow2")]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 showIfAny = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[ShowIf("GetEnum1", ShowIfEnum.Case2)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 showIfEnum = new Vector2(0.25f, 0.75f);
|
||||
|
||||
[ShowIf("GetEnum2", ShowIfEnumFlag.Flag0)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 showIfEnumFlag;
|
||||
|
||||
[ShowIf("GetEnum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)]
|
||||
[MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer
|
||||
public Vector2 showIfEnumFlagMulti;
|
||||
}
|
||||
|
||||
public enum ShowIfEnum
|
||||
{
|
||||
Case0,
|
||||
Case1,
|
||||
Case2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ShowIfEnumFlag
|
||||
{
|
||||
Flag0 = 1,
|
||||
Flag1 = 2,
|
||||
Flag2 = 4,
|
||||
Flag3 = 8
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4fdbfcfbf5b056a4bac491fe21569572
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,79 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ShowNativePropertyTest : MonoBehaviour
|
||||
{
|
||||
[ShowNativeProperty]
|
||||
private Transform Transform
|
||||
{
|
||||
get
|
||||
{
|
||||
return transform;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private Transform ParentTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
return transform.parent;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private ushort MyUShort
|
||||
{
|
||||
get
|
||||
{
|
||||
return ushort.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private short MyShort
|
||||
{
|
||||
get
|
||||
{
|
||||
return short.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private ulong MyULong
|
||||
{
|
||||
get
|
||||
{
|
||||
return ulong.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private long MyLong
|
||||
{
|
||||
get
|
||||
{
|
||||
return long.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private uint MyUInt
|
||||
{
|
||||
get
|
||||
{
|
||||
return uint.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
[ShowNativeProperty]
|
||||
private int MyInt
|
||||
{
|
||||
get
|
||||
{
|
||||
return int.MaxValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b5a73795d25dd334e90a5a347c6079d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,33 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ShowNonSerializedFieldTest : MonoBehaviour
|
||||
{
|
||||
#pragma warning disable 414
|
||||
[ShowNonSerializedField]
|
||||
private ushort myUShort = ushort.MaxValue;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private short myShort = short.MaxValue;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private uint myUInt = uint.MaxValue;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private int myInt = 10;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private ulong myULong = ulong.MaxValue;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private long myLong = long.MaxValue;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private const float PI = 3.14159f;
|
||||
|
||||
[ShowNonSerializedField]
|
||||
private static readonly Vector3 CONST_VECTOR = Vector3.one;
|
||||
#pragma warning restore 414
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 913d67a695253f744bdc776625b9b948
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,46 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class SortingLayerTest : MonoBehaviour
|
||||
{
|
||||
[SortingLayer]
|
||||
public int layerNumber0;
|
||||
|
||||
[SortingLayer]
|
||||
public string layerName0;
|
||||
|
||||
public SortingLayerNest1 nest1;
|
||||
|
||||
[Button]
|
||||
public void DebugLog()
|
||||
{
|
||||
Debug.LogFormat("{0} = {1}", nameof(layerNumber0), layerNumber0);
|
||||
Debug.LogFormat("{0} = {1}", nameof(layerName0), layerName0);
|
||||
Debug.LogFormat("LayerToName({0}) = {1}", layerNumber0, SortingLayer.IDToName(layerNumber0));
|
||||
Debug.LogFormat("NameToLayer({0}) = {1}", layerName0, SortingLayer.NameToID(layerName0));
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class SortingLayerNest1
|
||||
{
|
||||
[SortingLayer]
|
||||
public int layerNumber1;
|
||||
|
||||
[SortingLayer]
|
||||
public string layerName1;
|
||||
|
||||
public SortingLayerNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct SortingLayerNest2
|
||||
{
|
||||
[SortingLayer]
|
||||
public int layerNumber2;
|
||||
|
||||
[SortingLayer]
|
||||
public string layerName2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8ed73e666d447964d93c4840f05423dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
34
Assets/Vendors/NaughtyAttributes/Scripts/Test/TagTest.cs
Normal file
34
Assets/Vendors/NaughtyAttributes/Scripts/Test/TagTest.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class TagTest : MonoBehaviour
|
||||
{
|
||||
[Tag]
|
||||
public string tag0;
|
||||
|
||||
public TagNest1 nest1;
|
||||
|
||||
[Button]
|
||||
private void LogTag0()
|
||||
{
|
||||
Debug.Log(tag0);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class TagNest1
|
||||
{
|
||||
[Tag]
|
||||
public string tag1;
|
||||
|
||||
public TagNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct TagNest2
|
||||
{
|
||||
[Tag]
|
||||
public string tag2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8bcc0d5613b48fb43bd36c9d37e99900
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,52 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class ValidateInputTest : MonoBehaviour
|
||||
{
|
||||
[ValidateInput("NotZero0", "int0 must not be zero")]
|
||||
public int int0;
|
||||
|
||||
private bool NotZero0(int value)
|
||||
{
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
public ValidateInputNest1 nest1;
|
||||
|
||||
public ValidateInputInheritedNest inheritedNest;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ValidateInputNest1
|
||||
{
|
||||
[ValidateInput("NotZero1")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int int1;
|
||||
|
||||
private bool NotZero1(int value)
|
||||
{
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
public ValidateInputNest2 nest2;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ValidateInputNest2
|
||||
{
|
||||
[ValidateInput("NotZero2")]
|
||||
[AllowNesting] // Because it's nested we need to explicitly allow nesting
|
||||
public int int2;
|
||||
|
||||
private bool NotZero2(int value)
|
||||
{
|
||||
return value != 0;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ValidateInputInheritedNest : ValidateInputNest1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94adafcfe59aa344c9b5596b2cc6ecd0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
public class _NaughtyComponent : MonoBehaviour
|
||||
{
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class MyClass
|
||||
{
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public struct MyStruct
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c928ea15ae74a44089beb2e534c1a35
|
||||
timeCreated: 1507996629
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
//[CreateAssetMenu(fileName = "NaughtyScriptableObject", menuName = "NaughtyAttributes/_NaughtyScriptableObject")]
|
||||
public class _NaughtyScriptableObject : ScriptableObject
|
||||
{
|
||||
[Expandable]
|
||||
public List<_TestScriptableObjectA> listA;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 753bdb918c6038142acddbd7aae6958f
|
||||
timeCreated: 1518639587
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,12 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
//[CreateAssetMenu(fileName = "TestScriptableObjectA", menuName = "NaughtyAttributes/TestScriptableObjectA")]
|
||||
public class _TestScriptableObjectA : ScriptableObject
|
||||
{
|
||||
[Expandable]
|
||||
public List<_TestScriptableObjectB> listB;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 19472ac11eae27a4b804f354ca7d9c00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,12 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NaughtyAttributes.Test
|
||||
{
|
||||
//[CreateAssetMenu(fileName = "TestScriptableObjectB", menuName = "NaughtyAttributes/TestScriptableObjectB")]
|
||||
public class _TestScriptableObjectB : ScriptableObject
|
||||
{
|
||||
[MinMaxSlider(0, 10)]
|
||||
public Vector2Int slider;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2b396aeebc9d984da298eee313896bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue