diff --git a/MiraAPI/MeetingAbilities/TargetedMeetingAbilityManager.cs b/MiraAPI/MeetingAbilities/TargetedMeetingButtonManager.cs
similarity index 94%
rename from MiraAPI/MeetingAbilities/TargetedMeetingAbilityManager.cs
rename to MiraAPI/MeetingAbilities/TargetedMeetingButtonManager.cs
index a07f632..9d6e4b3 100644
--- a/MiraAPI/MeetingAbilities/TargetedMeetingAbilityManager.cs
+++ b/MiraAPI/MeetingAbilities/TargetedMeetingButtonManager.cs
@@ -11,7 +11,7 @@ namespace MiraAPI.MeetingAbilities;
///
/// Class for managing all registered meeting abilities.
///
-public static class TargetedMeetingAbilityManager
+public static class TargetedMeetingButtonManager
{
///
/// Gets a list if==of all registered .
diff --git a/MiraAPI/MeetingAbilities/TargetedMeetingButtonSingleton.cs b/MiraAPI/MeetingAbilities/TargetedMeetingButtonSingleton.cs
new file mode 100644
index 0000000..eab3968
--- /dev/null
+++ b/MiraAPI/MeetingAbilities/TargetedMeetingButtonSingleton.cs
@@ -0,0 +1,19 @@
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+
+namespace MiraAPI.MeetingAbilities;
+
+///
+/// A utility class to get the instance of a .
+///
+/// The type of the button you are trying to access.
+public static class TargetedMeetingButtonSingleton where T : TargetedMeetingButton
+{
+ private static T? _instance;
+
+ ///
+ /// Gets the instance of the button.
+ ///
+ [SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "This is a utility class to get the instance of a targeted meeting button.")]
+ public static T Instance => _instance ??= TargetedMeetingButtonManager.Buttons.OfType().Single();
+}
diff --git a/MiraAPI/Patches/Events/FreeplayRoundStartPatch.cs b/MiraAPI/Patches/Events/FreeplayRoundStartPatch.cs
index f81332b..36d4b18 100644
--- a/MiraAPI/Patches/Events/FreeplayRoundStartPatch.cs
+++ b/MiraAPI/Patches/Events/FreeplayRoundStartPatch.cs
@@ -20,7 +20,7 @@ public static class FreeplayRoundStartPatch
{
if (!__result)
{
- foreach (var ability in TargetedMeetingAbilityManager.Buttons.Where(x => x.ButtonUsesMode == MeetingButtonUsesMode.PerGame))
+ foreach (var ability in TargetedMeetingButtonManager.Buttons.Where(x => x.ButtonUsesMode == MeetingButtonUsesMode.PerGame))
{
ability.UsesRemaining = ability.MaxUses;
}
diff --git a/MiraAPI/Patches/IntroCutscenePatches.cs b/MiraAPI/Patches/IntroCutscenePatches.cs
index c611728..e12de85 100644
--- a/MiraAPI/Patches/IntroCutscenePatches.cs
+++ b/MiraAPI/Patches/IntroCutscenePatches.cs
@@ -130,7 +130,7 @@ public static class IntroCutscenePatches
var @event = new BeforeRoundStartEvent(true);
MiraEventManager.InvokeEvent(@event);
- foreach (var ability in TargetedMeetingAbilityManager.Buttons.Where(x => x.ButtonUsesMode == MeetingButtonUsesMode.PerGame))
+ foreach (var ability in TargetedMeetingButtonManager.Buttons.Where(x => x.ButtonUsesMode == MeetingButtonUsesMode.PerGame))
{
ability.UsesRemaining = ability.MaxUses;
}
diff --git a/MiraAPI/Patches/Voting/MeetingHudPatches.cs b/MiraAPI/Patches/Voting/MeetingHudPatches.cs
index 64764e8..062e162 100644
--- a/MiraAPI/Patches/Voting/MeetingHudPatches.cs
+++ b/MiraAPI/Patches/Voting/MeetingHudPatches.cs
@@ -41,7 +41,7 @@ internal static class MeetingHudPatches
[HarmonyPatch(typeof(PlayerVoteArea), nameof(PlayerVoteArea.Start))]
public static void VoteAreaStartPostfix(PlayerVoteArea __instance)
{
- foreach (var targetedMeetingAbility in TargetedMeetingAbilityManager.Buttons)
+ foreach (var targetedMeetingAbility in TargetedMeetingButtonManager.Buttons)
{
var btn = targetedMeetingAbility.CreateButton(__instance);
btn.transform.SetParent(__instance.Buttons.transform);
@@ -106,7 +106,7 @@ internal static class MeetingHudPatches
}
}
- foreach (var ability in TargetedMeetingAbilityManager.Buttons.Where(x => x.ButtonUsesMode == MeetingButtonUsesMode.PerMeeting))
+ foreach (var ability in TargetedMeetingButtonManager.Buttons.Where(x => x.ButtonUsesMode == MeetingButtonUsesMode.PerMeeting))
{
ability.UsesRemaining = ability.MaxUses;
}
@@ -133,7 +133,7 @@ internal static class MeetingHudPatches
[HarmonyPatch(nameof(MeetingHud.Update))]
public static void ForceSkipPatch(MeetingHud __instance)
{
- foreach (var targetedMeetingAbility in TargetedMeetingAbilityManager.Buttons.Where(x => x.Enabled(PlayerControl.LocalPlayer.Data.Role)))
+ foreach (var targetedMeetingAbility in TargetedMeetingButtonManager.Buttons.Where(x => x.Enabled(PlayerControl.LocalPlayer.Data.Role)))
{
targetedMeetingAbility.UpdateHandler();
}
diff --git a/MiraAPI/PluginLoading/MiraPluginManager.cs b/MiraAPI/PluginLoading/MiraPluginManager.cs
index 13ec3e8..67d97e2 100644
--- a/MiraAPI/PluginLoading/MiraPluginManager.cs
+++ b/MiraAPI/PluginLoading/MiraPluginManager.cs
@@ -454,7 +454,7 @@ public sealed class MiraPluginManager
{
try
{
- return TargetedMeetingAbilityManager.RegisterMeetingAbility(type, info);
+ return TargetedMeetingButtonManager.RegisterMeetingAbility(type, info);
}
catch (Exception e)
{