mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
this is very nitpicky, but better be overly conscious about it early iykwim some changes were whacked from pietro's faster load time branch
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using System;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Reflection;
|
|
|
|
namespace MiraAPI.GameOptions.Attributes;
|
|
|
|
/// <summary>
|
|
/// Represents an attribute that is used to define an <see cref="IModdedOption"/>.
|
|
/// </summary>
|
|
/// <param name="title">The option title.</param>
|
|
/// <param name="roleType">Optional parameter to specify a role Type.</param>
|
|
/// <param name="modeType">Optional parameter to specify a game mode Type.</param>
|
|
[AttributeUsage(AttributeTargets.Property)]
|
|
[SuppressMessage("Critical Code Smell", "S2223:Non-constant static fields should not be visible", Justification = "Internal behaviour that does not need property-level validation.")]
|
|
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Read above.")] // why so many warnings???
|
|
public abstract class ModdedOptionAttribute(string title, Type? roleType = null, Type? modeType = null) : PropertyOptionAttribute
|
|
{
|
|
internal IModdedOption? HolderOption;
|
|
internal Type ValueType;
|
|
|
|
/// <summary>
|
|
/// Gets the title of the option.
|
|
/// </summary>
|
|
public string Title => title;
|
|
|
|
/// <summary>
|
|
/// Gets the role type of the option.
|
|
/// </summary>
|
|
protected Type? RoleType { get; private set; } = roleType;
|
|
|
|
/// <summary>
|
|
/// Gets the game mode type of the option.
|
|
/// </summary>
|
|
protected Type? ModeType { get; private set; } = modeType;
|
|
|
|
internal abstract IModdedOption? CreateOption(object? value, PropertyInfo property);
|
|
}
|