diff --git a/CHANGELOG.md b/CHANGELOG.md index 389a294..63ede99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 2020.2.0 + +This release changes the minimal version to **Unity 2020.2** + +The following release changes the main guidelines in order to install and update: + +* Installation and update now rely on Project Settings/Package Manager/Scoped Registries + +* Installation must declare the OpenUPM scoped registry to the project `https://package.openupm.com` with the following scopes: + + * `net.peeweek` + * `com.dbrizov` (used for NaughtyAttributes dependency, minimal version 2.0.8) + +* Once declared in the Scoped Registries, package manager shall display gameplay ingredients. + +#### Added + +* NoLabel property attribute (Hides label in inspector) + ## 2019.3.7 #### Added diff --git a/Documentation~/Images/bg-source2.jpg b/Documentation~/Images/bg-source2.jpg new file mode 100644 index 0000000..57fe51c Binary files /dev/null and b/Documentation~/Images/bg-source2.jpg differ diff --git a/Documentation~/Images/bg-source2.txt b/Documentation~/Images/bg-source2.txt new file mode 100644 index 0000000..dcec806 --- /dev/null +++ b/Documentation~/Images/bg-source2.txt @@ -0,0 +1,2 @@ +Photo by NordWood Themes on Unsplash +https://unsplash.com/photos/wtevVfGYwnM \ No newline at end of file diff --git a/Documentation~/Images/project-settings.png b/Documentation~/Images/project-settings.png new file mode 100644 index 0000000..51434e2 Binary files /dev/null and b/Documentation~/Images/project-settings.png differ diff --git a/Documentation~/Images/site-banner.afphoto b/Documentation~/Images/site-banner.afphoto new file mode 100644 index 0000000..e8054f8 Binary files /dev/null and b/Documentation~/Images/site-banner.afphoto differ diff --git a/Documentation~/Images/site-banner.png b/Documentation~/Images/site-banner.png index a90799f..3b4c94c 100644 Binary files a/Documentation~/Images/site-banner.png and b/Documentation~/Images/site-banner.png differ diff --git a/Documentation~/Images/wizard-banner.afphoto b/Documentation~/Images/wizard-banner.afphoto new file mode 100644 index 0000000..11d7725 Binary files /dev/null and b/Documentation~/Images/wizard-banner.afphoto differ diff --git a/Documentation~/Images/wizard-banner.png b/Documentation~/Images/wizard-banner.png index bb3b92c..a86a6ba 100644 Binary files a/Documentation~/Images/wizard-banner.png and b/Documentation~/Images/wizard-banner.png differ diff --git a/Editor/PropertyDrawers/CallablePropertyDrawer.cs b/Editor/PropertyDrawers/CallablePropertyDrawer.cs index baabff1..232d751 100644 --- a/Editor/PropertyDrawers/CallablePropertyDrawer.cs +++ b/Editor/PropertyDrawers/CallablePropertyDrawer.cs @@ -3,7 +3,6 @@ namespace GameplayIngredients.Editor { - [CustomPropertyDrawer(typeof(Callable))] public class CallablePropertyDrawer : PropertyDrawer { diff --git a/Editor/PropertyDrawers/NoLabelPropertyDrawer.cs b/Editor/PropertyDrawers/NoLabelPropertyDrawer.cs new file mode 100644 index 0000000..f335910 --- /dev/null +++ b/Editor/PropertyDrawers/NoLabelPropertyDrawer.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using UnityEditor; + +namespace GameplayIngredients.Editor +{ + [CustomPropertyDrawer(typeof(NoLabelAttribute))] + public class NoLabelPropertyDrawer : PropertyDrawer + { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + EditorGUIUtility.labelWidth = 0; + EditorGUI.PropertyField(position, property, GUIContent.none); + } + } +} + diff --git a/NaughtyAttributes/Core/DrawerAttributes/DisableIfAttribute.cs.meta b/Editor/PropertyDrawers/NoLabelPropertyDrawer.cs.meta similarity index 83% rename from NaughtyAttributes/Core/DrawerAttributes/DisableIfAttribute.cs.meta rename to Editor/PropertyDrawers/NoLabelPropertyDrawer.cs.meta index 7315069..db6d407 100644 --- a/NaughtyAttributes/Core/DrawerAttributes/DisableIfAttribute.cs.meta +++ b/Editor/PropertyDrawers/NoLabelPropertyDrawer.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dac53a514fd03bb48b3fae8d3d23bf78 +guid: 174492dd868634b4291352bef24a3598 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Editor/WelcomeScreen/welcome-title.png b/Editor/WelcomeScreen/welcome-title.png index bb3b92c..a86a6ba 100644 Binary files a/Editor/WelcomeScreen/welcome-title.png and b/Editor/WelcomeScreen/welcome-title.png differ diff --git a/NaughtyAttributes.meta b/NaughtyAttributes.meta deleted file mode 100644 index 58f2ca2..0000000 --- a/NaughtyAttributes.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bfdc546b0991bd54fb24ad7151d27f7e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core.meta b/NaughtyAttributes/Core.meta deleted file mode 100644 index a055450..0000000 --- a/NaughtyAttributes/Core.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 1f67e408a6d0adf4ab29d095ccd8b116 -folderAsset: yes -timeCreated: 1507998942 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ConditionOperator.cs b/NaughtyAttributes/Core/ConditionOperator.cs deleted file mode 100644 index 2474f6d..0000000 --- a/NaughtyAttributes/Core/ConditionOperator.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - public enum ConditionOperator - { - And, - Or - } -} diff --git a/NaughtyAttributes/Core/ConditionOperator.cs.meta b/NaughtyAttributes/Core/ConditionOperator.cs.meta deleted file mode 100644 index 21b1100..0000000 --- a/NaughtyAttributes/Core/ConditionOperator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8da69fd2354ea264bb1c54362ee02938 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawConditionAttributes.meta b/NaughtyAttributes/Core/DrawConditionAttributes.meta deleted file mode 100644 index 1b422d7..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 0d8ad70d0e1e04248b1f5c5d5fb358f4 -folderAsset: yes -timeCreated: 1508414568 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawConditionAttributes/DrawConditionAttribute.cs b/NaughtyAttributes/Core/DrawConditionAttributes/DrawConditionAttribute.cs deleted file mode 100644 index 30b684f..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes/DrawConditionAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - public class DrawConditionAttribute : NaughtyAttribute - { - - } -} diff --git a/NaughtyAttributes/Core/DrawConditionAttributes/DrawConditionAttribute.cs.meta b/NaughtyAttributes/Core/DrawConditionAttributes/DrawConditionAttribute.cs.meta deleted file mode 100644 index 6d27b22..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes/DrawConditionAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 8fd9817e8bf3e054ab8e73b47bdce8c7 -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawConditionAttributes/HideIfAttribute.cs b/NaughtyAttributes/Core/DrawConditionAttributes/HideIfAttribute.cs deleted file mode 100644 index b739135..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes/HideIfAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class HideIfAttribute : ShowIfAttribute - { - public HideIfAttribute(string condition) - : base(condition) - { - Reversed = true; - } - - public HideIfAttribute(ConditionOperator conditionOperator, params string[] conditions) - : base(conditionOperator, conditions) - { - Reversed = true; - } - } -} diff --git a/NaughtyAttributes/Core/DrawConditionAttributes/HideIfAttribute.cs.meta b/NaughtyAttributes/Core/DrawConditionAttributes/HideIfAttribute.cs.meta deleted file mode 100644 index 363b863..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes/HideIfAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: aafc3a255165311419b7070198e7ffaf -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawConditionAttributes/ShowIfAttribute.cs b/NaughtyAttributes/Core/DrawConditionAttributes/ShowIfAttribute.cs deleted file mode 100644 index 46059f3..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes/ShowIfAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ShowIfAttribute : DrawConditionAttribute - { - public string[] Conditions { get; private set; } - public ConditionOperator ConditionOperator { get; private set; } - public bool Reversed { get; protected set; } - - public ShowIfAttribute(string condition) - { - ConditionOperator = ConditionOperator.And; - Conditions = new string[1] { condition }; - } - - public ShowIfAttribute(ConditionOperator conditionOperator, params string[] conditions) - { - ConditionOperator = conditionOperator; - Conditions = conditions; - } - } -} diff --git a/NaughtyAttributes/Core/DrawConditionAttributes/ShowIfAttribute.cs.meta b/NaughtyAttributes/Core/DrawConditionAttributes/ShowIfAttribute.cs.meta deleted file mode 100644 index cff1299..0000000 --- a/NaughtyAttributes/Core/DrawConditionAttributes/ShowIfAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 6a9e9448e6e70094297d49ec9c82c6e1 -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes.meta b/NaughtyAttributes/Core/DrawerAttributes.meta deleted file mode 100644 index 756c714..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: c76425e719cd4424d868674bcfb233f2 -folderAsset: yes -timeCreated: 1508151410 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ButtonAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ButtonAttribute.cs deleted file mode 100644 index 9e89ef6..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ButtonAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] - public class ButtonAttribute : DrawerAttribute - { - public string Text { get; private set; } - - public ButtonAttribute(string text = null) - { - this.Text = text; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ButtonAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ButtonAttribute.cs.meta deleted file mode 100644 index 3f00112..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ButtonAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: d61d9be90aa48764096a2bea37c9bd60 -timeCreated: 1508591778 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/DisableIfAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/DisableIfAttribute.cs deleted file mode 100644 index d9db224..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/DisableIfAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class DisableIfAttribute : EnableIfAttribute - { - public DisableIfAttribute(string condition) - : base(condition) - { - Reversed = true; - } - - public DisableIfAttribute(ConditionOperator conditionOperator, params string[] conditions) - : base(conditionOperator, conditions) - { - Reversed = true; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/DrawerAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/DrawerAttribute.cs deleted file mode 100644 index b3a3a67..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/DrawerAttribute.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - public abstract class DrawerAttribute : NaughtyAttribute - { - } -} \ No newline at end of file diff --git a/NaughtyAttributes/Core/DrawerAttributes/DrawerAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/DrawerAttribute.cs.meta deleted file mode 100644 index 2043b25..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/DrawerAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 57360d74732bf2749b2f8d5e0a0ea6f5 -timeCreated: 1508151410 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/DropdownAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/DropdownAttribute.cs deleted file mode 100644 index 0a433f4..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/DropdownAttribute.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class DropdownAttribute : DrawerAttribute - { - public string ValuesFieldName { get; private set; } - - public DropdownAttribute(string valuesFieldName) - { - this.ValuesFieldName = valuesFieldName; - } - } - - public interface IDropdownList : IEnumerable> - { - } - - public class DropdownList : IDropdownList - { - private List> values; - - public DropdownList() - { - this.values = new List>(); - } - - public void Add(string displayName, T value) - { - this.values.Add(new KeyValuePair(displayName, value)); - } - - public IEnumerator> GetEnumerator() - { - return this.values.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - - public static explicit operator DropdownList(DropdownList target) - { - DropdownList result = new DropdownList(); - foreach (var kvp in target) - { - result.Add(kvp.Key, kvp.Value); - } - - return result; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/DropdownAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/DropdownAttribute.cs.meta deleted file mode 100644 index a402b5a..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/DropdownAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: cd3b8c98b0803554e9152991fe806c62 -timeCreated: 1508752474 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/EnableIfAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/EnableIfAttribute.cs deleted file mode 100644 index d5f12d4..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/EnableIfAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class EnableIfAttribute : DrawerAttribute - { - public string[] Conditions { get; private set; } - public ConditionOperator ConditionOperator { get; private set; } - public bool Reversed { get; protected set; } - - public EnableIfAttribute(string condition) - { - ConditionOperator = ConditionOperator.And; - Conditions = new string[1] { condition }; - } - - public EnableIfAttribute(ConditionOperator conditionOperator, params string[] conditions) - { - ConditionOperator = conditionOperator; - Conditions = conditions; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs deleted file mode 100644 index d8a99d1..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - /// - /// Override default label - /// - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class LabelAttribute : DrawerAttribute - { - public string Label { get; private set; } - - public LabelAttribute(string label) - { - this.Label = label; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs.meta deleted file mode 100644 index 152c686..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/LabelAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e58df0ada05db63488ddd96c571d7bc1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/MinMaxSliderAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/MinMaxSliderAttribute.cs deleted file mode 100644 index aa429de..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/MinMaxSliderAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class MinMaxSliderAttribute : DrawerAttribute - { - public float MinValue { get; private set; } - public float MaxValue { get; private set; } - - public MinMaxSliderAttribute(float minValue, float maxValue) - { - this.MinValue = minValue; - this.MaxValue = maxValue; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta deleted file mode 100644 index 8dd63f3..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 61d133a2d203a77419f35652a7f3fae0 -timeCreated: 1508427131 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ProgressBarAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ProgressBarAttribute.cs deleted file mode 100644 index 0649477..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ProgressBarAttribute.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ProgressBarAttribute : DrawerAttribute - { - public string Name { get; private set; } - public float MaxValue { get; private set; } - public ProgressBarColor Color { get; private set; } - - public ProgressBarAttribute(string name = "", float maxValue = 100, ProgressBarColor color = ProgressBarColor.Blue) - { - Name = name; - MaxValue = maxValue; - Color = color; - } - } - - public enum ProgressBarColor - { - Red, - Pink, - Orange, - Yellow, - Green, - Blue, - Indigo, - Violet, - White - } -} \ No newline at end of file diff --git a/NaughtyAttributes/Core/DrawerAttributes/ProgressBarAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ProgressBarAttribute.cs.meta deleted file mode 100644 index 65bfa95..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ProgressBarAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 8d8eb74e78cba7b43b3025525c5084b9 -timeCreated: 1518435237 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ReadOnlyAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ReadOnlyAttribute.cs deleted file mode 100644 index d29794a..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ReadOnlyAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ReadOnlyAttribute : DrawerAttribute - { - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ReadOnlyAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ReadOnlyAttribute.cs.meta deleted file mode 100644 index 54b0ced..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ReadOnlyAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 4fa676ebc6d589c44817272871db148b -timeCreated: 1508862052 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ReorderableListAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ReorderableListAttribute.cs deleted file mode 100644 index ff1a701..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ReorderableListAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ReorderableListAttribute : DrawerAttribute - { - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ReorderableListAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ReorderableListAttribute.cs.meta deleted file mode 100644 index 59e4c99..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ReorderableListAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: ff85489452472c241987e5ba4c5e512a -timeCreated: 1508402303 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ResizableTextAreaAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ResizableTextAreaAttribute.cs deleted file mode 100644 index e84e664..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ResizableTextAreaAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ResizableTextAreaAttribute : DrawerAttribute - { - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta deleted file mode 100644 index 43e40fd..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 1793ea6e464ee6448930ecf133ed6a1d -timeCreated: 1508583166 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs deleted file mode 100644 index 6b35444..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ShowAssetPreviewAttribute : DrawerAttribute - { - public int Width { get; private set; } - public int Height { get; private set; } - - public ShowAssetPreviewAttribute(int width = 64, int height = 64) - { - this.Width = width; - this.Height = height; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta deleted file mode 100644 index bcdeb2c..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 313b856a920a987418d6437a8e20a59f -timeCreated: 1509089502 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ShowNativePropertyAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ShowNativePropertyAttribute.cs deleted file mode 100644 index bb8a7c7..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ShowNativePropertyAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using UnityEngine; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] - public class ShowNativePropertyAttribute : DrawerAttribute - { - - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ShowNativePropertyAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ShowNativePropertyAttribute.cs.meta deleted file mode 100644 index 29f619d..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ShowNativePropertyAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: acc7d7e8ec9e47a4aaf4167698ae076f -timeCreated: 1510926376 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/ShowNonSerializedFieldAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/ShowNonSerializedFieldAttribute.cs deleted file mode 100644 index 8f311ef..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ShowNonSerializedFieldAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ShowNonSerializedFieldAttribute : DrawerAttribute - { - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/ShowNonSerializedFieldAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/ShowNonSerializedFieldAttribute.cs.meta deleted file mode 100644 index d21b234..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/ShowNonSerializedFieldAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: a176aad85de73b34ba3ecd4f7baa367b -timeCreated: 1508835721 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/SliderAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/SliderAttribute.cs deleted file mode 100644 index ece2b58..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/SliderAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class SliderAttribute : DrawerAttribute - { - public float MinValue { get; private set; } - public float MaxValue { get; private set; } - - public SliderAttribute(float minValue, float maxValue) - { - this.MinValue = minValue; - this.MaxValue = maxValue; - } - - public SliderAttribute(int minValue, int maxValue) - { - this.MaxValue = minValue; - this.MaxValue = maxValue; - } - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/SliderAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/SliderAttribute.cs.meta deleted file mode 100644 index b121855..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/SliderAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: f75eef8142877c345ba9b95046dd3bf6 -timeCreated: 1508422518 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs b/NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs deleted file mode 100644 index f7829c6..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - /// - /// Make tags appear as tag popup fields - /// - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class TagAttribute : DrawerAttribute - { - } -} diff --git a/NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs.meta b/NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs.meta deleted file mode 100644 index 475b869..0000000 --- a/NaughtyAttributes/Core/DrawerAttributes/TagAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ad140cd5debdba44aa6db74894a5e913 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/GroupAttributes.meta b/NaughtyAttributes/Core/GroupAttributes.meta deleted file mode 100644 index 4455f01..0000000 --- a/NaughtyAttributes/Core/GroupAttributes.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 86ca4f90dd05bc448959ecd8f44097a7 -folderAsset: yes -timeCreated: 1508330803 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/GroupAttributes/BoxGroupAttribute.cs b/NaughtyAttributes/Core/GroupAttributes/BoxGroupAttribute.cs deleted file mode 100644 index a6f3b49..0000000 --- a/NaughtyAttributes/Core/GroupAttributes/BoxGroupAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class BoxGroupAttribute : GroupAttribute - { - public BoxGroupAttribute(string name = "") - : base(name) - { - } - } -} diff --git a/NaughtyAttributes/Core/GroupAttributes/BoxGroupAttribute.cs.meta b/NaughtyAttributes/Core/GroupAttributes/BoxGroupAttribute.cs.meta deleted file mode 100644 index fcdb278..0000000 --- a/NaughtyAttributes/Core/GroupAttributes/BoxGroupAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 88c5a8d79f9e72a43a4cfa67fd08fdd6 -timeCreated: 1508326108 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/GroupAttributes/GroupAttribute.cs b/NaughtyAttributes/Core/GroupAttributes/GroupAttribute.cs deleted file mode 100644 index a317fe2..0000000 --- a/NaughtyAttributes/Core/GroupAttributes/GroupAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - public abstract class GroupAttribute : NaughtyAttribute - { - public string Name { get; private set; } - - public GroupAttribute(string name) - { - this.Name = name; - } - } -} diff --git a/NaughtyAttributes/Core/GroupAttributes/GroupAttribute.cs.meta b/NaughtyAttributes/Core/GroupAttributes/GroupAttribute.cs.meta deleted file mode 100644 index db3cc39..0000000 --- a/NaughtyAttributes/Core/GroupAttributes/GroupAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: beb48511ef6091e4ba054ad1b618933c -timeCreated: 1508326108 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/MetaAttributes.meta b/NaughtyAttributes/Core/MetaAttributes.meta deleted file mode 100644 index f2ed90e..0000000 --- a/NaughtyAttributes/Core/MetaAttributes.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 51ee806b39c5fb343ae7d268404d8c67 -folderAsset: yes -timeCreated: 1508497398 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/MetaAttributes/InfoBoxAttribute.cs b/NaughtyAttributes/Core/MetaAttributes/InfoBoxAttribute.cs deleted file mode 100644 index d09c616..0000000 --- a/NaughtyAttributes/Core/MetaAttributes/InfoBoxAttribute.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] - public class InfoBoxAttribute : MetaAttribute - { - public string Text { get; private set; } - public InfoBoxType Type { get; private set; } - public string VisibleIf { get; private set; } - - public InfoBoxAttribute(string text, InfoBoxType type = InfoBoxType.Normal, string visibleIf = null) - { - this.Text = text; - this.Type = type; - this.VisibleIf = visibleIf; - } - - public InfoBoxAttribute(string text, string visibleIf) - : this(text, InfoBoxType.Normal, visibleIf) - { - } - } - - public enum InfoBoxType - { - Normal, - Warning, - Error - } -} diff --git a/NaughtyAttributes/Core/MetaAttributes/InfoBoxAttribute.cs.meta b/NaughtyAttributes/Core/MetaAttributes/InfoBoxAttribute.cs.meta deleted file mode 100644 index 19cb564..0000000 --- a/NaughtyAttributes/Core/MetaAttributes/InfoBoxAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 42c6184c84ab19d4382b06f9017f136d -timeCreated: 1508607449 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/MetaAttributes/MetaAttribute.cs b/NaughtyAttributes/Core/MetaAttributes/MetaAttribute.cs deleted file mode 100644 index ef2a451..0000000 --- a/NaughtyAttributes/Core/MetaAttributes/MetaAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - public abstract class MetaAttribute : NaughtyAttribute - { - public int Order { get; set; } - } -} diff --git a/NaughtyAttributes/Core/MetaAttributes/MetaAttribute.cs.meta b/NaughtyAttributes/Core/MetaAttributes/MetaAttribute.cs.meta deleted file mode 100644 index 5f5e5d7..0000000 --- a/NaughtyAttributes/Core/MetaAttributes/MetaAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: fcd6d339bcd667044a48d41a78a7830c -timeCreated: 1508497398 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/MetaAttributes/OnValueChangedAttribute.cs b/NaughtyAttributes/Core/MetaAttributes/OnValueChangedAttribute.cs deleted file mode 100644 index ab826b8..0000000 --- a/NaughtyAttributes/Core/MetaAttributes/OnValueChangedAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] - public class OnValueChangedAttribute : MetaAttribute - { - public string CallbackName { get; private set; } - - public OnValueChangedAttribute(string callbackName) - { - this.CallbackName = callbackName; - } - } -} diff --git a/NaughtyAttributes/Core/MetaAttributes/OnValueChangedAttribute.cs.meta b/NaughtyAttributes/Core/MetaAttributes/OnValueChangedAttribute.cs.meta deleted file mode 100644 index 1452234..0000000 --- a/NaughtyAttributes/Core/MetaAttributes/OnValueChangedAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: a144cdc17b6e4cf4f86692ae1dc7e4d7 -timeCreated: 1508610277 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/NaughtyAttribute.cs b/NaughtyAttributes/Core/NaughtyAttribute.cs deleted file mode 100644 index 6251af9..0000000 --- a/NaughtyAttributes/Core/NaughtyAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - // The base class for all naughty attributes - public class NaughtyAttribute : Attribute - { - } -} diff --git a/NaughtyAttributes/Core/NaughtyAttribute.cs.meta b/NaughtyAttributes/Core/NaughtyAttribute.cs.meta deleted file mode 100644 index fdf1ddf..0000000 --- a/NaughtyAttributes/Core/NaughtyAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 1accb89cb44c4a342a1857e5e3d13abb -timeCreated: 1508052914 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef b/NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef deleted file mode 100644 index b585d0b..0000000 --- a/NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "NaughtyAttributes.Core", - "references": [], - "optionalUnityReferences": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [] -} \ No newline at end of file diff --git a/NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef.meta b/NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef.meta deleted file mode 100644 index 731749c..0000000 --- a/NaughtyAttributes/Core/NaughtyAttributes.Core.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 776d03a35f1b52c4a9aed9f56d7b4229 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ValidatorAttributes.meta b/NaughtyAttributes/Core/ValidatorAttributes.meta deleted file mode 100644 index 9bee434..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 8a655727c2e629a438ad94f60080b9ea -folderAsset: yes -timeCreated: 1508151410 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ValidatorAttributes/MaxValueAttribute.cs b/NaughtyAttributes/Core/ValidatorAttributes/MaxValueAttribute.cs deleted file mode 100644 index 4c54127..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/MaxValueAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class MaxValueAttribute : ValidatorAttribute - { - public float MaxValue { get; private set; } - - public MaxValueAttribute(float maxValue) - { - this.MaxValue = maxValue; - } - - public MaxValueAttribute(int maxValue) - { - this.MaxValue = maxValue; - } - } -} diff --git a/NaughtyAttributes/Core/ValidatorAttributes/MaxValueAttribute.cs.meta b/NaughtyAttributes/Core/ValidatorAttributes/MaxValueAttribute.cs.meta deleted file mode 100644 index 4ba3b5a..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/MaxValueAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: e018059e7fe12fd42a3a1bba0dbbf9c5 -timeCreated: 1508047804 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ValidatorAttributes/MinValueAttribute.cs b/NaughtyAttributes/Core/ValidatorAttributes/MinValueAttribute.cs deleted file mode 100644 index 627e747..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/MinValueAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class MinValueAttribute : ValidatorAttribute - { - public float MinValue { get; private set; } - - public MinValueAttribute(float minValue) - { - this.MinValue = minValue; - } - - public MinValueAttribute(int minValue) - { - this.MinValue = minValue; - } - } -} diff --git a/NaughtyAttributes/Core/ValidatorAttributes/MinValueAttribute.cs.meta b/NaughtyAttributes/Core/ValidatorAttributes/MinValueAttribute.cs.meta deleted file mode 100644 index 19450e8..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/MinValueAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 337be62eb8c929f4ab8b3d495a712a56 -timeCreated: 1508048805 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ValidatorAttributes/RequiredAttribute.cs b/NaughtyAttributes/Core/ValidatorAttributes/RequiredAttribute.cs deleted file mode 100644 index 903f658..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/RequiredAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class RequiredAttribute : ValidatorAttribute - { - public string Message { get; private set; } - - public RequiredAttribute(string message = null) - { - this.Message = message; - } - } -} diff --git a/NaughtyAttributes/Core/ValidatorAttributes/RequiredAttribute.cs.meta b/NaughtyAttributes/Core/ValidatorAttributes/RequiredAttribute.cs.meta deleted file mode 100644 index 068d000..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/RequiredAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 0b70ebd0fbd89c648981f08469806779 -timeCreated: 1508655546 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ValidatorAttributes/ValidateInputAttribute.cs b/NaughtyAttributes/Core/ValidatorAttributes/ValidateInputAttribute.cs deleted file mode 100644 index d024816..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/ValidateInputAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] - public class ValidateInputAttribute : ValidatorAttribute - { - public string CallbackName { get; private set; } - public string Message { get; private set; } - - public ValidateInputAttribute(string callbackName, string message = null) - { - this.CallbackName = callbackName; - this.Message = message; - } - } -} diff --git a/NaughtyAttributes/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta b/NaughtyAttributes/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta deleted file mode 100644 index ed365d1..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: f13ea28cf56e89f4cb335e28c9ab5d9a -timeCreated: 1508657795 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Core/ValidatorAttributes/ValidatorAttribute.cs b/NaughtyAttributes/Core/ValidatorAttributes/ValidatorAttribute.cs deleted file mode 100644 index 38222eb..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/ValidatorAttribute.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace NaughtyAttributes -{ - public abstract class ValidatorAttribute : NaughtyAttribute - { - } -} diff --git a/NaughtyAttributes/Core/ValidatorAttributes/ValidatorAttribute.cs.meta b/NaughtyAttributes/Core/ValidatorAttributes/ValidatorAttribute.cs.meta deleted file mode 100644 index 668f7e1..0000000 --- a/NaughtyAttributes/Core/ValidatorAttributes/ValidatorAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 5fac74a9575c45342be1e6dda45610ad -timeCreated: 1508151410 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor.meta b/NaughtyAttributes/Editor.meta deleted file mode 100644 index 8110aa8..0000000 --- a/NaughtyAttributes/Editor.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: b76068e69df25a94ab378b0b6829c4f0 -folderAsset: yes -timeCreated: 1507995613 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes.meta b/NaughtyAttributes/Editor/Attributes.meta deleted file mode 100644 index 3f8ebe7..0000000 --- a/NaughtyAttributes/Editor/Attributes.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: bfd420e5bf6a25049b8fcea8b2f48c94 -folderAsset: yes -timeCreated: 1508153828 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/BaseAttribute.cs b/NaughtyAttributes/Editor/Attributes/BaseAttribute.cs deleted file mode 100644 index b3fef44..0000000 --- a/NaughtyAttributes/Editor/Attributes/BaseAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] - public abstract class BaseAttribute : Attribute, IAttribute - { - private Type targetAttributeType; - - public BaseAttribute(Type targetAttributeType) - { - this.targetAttributeType = targetAttributeType; - } - - public Type TargetAttributeType - { - get - { - return this.targetAttributeType; - } - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/BaseAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/BaseAttribute.cs.meta deleted file mode 100644 index d12b1ae..0000000 --- a/NaughtyAttributes/Editor/Attributes/BaseAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: dd861c512b7cd804fa5f01b4d0e9f5bc -timeCreated: 1508424822 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/FieldDrawerAttribute.cs b/NaughtyAttributes/Editor/Attributes/FieldDrawerAttribute.cs deleted file mode 100644 index e2de8b0..0000000 --- a/NaughtyAttributes/Editor/Attributes/FieldDrawerAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class FieldDrawerAttribute : BaseAttribute - { - public FieldDrawerAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/FieldDrawerAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/FieldDrawerAttribute.cs.meta deleted file mode 100644 index 456e222..0000000 --- a/NaughtyAttributes/Editor/Attributes/FieldDrawerAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: ad0dbf00ca9ec1e4290145dc40bda96f -timeCreated: 1508835980 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/IAttribute.cs b/NaughtyAttributes/Editor/Attributes/IAttribute.cs deleted file mode 100644 index 5d24b68..0000000 --- a/NaughtyAttributes/Editor/Attributes/IAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public interface IAttribute - { - Type TargetAttributeType { get; } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/IAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/IAttribute.cs.meta deleted file mode 100644 index 4b3a9d9..0000000 --- a/NaughtyAttributes/Editor/Attributes/IAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: eec883c51d802eb49be41f384e227dad -timeCreated: 1508424822 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/MethodDrawerAttribute.cs b/NaughtyAttributes/Editor/Attributes/MethodDrawerAttribute.cs deleted file mode 100644 index ad78d4b..0000000 --- a/NaughtyAttributes/Editor/Attributes/MethodDrawerAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class MethodDrawerAttribute : BaseAttribute - { - public MethodDrawerAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/MethodDrawerAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/MethodDrawerAttribute.cs.meta deleted file mode 100644 index 7b6acd3..0000000 --- a/NaughtyAttributes/Editor/Attributes/MethodDrawerAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: b89ac4d9b78686548baa09fb0b103850 -timeCreated: 1508592495 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/NativePropertyDrawerAttribute.cs b/NaughtyAttributes/Editor/Attributes/NativePropertyDrawerAttribute.cs deleted file mode 100644 index d60e141..0000000 --- a/NaughtyAttributes/Editor/Attributes/NativePropertyDrawerAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class NativePropertyDrawerAttribute : BaseAttribute - { - public NativePropertyDrawerAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/NativePropertyDrawerAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/NativePropertyDrawerAttribute.cs.meta deleted file mode 100644 index 9a726e7..0000000 --- a/NaughtyAttributes/Editor/Attributes/NativePropertyDrawerAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 7c30e23a060c0614b876d7f14e0ee649 -timeCreated: 1510924166 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/PropertyDrawConditionAttribute.cs b/NaughtyAttributes/Editor/Attributes/PropertyDrawConditionAttribute.cs deleted file mode 100644 index c8fa6e9..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyDrawConditionAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class PropertyDrawConditionAttribute : BaseAttribute - { - public PropertyDrawConditionAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/PropertyDrawConditionAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/PropertyDrawConditionAttribute.cs.meta deleted file mode 100644 index 663b290..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyDrawConditionAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: d7962631135870e4fa748e6f81cd64d4 -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/PropertyDrawerAttribute.cs b/NaughtyAttributes/Editor/Attributes/PropertyDrawerAttribute.cs deleted file mode 100644 index cce3c96..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyDrawerAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class PropertyDrawerAttribute : BaseAttribute - { - public PropertyDrawerAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/PropertyDrawerAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/PropertyDrawerAttribute.cs.meta deleted file mode 100644 index 3b4803b..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyDrawerAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 77bb6824c4e9e054db05347dd8465f24 -timeCreated: 1508153828 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/PropertyGrouperAttribute.cs b/NaughtyAttributes/Editor/Attributes/PropertyGrouperAttribute.cs deleted file mode 100644 index 5574cc5..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyGrouperAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class PropertyGrouperAttribute : BaseAttribute - { - public PropertyGrouperAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/PropertyGrouperAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/PropertyGrouperAttribute.cs.meta deleted file mode 100644 index 757cf05..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyGrouperAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 9d1b7efb592ab4a4796c70edaad2be75 -timeCreated: 1508332897 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/PropertyMetaAttribute.cs b/NaughtyAttributes/Editor/Attributes/PropertyMetaAttribute.cs deleted file mode 100644 index 0d2e09c..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyMetaAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class PropertyMetaAttribute : BaseAttribute - { - public PropertyMetaAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/PropertyMetaAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/PropertyMetaAttribute.cs.meta deleted file mode 100644 index 2537218..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyMetaAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: b46e1700b41c60141b19b0a7ed25a383 -timeCreated: 1508497398 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Attributes/PropertyValidatorAttribute.cs b/NaughtyAttributes/Editor/Attributes/PropertyValidatorAttribute.cs deleted file mode 100644 index 375bd33..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyValidatorAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public class PropertyValidatorAttribute : BaseAttribute - { - public PropertyValidatorAttribute(Type targetAttributeType) : base(targetAttributeType) - { - } - } -} diff --git a/NaughtyAttributes/Editor/Attributes/PropertyValidatorAttribute.cs.meta b/NaughtyAttributes/Editor/Attributes/PropertyValidatorAttribute.cs.meta deleted file mode 100644 index 1e3fbfe..0000000 --- a/NaughtyAttributes/Editor/Attributes/PropertyValidatorAttribute.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 38c34a83bfd0a07468f20ae50c36737f -timeCreated: 1508153828 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration.meta b/NaughtyAttributes/Editor/CodeGeneration.meta deleted file mode 100644 index 4d91c4b..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 3876cb6aacfb99f46803d5e50eacdf2c -folderAsset: yes -timeCreated: 1508230862 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs b/NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs deleted file mode 100644 index bafbf0b..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using UnityEngine; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - public class CodeGenerator : UnityEditor.Editor - { - private static readonly string GENERATED_CODE_TARGET_FOLDER = - (Application.dataPath.Replace("Assets", string.Empty) + AssetDatabase.GUIDToAssetPath(AssetDatabase.FindAssets("CodeGenerator")[0])) - .Replace("CodeGenerator.cs", string.Empty) - .Replace("/", "\\"); - - private static readonly string CLASS_NAME_PLACEHOLDER = "__classname__"; - private static readonly string ENTRIES_PLACEHOLDER = "__entries__"; - private static readonly string META_ENTRY_FORMAT = "metasByAttributeType[typeof({0})] = new {1}();" + Environment.NewLine; - private static readonly string DRAWER_ENTRY_FORMAT = "drawersByAttributeType[typeof({0})] = new {1}();" + Environment.NewLine; - private static readonly string GROUPER_ENTRY_FORMAT = "groupersByAttributeType[typeof({0})] = new {1}();" + Environment.NewLine; - private static readonly string VALIDATOR_ENTRY_FORMAT = "validatorsByAttributeType[typeof({0})] = new {1}();" + Environment.NewLine; - private static readonly string DRAW_CONDITION_ENTRY_FORMAT = "drawConditionsByAttributeType[typeof({0})] = new {1}();" + Environment.NewLine; - - //[UnityEditor.Callbacks.DidReloadScripts] - [MenuItem("Tools/NaughtyAttributes/Update Attributes Database")] - private static void GenerateCode() - { - GenerateScript("PropertyMetaDatabase", "PropertyMetaDatabaseTemplate", META_ENTRY_FORMAT); - GenerateScript("PropertyDrawerDatabase", "PropertyDrawerDatabaseTemplate", DRAWER_ENTRY_FORMAT); - GenerateScript("PropertyGrouperDatabase", "PropertyGrouperDatabaseTemplate", GROUPER_ENTRY_FORMAT); - GenerateScript("PropertyValidatorDatabase", "PropertyValidatorDatabaseTemplate", VALIDATOR_ENTRY_FORMAT); - GenerateScript("PropertyDrawConditionDatabase", "PropertyDrawConditionDatabaseTemplate", DRAW_CONDITION_ENTRY_FORMAT); - - GenerateScript("FieldDrawerDatabase", "FieldDrawerDatabaseTemplate", DRAWER_ENTRY_FORMAT); - GenerateScript("MethodDrawerDatabase", "MethodDrawerDatabaseTemplate", DRAWER_ENTRY_FORMAT); - GenerateScript("NativePropertyDrawerDatabase", "NativePropertyDrawerDbTemplate", DRAWER_ENTRY_FORMAT); - - AssetDatabase.Refresh(); - } - - private static void GenerateScript(string scriptName, string templateName, string entryFormat) - where TAttribute : IAttribute - { - string[] templateAssets = AssetDatabase.FindAssets(templateName); - if (templateAssets.Length == 0) - { - return; - } - - string templateGUID = templateAssets[0]; - string templateRelativePath = AssetDatabase.GUIDToAssetPath(templateGUID); - string templateFormat = (AssetDatabase.LoadAssetAtPath(templateRelativePath, typeof(TextAsset)) as TextAsset).ToString(); - //string templateFullPath = (Application.dataPath.Replace("Assets", string.Empty) + templateRelativePath).Replace("/", "\\"); - //string templateFormat = IOUtility.ReadFromFile(templateFullPath); - - StringBuilder entriesBuilder = new StringBuilder(); - List subTypes = GetAllSubTypes(typeof(TClass)); - - foreach (var subType in subTypes) - { - IAttribute[] attributes = (IAttribute[])subType.GetCustomAttributes(typeof(TAttribute), true); - if (attributes.Length > 0) - { - entriesBuilder.AppendFormat(entryFormat, attributes[0].TargetAttributeType.Name, subType.Name); - } - } - - string scriptContent = templateFormat - .Replace(CLASS_NAME_PLACEHOLDER, scriptName) - .Replace(ENTRIES_PLACEHOLDER, entriesBuilder.ToString()); - - scriptContent = Regex.Replace(scriptContent, @"\r\n|\n\r|\r|\n", Environment.NewLine); // Normalize line endings - - string scriptPath = GENERATED_CODE_TARGET_FOLDER + scriptName + ".cs"; - - IOUtility.WriteToFile(scriptPath, scriptContent); - } - - private static List GetAllSubTypes(Type baseClass) - { - var result = new List(); - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - - foreach (var assemly in assemblies) - { - Type[] types = assemly.GetTypes(); - foreach (var type in types) - { - if (type.IsSubclassOf(baseClass)) - { - result.Add(type); - } - } - } - - return result; - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs.meta deleted file mode 100644 index 2bbd870..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/CodeGenerator.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 990da0e1629b14049842bf2ac82cbff0 -timeCreated: 1508230160 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/FieldDrawerDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/FieldDrawerDatabase.cs deleted file mode 100644 index a1e4692..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/FieldDrawerDatabase.cs +++ /dev/null @@ -1,33 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class FieldDrawerDatabase - { - private static Dictionary drawersByAttributeType; - - static FieldDrawerDatabase() - { - drawersByAttributeType = new Dictionary(); - drawersByAttributeType[typeof(ShowNonSerializedFieldAttribute)] = new ShowNonSerializedFieldFieldDrawer(); - - } - - public static FieldDrawer GetDrawerForAttribute(Type attributeType) - { - FieldDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/FieldDrawerDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/FieldDrawerDatabase.cs.meta deleted file mode 100644 index 52c69e9..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/FieldDrawerDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: b2406e32d0ab1214ab4959f1cdc8a609 -timeCreated: 1508836346 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/MethodDrawerDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/MethodDrawerDatabase.cs deleted file mode 100644 index 832fb60..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/MethodDrawerDatabase.cs +++ /dev/null @@ -1,33 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class MethodDrawerDatabase - { - private static Dictionary drawersByAttributeType; - - static MethodDrawerDatabase() - { - drawersByAttributeType = new Dictionary(); - drawersByAttributeType[typeof(ButtonAttribute)] = new ButtonMethodDrawer(); - - } - - public static MethodDrawer GetDrawerForAttribute(Type attributeType) - { - MethodDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/MethodDrawerDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/MethodDrawerDatabase.cs.meta deleted file mode 100644 index 82b0f85..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/MethodDrawerDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 40b81aa63ff76d34ea67277db99a6a25 -timeCreated: 1508592498 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/NativePropertyDrawerDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/NativePropertyDrawerDatabase.cs deleted file mode 100644 index 2844f95..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/NativePropertyDrawerDatabase.cs +++ /dev/null @@ -1,33 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class NativePropertyDrawerDatabase - { - private static Dictionary drawersByAttributeType; - - static NativePropertyDrawerDatabase() - { - drawersByAttributeType = new Dictionary(); - drawersByAttributeType[typeof(ShowNativePropertyAttribute)] = new ShowNativePropertyNativePropertyDrawer(); - - } - - public static NativePropertyDrawer GetDrawerForAttribute(Type attributeType) - { - NativePropertyDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/NativePropertyDrawerDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/NativePropertyDrawerDatabase.cs.meta deleted file mode 100644 index b86e8d3..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/NativePropertyDrawerDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 9fd2f82e21266a94ea967208610dda1e -timeCreated: 1510925645 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawConditionDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawConditionDatabase.cs deleted file mode 100644 index 2bf40b8..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawConditionDatabase.cs +++ /dev/null @@ -1,34 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class PropertyDrawConditionDatabase - { - private static Dictionary drawConditionsByAttributeType; - - static PropertyDrawConditionDatabase() - { - drawConditionsByAttributeType = new Dictionary(); - drawConditionsByAttributeType[typeof(HideIfAttribute)] = new HideIfPropertyDrawCondition(); -drawConditionsByAttributeType[typeof(ShowIfAttribute)] = new ShowIfPropertyDrawCondition(); - - } - - public static PropertyDrawCondition GetDrawConditionForAttribute(Type attributeType) - { - PropertyDrawCondition drawCondition; - if (drawConditionsByAttributeType.TryGetValue(attributeType, out drawCondition)) - { - return drawCondition; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawConditionDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawConditionDatabase.cs.meta deleted file mode 100644 index e4b5bff..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawConditionDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 0b96dc9fe878bfc49865d28d601a7468 -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs deleted file mode 100644 index ff6c213..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs +++ /dev/null @@ -1,52 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class PropertyDrawerDatabase - { - private static Dictionary drawersByAttributeType; - - static PropertyDrawerDatabase() - { - drawersByAttributeType = new Dictionary(); - drawersByAttributeType[typeof(DisableIfAttribute)] = new DisableIfPropertyDrawer(); -drawersByAttributeType[typeof(DropdownAttribute)] = new DropdownPropertyDrawer(); -drawersByAttributeType[typeof(EnableIfAttribute)] = new EnableIfPropertyDrawer(); -drawersByAttributeType[typeof(LabelAttribute)] = new LabelPropertyDrawer(); -drawersByAttributeType[typeof(MinMaxSliderAttribute)] = new MinMaxSliderPropertyDrawer(); -drawersByAttributeType[typeof(ProgressBarAttribute)] = new ProgressBarPropertyDrawer(); -drawersByAttributeType[typeof(ReadOnlyAttribute)] = new ReadOnlyPropertyDrawer(); -drawersByAttributeType[typeof(ReorderableListAttribute)] = new ReorderableListPropertyDrawer(); -drawersByAttributeType[typeof(ResizableTextAreaAttribute)] = new ResizableTextAreaPropertyDrawer(); -drawersByAttributeType[typeof(ShowAssetPreviewAttribute)] = new ShowAssetPreviewPropertyDrawer(); -drawersByAttributeType[typeof(SliderAttribute)] = new SliderPropertyDrawer(); -drawersByAttributeType[typeof(TagAttribute)] = new TagPropertyDrawer(); - - } - - public static PropertyDrawer GetDrawerForAttribute(Type attributeType) - { - PropertyDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - - public static void ClearCache() - { - foreach (var kvp in drawersByAttributeType) - { - kvp.Value.ClearCache(); - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs.meta deleted file mode 100644 index 36c43db..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyDrawerDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 57bb89ab38f8da84db719a3fad7934d2 -timeCreated: 1508241644 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyGrouperDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/PropertyGrouperDatabase.cs deleted file mode 100644 index d2d067e..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyGrouperDatabase.cs +++ /dev/null @@ -1,33 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class PropertyGrouperDatabase - { - private static Dictionary groupersByAttributeType; - - static PropertyGrouperDatabase() - { - groupersByAttributeType = new Dictionary(); - groupersByAttributeType[typeof(BoxGroupAttribute)] = new BoxGroupPropertyGrouper(); - - } - - public static PropertyGrouper GetGrouperForAttribute(Type attributeType) - { - PropertyGrouper grouper; - if (groupersByAttributeType.TryGetValue(attributeType, out grouper)) - { - return grouper; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyGrouperDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/PropertyGrouperDatabase.cs.meta deleted file mode 100644 index bc0f34b..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyGrouperDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 0e5fed99fdc5f794291677a80073b4ba -timeCreated: 1508333008 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyMetaDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/PropertyMetaDatabase.cs deleted file mode 100644 index 45dfc00..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyMetaDatabase.cs +++ /dev/null @@ -1,34 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class PropertyMetaDatabase - { - private static Dictionary metasByAttributeType; - - static PropertyMetaDatabase() - { - metasByAttributeType = new Dictionary(); - metasByAttributeType[typeof(InfoBoxAttribute)] = new InfoBoxPropertyMeta(); -metasByAttributeType[typeof(OnValueChangedAttribute)] = new OnValueChangedPropertyMeta(); - - } - - public static PropertyMeta GetMetaForAttribute(Type attributeType) - { - PropertyMeta meta; - if (metasByAttributeType.TryGetValue(attributeType, out meta)) - { - return meta; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyMetaDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/PropertyMetaDatabase.cs.meta deleted file mode 100644 index 6a60430..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyMetaDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 57233c5ec1975024aa0723241b2f8210 -timeCreated: 1508497398 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyValidatorDatabase.cs b/NaughtyAttributes/Editor/CodeGeneration/PropertyValidatorDatabase.cs deleted file mode 100644 index c74ca91..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyValidatorDatabase.cs +++ /dev/null @@ -1,36 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class PropertyValidatorDatabase - { - private static Dictionary validatorsByAttributeType; - - static PropertyValidatorDatabase() - { - validatorsByAttributeType = new Dictionary(); - validatorsByAttributeType[typeof(MaxValueAttribute)] = new MaxValuePropertyValidator(); -validatorsByAttributeType[typeof(MinValueAttribute)] = new MinValuePropertyValidator(); -validatorsByAttributeType[typeof(RequiredAttribute)] = new RequiredPropertyValidator(); -validatorsByAttributeType[typeof(ValidateInputAttribute)] = new ValidateInputPropertyValidator(); - - } - - public static PropertyValidator GetValidatorForAttribute(Type attributeType) - { - PropertyValidator validator; - if (validatorsByAttributeType.TryGetValue(attributeType, out validator)) - { - return validator; - } - else - { - return null; - } - } - } -} - diff --git a/NaughtyAttributes/Editor/CodeGeneration/PropertyValidatorDatabase.cs.meta b/NaughtyAttributes/Editor/CodeGeneration/PropertyValidatorDatabase.cs.meta deleted file mode 100644 index 6d882da..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/PropertyValidatorDatabase.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 24e9da8a6b324374a9f655d3a867b284 -timeCreated: 1508241122 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates.meta deleted file mode 100644 index 5d830f1..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 7b15ea6695a69d74ab656006617d8d21 -folderAsset: yes -timeCreated: 1508230862 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/FieldDrawerDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/FieldDrawerDatabaseTemplate.txt deleted file mode 100644 index 926a6d7..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/FieldDrawerDatabaseTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary drawersByAttributeType; - - static __classname__() - { - drawersByAttributeType = new Dictionary(); - __entries__ - } - - public static FieldDrawer GetDrawerForAttribute(Type attributeType) - { - FieldDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/FieldDrawerDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/FieldDrawerDatabaseTemplate.txt.meta deleted file mode 100644 index 43e8f76..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/FieldDrawerDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 943b4c41373856243996247275be2cd8 -timeCreated: 1508836344 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/MethodDrawerDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/MethodDrawerDatabaseTemplate.txt deleted file mode 100644 index d6efd8a..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/MethodDrawerDatabaseTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary drawersByAttributeType; - - static __classname__() - { - drawersByAttributeType = new Dictionary(); - __entries__ - } - - public static MethodDrawer GetDrawerForAttribute(Type attributeType) - { - MethodDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/MethodDrawerDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/MethodDrawerDatabaseTemplate.txt.meta deleted file mode 100644 index 4531345..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/MethodDrawerDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 52d15465eb3439f4a9b95963a21d19b7 -timeCreated: 1508592495 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/NativePropertyDrawerDbTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/NativePropertyDrawerDbTemplate.txt deleted file mode 100644 index fe9cca1..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/NativePropertyDrawerDbTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary drawersByAttributeType; - - static __classname__() - { - drawersByAttributeType = new Dictionary(); - __entries__ - } - - public static NativePropertyDrawer GetDrawerForAttribute(Type attributeType) - { - NativePropertyDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/NativePropertyDrawerDbTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/NativePropertyDrawerDbTemplate.txt.meta deleted file mode 100644 index 4c16e8c..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/NativePropertyDrawerDbTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b82f5f6bf1fd4314c93624a8bc8835fd -timeCreated: 1510924467 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawConditionDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawConditionDatabaseTemplate.txt deleted file mode 100644 index adc064a..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawConditionDatabaseTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary drawConditionsByAttributeType; - - static __classname__() - { - drawConditionsByAttributeType = new Dictionary(); - __entries__ - } - - public static PropertyDrawCondition GetDrawConditionForAttribute(Type attributeType) - { - PropertyDrawCondition drawCondition; - if (drawConditionsByAttributeType.TryGetValue(attributeType, out drawCondition)) - { - return drawCondition; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawConditionDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawConditionDatabaseTemplate.txt.meta deleted file mode 100644 index 1d19d37..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawConditionDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b36f5858330c2d140a697f19ba6cc36b -timeCreated: 1508414568 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawerDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawerDatabaseTemplate.txt deleted file mode 100644 index 338dde4..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawerDatabaseTemplate.txt +++ /dev/null @@ -1,39 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary drawersByAttributeType; - - static __classname__() - { - drawersByAttributeType = new Dictionary(); - __entries__ - } - - public static PropertyDrawer GetDrawerForAttribute(Type attributeType) - { - PropertyDrawer drawer; - if (drawersByAttributeType.TryGetValue(attributeType, out drawer)) - { - return drawer; - } - else - { - return null; - } - } - - public static void ClearCache() - { - foreach (var kvp in drawersByAttributeType) - { - kvp.Value.ClearCache(); - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawerDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawerDatabaseTemplate.txt.meta deleted file mode 100644 index 26014c9..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyDrawerDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 136a96a904b577244b08be5d5542a77d -timeCreated: 1508241102 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyGrouperDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyGrouperDatabaseTemplate.txt deleted file mode 100644 index 5065a45..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyGrouperDatabaseTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary groupersByAttributeType; - - static __classname__() - { - groupersByAttributeType = new Dictionary(); - __entries__ - } - - public static PropertyGrouper GetGrouperForAttribute(Type attributeType) - { - PropertyGrouper grouper; - if (groupersByAttributeType.TryGetValue(attributeType, out grouper)) - { - return grouper; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyGrouperDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyGrouperDatabaseTemplate.txt.meta deleted file mode 100644 index 1167151..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyGrouperDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7fcc5bff99ecd4843b766f23cd585b55 -timeCreated: 1508332899 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyMetaDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyMetaDatabaseTemplate.txt deleted file mode 100644 index d88bea4..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyMetaDatabaseTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary metasByAttributeType; - - static __classname__() - { - metasByAttributeType = new Dictionary(); - __entries__ - } - - public static PropertyMeta GetMetaForAttribute(Type attributeType) - { - PropertyMeta meta; - if (metasByAttributeType.TryGetValue(attributeType, out meta)) - { - return meta; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyMetaDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyMetaDatabaseTemplate.txt.meta deleted file mode 100644 index 849d247..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyMetaDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fde25cf95f45b50469fcf4ee1e38993c -timeCreated: 1508497401 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyValidatorDatabaseTemplate.txt b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyValidatorDatabaseTemplate.txt deleted file mode 100644 index 2a63494..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyValidatorDatabaseTemplate.txt +++ /dev/null @@ -1,31 +0,0 @@ -// This class is auto generated - -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - public static class __classname__ - { - private static Dictionary validatorsByAttributeType; - - static __classname__() - { - validatorsByAttributeType = new Dictionary(); - __entries__ - } - - public static PropertyValidator GetValidatorForAttribute(Type attributeType) - { - PropertyValidator validator; - if (validatorsByAttributeType.TryGetValue(attributeType, out validator)) - { - return validator; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyValidatorDatabaseTemplate.txt.meta b/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyValidatorDatabaseTemplate.txt.meta deleted file mode 100644 index c0c96d4..0000000 --- a/NaughtyAttributes/Editor/CodeGeneration/Templates/PropertyValidatorDatabaseTemplate.txt.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a21c3d37c1492da4386198388150024c -timeCreated: 1508230862 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Editors.meta b/NaughtyAttributes/Editor/Editors.meta deleted file mode 100644 index 2c445db..0000000 --- a/NaughtyAttributes/Editor/Editors.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 4db73d2276d0e8144a206c5c2cd350de -folderAsset: yes -timeCreated: 1508055750 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Editors/InspectorEditor.cs b/NaughtyAttributes/Editor/Editors/InspectorEditor.cs deleted file mode 100644 index da91482..0000000 --- a/NaughtyAttributes/Editor/Editors/InspectorEditor.cs +++ /dev/null @@ -1,329 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace NaughtyAttributes.Editor -{ - [CanEditMultipleObjects] - [CustomEditor(typeof(UnityEngine.Object), true)] - public class InspectorEditor : UnityEditor.Editor - { - private SerializedProperty script; - - private IEnumerable fields; - private HashSet groupedFields; - private Dictionary> groupedFieldsByGroupName; - private IEnumerable nonSerializedFields; - private IEnumerable nativeProperties; - private IEnumerable methods; - - private Dictionary serializedPropertiesByFieldName; - - private bool useDefaultInspector; - - private void OnEnable() - { - this.script = this.serializedObject.FindProperty("m_Script"); - - // Cache serialized fields - this.fields = ReflectionUtility.GetAllFields(this.target, f => this.serializedObject.FindProperty(f.Name) != null); - - // If there are no NaughtyAttributes use default inspector - if (this.fields.All(f => f.GetCustomAttributes(typeof(NaughtyAttribute), true).Length == 0)) - { - this.useDefaultInspector = true; - } - else - { - this.useDefaultInspector = false; - - // Cache grouped fields - this.groupedFields = new HashSet(this.fields.Where(f => f.GetCustomAttributes(typeof(GroupAttribute), true).Length > 0)); - - // Cache grouped fields by group name - this.groupedFieldsByGroupName = new Dictionary>(); - foreach (var groupedField in this.groupedFields) - { - string groupName = (groupedField.GetCustomAttributes(typeof(GroupAttribute), true)[0] as GroupAttribute).Name; - - if (this.groupedFieldsByGroupName.ContainsKey(groupName)) - { - this.groupedFieldsByGroupName[groupName].Add(groupedField); - } - else - { - this.groupedFieldsByGroupName[groupName] = new List() - { - groupedField - }; - } - } - - // Cache serialized properties by field name - this.serializedPropertiesByFieldName = new Dictionary(); - foreach (var field in this.fields) - { - this.serializedPropertiesByFieldName[field.Name] = this.serializedObject.FindProperty(field.Name); - } - } - - // Cache non-serialized fields - this.nonSerializedFields = ReflectionUtility.GetAllFields( - this.target, f => f.GetCustomAttributes(typeof(DrawerAttribute), true).Length > 0 && this.serializedObject.FindProperty(f.Name) == null); - - // Cache the native properties - this.nativeProperties = ReflectionUtility.GetAllProperties( - this.target, p => p.GetCustomAttributes(typeof(DrawerAttribute), true).Length > 0); - - // Cache methods with DrawerAttribute - this.methods = ReflectionUtility.GetAllMethods( - this.target, m => m.GetCustomAttributes(typeof(DrawerAttribute), true).Length > 0); - } - - private void OnDisable() - { - PropertyDrawerDatabase.ClearCache(); - } - - public override void OnInspectorGUI() - { - if (this.useDefaultInspector) - { - this.DrawDefaultInspector(); - } - else - { - this.serializedObject.Update(); - - if (this.script != null) - { - GUI.enabled = false; - EditorGUILayout.PropertyField(this.script); - GUI.enabled = true; - } - - // Draw fields - HashSet drawnGroups = new HashSet(); - foreach (var field in this.fields) - { - if (this.groupedFields.Contains(field)) - { - // Draw grouped fields - string groupName = (field.GetCustomAttributes(typeof(GroupAttribute), true)[0] as GroupAttribute).Name; - if (!drawnGroups.Contains(groupName)) - { - drawnGroups.Add(groupName); - - PropertyGrouper grouper = this.GetPropertyGrouperForField(field); - if (grouper != null) - { - grouper.BeginGroup(groupName); - - this.ValidateAndDrawFields(this.groupedFieldsByGroupName[groupName]); - - grouper.EndGroup(); - } - else - { - this.ValidateAndDrawFields(this.groupedFieldsByGroupName[groupName]); - } - } - } - else - { - // Draw non-grouped field - this.ValidateAndDrawField(field); - } - } - - this.serializedObject.ApplyModifiedProperties(); - } - - // Draw non-serialized fields - foreach (var field in this.nonSerializedFields) - { - DrawerAttribute drawerAttribute = (DrawerAttribute)field.GetCustomAttributes(typeof(DrawerAttribute), true)[0]; - FieldDrawer drawer = FieldDrawerDatabase.GetDrawerForAttribute(drawerAttribute.GetType()); - if (drawer != null) - { - drawer.DrawField(this.target, field); - } - } - - // Draw native properties - foreach (var property in this.nativeProperties) - { - DrawerAttribute drawerAttribute = (DrawerAttribute)property.GetCustomAttributes(typeof(DrawerAttribute), true)[0]; - NativePropertyDrawer drawer = NativePropertyDrawerDatabase.GetDrawerForAttribute(drawerAttribute.GetType()); - if (drawer != null) - { - drawer.DrawNativeProperty(this.target, property); - } - } - - // Draw methods - foreach (var method in this.methods) - { - DrawerAttribute drawerAttribute = (DrawerAttribute)method.GetCustomAttributes(typeof(DrawerAttribute), true)[0]; - MethodDrawer methodDrawer = MethodDrawerDatabase.GetDrawerForAttribute(drawerAttribute.GetType()); - if (methodDrawer != null) - { - methodDrawer.DrawMethod(this.target, method); - } - } - } - - private void ValidateAndDrawFields(IEnumerable fields) - { - foreach (var field in fields) - { - this.ValidateAndDrawField(field); - } - } - - private void ValidateAndDrawField(FieldInfo field) - { - if (!ShouldDrawField(field)) - { - return; - } - - this.ValidateField(field); - this.ApplyFieldMeta(field); - this.DrawField(field); - } - - private void ValidateField(FieldInfo field) - { - ValidatorAttribute[] validatorAttributes = (ValidatorAttribute[])field.GetCustomAttributes(typeof(ValidatorAttribute), true); - - foreach (var attribute in validatorAttributes) - { - PropertyValidator validator = PropertyValidatorDatabase.GetValidatorForAttribute(attribute.GetType()); - if (validator != null) - { - validator.ValidateProperty(this.serializedPropertiesByFieldName[field.Name]); - } - } - } - - private bool ShouldDrawField(FieldInfo field) - { - // Check if the field has draw conditions - PropertyDrawCondition drawCondition = this.GetPropertyDrawConditionForField(field); - if (drawCondition != null) - { - bool canDrawProperty = drawCondition.CanDrawProperty(this.serializedPropertiesByFieldName[field.Name]); - if (!canDrawProperty) - { - return false; - } - } - - // Check if the field has HideInInspectorAttribute - HideInInspector[] hideInInspectorAttributes = (HideInInspector[])field.GetCustomAttributes(typeof(HideInInspector), true); - if (hideInInspectorAttributes.Length > 0) - { - return false; - } - - return true; - } - - private void DrawField(FieldInfo field) - { - EditorGUI.BeginChangeCheck(); - PropertyDrawer drawer = this.GetPropertyDrawerForField(field); - if (drawer != null) - { - drawer.DrawProperty(this.serializedPropertiesByFieldName[field.Name]); - } - else - { - EditorDrawUtility.DrawPropertyField(this.serializedPropertiesByFieldName[field.Name]); - } - - if (EditorGUI.EndChangeCheck()) - { - OnValueChangedAttribute[] onValueChangedAttributes = (OnValueChangedAttribute[])field.GetCustomAttributes(typeof(OnValueChangedAttribute), true); - foreach (var onValueChangedAttribute in onValueChangedAttributes) - { - PropertyMeta meta = PropertyMetaDatabase.GetMetaForAttribute(onValueChangedAttribute.GetType()); - if (meta != null) - { - meta.ApplyPropertyMeta(this.serializedPropertiesByFieldName[field.Name], onValueChangedAttribute); - } - } - } - } - - private void ApplyFieldMeta(FieldInfo field) - { - // Apply custom meta attributes - MetaAttribute[] metaAttributes = field - .GetCustomAttributes(typeof(MetaAttribute), true) - .Where(attr => attr.GetType() != typeof(OnValueChangedAttribute)) - .Select(obj => obj as MetaAttribute) - .ToArray(); - - Array.Sort(metaAttributes, (x, y) => - { - return x.Order - y.Order; - }); - - foreach (var metaAttribute in metaAttributes) - { - PropertyMeta meta = PropertyMetaDatabase.GetMetaForAttribute(metaAttribute.GetType()); - if (meta != null) - { - meta.ApplyPropertyMeta(this.serializedPropertiesByFieldName[field.Name], metaAttribute); - } - } - } - - private PropertyDrawer GetPropertyDrawerForField(FieldInfo field) - { - DrawerAttribute[] drawerAttributes = (DrawerAttribute[])field.GetCustomAttributes(typeof(DrawerAttribute), true); - if (drawerAttributes.Length > 0) - { - PropertyDrawer drawer = PropertyDrawerDatabase.GetDrawerForAttribute(drawerAttributes[0].GetType()); - return drawer; - } - else - { - return null; - } - } - - private PropertyGrouper GetPropertyGrouperForField(FieldInfo field) - { - GroupAttribute[] groupAttributes = (GroupAttribute[])field.GetCustomAttributes(typeof(GroupAttribute), true); - if (groupAttributes.Length > 0) - { - PropertyGrouper grouper = PropertyGrouperDatabase.GetGrouperForAttribute(groupAttributes[0].GetType()); - return grouper; - } - else - { - return null; - } - } - - private PropertyDrawCondition GetPropertyDrawConditionForField(FieldInfo field) - { - DrawConditionAttribute[] drawConditionAttributes = (DrawConditionAttribute[])field.GetCustomAttributes(typeof(DrawConditionAttribute), true); - if (drawConditionAttributes.Length > 0) - { - PropertyDrawCondition drawCondition = PropertyDrawConditionDatabase.GetDrawConditionForAttribute(drawConditionAttributes[0].GetType()); - return drawCondition; - } - else - { - return null; - } - } - } -} diff --git a/NaughtyAttributes/Editor/Editors/InspectorEditor.cs.meta b/NaughtyAttributes/Editor/Editors/InspectorEditor.cs.meta deleted file mode 100644 index b623552..0000000 --- a/NaughtyAttributes/Editor/Editors/InspectorEditor.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 9e82d6d6926a6c74688e2787b37630d1 -timeCreated: 1508055750 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/FieldDrawers.meta b/NaughtyAttributes/Editor/FieldDrawers.meta deleted file mode 100644 index ed81436..0000000 --- a/NaughtyAttributes/Editor/FieldDrawers.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 79b05858e72c1b0498eca7954843c802 -folderAsset: yes -timeCreated: 1508835721 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/FieldDrawers/FieldDrawer.cs b/NaughtyAttributes/Editor/FieldDrawers/FieldDrawer.cs deleted file mode 100644 index 805a064..0000000 --- a/NaughtyAttributes/Editor/FieldDrawers/FieldDrawer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; - -namespace NaughtyAttributes.Editor -{ - public abstract class FieldDrawer - { - public abstract void DrawField(UnityEngine.Object target, FieldInfo field); - } -} diff --git a/NaughtyAttributes/Editor/FieldDrawers/FieldDrawer.cs.meta b/NaughtyAttributes/Editor/FieldDrawers/FieldDrawer.cs.meta deleted file mode 100644 index 789d479..0000000 --- a/NaughtyAttributes/Editor/FieldDrawers/FieldDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 8949267118f232a4fbebd777de8ed6fe -timeCreated: 1508835721 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/FieldDrawers/ShowNonSerializedFieldFieldDrawer.cs b/NaughtyAttributes/Editor/FieldDrawers/ShowNonSerializedFieldFieldDrawer.cs deleted file mode 100644 index efc3a39..0000000 --- a/NaughtyAttributes/Editor/FieldDrawers/ShowNonSerializedFieldFieldDrawer.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Reflection; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [FieldDrawer(typeof(ShowNonSerializedFieldAttribute))] - public class ShowNonSerializedFieldFieldDrawer : FieldDrawer - { - public override void DrawField(UnityEngine.Object target, FieldInfo field) - { - object value = field.GetValue(target); - - if (value == null) - { - string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNonSerializedFieldFieldDrawer).Name, "Reference"); - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - else if (!EditorDrawUtility.DrawLayoutField(value, field.Name)) - { - string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNonSerializedFieldFieldDrawer).Name, field.FieldType.Name); - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - } - } -} diff --git a/NaughtyAttributes/Editor/FieldDrawers/ShowNonSerializedFieldFieldDrawer.cs.meta b/NaughtyAttributes/Editor/FieldDrawers/ShowNonSerializedFieldFieldDrawer.cs.meta deleted file mode 100644 index fa3410c..0000000 --- a/NaughtyAttributes/Editor/FieldDrawers/ShowNonSerializedFieldFieldDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 8449d5c2158e97d479caaec24c61baec -timeCreated: 1508835721 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/MethodDrawers.meta b/NaughtyAttributes/Editor/MethodDrawers.meta deleted file mode 100644 index 7e351e2..0000000 --- a/NaughtyAttributes/Editor/MethodDrawers.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: f95312994b1f8c746a402669cb1655eb -folderAsset: yes -timeCreated: 1508592494 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/MethodDrawers/ButtonMethodDrawer.cs b/NaughtyAttributes/Editor/MethodDrawers/ButtonMethodDrawer.cs deleted file mode 100644 index a6e1f7b..0000000 --- a/NaughtyAttributes/Editor/MethodDrawers/ButtonMethodDrawer.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace NaughtyAttributes.Editor -{ - [MethodDrawer(typeof(ButtonAttribute))] - public class ButtonMethodDrawer : MethodDrawer - { - public override void DrawMethod(UnityEngine.Object target, MethodInfo methodInfo) - { - if (methodInfo.GetParameters().Length == 0) - { - ButtonAttribute buttonAttribute = (ButtonAttribute)methodInfo.GetCustomAttributes(typeof(ButtonAttribute), true)[0]; - string buttonText = string.IsNullOrEmpty(buttonAttribute.Text) ? methodInfo.Name : buttonAttribute.Text; - - if (GUILayout.Button(buttonText)) - { - methodInfo.Invoke(target, null); - } - } - else - { - string warning = typeof(ButtonAttribute).Name + " works only on methods with no parameters"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - } - } -} diff --git a/NaughtyAttributes/Editor/MethodDrawers/ButtonMethodDrawer.cs.meta b/NaughtyAttributes/Editor/MethodDrawers/ButtonMethodDrawer.cs.meta deleted file mode 100644 index cff17a7..0000000 --- a/NaughtyAttributes/Editor/MethodDrawers/ButtonMethodDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: ad01ec1a22422c6409f913d60ce39d61 -timeCreated: 1508592494 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/MethodDrawers/MethodDrawer.cs b/NaughtyAttributes/Editor/MethodDrawers/MethodDrawer.cs deleted file mode 100644 index 687688d..0000000 --- a/NaughtyAttributes/Editor/MethodDrawers/MethodDrawer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; - -namespace NaughtyAttributes.Editor -{ - public abstract class MethodDrawer - { - public abstract void DrawMethod(UnityEngine.Object target, MethodInfo methodInfo); - } -} diff --git a/NaughtyAttributes/Editor/MethodDrawers/MethodDrawer.cs.meta b/NaughtyAttributes/Editor/MethodDrawers/MethodDrawer.cs.meta deleted file mode 100644 index 22137e5..0000000 --- a/NaughtyAttributes/Editor/MethodDrawers/MethodDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: a65a1addcdd323249b590f7a06110869 -timeCreated: 1508592494 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/NativePropertyDrawers.meta b/NaughtyAttributes/Editor/NativePropertyDrawers.meta deleted file mode 100644 index 665bbfc..0000000 --- a/NaughtyAttributes/Editor/NativePropertyDrawers.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: ae67cc6bfa799f147968e9b0371a21fc -folderAsset: yes -timeCreated: 1510924467 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/NativePropertyDrawers/NativePropertyDrawer.cs b/NaughtyAttributes/Editor/NativePropertyDrawers/NativePropertyDrawer.cs deleted file mode 100644 index 0fb0e6b..0000000 --- a/NaughtyAttributes/Editor/NativePropertyDrawers/NativePropertyDrawer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Reflection; - -namespace NaughtyAttributes.Editor -{ - public abstract class NativePropertyDrawer - { - public abstract void DrawNativeProperty(UnityEngine.Object target, PropertyInfo property); - } -} diff --git a/NaughtyAttributes/Editor/NativePropertyDrawers/NativePropertyDrawer.cs.meta b/NaughtyAttributes/Editor/NativePropertyDrawers/NativePropertyDrawer.cs.meta deleted file mode 100644 index 897323c..0000000 --- a/NaughtyAttributes/Editor/NativePropertyDrawers/NativePropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 715c5ada29663a245b0b35937c892377 -timeCreated: 1510924467 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/NativePropertyDrawers/ShowNativePropertyNativePropertyDrawer.cs b/NaughtyAttributes/Editor/NativePropertyDrawers/ShowNativePropertyNativePropertyDrawer.cs deleted file mode 100644 index 326247e..0000000 --- a/NaughtyAttributes/Editor/NativePropertyDrawers/ShowNativePropertyNativePropertyDrawer.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Reflection; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [NativePropertyDrawer(typeof(ShowNativePropertyAttribute))] - public class ShowNativePropertyNativePropertyDrawer : NativePropertyDrawer - { - public override void DrawNativeProperty(UnityEngine.Object target, PropertyInfo property) - { - object value = property.GetValue(target, null); - - if (value == null) - { - string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNativePropertyNativePropertyDrawer).Name, "Reference"); - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - else if (!EditorDrawUtility.DrawLayoutField(value, property.Name)) - { - string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNativePropertyNativePropertyDrawer).Name, property.PropertyType.Name); - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - } - } -} diff --git a/NaughtyAttributes/Editor/NativePropertyDrawers/ShowNativePropertyNativePropertyDrawer.cs.meta b/NaughtyAttributes/Editor/NativePropertyDrawers/ShowNativePropertyNativePropertyDrawer.cs.meta deleted file mode 100644 index 9b1f424..0000000 --- a/NaughtyAttributes/Editor/NativePropertyDrawers/ShowNativePropertyNativePropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 518b0fde2a9d15d498bc17fd1d7062c7 -timeCreated: 1510926376 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef b/NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef deleted file mode 100644 index e1aafc2..0000000 --- a/NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "NaughtyAttributes.Editor", - "references": [ - "NaughtyAttributes.Core" - ], - "optionalUnityReferences": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [] -} \ No newline at end of file diff --git a/NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef.meta b/NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef.meta deleted file mode 100644 index 70dc9f2..0000000 --- a/NaughtyAttributes/Editor/NaughtyAttributes.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: f88fb04354076c646a4107a491394033 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions.meta b/NaughtyAttributes/Editor/PropertyDrawConditions.meta deleted file mode 100644 index 6742dcd..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 0ed2b7d432f0ad644b1f0752cf65aa9c -folderAsset: yes -timeCreated: 1508414568 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions/HideIfPropertyDrawCondition.cs b/NaughtyAttributes/Editor/PropertyDrawConditions/HideIfPropertyDrawCondition.cs deleted file mode 100644 index 84276db..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions/HideIfPropertyDrawCondition.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawCondition(typeof(HideIfAttribute))] - public class HideIfPropertyDrawCondition : ShowIfPropertyDrawCondition - { - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions/HideIfPropertyDrawCondition.cs.meta b/NaughtyAttributes/Editor/PropertyDrawConditions/HideIfPropertyDrawCondition.cs.meta deleted file mode 100644 index 2b7cd1d..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions/HideIfPropertyDrawCondition.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: f7e60d80f0231654ab13cfb1178e6eb8 -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions/PropertyDrawCondition.cs b/NaughtyAttributes/Editor/PropertyDrawConditions/PropertyDrawCondition.cs deleted file mode 100644 index 2ea9f7a..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions/PropertyDrawCondition.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - public abstract class PropertyDrawCondition - { - public abstract bool CanDrawProperty(SerializedProperty property); - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions/PropertyDrawCondition.cs.meta b/NaughtyAttributes/Editor/PropertyDrawConditions/PropertyDrawCondition.cs.meta deleted file mode 100644 index f326b5d..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions/PropertyDrawCondition.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: ce2d1d9afa04cae43a18bd01ec9447eb -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions/ShowIfPropertyDrawCondition.cs b/NaughtyAttributes/Editor/PropertyDrawConditions/ShowIfPropertyDrawCondition.cs deleted file mode 100644 index 3cd1a97..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions/ShowIfPropertyDrawCondition.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections.Generic; -using System.Reflection; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawCondition(typeof(ShowIfAttribute))] - public class ShowIfPropertyDrawCondition : PropertyDrawCondition - { - public override bool CanDrawProperty(SerializedProperty property) - { - ShowIfAttribute showIfAttribute = PropertyUtility.GetAttribute(property); - UnityEngine.Object target = PropertyUtility.GetTargetObject(property); - - List conditionValues = new List(); - foreach (var condition in showIfAttribute.Conditions) - { - FieldInfo conditionField = ReflectionUtility.GetField(target, condition); - if (conditionField != null && - conditionField.FieldType == typeof(bool)) - { - conditionValues.Add((bool)conditionField.GetValue(target)); - } - - MethodInfo conditionMethod = ReflectionUtility.GetMethod(target, condition); - if (conditionMethod != null && - conditionMethod.ReturnType == typeof(bool) && - conditionMethod.GetParameters().Length == 0) - { - conditionValues.Add((bool)conditionMethod.Invoke(target, null)); - } - } - - if (conditionValues.Count > 0) - { - bool draw; - if (showIfAttribute.ConditionOperator == ConditionOperator.And) - { - draw = true; - foreach (var value in conditionValues) - { - draw = draw && value; - } - } - else - { - draw = false; - foreach (var value in conditionValues) - { - draw = draw || value; - } - } - - if (showIfAttribute.Reversed) - { - draw = !draw; - } - - return draw; - } - else - { - string warning = showIfAttribute.GetType().Name + " needs a valid boolean condition field or method name to work"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - - return true; - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawConditions/ShowIfPropertyDrawCondition.cs.meta b/NaughtyAttributes/Editor/PropertyDrawConditions/ShowIfPropertyDrawCondition.cs.meta deleted file mode 100644 index 2e7a555..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawConditions/ShowIfPropertyDrawCondition.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: fce0c8241476ad94cbbcdd6faae90700 -timeCreated: 1508414568 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers.meta b/NaughtyAttributes/Editor/PropertyDrawers.meta deleted file mode 100644 index 7f3a245..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 4327d74fca5deaa4c83c483fe468d274 -folderAsset: yes -timeCreated: 1508051576 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/DisableIfPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/DisableIfPropertyDrawer.cs deleted file mode 100644 index ed27b41..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/DisableIfPropertyDrawer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(DisableIfAttribute))] - public class DisableIfPropertyDrawer : EnableIfPropertyDrawer - { - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/DisableIfPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/DisableIfPropertyDrawer.cs.meta deleted file mode 100644 index 579b0a4..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/DisableIfPropertyDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6093965e939dcd24687aed40741be04b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/DropdownPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/DropdownPropertyDrawer.cs deleted file mode 100644 index f7ac834..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/DropdownPropertyDrawer.cs +++ /dev/null @@ -1,130 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System.Reflection; -using System.Collections; -using System; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(DropdownAttribute))] - public class DropdownPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawHeader(property); - - DropdownAttribute dropdownAttribute = PropertyUtility.GetAttribute(property); - UnityEngine.Object target = PropertyUtility.GetTargetObject(property); - - FieldInfo fieldInfo = ReflectionUtility.GetField(target, property.name); - FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, dropdownAttribute.ValuesFieldName); - - if (valuesFieldInfo == null) - { - this.DrawWarningBox(string.Format("{0} cannot find a values field with name \"{1}\"", dropdownAttribute.GetType().Name, dropdownAttribute.ValuesFieldName)); - EditorGUILayout.PropertyField(property, true); - } - else if (valuesFieldInfo.GetValue(target) is IList && - fieldInfo.FieldType == this.GetElementType(valuesFieldInfo)) - { - // Selected value - object selectedValue = fieldInfo.GetValue(target); - - // Values and display options - IList valuesList = (IList)valuesFieldInfo.GetValue(target); - object[] values = new object[valuesList.Count]; - string[] displayOptions = new string[valuesList.Count]; - - for (int i = 0; i < values.Length; i++) - { - object value = valuesList[i]; - values[i] = value; - displayOptions[i] = value.ToString(); - } - - // Selected value index - int selectedValueIndex = Array.IndexOf(values, selectedValue); - if (selectedValueIndex < 0) - { - selectedValueIndex = 0; - } - - // Draw the dropdown - this.DrawDropdown(target, fieldInfo, property.displayName, selectedValueIndex, values, displayOptions); - } - else if (valuesFieldInfo.GetValue(target) is IDropdownList) - { - // Current value - object selectedValue = fieldInfo.GetValue(target); - - // Current value index, values and display options - IDropdownList dropdown = (IDropdownList)valuesFieldInfo.GetValue(target); - IEnumerator> dropdownEnumerator = dropdown.GetEnumerator(); - - int index = -1; - int selectedValueIndex = -1; - List values = new List(); - List displayOptions = new List(); - - while (dropdownEnumerator.MoveNext()) - { - index++; - - KeyValuePair current = dropdownEnumerator.Current; - if (current.Value.Equals(selectedValue)) - { - selectedValueIndex = index; - } - - values.Add(current.Value); - displayOptions.Add(current.Key); - } - - if (selectedValueIndex < 0) - { - selectedValueIndex = 0; - } - - // Draw the dropdown - this.DrawDropdown(target, fieldInfo, property.displayName, selectedValueIndex, values.ToArray(), displayOptions.ToArray()); - } - else - { - this.DrawWarningBox(typeof(DropdownAttribute).Name + " works only when the type of the field is equal to the element type of the array"); - EditorGUILayout.PropertyField(property, true); - } - } - - private Type GetElementType(FieldInfo listFieldInfo) - { - if (listFieldInfo.FieldType.IsGenericType) - { - return listFieldInfo.FieldType.GetGenericArguments()[0]; - } - else - { - return listFieldInfo.FieldType.GetElementType(); - } - } - - private void DrawDropdown(UnityEngine.Object target, FieldInfo fieldInfo, string label, int selectedValueIndex, object[] values, string[] displayOptions) - { - EditorGUI.BeginChangeCheck(); - - int newIndex = EditorGUILayout.Popup(label, selectedValueIndex, displayOptions); - - if (EditorGUI.EndChangeCheck()) - { - Undo.RecordObject(target, "Dropdown"); - fieldInfo.SetValue(target, values[newIndex]); - } - } - - private void DrawWarningBox(string message) - { - EditorGUILayout.HelpBox(message, MessageType.Warning); - Debug.LogWarning(message); - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta deleted file mode 100644 index eb68163..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 19d935f1205a5804c80c51c3ad95a271 -timeCreated: 1508753698 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/EnableIfPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/EnableIfPropertyDrawer.cs deleted file mode 100644 index dfb8060..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/EnableIfPropertyDrawer.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections.Generic; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(EnableIfAttribute))] - public class EnableIfPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EnableIfAttribute enableIfAttribute = PropertyUtility.GetAttribute(property); - UnityEngine.Object target = PropertyUtility.GetTargetObject(property); - - List conditionValues = new List(); - foreach (var condition in enableIfAttribute.Conditions) - { - FieldInfo conditionField = ReflectionUtility.GetField(target, condition); - if (conditionField != null && - conditionField.FieldType == typeof(bool)) - { - conditionValues.Add((bool)conditionField.GetValue(target)); - } - - MethodInfo conditionMethod = ReflectionUtility.GetMethod(target, condition); - if (conditionMethod != null && - conditionMethod.ReturnType == typeof(bool) && - conditionMethod.GetParameters().Length == 0) - { - conditionValues.Add((bool)conditionMethod.Invoke(target, null)); - } - } - - if (conditionValues.Count > 0) - { - bool enabled; - if (enableIfAttribute.ConditionOperator == ConditionOperator.And) - { - enabled = true; - foreach (var value in conditionValues) - { - enabled = enabled && value; - } - } - else - { - enabled = false; - foreach (var value in conditionValues) - { - enabled = enabled || value; - } - } - - if (enableIfAttribute.Reversed) - { - enabled = !enabled; - } - - GUI.enabled = enabled; - EditorDrawUtility.DrawPropertyField(property); - GUI.enabled = true; - } - else - { - string warning = enableIfAttribute.GetType().Name + " needs a valid boolean condition field or method name to work"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/EnableIfPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/EnableIfPropertyDrawer.cs.meta deleted file mode 100644 index 9b1abe6..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/EnableIfPropertyDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 36d4c9f730abf4945814f7e205003836 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs deleted file mode 100644 index 301b48f..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs +++ /dev/null @@ -1,16 +0,0 @@ -using UnityEngine; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(LabelAttribute))] - public class LabelPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - var labelAttribute = PropertyUtility.GetAttribute(property); - var guiContent = new GUIContent(labelAttribute.Label); - EditorGUILayout.PropertyField(property, guiContent, true); - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs.meta deleted file mode 100644 index bfd5f26..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/LabelPropertyDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: efcf74639df2db34c8302355c0d29454 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs deleted file mode 100644 index f902046..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs +++ /dev/null @@ -1,76 +0,0 @@ -using UnityEngine; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(MinMaxSliderAttribute))] - public class MinMaxSliderPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawHeader(property); - - MinMaxSliderAttribute minMaxSliderAttribute = PropertyUtility.GetAttribute(property); - - if (property.propertyType == SerializedPropertyType.Vector2) - { - Rect controlRect = EditorGUILayout.GetControlRect(); - float labelWidth = EditorGUIUtility.labelWidth; - float floatFieldWidth = EditorGUIUtility.fieldWidth; - float sliderWidth = controlRect.width - labelWidth - 2f * floatFieldWidth; - float sliderPadding = 5f; - - Rect labelRect = new Rect( - controlRect.x, - controlRect.y, - labelWidth, - controlRect.height); - - Rect sliderRect = new Rect( - controlRect.x + labelWidth + floatFieldWidth + sliderPadding, - controlRect.y, - sliderWidth - 2f * sliderPadding, - controlRect.height); - - Rect minFloatFieldRect = new Rect( - controlRect.x + labelWidth, - controlRect.y, - floatFieldWidth, - controlRect.height); - - Rect maxFloatFieldRect = new Rect( - controlRect.x + labelWidth + floatFieldWidth + sliderWidth, - controlRect.y, - floatFieldWidth, - controlRect.height); - - // Draw the label - EditorGUI.LabelField(labelRect, property.displayName); - - // Draw the slider - EditorGUI.BeginChangeCheck(); - - Vector2 sliderValue = property.vector2Value; - EditorGUI.MinMaxSlider(sliderRect, ref sliderValue.x, ref sliderValue.y, minMaxSliderAttribute.MinValue, minMaxSliderAttribute.MaxValue); - - sliderValue.x = EditorGUI.FloatField(minFloatFieldRect, sliderValue.x); - sliderValue.x = Mathf.Clamp(sliderValue.x, minMaxSliderAttribute.MinValue, Mathf.Min(minMaxSliderAttribute.MaxValue, sliderValue.y)); - - sliderValue.y = EditorGUI.FloatField(maxFloatFieldRect, sliderValue.y); - sliderValue.y = Mathf.Clamp(sliderValue.y, Mathf.Max(minMaxSliderAttribute.MinValue, sliderValue.x), minMaxSliderAttribute.MaxValue); - - if (EditorGUI.EndChangeCheck()) - { - property.vector2Value = sliderValue; - } - } - else - { - string warning = minMaxSliderAttribute.GetType().Name + " can be used only on Vector2 fields"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - - EditorDrawUtility.DrawPropertyField(property); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta deleted file mode 100644 index ca0af07..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 27011af81554b5b4489b155f09275475 -timeCreated: 1508427131 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs deleted file mode 100644 index 582f2b1..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs +++ /dev/null @@ -1,96 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(ProgressBarAttribute))] - public class ProgressBarPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawHeader(property); - - if (property.propertyType != SerializedPropertyType.Float && property.propertyType != SerializedPropertyType.Integer) - { - EditorGUILayout.HelpBox("Field " + property.name + " is not a number", MessageType.Warning); - return; - } - - var value = property.propertyType == SerializedPropertyType.Integer ? property.intValue : property.floatValue; - var valueFormatted = property.propertyType == SerializedPropertyType.Integer ? value.ToString() : String.Format("{0:0.00}", value); - - ProgressBarAttribute progressBarAttribute = PropertyUtility.GetAttribute(property); - var position = EditorGUILayout.GetControlRect(); - var maxValue = progressBarAttribute.MaxValue; - float lineHight = EditorGUIUtility.singleLineHeight; - float padding = EditorGUIUtility.standardVerticalSpacing; - var barPosition = new Rect(position.position.x, position.position.y, position.size.x, lineHight); - - var fillPercentage = value / maxValue; - var barLabel = (!string.IsNullOrEmpty(progressBarAttribute.Name) ? "[" + progressBarAttribute.Name + "] " : "") + valueFormatted + "/" + maxValue; - - var color = GetColor(progressBarAttribute.Color); - var color2 = Color.white; - DrawBar(barPosition, Mathf.Clamp01(fillPercentage), barLabel, color, color2); - } - - private void DrawBar(Rect position, float fillPercent, string label, Color barColor, Color labelColor) - { - if (Event.current.type != EventType.Repaint) - { - return; - } - - Color savedColor = GUI.color; - - var fillRect = new Rect(position.x, position.y, position.width * fillPercent, position.height); - - EditorGUI.DrawRect(position, new Color(0.13f, 0.13f, 0.13f)); - EditorGUI.DrawRect(fillRect, barColor); - - // set alignment and cache the default - var align = GUI.skin.label.alignment; - GUI.skin.label.alignment = TextAnchor.UpperCenter; - - // set the color and cache the default - var c = GUI.contentColor; - GUI.contentColor = labelColor; - - // calculate the position - var labelRect = new Rect(position.x, position.y - 2, position.width, position.height); - - // draw~ - EditorGUI.DropShadowLabel(labelRect, label); - - // reset color and alignment - GUI.contentColor = c; - GUI.skin.label.alignment = align; - } - - private Color GetColor(ProgressBarColor color) - { - switch (color) - { - case ProgressBarColor.Red: - return new Color32(255, 0, 63, 255); - case ProgressBarColor.Pink: - return new Color32(255, 152, 203, 255); - case ProgressBarColor.Orange: - return new Color32(255, 128, 0, 255); - case ProgressBarColor.Yellow: - return new Color32(255, 211, 0, 255); - case ProgressBarColor.Green: - return new Color32(102, 255, 0, 255); - case ProgressBarColor.Blue: - return new Color32(0, 135, 189, 255); - case ProgressBarColor.Indigo: - return new Color32(75, 0, 130, 255); - case ProgressBarColor.Violet: - return new Color32(127, 0, 255, 255); - default: - return Color.white; - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta deleted file mode 100644 index c7403f8..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 47ba764aac86a4d488c8acd0af8f0d23 -timeCreated: 1518435237 -licenseType: Pro -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/PropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/PropertyDrawer.cs deleted file mode 100644 index 762c30e..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/PropertyDrawer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - public abstract class PropertyDrawer - { - public abstract void DrawProperty(SerializedProperty property); - - public virtual void ClearCache() - { - - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/PropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/PropertyDrawer.cs.meta deleted file mode 100644 index 276a963..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/PropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: fd2df67a49fb7bd4d8e3914c5a2cf4a8 -timeCreated: 1508051576 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs deleted file mode 100644 index a255642..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs +++ /dev/null @@ -1,16 +0,0 @@ -using UnityEditor; -using UnityEngine; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(ReadOnlyAttribute))] - public class ReadOnlyPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - GUI.enabled = false; - EditorDrawUtility.DrawPropertyField(property); - GUI.enabled = true; - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs.meta deleted file mode 100644 index aa80c05..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: a392efb1d44b30744bb7bf76e479cfab -timeCreated: 1508862451 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs deleted file mode 100644 index c618477..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs +++ /dev/null @@ -1,70 +0,0 @@ -using UnityEngine; -using UnityEditor; -using UnityEditorInternal; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(ReorderableListAttribute))] - public class ReorderableListPropertyDrawer : PropertyDrawer - { - private Dictionary reorderableListsByPropertyName = new Dictionary(); - - string GetPropertyKeyName(SerializedProperty property) - { - return property.serializedObject.targetObject.GetInstanceID() + "/" + property.name; - } - - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawHeader(property); - - if (property.isArray) - { - var key = GetPropertyKeyName(property); - - if (!this.reorderableListsByPropertyName.ContainsKey(key)) - { - ReorderableList reorderableList = new ReorderableList(property.serializedObject, property, true, true, true, true) - { - drawHeaderCallback = (Rect rect) => - { - EditorGUI.LabelField(rect, string.Format("{0}: {1}", property.displayName, property.arraySize), EditorStyles.label); - }, - - drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => - { - var element = property.GetArrayElementAtIndex(index); - rect.y += 1.0f; - rect.x += 10.0f; - rect.width -= 10.0f; - - EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, true); - }, - - elementHeightCallback = (int index) => - { - return EditorGUI.GetPropertyHeight(property.GetArrayElementAtIndex(index)) + 4.0f; - } - }; - - this.reorderableListsByPropertyName[key] = reorderableList; - } - - this.reorderableListsByPropertyName[key].DoLayoutList(); - } - else - { - string warning = typeof(ReorderableListAttribute).Name + " can be used only on arrays or lists"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - - EditorDrawUtility.DrawPropertyField(property); - } - } - - public override void ClearCache() - { - this.reorderableListsByPropertyName.Clear(); - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs.meta deleted file mode 100644 index c06f619..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ReorderableListPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 6d5a6c66de03d1d4882f0c83b0e5f8f2 -timeCreated: 1508402303 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs deleted file mode 100644 index e2fd1d8..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs +++ /dev/null @@ -1,35 +0,0 @@ -using UnityEngine; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(ResizableTextAreaAttribute))] - public class ResizableTextAreaPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawHeader(property); - - if (property.propertyType == SerializedPropertyType.String) - { - EditorGUILayout.LabelField(property.displayName); - - EditorGUI.BeginChangeCheck(); - - string textAreaValue = EditorGUILayout.TextArea(property.stringValue, GUILayout.MinHeight(EditorGUIUtility.singleLineHeight * 3f)); - - if (EditorGUI.EndChangeCheck()) - { - property.stringValue = textAreaValue; - } - } - else - { - string warning = PropertyUtility.GetAttribute(property).GetType().Name + " can only be used on string fields"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - - EditorDrawUtility.DrawPropertyField(property); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta deleted file mode 100644 index 898f9d2..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 57848d4e847a8d445a53095abdbbb274 -timeCreated: 1508583167 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs deleted file mode 100644 index f2e42b7..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs +++ /dev/null @@ -1,40 +0,0 @@ -using UnityEngine; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(ShowAssetPreviewAttribute))] - public class ShowAssetPreviewPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawPropertyField(property); - - if (property.propertyType == SerializedPropertyType.ObjectReference) - { - if (property.objectReferenceValue != null) - { - Texture2D previewTexture = AssetPreview.GetAssetPreview(property.objectReferenceValue); - if (previewTexture != null) - { - ShowAssetPreviewAttribute showAssetPreviewAttribute = PropertyUtility.GetAttribute(property); - int width = Mathf.Clamp(showAssetPreviewAttribute.Width, 0, previewTexture.width); - int height = Mathf.Clamp(showAssetPreviewAttribute.Height, 0, previewTexture.height); - - GUILayout.Label(previewTexture, GUILayout.MaxWidth(width), GUILayout.MaxHeight(height)); - } - else - { - string warning = property.name + " doesn't have an asset preview"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - } - } - } - else - { - string warning = property.name + " doesn't have an asset preview"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta deleted file mode 100644 index 4c4b7c0..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 6c461f4d7edd955419e5e6ce2c874599 -timeCreated: 1509089502 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/SliderPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/SliderPropertyDrawer.cs deleted file mode 100644 index 49280f0..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/SliderPropertyDrawer.cs +++ /dev/null @@ -1,31 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyDrawer(typeof(SliderAttribute))] - public class SliderPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - EditorDrawUtility.DrawHeader(property); - - SliderAttribute sliderAttribute = PropertyUtility.GetAttribute(property); - - if (property.propertyType == SerializedPropertyType.Integer) - { - EditorGUILayout.IntSlider(property, (int)sliderAttribute.MinValue, (int)sliderAttribute.MaxValue); - } - else if (property.propertyType == SerializedPropertyType.Float) - { - EditorGUILayout.Slider(property, sliderAttribute.MinValue, sliderAttribute.MaxValue); - } - else - { - string warning = sliderAttribute.GetType().Name + " can be used only on int or float fields"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - - EditorDrawUtility.DrawPropertyField(property); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyDrawers/SliderPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/SliderPropertyDrawer.cs.meta deleted file mode 100644 index 5aae3b0..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/SliderPropertyDrawer.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: ae129a284d179ae41b8ab20f506e5d99 -timeCreated: 1508422518 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs b/NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs deleted file mode 100644 index 462a1f1..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs +++ /dev/null @@ -1,56 +0,0 @@ -using UnityEditor; -using System.Collections.Generic; - -namespace NaughtyAttributes.Editor -{ - // Original by Dylan Engelman - // http://jupiterlighthousestudio.com/custom-inspectors-unity/ - // Altered by Brecht Lecluyse http://www.brechtos.com - // and Sichen Liu https://sichenn.github.io - [PropertyDrawer(typeof(TagAttribute))] - public class TagPropertyDrawer : PropertyDrawer - { - public override void DrawProperty(SerializedProperty property) - { - if (property.propertyType == SerializedPropertyType.String) - { - // generate the taglist + custom tags - List tagList = new List(); - tagList.Add("(None)"); - tagList.Add("Untagged"); - tagList.AddRange(UnityEditorInternal.InternalEditorUtility.tags); - - string propertyString = property.stringValue; - int index = 0; - // check if there is an entry that matches the entry and get the index - // we skip index 0 as that is a special custom case - for (int i = 1; i < tagList.Count; i++) - { - if (tagList[i] == propertyString) - { - index = i; - break; - } - } - - // Draw the popup box with the current selected index - index = EditorGUILayout.Popup(property.displayName, index, tagList.ToArray()); - - // Adjust the actual string value of the property based on the selection - if (index > 0) - { - property.stringValue = tagList[index]; - } - else - { - property.stringValue = string.Empty; - } - } - else - { - EditorGUILayout.HelpBox(property.type + " is not supported by TagAttribute\n" + - "Use string instead", MessageType.Warning); - } - } - } -} \ No newline at end of file diff --git a/NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta b/NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta deleted file mode 100644 index 7a841a8..0000000 --- a/NaughtyAttributes/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f915ac324502a0e48990bfe775312665 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyGroupers.meta b/NaughtyAttributes/Editor/PropertyGroupers.meta deleted file mode 100644 index d850feb..0000000 --- a/NaughtyAttributes/Editor/PropertyGroupers.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 35fed6de66b90ad418e2ca247a303b9b -folderAsset: yes -timeCreated: 1508331735 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyGroupers/BoxGroupPropertyGrouper.cs b/NaughtyAttributes/Editor/PropertyGroupers/BoxGroupPropertyGrouper.cs deleted file mode 100644 index e84eaf3..0000000 --- a/NaughtyAttributes/Editor/PropertyGroupers/BoxGroupPropertyGrouper.cs +++ /dev/null @@ -1,24 +0,0 @@ -using UnityEditor; -using UnityEngine; - -namespace NaughtyAttributes.Editor -{ - [PropertyGrouper(typeof(BoxGroupAttribute))] - public class BoxGroupPropertyGrouper : PropertyGrouper - { - public override void BeginGroup(string label) - { - EditorGUILayout.BeginVertical(GUI.skin.box); - - if (!string.IsNullOrEmpty(label)) - { - EditorGUILayout.LabelField(label, EditorStyles.boldLabel); - } - } - - public override void EndGroup() - { - EditorGUILayout.EndVertical(); - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyGroupers/BoxGroupPropertyGrouper.cs.meta b/NaughtyAttributes/Editor/PropertyGroupers/BoxGroupPropertyGrouper.cs.meta deleted file mode 100644 index b11e43f..0000000 --- a/NaughtyAttributes/Editor/PropertyGroupers/BoxGroupPropertyGrouper.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 657c1fb836d709c4b964d04f07ddd047 -timeCreated: 1508332897 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyGroupers/PropertyGrouper.cs b/NaughtyAttributes/Editor/PropertyGroupers/PropertyGrouper.cs deleted file mode 100644 index 2e4492a..0000000 --- a/NaughtyAttributes/Editor/PropertyGroupers/PropertyGrouper.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NaughtyAttributes.Editor -{ - public abstract class PropertyGrouper - { - public abstract void BeginGroup(string label); - - public abstract void EndGroup(); - } -} diff --git a/NaughtyAttributes/Editor/PropertyGroupers/PropertyGrouper.cs.meta b/NaughtyAttributes/Editor/PropertyGroupers/PropertyGrouper.cs.meta deleted file mode 100644 index 1e2a88a..0000000 --- a/NaughtyAttributes/Editor/PropertyGroupers/PropertyGrouper.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 207d6d654fe48184c97a1c946d0ad8a4 -timeCreated: 1508331735 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyMetas.meta b/NaughtyAttributes/Editor/PropertyMetas.meta deleted file mode 100644 index 58792a1..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: 254c9f391295da84fb392b742e7fceae -folderAsset: yes -timeCreated: 1508497398 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyMetas/InfoBoxPropertyMeta.cs b/NaughtyAttributes/Editor/PropertyMetas/InfoBoxPropertyMeta.cs deleted file mode 100644 index 9d43e5c..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas/InfoBoxPropertyMeta.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Reflection; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyMeta(typeof(InfoBoxAttribute))] - public class InfoBoxPropertyMeta : PropertyMeta - { - public override void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute) - { - InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)metaAttribute; - UnityEngine.Object target = PropertyUtility.GetTargetObject(property); - - if (!string.IsNullOrEmpty(infoBoxAttribute.VisibleIf)) - { - FieldInfo conditionField = ReflectionUtility.GetField(target, infoBoxAttribute.VisibleIf); - if (conditionField != null && - conditionField.FieldType == typeof(bool)) - { - if ((bool)conditionField.GetValue(target)) - { - this.DrawInfoBox(infoBoxAttribute.Text, infoBoxAttribute.Type); - } - - return; - } - - MethodInfo conditionMethod = ReflectionUtility.GetMethod(target, infoBoxAttribute.VisibleIf); - if (conditionMethod != null && - conditionMethod.ReturnType == typeof(bool) && - conditionMethod.GetParameters().Length == 0) - { - if ((bool)conditionMethod.Invoke(target, null)) - { - this.DrawInfoBox(infoBoxAttribute.Text, infoBoxAttribute.Type); - } - - return; - } - - string warning = infoBoxAttribute.GetType().Name + " needs a valid boolean condition field or method name to work"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - } - else - { - this.DrawInfoBox(infoBoxAttribute.Text, infoBoxAttribute.Type); - } - } - - private void DrawInfoBox(string infoText, InfoBoxType infoBoxType) - { - switch (infoBoxType) - { - case InfoBoxType.Normal: - EditorGUILayout.HelpBox(infoText, MessageType.Info); - break; - - case InfoBoxType.Warning: - EditorGUILayout.HelpBox(infoText, MessageType.Warning); - break; - - case InfoBoxType.Error: - EditorGUILayout.HelpBox(infoText, MessageType.Error); - break; - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyMetas/InfoBoxPropertyMeta.cs.meta b/NaughtyAttributes/Editor/PropertyMetas/InfoBoxPropertyMeta.cs.meta deleted file mode 100644 index bb4c001..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas/InfoBoxPropertyMeta.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 998d996265069854eae8d1241df0c8aa -timeCreated: 1508607449 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyMetas/OnValueChangedPropertyMeta.cs b/NaughtyAttributes/Editor/PropertyMetas/OnValueChangedPropertyMeta.cs deleted file mode 100644 index 75303ce..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas/OnValueChangedPropertyMeta.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace NaughtyAttributes.Editor -{ - [PropertyMeta(typeof(OnValueChangedAttribute))] - public class OnValueChangedPropertyMeta : PropertyMeta - { - public override void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute) - { - OnValueChangedAttribute onValueChangedAttribute = (OnValueChangedAttribute)metaAttribute; - UnityEngine.Object target = PropertyUtility.GetTargetObject(property); - - MethodInfo callbackMethod = ReflectionUtility.GetMethod(target, onValueChangedAttribute.CallbackName); - if (callbackMethod != null && - callbackMethod.ReturnType == typeof(void) && - callbackMethod.GetParameters().Length == 0) - { - property.serializedObject.ApplyModifiedProperties(); // We must apply modifications so that the callback can be invoked with up-to-date data - - callbackMethod.Invoke(target, null); - } - else - { - string warning = onValueChangedAttribute.GetType().Name + " can invoke only action methods - with void return type and no parameters"; - Debug.LogWarning(warning, target); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyMetas/OnValueChangedPropertyMeta.cs.meta b/NaughtyAttributes/Editor/PropertyMetas/OnValueChangedPropertyMeta.cs.meta deleted file mode 100644 index 4c29909..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas/OnValueChangedPropertyMeta.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: a55050bf047356c49b1598f431d277e9 -timeCreated: 1508612140 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyMetas/PropertyMeta.cs b/NaughtyAttributes/Editor/PropertyMetas/PropertyMeta.cs deleted file mode 100644 index 3d9b499..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas/PropertyMeta.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - public abstract class PropertyMeta - { - public abstract void ApplyPropertyMeta(SerializedProperty property, MetaAttribute metaAttribute); - } -} diff --git a/NaughtyAttributes/Editor/PropertyMetas/PropertyMeta.cs.meta b/NaughtyAttributes/Editor/PropertyMetas/PropertyMeta.cs.meta deleted file mode 100644 index 831ab49..0000000 --- a/NaughtyAttributes/Editor/PropertyMetas/PropertyMeta.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 87cd72b1f8ad36840a07e1128f77ec5b -timeCreated: 1508497398 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyValidators.meta b/NaughtyAttributes/Editor/PropertyValidators.meta deleted file mode 100644 index 6713dc9..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: efd539f7816167541ba63e633f2a9a7c -folderAsset: yes -timeCreated: 1508153828 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyValidators/MaxValuePropertyValidator.cs b/NaughtyAttributes/Editor/PropertyValidators/MaxValuePropertyValidator.cs deleted file mode 100644 index 454313f..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/MaxValuePropertyValidator.cs +++ /dev/null @@ -1,33 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyValidator(typeof(MaxValueAttribute))] - public class MaxValuePropertyValidator : PropertyValidator - { - public override void ValidateProperty(SerializedProperty property) - { - MaxValueAttribute maxValueAttribute = PropertyUtility.GetAttribute(property); - - if (property.propertyType == SerializedPropertyType.Integer) - { - if (property.intValue > maxValueAttribute.MaxValue) - { - property.intValue = (int)maxValueAttribute.MaxValue; - } - } - else if (property.propertyType == SerializedPropertyType.Float) - { - if (property.floatValue > maxValueAttribute.MaxValue) - { - property.floatValue = maxValueAttribute.MaxValue; - } - } - else - { - string warning = maxValueAttribute.GetType().Name + " can be used only on int or float fields"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta b/NaughtyAttributes/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta deleted file mode 100644 index a11c91a..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 84ddaea11c76b9c4f9a0b56dbab25b4c -timeCreated: 1508153828 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyValidators/MinValuePropertyValidator.cs b/NaughtyAttributes/Editor/PropertyValidators/MinValuePropertyValidator.cs deleted file mode 100644 index 30a80b1..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/MinValuePropertyValidator.cs +++ /dev/null @@ -1,33 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyValidator(typeof(MinValueAttribute))] - public class MinValuePropertyValidator : PropertyValidator - { - public override void ValidateProperty(SerializedProperty property) - { - MinValueAttribute minValueAttribute = PropertyUtility.GetAttribute(property); - - if (property.propertyType == SerializedPropertyType.Integer) - { - if (property.intValue < minValueAttribute.MinValue) - { - property.intValue = (int)minValueAttribute.MinValue; - } - } - else if (property.propertyType == SerializedPropertyType.Float) - { - if (property.floatValue < minValueAttribute.MinValue) - { - property.floatValue = minValueAttribute.MinValue; - } - } - else - { - string warning = minValueAttribute.GetType().Name + " can be used only on int or float fields"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta b/NaughtyAttributes/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta deleted file mode 100644 index 929ac89..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 68add38e187dd154889b1e3b13247621 -timeCreated: 1508153828 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyValidators/PropertyValidator.cs b/NaughtyAttributes/Editor/PropertyValidators/PropertyValidator.cs deleted file mode 100644 index c7380ea..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/PropertyValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - public abstract class PropertyValidator - { - public abstract void ValidateProperty(SerializedProperty property); - } -} diff --git a/NaughtyAttributes/Editor/PropertyValidators/PropertyValidator.cs.meta b/NaughtyAttributes/Editor/PropertyValidators/PropertyValidator.cs.meta deleted file mode 100644 index 56aca33..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/PropertyValidator.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 73502d09058a2e344a1eb20859d29203 -timeCreated: 1508153828 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyValidators/RequiredPropertyValidator.cs b/NaughtyAttributes/Editor/PropertyValidators/RequiredPropertyValidator.cs deleted file mode 100644 index 5f16c6e..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/RequiredPropertyValidator.cs +++ /dev/null @@ -1,32 +0,0 @@ -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyValidator(typeof(RequiredAttribute))] - public class RequiredPropertyValidator : PropertyValidator - { - public override void ValidateProperty(SerializedProperty property) - { - RequiredAttribute requiredAttribute = PropertyUtility.GetAttribute(property); - - if (property.propertyType == SerializedPropertyType.ObjectReference) - { - if (property.objectReferenceValue == null) - { - string errorMessage = property.name + " is required"; - if (!string.IsNullOrEmpty(requiredAttribute.Message)) - { - errorMessage = requiredAttribute.Message; - } - - EditorDrawUtility.DrawHelpBox(errorMessage, MessageType.Error, context: PropertyUtility.GetTargetObject(property)); - } - } - else - { - string warning = requiredAttribute.GetType().Name + " works only on reference types"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: PropertyUtility.GetTargetObject(property)); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta b/NaughtyAttributes/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta deleted file mode 100644 index 239c36c..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 0675503782f800d4081737a5e41f9bf5 -timeCreated: 1508655546 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/PropertyValidators/ValidateInputPropertyValidator.cs b/NaughtyAttributes/Editor/PropertyValidators/ValidateInputPropertyValidator.cs deleted file mode 100644 index 1113ef1..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/ValidateInputPropertyValidator.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Reflection; -using UnityEditor; - -namespace NaughtyAttributes.Editor -{ - [PropertyValidator(typeof(ValidateInputAttribute))] - public class ValidateInputPropertyValidator : PropertyValidator - { - public override void ValidateProperty(SerializedProperty property) - { - ValidateInputAttribute validateInputAttribute = PropertyUtility.GetAttribute(property); - UnityEngine.Object target = PropertyUtility.GetTargetObject(property); - - MethodInfo validationCallback = ReflectionUtility.GetMethod(target, validateInputAttribute.CallbackName); - - if (validationCallback != null && - validationCallback.ReturnType == typeof(bool) && - validationCallback.GetParameters().Length == 1) - { - FieldInfo fieldInfo = ReflectionUtility.GetField(target, property.name); - Type fieldType = fieldInfo.FieldType; - Type parameterType = validationCallback.GetParameters()[0].ParameterType; - - if (fieldType == parameterType) - { - if (!(bool)validationCallback.Invoke(target, new object[] { fieldInfo.GetValue(target) })) - { - if (string.IsNullOrEmpty(validateInputAttribute.Message)) - { - EditorDrawUtility.DrawHelpBox(property.name + " is not valid", MessageType.Error, context: target); - } - else - { - EditorDrawUtility.DrawHelpBox(validateInputAttribute.Message, MessageType.Error, context: target); - } - } - } - else - { - string warning = "The field type is not the same as the callback's parameter type"; - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - } - else - { - string warning = - validateInputAttribute.GetType().Name + - " needs a callback with boolean return type and a single parameter of the same type as the field"; - - EditorDrawUtility.DrawHelpBox(warning, MessageType.Warning, context: target); - } - } - } -} diff --git a/NaughtyAttributes/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta b/NaughtyAttributes/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta deleted file mode 100644 index fb4a666..0000000 --- a/NaughtyAttributes/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 9b7357cef1466544aac67a1976ad9a18 -timeCreated: 1508657795 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Utility.meta b/NaughtyAttributes/Editor/Utility.meta deleted file mode 100644 index ed16edd..0000000 --- a/NaughtyAttributes/Editor/Utility.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: acb4475c71a3fe947a81ced84ab89c6d -folderAsset: yes -timeCreated: 1508062761 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Utility/EditorDrawUtility.cs b/NaughtyAttributes/Editor/Utility/EditorDrawUtility.cs deleted file mode 100644 index 5532461..0000000 --- a/NaughtyAttributes/Editor/Utility/EditorDrawUtility.cs +++ /dev/null @@ -1,123 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; - -namespace NaughtyAttributes.Editor -{ - public static class EditorDrawUtility - { - public static void DrawHeader(string header) - { - EditorGUILayout.Space(); - EditorGUILayout.LabelField(header, EditorStyles.boldLabel); - } - - public static bool DrawHeader(SerializedProperty property) - { - HeaderAttribute headerAttr = PropertyUtility.GetAttribute(property); - if (headerAttr != null) - { - DrawHeader(headerAttr.header); - return true; - } - - return false; - } - - public static void DrawHelpBox(string message, MessageType type, UnityEngine.Object context = null, bool logToConsole = true) - { - EditorGUILayout.HelpBox(message, type); - - if (logToConsole) - { - switch (type) - { - case MessageType.None: - case MessageType.Info: - Debug.Log(message, context); - break; - case MessageType.Warning: - Debug.LogWarning(message, context); - break; - case MessageType.Error: - Debug.LogError(message, context); - break; - } - } - } - - public static void DrawPropertyField(SerializedProperty property, bool includeChildren = true) - { - EditorGUILayout.PropertyField(property, includeChildren); - } - - public static bool DrawLayoutField(object value, string label) - { - GUI.enabled = false; - - bool isDrawn = true; - Type valueType = value.GetType(); - - if (valueType == typeof(bool)) - { - EditorGUILayout.Toggle(label, (bool)value); - } - else if (valueType == typeof(int)) - { - EditorGUILayout.IntField(label, (int)value); - } - else if (valueType == typeof(long)) - { - EditorGUILayout.LongField(label, (long)value); - } - else if (valueType == typeof(float)) - { - EditorGUILayout.FloatField(label, (float)value); - } - else if (valueType == typeof(double)) - { - EditorGUILayout.DoubleField(label, (double)value); - } - else if (valueType == typeof(string)) - { - EditorGUILayout.TextField(label, (string)value); - } - else if (valueType == typeof(Vector2)) - { - EditorGUILayout.Vector2Field(label, (Vector2)value); - } - else if (valueType == typeof(Vector3)) - { - EditorGUILayout.Vector3Field(label, (Vector3)value); - } - else if (valueType == typeof(Vector4)) - { - EditorGUILayout.Vector4Field(label, (Vector4)value); - } - else if (valueType == typeof(Color)) - { - EditorGUILayout.ColorField(label, (Color)value); - } - else if (valueType == typeof(Bounds)) - { - EditorGUILayout.BoundsField(label, (Bounds)value); - } - else if (valueType == typeof(Rect)) - { - EditorGUILayout.RectField(label, (Rect)value); - } - else if (typeof(UnityEngine.Object).IsAssignableFrom(valueType)) - { - EditorGUILayout.ObjectField(label, (UnityEngine.Object)value, valueType, true); - } - else - { - isDrawn = false; - } - - GUI.enabled = true; - - return isDrawn; - } - } -} diff --git a/NaughtyAttributes/Editor/Utility/EditorDrawUtility.cs.meta b/NaughtyAttributes/Editor/Utility/EditorDrawUtility.cs.meta deleted file mode 100644 index 704d3e5..0000000 --- a/NaughtyAttributes/Editor/Utility/EditorDrawUtility.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 6ff27ff7705d6064e935bb2159a1b453 -timeCreated: 1510926159 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Utility/IOUtility.cs b/NaughtyAttributes/Editor/Utility/IOUtility.cs deleted file mode 100644 index 9872765..0000000 --- a/NaughtyAttributes/Editor/Utility/IOUtility.cs +++ /dev/null @@ -1,49 +0,0 @@ -using UnityEngine; -using System.IO; - -namespace NaughtyAttributes.Editor -{ - public static class IOUtility - { - public static string GetPersistentDataPath() - { - return Application.persistentDataPath + "/"; - } - - public static void WriteToFile(string filePath, string content) - { - using (FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) - { - using (StreamWriter streamWriter = new StreamWriter(fileStream, System.Text.Encoding.ASCII)) - { - streamWriter.WriteLine(content); - } - } - } - - public static string ReadFromFile(string filePath) - { - using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) - { - using (StreamReader streamReader = new StreamReader(fileStream, System.Text.Encoding.ASCII)) - { - string content = streamReader.ReadToEnd(); - return content; - } - } - } - - public static bool FileExists(string filePath) - { - return File.Exists(filePath); - } - - public static string GetPathRelativeToProjectFolder(string fullPath) - { - int indexOfAssetsWord = fullPath.IndexOf("\\Assets"); - string relativePath = fullPath.Substring(indexOfAssetsWord + 1); - - return relativePath; - } - } -} diff --git a/NaughtyAttributes/Editor/Utility/IOUtility.cs.meta b/NaughtyAttributes/Editor/Utility/IOUtility.cs.meta deleted file mode 100644 index e8ab56a..0000000 --- a/NaughtyAttributes/Editor/Utility/IOUtility.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: bf376371b2951274e823154c03f066e2 -timeCreated: 1508232215 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Utility/PropertyUtility.cs b/NaughtyAttributes/Editor/Utility/PropertyUtility.cs deleted file mode 100644 index fa8051c..0000000 --- a/NaughtyAttributes/Editor/Utility/PropertyUtility.cs +++ /dev/null @@ -1,27 +0,0 @@ -using UnityEditor; -using System; -using System.Reflection; - -namespace NaughtyAttributes.Editor -{ - public static class PropertyUtility - { - public static T GetAttribute(SerializedProperty property) where T : Attribute - { - T[] attributes = GetAttributes(property); - return attributes.Length > 0 ? attributes[0] : null; - } - - public static T[] GetAttributes(SerializedProperty property) where T : Attribute - { - FieldInfo fieldInfo = ReflectionUtility.GetField(GetTargetObject(property), property.name); - - return (T[])fieldInfo.GetCustomAttributes(typeof(T), true); - } - - public static UnityEngine.Object GetTargetObject(SerializedProperty property) - { - return property.serializedObject.targetObject; - } - } -} diff --git a/NaughtyAttributes/Editor/Utility/PropertyUtility.cs.meta b/NaughtyAttributes/Editor/Utility/PropertyUtility.cs.meta deleted file mode 100644 index fad8d5b..0000000 --- a/NaughtyAttributes/Editor/Utility/PropertyUtility.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: e2d50a3c7c8a9754cb3936216494be66 -timeCreated: 1508153828 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs b/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs deleted file mode 100644 index f1df8a4..0000000 --- a/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace NaughtyAttributes.Editor -{ - public static class ReflectionUtility - { - public static IEnumerable GetAllFields(object target, Func predicate) - { - List types = new List() - { - target.GetType() - }; - - while (types.Last().BaseType != null) - { - types.Add(types.Last().BaseType); - } - - for (int i = types.Count - 1; i >= 0; i--) - { - IEnumerable fieldInfos = types[i] - .GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) - .Where(predicate); - - foreach (var fieldInfo in fieldInfos) - { - yield return fieldInfo; - } - } - } - - public static IEnumerable GetAllProperties(object target, Func predicate) - { - List types = new List() - { - target.GetType() - }; - - while (types.Last().BaseType != null) - { - types.Add(types.Last().BaseType); - } - - for (int i = types.Count - 1; i >= 0; i--) - { - IEnumerable propertyInfos = types[i] - .GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) - .Where(predicate); - - foreach (var propertyInfo in propertyInfos) - { - yield return propertyInfo; - } - } - } - - public static IEnumerable GetAllMethods(object target, Func predicate) - { - IEnumerable methodInfos = target.GetType() - .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public) - .Where(predicate); - - return methodInfos; - } - - public static FieldInfo GetField(object target, string fieldName) - { - return GetAllFields(target, f => f.Name.Equals(fieldName, StringComparison.InvariantCulture)).FirstOrDefault(); - } - - public static PropertyInfo GetProperty(object target, string propertyName) - { - return GetAllProperties(target, p => p.Name.Equals(propertyName, StringComparison.InvariantCulture)).FirstOrDefault(); - } - - public static MethodInfo GetMethod(object target, string methodName) - { - return GetAllMethods(target, m => m.Name.Equals(methodName, StringComparison.InvariantCulture)).FirstOrDefault(); - } - } -} diff --git a/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs.meta b/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs.meta deleted file mode 100644 index 73b6ea9..0000000 --- a/NaughtyAttributes/Editor/Utility/ReflectionUtility.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 1d86c581f02a55f458e36bf7e81e3084 -timeCreated: 1520258793 -licenseType: Free -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/NaughtyAttributes/LICENSE b/NaughtyAttributes/LICENSE deleted file mode 100644 index 65b7986..0000000 --- a/NaughtyAttributes/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Denis Rizov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/NaughtyAttributes/LICENSE.meta b/NaughtyAttributes/LICENSE.meta deleted file mode 100644 index 1b025d6..0000000 --- a/NaughtyAttributes/LICENSE.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 7546e684e809e5f4a852e3cc8591f250 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/README.md b/README.md index bce84af..035b2fc 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,31 @@ Gameplay Ingredients for your Unity Games - A collection of scripts that ease si ## Requirements -* **Unity 2020.2** (Older versions compatible with 2018.3 / 2019.1 / 2019.2 / 2019.3 / 2019.4 / 2020.1) -* Package Manager UI -* (**Optional** : Command-line Git installed on your system, for example [Git For Windows](https://gitforwindows.org/)) +* **Unity 2020.2** (Older versions compatible with 2018.3 / 2019.1 / 2019.2 / 2019.3 / 2020.1) +* (**Optional, for older versions or development** : Command-line Git installed on your system, for example [Git For Windows](https://gitforwindows.org/)) -## How to install +## How to install (2020.2 and Newer) -### Install as Local Package +* In Unity, Open **Project Settings** Window (Edit/Project Settings) and navigate to **Package Manager** +* Add a new **Scoped Registry** that references the [openupm registry](https://openupm.com): `https://package.openupm.com` +* Add the following scopes to the OpenUPM Scoped Registry : `com.dbrizov`, `net.peeweek` -You can use a manual, local package installation if you need to alter the code locally or update the code base regularly. +![](https://raw.githubusercontent.com/peeweek/net.peeweek.gameplay-ingredients/master/Documentation%7E/Images/project-settings.png) -- Clone this repository somewhere of your liking -- In your project, open the `Window/Package Manager` window and use the + button to select the `Add Package from Disk...` option. -- Navigate to your repository folder and select the `package.json` file -- The package shall be added as a **local package** +* Open the Package Manager window (Window/Package Manager) and Select **Packages : My Registries** in the toolbar. +* Select Gameplay Ingredients in the list, then click the Install Button + +## How to install as Local Package (2020.2 and Newer) + +* Clone the repository. +* In Unity, Open **Project Settings** Window (Edit/Project Settings) and navigate to **Package Manager** +* Add a new **Scoped Registry** that references the [openupm registry](https://openupm.com): `https://package.openupm.com` +* Add the following scopes to the OpenUPM Scoped Registry : `com.dbrizov`, `net.peeweek` + +* Open the Package Manager window (Window/Package Manager) +* Click the plus button, select "Add Pacakge from disk" and locate the `package.json` file located at the root of the package. + +## How to install (2019.3.x and Older) ### Install via OpenUPM @@ -43,9 +54,10 @@ You can check that the package was imported by looking at the project window, un Gameplay Ingredients comes at latest version with the following compatibility: -**Unity 2019.3** : clone and check out the `master` branch at the tag `2019.3.7` +**Unity 2020.2 +** : choose the tag `2020.2.0` #### Older Versions * **Unity 2018.3 / 2018.4 :** choose the tag `2018.3.0` * **Unity 2019.1 / 2019.2 :** choose the tag `2019.1.2` +* **Unity 2019.3 / 2020.1** : choose the the tag `2019.3.7` diff --git a/Runtime/Attributes/NoLabelAttribute.cs b/Runtime/Attributes/NoLabelAttribute.cs new file mode 100644 index 0000000..41d4c43 --- /dev/null +++ b/Runtime/Attributes/NoLabelAttribute.cs @@ -0,0 +1,7 @@ +using System; +using UnityEngine; + +namespace GameplayIngredients +{ + public class NoLabelAttribute : PropertyAttribute { } +} diff --git a/NaughtyAttributes/Core/DrawerAttributes/EnableIfAttribute.cs.meta b/Runtime/Attributes/NoLabelAttribute.cs.meta similarity index 83% rename from NaughtyAttributes/Core/DrawerAttributes/EnableIfAttribute.cs.meta rename to Runtime/Attributes/NoLabelAttribute.cs.meta index b2e4973..c712b2d 100644 --- a/NaughtyAttributes/Core/DrawerAttributes/EnableIfAttribute.cs.meta +++ b/Runtime/Attributes/NoLabelAttribute.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a3ef98b2c0ffe1b4c91fbec23d77898e +guid: 91ceac716d1fbf249ba4f46ed1067339 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/Ingredients/Factory/Factory.cs b/Runtime/Ingredients/Factory/Factory.cs index 130ddba..d052316 100644 --- a/Runtime/Ingredients/Factory/Factory.cs +++ b/Runtime/Ingredients/Factory/Factory.cs @@ -33,7 +33,7 @@ public enum SpawnLocation } [Header("Blueprint")] - [ReorderableList, NonNullCheck] + [ReorderableList, NoLabel, NonNullCheck] public GameObject[] FactoryBlueprints; public BlueprintSelectionMode blueprintSelecionMode = BlueprintSelectionMode.Random; [ShowIf("usesGameSave")] diff --git a/Runtime/Ingredients/Rigs/ReachPositionRig.cs b/Runtime/Ingredients/Rigs/ReachPositionRig.cs index c49b189..4d4c63c 100644 --- a/Runtime/Ingredients/Rigs/ReachPositionRig.cs +++ b/Runtime/Ingredients/Rigs/ReachPositionRig.cs @@ -9,7 +9,7 @@ public class ReachPositionRig : MonoBehaviour [Header("Target")] [SerializeField] - [InfoBox("Target needs to have the same parent as the current game object", InfoBoxType.Warning, "warnLocalParent")] + [InfoBox("Target needs to have the same parent as the current game object", EInfoBoxType.Warning)] protected Transform m_Target; [Header("Motion")] public float Dampen = 1.0f; diff --git a/Runtime/Ingredients/Timer/TimerDisplayRig.cs b/Runtime/Ingredients/Timer/TimerDisplayRig.cs index 3af35bb..38616d9 100644 --- a/Runtime/Ingredients/Timer/TimerDisplayRig.cs +++ b/Runtime/Ingredients/Timer/TimerDisplayRig.cs @@ -17,7 +17,7 @@ public class TimerDisplayRig : MonoBehaviour [NonNullCheck] public Timer timer; - [InfoBox("Use the following wildcards:\n - %h : hours\n - %m : minutes\n - %s : seconds\n - %x : milliseconds", InfoBoxType.Normal)] + [InfoBox("Use the following wildcards:\n - %h : hours\n - %m : minutes\n - %s : seconds\n - %x : milliseconds", EInfoBoxType.Normal)] public string format = "%h:%m:%s:%x"; private void OnValidate() diff --git a/Runtime/LevelScripting/Actions/LogAction.cs b/Runtime/LevelScripting/Actions/LogAction.cs index a86eb65..232f5b2 100644 --- a/Runtime/LevelScripting/Actions/LogAction.cs +++ b/Runtime/LevelScripting/Actions/LogAction.cs @@ -12,7 +12,7 @@ public class LogAction : ActionBase %TIME% : Time (since startup) "; - [Multiline, InfoBox(kHelpText, InfoBoxType.Normal)] + [Multiline, InfoBox(kHelpText, EInfoBoxType.Normal)] public string LogText = "Instigator = %INSTIGATOR%"; public LogType type = LogType.Log; diff --git a/Runtime/LevelScripting/Events/OnUpdateEvent.cs b/Runtime/LevelScripting/Events/OnUpdateEvent.cs index 76cedf5..ebe0cc0 100644 --- a/Runtime/LevelScripting/Events/OnUpdateEvent.cs +++ b/Runtime/LevelScripting/Events/OnUpdateEvent.cs @@ -4,7 +4,7 @@ namespace GameplayIngredients.Events { public class OnUpdateEvent : EventBase { - [ReorderableList, ShowIf("AllowUpdateCalls"), InfoBox("Update Calls are disabled on this project. Check your GameplayIngredientsSettings asset if you want to allow them.", InfoBoxType.Warning, "ForbidUpdateCalls")] + [ReorderableList, ShowIf("AllowUpdateCalls")] public Callable[] OnUpdate; private void OnEnable() diff --git a/Runtime/Managers/Implementations/GameSaveManager.cs b/Runtime/Managers/Implementations/GameSaveManager.cs index 1337616..0d4d2b4 100644 --- a/Runtime/Managers/Implementations/GameSaveManager.cs +++ b/Runtime/Managers/Implementations/GameSaveManager.cs @@ -9,7 +9,7 @@ namespace GameplayIngredients [ManagerDefaultPrefab("GameSaveManager")] public class GameSaveManager : Manager { - [InfoBox(@"Use PlayerPrefs will store save data in common target platform registry instead of individual files. For some platforms where writing on disk is forbidden, this is required.", InfoBoxType.Normal)] + [InfoBox(@"Use PlayerPrefs will store save data in common target platform registry instead of individual files. For some platforms where writing on disk is forbidden, this is required.", EInfoBoxType.Normal)] public bool UsePlayerPrefs = false; [DisableIf("UsePlayerPrefs"), SerializeField, Tooltip("The path where system and user saves will be stored. Relative to the Application.persistantDataPath folder.")] diff --git a/Runtime/Settings/GameplayIngredientsSettings.cs b/Runtime/Settings/GameplayIngredientsSettings.cs index a19320d..bdb4297 100644 --- a/Runtime/Settings/GameplayIngredientsSettings.cs +++ b/Runtime/Settings/GameplayIngredientsSettings.cs @@ -22,11 +22,11 @@ public class GameplayIngredientsSettings : ScriptableObject protected string[] m_ExcludedManagers; [BoxGroup("Callables")] - [SerializeField, InfoBox("Verbose Calls enable logging at runtime, this can lead to performance drop, use only when debugging.", InfoBoxType.Warning, "m_VerboseCalls")] + [SerializeField, InfoBox("Verbose Calls enable logging at runtime, this can lead to performance drop, use only when debugging.", EInfoBoxType.Warning)] private bool m_VerboseCalls = false; [BoxGroup("Callables")] - [SerializeField, InfoBox("Per-update calls should be avoided due to high performance impact. Enable and use with care, only if strictly necessary.", InfoBoxType.Warning, "m_AllowUpdateCalls")] + [SerializeField, InfoBox("Per-update calls should be avoided due to high performance impact. Enable and use with care, only if strictly necessary.", EInfoBoxType.Warning)] private bool m_AllowUpdateCalls = false; const string kAssetName = "GameplayIngredientsSettings"; diff --git a/package.json b/package.json index 6a3c894..be4c31a 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "net.peeweek.gameplay-ingredients", "displayName": "Gameplay Ingredients", - "version": "2019.3.7", + "version": "2020.2.0", "category": "Gameplay", - "unity": "2019.3", + "unity": "2020.2", "description": "Gameplay ingredients - A Collection of scripts for the editor and runtime to set-up gameplay actions and logic in your games.", "dependencies": { - "com.unity.cinemachine": "2.5.0", - "com.unity.timeline" : "1.3.0" + "com.unity.cinemachine": "2.6.3", + "com.unity.timeline": "1.4.5", + "com.dbrizov.naughtyattributes" : "2.0.8" }, "keywords": [ "Gameplay",