From b5aff36f1bb84e87c658f6f840455bffa343b4b4 Mon Sep 17 00:00:00 2001
From: Zenodeon <32438218+Zenodeon@users.noreply.github.com>
Date: Mon, 19 Jun 2023 11:43:26 +0400
Subject: [PATCH 1/2] ComparisonAttribute QOL
Compares To True By Default If no valueToMatch value is Given.
---
.../ConditionAttributes/ComparisonAttribute.cs | 12 +++++++++++-
.../ConditionAttributes/DisableIfAttribute.cs | 3 +++
.../Toolbox/ConditionAttributes/EnableIfAttribute.cs | 3 +++
.../ConditionAttributes/HideDisabledIfAttribute.cs | 3 +++
.../Toolbox/ConditionAttributes/HideIfAttribute.cs | 3 +++
.../ConditionAttributes/ShowDisabledIfAttribute.cs | 3 +++
.../Toolbox/ConditionAttributes/ShowIfAttribute.cs | 5 ++++-
.../ConditionAttributes/ShowWarningIfAttribute.cs | 5 +++++
8 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ComparisonAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ComparisonAttribute.cs
index 2a63da21..b8b6c502 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ComparisonAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ComparisonAttribute.cs
@@ -7,8 +7,18 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public abstract class ComparisonAttribute : ToolboxConditionAttribute
{
+ ///
+ /// If is True
+ ///
+ /// L-value or the mask if is set to
+ public ComparisonAttribute(string sourceHandle)
+ {
+ SourceHandle = sourceHandle;
+ ValueToMatch = true;
+ }
+
/// L-value or the mask if is set to
- /// R-value or the flag if is set to
+ /// R-value or the flag if is set to
public ComparisonAttribute(string sourceHandle, object valueToMatch)
{
SourceHandle = sourceHandle;
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/DisableIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/DisableIfAttribute.cs
index c357d471..54640e2b 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/DisableIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/DisableIfAttribute.cs
@@ -14,6 +14,9 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class DisableIfAttribute : ComparisonAttribute
{
+ public DisableIfAttribute(string sourceHandle) : base(sourceHandle)
+ { }
+
public DisableIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
{ }
}
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/EnableIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/EnableIfAttribute.cs
index 776a4a85..b12a53fe 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/EnableIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/EnableIfAttribute.cs
@@ -14,6 +14,9 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class EnableIfAttribute : ComparisonAttribute
{
+ public EnableIfAttribute(string sourceHandle) : base(sourceHandle)
+ { }
+
public EnableIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
{ }
}
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideDisabledIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideDisabledIfAttribute.cs
index 2b099bd8..57af92e0 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideDisabledIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideDisabledIfAttribute.cs
@@ -14,6 +14,9 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class HideDisabledIfAttribute : ComparisonAttribute
{
+ public HideDisabledIfAttribute(string sourceHandle) : base(sourceHandle)
+ { }
+
public HideDisabledIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
{ }
}
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideIfAttribute.cs
index d98ce21d..c2e09ef4 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/HideIfAttribute.cs
@@ -14,6 +14,9 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class HideIfAttribute : ComparisonAttribute
{
+ public HideIfAttribute(string sourceHandle) : base(sourceHandle)
+ { }
+
public HideIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
{ }
}
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowDisabledIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowDisabledIfAttribute.cs
index 944c6551..7226616c 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowDisabledIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowDisabledIfAttribute.cs
@@ -14,6 +14,9 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class ShowDisabledIfAttribute : ComparisonAttribute
{
+ public ShowDisabledIfAttribute(string sourceHandle) : base(sourceHandle)
+ { }
+
public ShowDisabledIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
{ }
}
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs
index ac27c752..4326b434 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs
@@ -14,7 +14,10 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class ShowIfAttribute : ComparisonAttribute
{
- public ShowIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
+ public ShowIfAttribute(string sourceHandle) : base(sourceHandle)
+ { }
+
+ public ShowIfAttribute(string sourceHandle, object valueToMatch = null) : base(sourceHandle, valueToMatch)
{ }
}
}
\ No newline at end of file
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowWarningIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowWarningIfAttribute.cs
index a63dfafc..2babe76b 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowWarningIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowWarningIfAttribute.cs
@@ -14,6 +14,11 @@ namespace UnityEngine
[Conditional("UNITY_EDITOR")]
public class ShowWarningIfAttribute : ComparisonAttribute
{
+ public ShowWarningIfAttribute(string sourceHandle, string message) : base(sourceHandle)
+ {
+ Message = message;
+ }
+
public ShowWarningIfAttribute(string sourceHandle, object valueToMatch, string message) : base(sourceHandle, valueToMatch)
{
Message = message;
From 4a4cdac2fac692ab116895fba08cc730a2352711 Mon Sep 17 00:00:00 2001
From: Zenodeon <32438218+Zenodeon@users.noreply.github.com>
Date: Mon, 19 Jun 2023 12:02:04 +0400
Subject: [PATCH 2/2] Update ShowIfAttribute.cs
---
.../Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs
index 4326b434..27d3a1a3 100644
--- a/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs
+++ b/Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ConditionAttributes/ShowIfAttribute.cs
@@ -17,7 +17,7 @@ public class ShowIfAttribute : ComparisonAttribute
public ShowIfAttribute(string sourceHandle) : base(sourceHandle)
{ }
- public ShowIfAttribute(string sourceHandle, object valueToMatch = null) : base(sourceHandle, valueToMatch)
+ public ShowIfAttribute(string sourceHandle, object valueToMatch) : base(sourceHandle, valueToMatch)
{ }
}
}
\ No newline at end of file