ScriptCore: Added NumberFormatAttribute

This commit is contained in:
Simon Lübeß
2024-03-09 01:00:59 +01:00
parent 5dbe1d7e50
commit 09624e4e59
2 changed files with 36 additions and 2 deletions
@@ -0,0 +1,30 @@
using System;
namespace GlitchyEngine.Editor;
/// <summary>
/// Specifies a custom number format for the input field in the editor.
/// </summary>
/// <remarks>
/// This attribute is only applicable to numerical fields like <see cref="float"/>, <see cref="int"/>, etc.
/// </remarks>
[AttributeUsage(AttributeTargets.Field)]
public sealed class NumberFormatAttribute : Attribute
{
/// <summary>
/// The number format for the input field.
/// </summary>
/// <remarks>
/// This doesn't use C# number formatting, but rather the C-style printf number formatting.
/// </remarks>
public string Format { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="NumberFormatAttribute"/> with a custom number format.
/// </summary>
/// <param name="format"><inheritdoc cref="Format"/></param>
public NumberFormatAttribute(string format)
{
Format = format;
}
}