23 lines
No EOL
825 B
C#
23 lines
No EOL
825 B
C#
using UnityEngine;
|
|
|
|
namespace Module.ProjectValidator.Editor
|
|
{
|
|
internal sealed class AttributeValidatorMin : IAttributeValidator<MinAttribute>
|
|
{
|
|
public ValidatorResult Validate(MinAttribute attribute, object value)
|
|
{
|
|
if (value is int iValue)
|
|
{
|
|
if (iValue < attribute.min)
|
|
return ValidatorResult.Create(EValidatorSeverity.Error, $"Value {iValue} is less than minimum value of {attribute.min}");
|
|
}
|
|
else if (value is float fValue)
|
|
{
|
|
if (fValue < attribute.min)
|
|
return ValidatorResult.Create(EValidatorSeverity.Error, $"Value {fValue} is less than minimum value of {attribute.min}");
|
|
}
|
|
|
|
return ValidatorResult.Valid;
|
|
}
|
|
}
|
|
} |