Scripts: First implementation of Range- and Readonly-Attributes + added support for all primitive types

This commit is contained in:
Simon Lübeß
2023-11-22 00:57:18 +01:00
parent 881bb8ee51
commit ffe86a18cf
5 changed files with 197 additions and 43 deletions
+13 -10
View File
@@ -2,14 +2,17 @@ using System;
namespace GlitchyEngine.Editor;
//public sealed class RangeAttribute : Attribute
//{
// public float Min { get; set; }
// public float Max { get; set; }
public sealed class RangeAttribute : Attribute
{
public double Min { get; set; }
public double Max { get; set; }
// public RangeAttribute(float min, float max)
// {
// Min = min;
// Max = max;
// }
//}
public RangeAttribute(double min, double max)
{
if (max < min)
throw new ArgumentOutOfRangeException(nameof(max), $"{nameof(max)} must be larger than {nameof(min)}.");
Min = min;
Max = max;
}
}