40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
namespace KitsuneCafe.Sys.Attributes
|
|
{
|
|
public enum LogicalOperator
|
|
{
|
|
And,
|
|
Or
|
|
}
|
|
|
|
public enum ComparisonOperator
|
|
{
|
|
Less,
|
|
Equal,
|
|
LessEqual,
|
|
Greater,
|
|
NotEqual,
|
|
GreaterEqual,
|
|
}
|
|
|
|
public abstract class ConditionalDisplayAttribute : PropertyAttribute
|
|
{
|
|
public readonly string[] Properties;
|
|
public readonly LogicalOperator LogicalOperator;
|
|
public readonly ComparisonOperator ComparisonOperator;
|
|
public readonly object Value;
|
|
|
|
public ConditionalDisplayAttribute(LogicalOperator logicalOp, ComparisonOperator compareOp, object value, params string[] properties)
|
|
{
|
|
LogicalOperator = logicalOp;
|
|
ComparisonOperator = compareOp;
|
|
Properties = properties;
|
|
Value = value;
|
|
}
|
|
|
|
public ConditionalDisplayAttribute(LogicalOperator op, object value, string property) : this(op, ComparisonOperator.Equal, value, property) { }
|
|
public ConditionalDisplayAttribute(ComparisonOperator op, object value, string property) : this(LogicalOperator.And, op, value, property) { }
|
|
public ConditionalDisplayAttribute(string property, object value) : this(LogicalOperator.And, ComparisonOperator.Equal, value, property) { }
|
|
}
|
|
}
|