From c783e6dee7d5d9e22e4ebf09813cf105e4ed222b Mon Sep 17 00:00:00 2001 From: VladV Date: Wed, 3 Aug 2022 11:18:28 +0300 Subject: [PATCH] Simplify processors code --- .../Processors/DisableIfProcessor.cs | 27 ++----------------- .../Processors/DisableInEditModeProcessor.cs | 11 +------- .../Processors/DisableInPlayModeProcessor.cs | 11 +------- .../Processors/HIdeInEditModeProcessor.cs | 11 +------- Editor.Extras/Processors/HideIfProcessor.cs | 27 ++----------------- .../Processors/HideInPlayModeProcessor.cs | 11 +------- .../Conditionals_DisableInEditMode.cs | 8 ++++++ .../Conditionals_DisableInEditMode.cs.meta | 3 +++ .../Conditionals_DisableInPlayMode.cs | 8 ++++++ .../Conditionals_DisableInPlayMode.cs.meta | 3 +++ .../Conditionals_EnableInEditMode.cs | 8 ++++++ .../Conditionals_EnableInEditMode.cs.meta | 3 +++ .../Conditionals_EnableInPlayMode.cs | 8 ++++++ .../Conditionals_EnableInPlayMode.cs.meta | 3 +++ .../Conditionals_HideInEditMode.cs | 8 ++++++ .../Conditionals_HideInEditMode.cs.meta | 3 +++ .../Conditionals_HideInPlayMode.cs | 8 ++++++ .../Conditionals_HideInPlayMode.cs.meta | 3 +++ .../Conditionals_ShowInEditMode.cs | 8 ++++++ .../Conditionals_ShowInEditMode.cs.meta | 3 +++ .../Conditionals_ShowInPlayMode.cs | 8 ++++++ .../Conditionals_ShowInPlayMode.cs.meta | 3 +++ Editor/TriPropertyDisableProcessor.cs | 2 +- Editor/TriPropertyHideProcessor.cs | 2 +- .../ConditionalDisableBaseAttribute.cs | 14 ---------- .../ConditionalDisableBaseAttribute.cs.meta | 3 --- .../ConditionalHideBaseAttribute.cs | 14 ---------- .../ConditionalHideBaseAttribute.cs.meta | 3 --- Runtime/Attributes/DisableBaseAttribute.cs | 8 ------ .../Attributes/DisableBaseAttribute.cs.meta | 3 --- Runtime/Attributes/DisableIfAttribute.cs | 11 ++++++-- .../Attributes/DisableInEditModeAttribute.cs | 3 ++- .../Attributes/DisableInPlayModeAttribute.cs | 3 ++- Runtime/Attributes/EnableIfAttribute.cs | 3 ++- .../Attributes/EnableInEditModeAttribute.cs | 6 ++++- .../Attributes/EnableInPlayModeAttribute.cs | 6 ++++- Runtime/Attributes/HideBaseAttribute.cs | 8 ------ Runtime/Attributes/HideBaseAttribute.cs.meta | 3 --- Runtime/Attributes/HideIfAttribute.cs | 11 ++++++-- Runtime/Attributes/HideInEditModeAttribute.cs | 3 ++- Runtime/Attributes/HideInPlayModeAttribute.cs | 3 ++- Runtime/Attributes/ShowIfAttribute.cs | 3 ++- Runtime/Attributes/ShowInEditModeAttribute.cs | 6 ++++- Runtime/Attributes/ShowInPlayModeAttribute.cs | 6 ++++- 44 files changed, 148 insertions(+), 162 deletions(-) create mode 100644 Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs.meta create mode 100644 Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs create mode 100644 Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs.meta delete mode 100644 Runtime/Attributes/ConditionalDisableBaseAttribute.cs delete mode 100644 Runtime/Attributes/ConditionalDisableBaseAttribute.cs.meta delete mode 100644 Runtime/Attributes/ConditionalHideBaseAttribute.cs delete mode 100644 Runtime/Attributes/ConditionalHideBaseAttribute.cs.meta delete mode 100644 Runtime/Attributes/DisableBaseAttribute.cs delete mode 100644 Runtime/Attributes/DisableBaseAttribute.cs.meta delete mode 100644 Runtime/Attributes/HideBaseAttribute.cs delete mode 100644 Runtime/Attributes/HideBaseAttribute.cs.meta diff --git a/Editor.Extras/Processors/DisableIfProcessor.cs b/Editor.Extras/Processors/DisableIfProcessor.cs index 65ba593..f11e4e4 100644 --- a/Editor.Extras/Processors/DisableIfProcessor.cs +++ b/Editor.Extras/Processors/DisableIfProcessor.cs @@ -3,22 +3,13 @@ using TriInspector.Processors; using TriInspector.Resolvers; [assembly: RegisterTriPropertyDisableProcessor(typeof(DisableIfProcessor))] -[assembly: RegisterTriPropertyDisableProcessor(typeof(EnableIfProcessor))] namespace TriInspector.Processors { - public abstract class DisableIfProcessorBase : TriPropertyDisableProcessor - where T : ConditionalDisableBaseAttribute + public class DisableIfProcessor : TriPropertyDisableProcessor { - private readonly bool _inverse; - private ValueResolver _conditionResolver; - protected DisableIfProcessorBase(bool inverse) - { - _inverse = inverse; - } - public override TriExtensionInitializationResult Initialize(TriPropertyDefinition propertyDefinition) { base.Initialize(propertyDefinition); @@ -36,21 +27,7 @@ namespace TriInspector.Processors { var val = _conditionResolver.GetValue(property); var equal = val?.Equals(Attribute.Value) ?? Attribute.Value == null; - return equal != _inverse; - } - } - - public sealed class DisableIfProcessor : DisableIfProcessorBase - { - public DisableIfProcessor() : base(false) - { - } - } - - public sealed class EnableIfProcessor : DisableIfProcessorBase - { - public EnableIfProcessor() : base(true) - { + return equal != Attribute.Inverse; } } } \ No newline at end of file diff --git a/Editor.Extras/Processors/DisableInEditModeProcessor.cs b/Editor.Extras/Processors/DisableInEditModeProcessor.cs index 4c0e97e..482d305 100644 --- a/Editor.Extras/Processors/DisableInEditModeProcessor.cs +++ b/Editor.Extras/Processors/DisableInEditModeProcessor.cs @@ -3,7 +3,6 @@ using TriInspector; using UnityEngine; [assembly: RegisterTriPropertyDisableProcessor(typeof(DisableInEditModeProcessor))] -[assembly: RegisterTriPropertyDisableProcessor(typeof(EnableInEditModeProcessor))] namespace TriInspector.Processors { @@ -11,15 +10,7 @@ namespace TriInspector.Processors { public override bool IsDisabled(TriProperty property) { - return !Application.isPlaying; - } - } - - public class EnableInEditModeProcessor : TriPropertyDisableProcessor - { - public override bool IsDisabled(TriProperty property) - { - return Application.isPlaying; + return Application.isPlaying == Attribute.Inverse; } } } \ No newline at end of file diff --git a/Editor.Extras/Processors/DisableInPlayModeProcessor.cs b/Editor.Extras/Processors/DisableInPlayModeProcessor.cs index c709061..b861168 100644 --- a/Editor.Extras/Processors/DisableInPlayModeProcessor.cs +++ b/Editor.Extras/Processors/DisableInPlayModeProcessor.cs @@ -3,7 +3,6 @@ using TriInspector; using UnityEngine; [assembly: RegisterTriPropertyDisableProcessor(typeof(DisableInPlayModeProcessor))] -[assembly: RegisterTriPropertyDisableProcessor(typeof(EnableInPlayModeProcessor))] namespace TriInspector.Processors { @@ -11,15 +10,7 @@ namespace TriInspector.Processors { public override bool IsDisabled(TriProperty property) { - return Application.isPlaying; - } - } - - public class EnableInPlayModeProcessor : TriPropertyDisableProcessor - { - public override bool IsDisabled(TriProperty property) - { - return !Application.isPlaying; + return Application.isPlaying != Attribute.Inverse; } } } \ No newline at end of file diff --git a/Editor.Extras/Processors/HIdeInEditModeProcessor.cs b/Editor.Extras/Processors/HIdeInEditModeProcessor.cs index 8483203..d3e0309 100644 --- a/Editor.Extras/Processors/HIdeInEditModeProcessor.cs +++ b/Editor.Extras/Processors/HIdeInEditModeProcessor.cs @@ -3,7 +3,6 @@ using TriInspector; using UnityEngine; [assembly: RegisterTriPropertyHideProcessor(typeof(HideInEditModeProcessor))] -[assembly: RegisterTriPropertyHideProcessor(typeof(ShowInEditModeProcessor))] namespace TriInspector.Processors { @@ -11,15 +10,7 @@ namespace TriInspector.Processors { public override bool IsHidden(TriProperty property) { - return !Application.isPlaying; - } - } - - public class ShowInEditModeProcessor : TriPropertyHideProcessor - { - public override bool IsHidden(TriProperty property) - { - return Application.isPlaying; + return Application.isPlaying == Attribute.Inverse; } } } \ No newline at end of file diff --git a/Editor.Extras/Processors/HideIfProcessor.cs b/Editor.Extras/Processors/HideIfProcessor.cs index 454a44b..86af576 100644 --- a/Editor.Extras/Processors/HideIfProcessor.cs +++ b/Editor.Extras/Processors/HideIfProcessor.cs @@ -3,22 +3,13 @@ using TriInspector.Processors; using TriInspector.Resolvers; [assembly: RegisterTriPropertyHideProcessor(typeof(HideIfProcessor))] -[assembly: RegisterTriPropertyHideProcessor(typeof(ShowIfProcessor))] namespace TriInspector.Processors { - public abstract class HideIfProcessorBase : TriPropertyHideProcessor - where T : ConditionalHideBaseAttribute + public class HideIfProcessor : TriPropertyHideProcessor { - private readonly bool _inverse; - private ValueResolver _conditionResolver; - protected HideIfProcessorBase(bool inverse) - { - _inverse = inverse; - } - public override TriExtensionInitializationResult Initialize(TriPropertyDefinition propertyDefinition) { base.Initialize(propertyDefinition); @@ -37,21 +28,7 @@ namespace TriInspector.Processors { var val = _conditionResolver.GetValue(property); var equal = val?.Equals(Attribute.Value) ?? Attribute.Value == null; - return equal != _inverse; - } - } - - public sealed class HideIfProcessor : HideIfProcessorBase - { - public HideIfProcessor() : base(false) - { - } - } - - public sealed class ShowIfProcessor : HideIfProcessorBase - { - public ShowIfProcessor() : base(true) - { + return equal != Attribute.Inverse; } } } \ No newline at end of file diff --git a/Editor.Extras/Processors/HideInPlayModeProcessor.cs b/Editor.Extras/Processors/HideInPlayModeProcessor.cs index 44ee0f8..3499ae7 100644 --- a/Editor.Extras/Processors/HideInPlayModeProcessor.cs +++ b/Editor.Extras/Processors/HideInPlayModeProcessor.cs @@ -3,7 +3,6 @@ using TriInspector; using UnityEngine; [assembly: RegisterTriPropertyHideProcessor(typeof(HideInPlayModeProcessor))] -[assembly: RegisterTriPropertyHideProcessor(typeof(ShowInPlayModeProcessor))] namespace TriInspector.Processors { @@ -11,15 +10,7 @@ namespace TriInspector.Processors { public override bool IsHidden(TriProperty property) { - return Application.isPlaying; - } - } - - public class ShowInPlayModeProcessor : TriPropertyHideProcessor - { - public override bool IsHidden(TriProperty property) - { - return !Application.isPlaying; + return Application.isPlaying != Attribute.Inverse; } } } \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs b/Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs new file mode 100644 index 0000000..0d03908 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_DisableInEditMode : ScriptableObject +{ + [DisableInEditMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs.meta new file mode 100644 index 0000000..ddd022d --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_DisableInEditMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d4329a716d424b0babfe5e9c046950f6 +timeCreated: 1659515326 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs b/Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs new file mode 100644 index 0000000..6f17495 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_DisableInPlayMode : ScriptableObject +{ + [DisableInPlayMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs.meta new file mode 100644 index 0000000..2e4d574 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_DisableInPlayMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f04bc8a7e7574f5dafc3e02fc5917e5e +timeCreated: 1659515316 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs b/Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs new file mode 100644 index 0000000..1d3ac2b --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_EnableInEditMode : ScriptableObject +{ + [EnableInEditMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs.meta new file mode 100644 index 0000000..56fb9e5 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_EnableInEditMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eceba01bbe72411eaeb6ba5a6dd6bdbd +timeCreated: 1659515330 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs b/Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs new file mode 100644 index 0000000..7b3ae92 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_EnableInPlayMode : ScriptableObject +{ + [EnableInPlayMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs.meta new file mode 100644 index 0000000..eadaf45 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_EnableInPlayMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9b640777fb3e4eb8819741d07b11aa39 +timeCreated: 1659515322 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs b/Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs new file mode 100644 index 0000000..9a0a99c --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_HideInEditMode : ScriptableObject +{ + [HideInEditMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs.meta new file mode 100644 index 0000000..1453ed2 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_HideInEditMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d2c0afeededf47bcaaebbc3e2d39aed3 +timeCreated: 1659515490 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs b/Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs new file mode 100644 index 0000000..b39b0d1 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_HideInPlayMode : ScriptableObject +{ + [HideInPlayMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs.meta new file mode 100644 index 0000000..98ce40d --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_HideInPlayMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ea1cf8b4405a4d309866c2b8cc2225cd +timeCreated: 1659515499 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs b/Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs new file mode 100644 index 0000000..15b4e63 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_ShowInEditMode : ScriptableObject +{ + [ShowInEditMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs.meta new file mode 100644 index 0000000..0541963 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_ShowInEditMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ab794f598d3940be927f3ecea8464097 +timeCreated: 1659515495 \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs b/Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs new file mode 100644 index 0000000..5f622a2 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs @@ -0,0 +1,8 @@ +using TriInspector; +using UnityEngine; + +public class Conditionals_ShowInPlayMode : ScriptableObject +{ + [ShowInPlayMode] + public float val; +} \ No newline at end of file diff --git a/Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs.meta b/Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs.meta new file mode 100644 index 0000000..270fca0 --- /dev/null +++ b/Editor.Samples/Conditionals/Conditionals_ShowInPlayMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4021d03b1ac443de8a283a15a2cc16ac +timeCreated: 1659515502 \ No newline at end of file diff --git a/Editor/TriPropertyDisableProcessor.cs b/Editor/TriPropertyDisableProcessor.cs index eb45ffe..3253a6c 100644 --- a/Editor/TriPropertyDisableProcessor.cs +++ b/Editor/TriPropertyDisableProcessor.cs @@ -12,7 +12,7 @@ namespace TriInspector } public abstract class TriPropertyDisableProcessor : TriPropertyDisableProcessor - where TAttribute : DisableBaseAttribute + where TAttribute : Attribute { [PublicAPI] public TAttribute Attribute => (TAttribute) RawAttribute; diff --git a/Editor/TriPropertyHideProcessor.cs b/Editor/TriPropertyHideProcessor.cs index 958956c..67e9e0d 100644 --- a/Editor/TriPropertyHideProcessor.cs +++ b/Editor/TriPropertyHideProcessor.cs @@ -12,7 +12,7 @@ namespace TriInspector } public abstract class TriPropertyHideProcessor : TriPropertyHideProcessor - where TAttribute : HideBaseAttribute + where TAttribute : Attribute { [PublicAPI] public TAttribute Attribute => (TAttribute) RawAttribute; diff --git a/Runtime/Attributes/ConditionalDisableBaseAttribute.cs b/Runtime/Attributes/ConditionalDisableBaseAttribute.cs deleted file mode 100644 index 8524ebe..0000000 --- a/Runtime/Attributes/ConditionalDisableBaseAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace TriInspector -{ - public abstract class ConditionalDisableBaseAttribute : DisableBaseAttribute - { - protected ConditionalDisableBaseAttribute(string condition, object value) - { - Condition = condition; - Value = value; - } - - public string Condition { get; } - public object Value { get; } - } -} \ No newline at end of file diff --git a/Runtime/Attributes/ConditionalDisableBaseAttribute.cs.meta b/Runtime/Attributes/ConditionalDisableBaseAttribute.cs.meta deleted file mode 100644 index 572da35..0000000 --- a/Runtime/Attributes/ConditionalDisableBaseAttribute.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8eafca5093484faf8a443c5350b32394 -timeCreated: 1652289509 \ No newline at end of file diff --git a/Runtime/Attributes/ConditionalHideBaseAttribute.cs b/Runtime/Attributes/ConditionalHideBaseAttribute.cs deleted file mode 100644 index 402bb6b..0000000 --- a/Runtime/Attributes/ConditionalHideBaseAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace TriInspector -{ - public abstract class ConditionalHideBaseAttribute : HideBaseAttribute - { - protected ConditionalHideBaseAttribute(string condition, object value) - { - Condition = condition; - Value = value; - } - - public string Condition { get; } - public object Value { get; } - } -} \ No newline at end of file diff --git a/Runtime/Attributes/ConditionalHideBaseAttribute.cs.meta b/Runtime/Attributes/ConditionalHideBaseAttribute.cs.meta deleted file mode 100644 index f6cc9ab..0000000 --- a/Runtime/Attributes/ConditionalHideBaseAttribute.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f5ab937126ed4c07937264bce29616c0 -timeCreated: 1652289448 \ No newline at end of file diff --git a/Runtime/Attributes/DisableBaseAttribute.cs b/Runtime/Attributes/DisableBaseAttribute.cs deleted file mode 100644 index 7e5ca3b..0000000 --- a/Runtime/Attributes/DisableBaseAttribute.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace TriInspector -{ - public abstract class DisableBaseAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/Runtime/Attributes/DisableBaseAttribute.cs.meta b/Runtime/Attributes/DisableBaseAttribute.cs.meta deleted file mode 100644 index 9418e06..0000000 --- a/Runtime/Attributes/DisableBaseAttribute.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 62ef6624296046438d41bb5ef66cc422 -timeCreated: 1641386025 \ No newline at end of file diff --git a/Runtime/Attributes/DisableIfAttribute.cs b/Runtime/Attributes/DisableIfAttribute.cs index 42ef088..7b7eb3c 100644 --- a/Runtime/Attributes/DisableIfAttribute.cs +++ b/Runtime/Attributes/DisableIfAttribute.cs @@ -5,14 +5,21 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true)] [Conditional("UNITY_EDITOR")] - public class DisableIfAttribute : ConditionalDisableBaseAttribute + public class DisableIfAttribute : Attribute { public DisableIfAttribute(string condition) : this(condition, true) { } - public DisableIfAttribute(string condition, object value) : base(condition, value) + public DisableIfAttribute(string condition, object value) { + Condition = condition; + Value = value; } + + public string Condition { get; } + public object Value { get; } + + public bool Inverse { get; protected set; } } } \ No newline at end of file diff --git a/Runtime/Attributes/DisableInEditModeAttribute.cs b/Runtime/Attributes/DisableInEditModeAttribute.cs index 59b74e8..090924b 100644 --- a/Runtime/Attributes/DisableInEditModeAttribute.cs +++ b/Runtime/Attributes/DisableInEditModeAttribute.cs @@ -5,7 +5,8 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class DisableInEditModeAttribute : DisableBaseAttribute + public class DisableInEditModeAttribute : Attribute { + public bool Inverse { get; protected set; } } } \ No newline at end of file diff --git a/Runtime/Attributes/DisableInPlayModeAttribute.cs b/Runtime/Attributes/DisableInPlayModeAttribute.cs index 643a110..958111d 100644 --- a/Runtime/Attributes/DisableInPlayModeAttribute.cs +++ b/Runtime/Attributes/DisableInPlayModeAttribute.cs @@ -5,7 +5,8 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class DisableInPlayModeAttribute : DisableBaseAttribute + public class DisableInPlayModeAttribute : Attribute { + public bool Inverse { get; protected set; } } } \ No newline at end of file diff --git a/Runtime/Attributes/EnableIfAttribute.cs b/Runtime/Attributes/EnableIfAttribute.cs index 7669b60..67b84e9 100644 --- a/Runtime/Attributes/EnableIfAttribute.cs +++ b/Runtime/Attributes/EnableIfAttribute.cs @@ -5,7 +5,7 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true)] [Conditional("UNITY_EDITOR")] - public class EnableIfAttribute : ConditionalDisableBaseAttribute + public class EnableIfAttribute : DisableIfAttribute { public EnableIfAttribute(string condition) : this(condition, true) { @@ -13,6 +13,7 @@ namespace TriInspector public EnableIfAttribute(string condition, object value) : base(condition, value) { + Inverse = true; } } } \ No newline at end of file diff --git a/Runtime/Attributes/EnableInEditModeAttribute.cs b/Runtime/Attributes/EnableInEditModeAttribute.cs index 608a80b..d0d9263 100644 --- a/Runtime/Attributes/EnableInEditModeAttribute.cs +++ b/Runtime/Attributes/EnableInEditModeAttribute.cs @@ -5,7 +5,11 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class EnableInEditModeAttribute : DisableBaseAttribute + public class EnableInEditModeAttribute : DisableInEditModeAttribute { + public EnableInEditModeAttribute() + { + Inverse = true; + } } } \ No newline at end of file diff --git a/Runtime/Attributes/EnableInPlayModeAttribute.cs b/Runtime/Attributes/EnableInPlayModeAttribute.cs index 4ba2c0a..601c4f4 100644 --- a/Runtime/Attributes/EnableInPlayModeAttribute.cs +++ b/Runtime/Attributes/EnableInPlayModeAttribute.cs @@ -5,7 +5,11 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class EnableInPlayModeAttribute : DisableBaseAttribute + public class EnableInPlayModeAttribute : DisableInPlayModeAttribute { + public EnableInPlayModeAttribute() + { + Inverse = true; + } } } \ No newline at end of file diff --git a/Runtime/Attributes/HideBaseAttribute.cs b/Runtime/Attributes/HideBaseAttribute.cs deleted file mode 100644 index df1d7e4..0000000 --- a/Runtime/Attributes/HideBaseAttribute.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace TriInspector -{ - public abstract class HideBaseAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/Runtime/Attributes/HideBaseAttribute.cs.meta b/Runtime/Attributes/HideBaseAttribute.cs.meta deleted file mode 100644 index 96be30b..0000000 --- a/Runtime/Attributes/HideBaseAttribute.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ff02ae4b7c9a4f2598212bef121bb141 -timeCreated: 1641386002 \ No newline at end of file diff --git a/Runtime/Attributes/HideIfAttribute.cs b/Runtime/Attributes/HideIfAttribute.cs index 237103d..a6e7e66 100644 --- a/Runtime/Attributes/HideIfAttribute.cs +++ b/Runtime/Attributes/HideIfAttribute.cs @@ -5,14 +5,21 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true)] [Conditional("UNITY_EDITOR")] - public class HideIfAttribute : ConditionalHideBaseAttribute + public class HideIfAttribute : Attribute { public HideIfAttribute(string condition) : this(condition, true) { } - public HideIfAttribute(string condition, object value) : base(condition, value) + public HideIfAttribute(string condition, object value) { + Condition = condition; + Value = value; } + + public string Condition { get; } + public object Value { get; } + + public bool Inverse { get; protected set; } } } \ No newline at end of file diff --git a/Runtime/Attributes/HideInEditModeAttribute.cs b/Runtime/Attributes/HideInEditModeAttribute.cs index e540a59..6b9586b 100644 --- a/Runtime/Attributes/HideInEditModeAttribute.cs +++ b/Runtime/Attributes/HideInEditModeAttribute.cs @@ -5,7 +5,8 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class HideInEditModeAttribute : HideBaseAttribute + public class HideInEditModeAttribute : Attribute { + public bool Inverse { get; protected set; } } } \ No newline at end of file diff --git a/Runtime/Attributes/HideInPlayModeAttribute.cs b/Runtime/Attributes/HideInPlayModeAttribute.cs index 55aba6a..98f4228 100644 --- a/Runtime/Attributes/HideInPlayModeAttribute.cs +++ b/Runtime/Attributes/HideInPlayModeAttribute.cs @@ -5,7 +5,8 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class HideInPlayModeAttribute : HideBaseAttribute + public class HideInPlayModeAttribute : Attribute { + public bool Inverse { get; protected set; } } } \ No newline at end of file diff --git a/Runtime/Attributes/ShowIfAttribute.cs b/Runtime/Attributes/ShowIfAttribute.cs index 77dc8ea..b0e8a41 100644 --- a/Runtime/Attributes/ShowIfAttribute.cs +++ b/Runtime/Attributes/ShowIfAttribute.cs @@ -5,7 +5,7 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true)] [Conditional("UNITY_EDITOR")] - public class ShowIfAttribute : ConditionalHideBaseAttribute + public class ShowIfAttribute : HideIfAttribute { public ShowIfAttribute(string condition) : this(condition, true) { @@ -13,6 +13,7 @@ namespace TriInspector public ShowIfAttribute(string condition, object value) : base(condition, value) { + Inverse = true; } } } \ No newline at end of file diff --git a/Runtime/Attributes/ShowInEditModeAttribute.cs b/Runtime/Attributes/ShowInEditModeAttribute.cs index 5595861..9f77273 100644 --- a/Runtime/Attributes/ShowInEditModeAttribute.cs +++ b/Runtime/Attributes/ShowInEditModeAttribute.cs @@ -5,7 +5,11 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class ShowInEditModeAttribute : HideBaseAttribute + public class ShowInEditModeAttribute : HideInEditModeAttribute { + public ShowInEditModeAttribute() + { + Inverse = true; + } } } \ No newline at end of file diff --git a/Runtime/Attributes/ShowInPlayModeAttribute.cs b/Runtime/Attributes/ShowInPlayModeAttribute.cs index be59739..289ba3e 100644 --- a/Runtime/Attributes/ShowInPlayModeAttribute.cs +++ b/Runtime/Attributes/ShowInPlayModeAttribute.cs @@ -5,7 +5,11 @@ namespace TriInspector { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] [Conditional("UNITY_EDITOR")] - public class ShowInPlayModeAttribute : HideBaseAttribute + public class ShowInPlayModeAttribute : HideInPlayModeAttribute { + public ShowInPlayModeAttribute() + { + Inverse = true; + } } } \ No newline at end of file