PkmnLib.NET/PkmnLib.Dynamic/ScriptHandling/Registry/ScriptAttribute.cs

29 lines
730 B
C#
Raw Normal View History

2024-07-28 10:18:12 +00:00
using JetBrains.Annotations;
using PkmnLib.Static.Utils;
2024-07-28 10:52:17 +00:00
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
2024-07-27 14:26:45 +00:00
2024-07-28 10:52:17 +00:00
/// <summary>
/// Helper attribute to register scripts through reflection.
/// </summary>
2024-07-27 14:26:45 +00:00
[AttributeUsage(AttributeTargets.Class)]
2024-07-28 10:18:12 +00:00
[MeansImplicitUse]
2024-07-27 14:26:45 +00:00
public class ScriptAttribute : Attribute
{
2024-07-28 10:52:17 +00:00
/// <summary>
/// The category of the script it should be registered in.
/// </summary>
2024-07-27 14:26:45 +00:00
public ScriptCategory Category { get; }
2024-07-28 10:52:17 +00:00
/// <summary>
/// The name of the script.
/// </summary>
2024-07-28 10:18:12 +00:00
public StringKey Name { get; }
2024-07-28 10:52:17 +00:00
/// <inheritdoc cref="ScriptAttribute"/>
2024-07-27 14:26:45 +00:00
public ScriptAttribute(ScriptCategory category, string name)
{
Category = category;
Name = name;
}
}