mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
20 lines
530 B
C#
20 lines
530 B
C#
using System.Linq;
|
|
|
|
namespace MiraAPI.GameOptions;
|
|
|
|
/// <summary>
|
|
/// Singleton for option groups.
|
|
/// </summary>
|
|
/// <typeparam name="T">The option group type.</typeparam>
|
|
public static class OptionGroupSingleton<T> where T : AbstractOptionGroup
|
|
{
|
|
private static T? _instance;
|
|
|
|
/// <summary>
|
|
/// Gets the instance of the option group.
|
|
/// </summary>
|
|
#pragma warning disable CA1000
|
|
public static T Instance => _instance ??= ModdedOptionsManager.Groups.OfType<T>().Single();
|
|
#pragma warning restore CA1000
|
|
}
|