From c1d0bb5d2610e56bf660e6cfd905a569dcd98ba3 Mon Sep 17 00:00:00 2001 From: amber Date: Thu, 11 Jun 2026 22:34:27 -0400 Subject: [PATCH 01/42] Seperate vanilla vent data receiving from the actual button --- MiraAPI.Example/Roles/NeutralKillerRole.cs | 3 ++- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 +- MiraAPI/Patches/VentCanUsePatch.cs | 2 +- MiraAPI/Roles/CustomRoleConfiguration.cs | 14 +++++++++++++- MiraAPI/Roles/CustomRoleManager.cs | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/MiraAPI.Example/Roles/NeutralKillerRole.cs b/MiraAPI.Example/Roles/NeutralKillerRole.cs index 1afa4eb..640e86c 100644 --- a/MiraAPI.Example/Roles/NeutralKillerRole.cs +++ b/MiraAPI.Example/Roles/NeutralKillerRole.cs @@ -18,7 +18,8 @@ public class NeutralKillerRole : ImpostorRole, ICustomRole { UseVanillaKillButton = true, CanGetKilled = true, - CanUseVent = true, + GetsVentData = true, + UseVanillaVentButton = true, }; public RoleOptionsGroup RoleOptionsGroup { get; } = new("Outcast", Color.gray); diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index 348f739..6d274f9 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -34,7 +34,7 @@ public static class HudManagerPatches if (role is ICustomRole customRole) { __instance.KillButton.ToggleVisible(isActive && customRole.Configuration.UseVanillaKillButton && !flag); - __instance.ImpostorVentButton.ToggleVisible(isActive && customRole.Configuration.CanUseVent && !flag); + __instance.ImpostorVentButton.ToggleVisible(isActive && (customRole.Configuration.CanUseVent || customRole.Configuration.UseVanillaVentButton) && !flag); __instance.SabotageButton.gameObject.SetActive(isActive && customRole.Configuration.CanUseSabotage); } diff --git a/MiraAPI/Patches/VentCanUsePatch.cs b/MiraAPI/Patches/VentCanUsePatch.cs index b285411..b2bea09 100644 --- a/MiraAPI/Patches/VentCanUsePatch.cs +++ b/MiraAPI/Patches/VentCanUsePatch.cs @@ -28,7 +28,7 @@ internal static class VentCanUsePatch var @object = pc.Object; var role = @object.Data.Role; - var canVent = role is ICustomRole customRole ? customRole.Configuration.CanUseVent : role.CanVent; + var canVent = role is ICustomRole customRole ? customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData || customRole.Configuration.UseVanillaVentButton : role.CanVent; couldUse = canVent; var modifiers = @object.GetModifierComponent().ActiveModifiers; diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index a11ddc0..9c58103 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -39,7 +39,8 @@ public record struct CustomRoleConfiguration GhostRole = role.Team is ModdedRoleTeams.Impostor ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost; CanGetKilled = roleBehaviour?.IsDead == false && role.Team is not ModdedRoleTeams.Impostor; UseVanillaKillButton = role.Team is ModdedRoleTeams.Impostor; - CanUseVent = role.Team is ModdedRoleTeams.Impostor; + GetsVentData = role.Team is ModdedRoleTeams.Impostor; + UseVanillaVentButton = role.Team is ModdedRoleTeams.Impostor; CanUseSabotage = role.Team is ModdedRoleTeams.Impostor; TasksCountForProgress = role.Team is ModdedRoleTeams.Crewmate; HideSettings = roleBehaviour?.IsDead == true; @@ -111,8 +112,19 @@ public record struct CustomRoleConfiguration /// /// Gets or sets a value indicating whether the role can use vents. /// + [Obsolete("The equivalent of having both GetsVentData and UseVanillaVentButton as true. Only remains for compatability.")] public bool CanUseVent { get; set; } + /// + /// Gets or sets a value indicating whether the role can receive vanilla vent data. + /// + public bool GetsVentData { get; set; } + + /// + /// Gets or sets a value indicating whether the role can use the vanilla vent button. + /// + public bool UseVanillaVentButton { get; set; } + /// /// Gets or sets a value indicating whether the role can use the sabotage button. /// diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index 0bbf4eb..458654f 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -139,7 +139,7 @@ public static class CustomRoleManager roleBehaviour.CanBeKilled = customRole.Configuration.CanGetKilled; roleBehaviour.CanUseKillButton = customRole.Configuration.UseVanillaKillButton; roleBehaviour.TasksCountTowardProgress = customRole.Configuration.TasksCountForProgress; - roleBehaviour.CanVent = customRole.Configuration.CanUseVent; + roleBehaviour.CanVent = customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData || customRole.Configuration.UseVanillaVentButton; roleBehaviour.DefaultGhostRole = customRole.Configuration.GhostRole; roleBehaviour.MaxCount = customRole.Configuration.MaxRoleCount; roleBehaviour.RoleScreenshot = customRole.Configuration.OptionsScreenshot?.LoadAsset(); From 90921ff786cd12df239dd008a550ac21eae86d7e Mon Sep 17 00:00:00 2001 From: amber Date: Thu, 11 Jun 2026 22:37:10 -0400 Subject: [PATCH 02/42] Remove UseVanillaVentButton as it's unnecessary --- MiraAPI.Example/Roles/NeutralKillerRole.cs | 3 +-- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 +- MiraAPI/Patches/VentCanUsePatch.cs | 2 +- MiraAPI/Roles/CustomRoleConfiguration.cs | 11 ++--------- MiraAPI/Roles/CustomRoleManager.cs | 2 +- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/MiraAPI.Example/Roles/NeutralKillerRole.cs b/MiraAPI.Example/Roles/NeutralKillerRole.cs index 640e86c..1afa4eb 100644 --- a/MiraAPI.Example/Roles/NeutralKillerRole.cs +++ b/MiraAPI.Example/Roles/NeutralKillerRole.cs @@ -18,8 +18,7 @@ public class NeutralKillerRole : ImpostorRole, ICustomRole { UseVanillaKillButton = true, CanGetKilled = true, - GetsVentData = true, - UseVanillaVentButton = true, + CanUseVent = true, }; public RoleOptionsGroup RoleOptionsGroup { get; } = new("Outcast", Color.gray); diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index 6d274f9..d8ac9e1 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -34,7 +34,7 @@ public static class HudManagerPatches if (role is ICustomRole customRole) { __instance.KillButton.ToggleVisible(isActive && customRole.Configuration.UseVanillaKillButton && !flag); - __instance.ImpostorVentButton.ToggleVisible(isActive && (customRole.Configuration.CanUseVent || customRole.Configuration.UseVanillaVentButton) && !flag); + __instance.ImpostorVentButton.ToggleVisible(isActive && (customRole.Configuration.CanUseVent) && !flag); __instance.SabotageButton.gameObject.SetActive(isActive && customRole.Configuration.CanUseSabotage); } diff --git a/MiraAPI/Patches/VentCanUsePatch.cs b/MiraAPI/Patches/VentCanUsePatch.cs index b2bea09..ff584b7 100644 --- a/MiraAPI/Patches/VentCanUsePatch.cs +++ b/MiraAPI/Patches/VentCanUsePatch.cs @@ -28,7 +28,7 @@ internal static class VentCanUsePatch var @object = pc.Object; var role = @object.Data.Role; - var canVent = role is ICustomRole customRole ? customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData || customRole.Configuration.UseVanillaVentButton : role.CanVent; + var canVent = role is ICustomRole customRole ? customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData : role.CanVent; couldUse = canVent; var modifiers = @object.GetModifierComponent().ActiveModifiers; diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index 9c58103..d597fa8 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -39,8 +39,7 @@ public record struct CustomRoleConfiguration GhostRole = role.Team is ModdedRoleTeams.Impostor ? RoleTypes.ImpostorGhost : RoleTypes.CrewmateGhost; CanGetKilled = roleBehaviour?.IsDead == false && role.Team is not ModdedRoleTeams.Impostor; UseVanillaKillButton = role.Team is ModdedRoleTeams.Impostor; - GetsVentData = role.Team is ModdedRoleTeams.Impostor; - UseVanillaVentButton = role.Team is ModdedRoleTeams.Impostor; + CanUseVent = role.Team is ModdedRoleTeams.Impostor; CanUseSabotage = role.Team is ModdedRoleTeams.Impostor; TasksCountForProgress = role.Team is ModdedRoleTeams.Crewmate; HideSettings = roleBehaviour?.IsDead == true; @@ -110,9 +109,8 @@ public record struct CustomRoleConfiguration public bool UseVanillaKillButton { get; set; } /// - /// Gets or sets a value indicating whether the role can use vents. + /// Gets or sets a value indicating whether the role can use vents. Also sends vanilla vent data. /// - [Obsolete("The equivalent of having both GetsVentData and UseVanillaVentButton as true. Only remains for compatability.")] public bool CanUseVent { get; set; } /// @@ -120,11 +118,6 @@ public record struct CustomRoleConfiguration /// public bool GetsVentData { get; set; } - /// - /// Gets or sets a value indicating whether the role can use the vanilla vent button. - /// - public bool UseVanillaVentButton { get; set; } - /// /// Gets or sets a value indicating whether the role can use the sabotage button. /// diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index 458654f..f306c68 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -139,7 +139,7 @@ public static class CustomRoleManager roleBehaviour.CanBeKilled = customRole.Configuration.CanGetKilled; roleBehaviour.CanUseKillButton = customRole.Configuration.UseVanillaKillButton; roleBehaviour.TasksCountTowardProgress = customRole.Configuration.TasksCountForProgress; - roleBehaviour.CanVent = customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData || customRole.Configuration.UseVanillaVentButton; + roleBehaviour.CanVent = customRole.Configuration.CanUseVent || customRole.Configuration.GetsVentData; roleBehaviour.DefaultGhostRole = customRole.Configuration.GhostRole; roleBehaviour.MaxCount = customRole.Configuration.MaxRoleCount; roleBehaviour.RoleScreenshot = customRole.Configuration.OptionsScreenshot?.LoadAsset(); From e3b0eb68c0adcfb5933994e70118b0151d815f31 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Fri, 12 Jun 2026 18:03:13 -0500 Subject: [PATCH 03/42] Temporary measures for clearing up memory leaks --- .../ModifierDisplayComponent.cs | 5 ++- MiraAPI/Patches/Freeplay/TaskAdderPatches.cs | 2 +- MiraAPI/Patches/HudManagerPatches.cs | 2 +- MiraAPI/Patches/Menu/HatsTabPatches.cs | 6 +-- MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 4 +- MiraAPI/Patches/Menu/SkinsTabPatches.cs | 4 +- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 4 +- .../Patches/Options/GamePresetsTabPatches.cs | 2 +- .../Patches/Options/RoleSettingMenuPatches.cs | 44 ++++++++++++++----- MiraAPI/Patches/Roles/HudManagerPatches.cs | 7 ++- MiraAPI/Presets/PresetManager.cs | 3 +- MiraAPI/Presets/SavePresetPopup.cs | 2 +- MiraAPI/Utilities/Extensions.cs | 20 ++++++++- 13 files changed, 74 insertions(+), 31 deletions(-) diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs index 2982f67..e47d775 100644 --- a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs +++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs @@ -4,6 +4,7 @@ using System.Linq; using HarmonyLib; using Il2CppInterop.Runtime.Attributes; using MiraAPI.LocalSettings; +using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; using Reactor.Utilities.Attributes; using Reactor.Utilities.Extensions; @@ -137,7 +138,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) internal void DestroyComponent(ModifierUiComponent component) { _modifiers.Remove(component.Modifier!); - component.gameObject.DestroyImmediate(); + component.gameObject.FakeDestroy(); RefreshModifiers(); } @@ -207,7 +208,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) continue; } - mod.Value.gameObject.Destroy(); + mod.Value.gameObject.FakeDestroy(); _modifiers.Remove(mod.Key); } diff --git a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs index 5bee1ae..ea13199 100644 --- a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs +++ b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs @@ -276,7 +276,7 @@ public static class TaskAdderPatches __instance.transform.FindChild("TitleText_TMP")?.gameObject.DestroyImmediate(); } - __instance.ActiveItems.ToArray().Do(x => x.gameObject.Destroy()); + __instance.ActiveItems.ToArray().Do(x => x.gameObject.FakeDestroy()); __instance.ActiveItems.Clear(); float num = 0f; diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index de8593b..7af625e 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -143,7 +143,7 @@ public static class HudManagerPatches foreach (var t in BottomLeft.GetComponentsInChildren(true)) { - t.gameObject.Destroy(); + t.gameObject.FakeDestroy(); } var gridArrange = BottomLeft.GetComponent(); diff --git a/MiraAPI/Patches/Menu/HatsTabPatches.cs b/MiraAPI/Patches/Menu/HatsTabPatches.cs index 5f07cfd..98bbc92 100644 --- a/MiraAPI/Patches/Menu/HatsTabPatches.cs +++ b/MiraAPI/Patches/Menu/HatsTabPatches.cs @@ -11,8 +11,6 @@ using Reactor.Utilities; using Reactor.Utilities.Extensions; using TMPro; using UnityEngine; -using UnityEngine.Events; -using UnityEngine.UI; using Object = UnityEngine.Object; namespace MiraAPI.Patches.Menu; @@ -94,9 +92,9 @@ public static class HatsTabPatches if (loadRoutine != null) Coroutines.Stop(loadRoutine); hatIndex = 0; - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.Destroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index 1526cce..6fd1031 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -81,9 +81,9 @@ public static class NameplatesTabPatches private static void GenerateHats(NameplatesTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); + foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.Destroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/SkinsTabPatches.cs b/MiraAPI/Patches/Menu/SkinsTabPatches.cs index 8e99bf2..bc8e64e 100644 --- a/MiraAPI/Patches/Menu/SkinsTabPatches.cs +++ b/MiraAPI/Patches/Menu/SkinsTabPatches.cs @@ -83,9 +83,9 @@ public static class SkinsTabPatches private static void GenerateHats(SkinsTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); + foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.Destroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index c543a94..f3a8d93 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -81,9 +81,9 @@ public static class VisorsTabPatches private static void GenerateHats(VisorsTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); + foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.Destroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs index 2c6cc68..bae9b8b 100644 --- a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs +++ b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs @@ -262,7 +262,7 @@ internal static class GamePresetsTabPatches iconSpriteRend.sprite = MiraAssets.RefreshIcon.LoadAsset(); Helpers.DivideSize(refreshButton.gameObject, 2f); - refreshButton.buttonText.gameObject.Destroy(); + refreshButton.buttonText.gameObject.FakeDestroy(); refreshButton.OnClick = new Button.ButtonClickedEvent(); refreshButton.OnClick.AddListener((UnityAction)Refresh); diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 62560a8..6e28cd9 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -53,9 +53,23 @@ public static class RoleSettingMenuPatches [HarmonyPatch(nameof(RolesSettingsMenu.SetQuotaTab))] public static bool SetQuotaTabPatch(RolesSettingsMenu __instance) { - Headers.ForEach(Object.Destroy); - RoleOptionSettings.ForEach(Object.Destroy); + foreach (var obj in Headers) + { + if (!obj) + { + continue; + } + obj.FakeDestroy(); + } Headers.Clear(); + foreach (var obj in RoleOptionSettings) + { + if (!obj) + { + continue; + } + obj.gameObject.FakeDestroy(); + } RoleOptionSettings.Clear(); CurrentRole = null; CurrentRoleOptions = null; @@ -204,9 +218,9 @@ public static class RoleSettingMenuPatches var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; var countLabel = quotaInst.transform.FindChild("# Label").gameObject; - blankLabel.Destroy(); - chanceLabel.Destroy(); - countLabel.Destroy(); + blankLabel.FakeDestroy(); + chanceLabel.FakeDestroy(); + countLabel.FakeDestroy(); categoryHeaderMasked.Background.sprite = MiraAssets.CategoryHeader.LoadAsset(); categoryHeaderMasked.Background.sprite.texture.filterMode = FilterMode.Bilinear; @@ -289,14 +303,22 @@ public static class RoleSettingMenuPatches { RoleGroupHidden[group] = !groupHidden; } - foreach (var header in Headers) + foreach (var obj in Headers) { - header.Destroy(); + if (!obj) + { + continue; + } + obj.FakeDestroy(); } Headers.Clear(); - foreach (var option in RoleOptionSettings) + foreach (var obj in RoleOptionSettings) { - option.gameObject.Destroy(); + if (!obj) + { + continue; + } + obj.gameObject.FakeDestroy(); } RoleOptionSettings.Clear(); __instance.SetQuotaTab(); @@ -422,7 +444,7 @@ public static class RoleSettingMenuPatches { foreach (var optBehaviour in __instance.AdvancedRolesSettings.GetComponentsInChildren()) { - optBehaviour.gameObject.DestroyImmediate(); + optBehaviour.gameObject.FakeDestroy(); } CurrentRole = role; @@ -618,7 +640,7 @@ public static class RoleSettingMenuPatches var newButton = Object.Instantiate(roleOptionSetting.buttons[0], roleOptionSetting.transform); newButton.name = "ConfigButton"; newButton.transform.localPosition = new Vector3(0.4473f, -0.3f, -2f); - newButton.transform.FindChild("Text_TMP").gameObject.DestroyImmediate(); + newButton.transform.FindChild("Text_TMP").gameObject.FakeDestroy(); newButton.activeSprites.Destroy(); var btnRend = newButton.transform.FindChild("ButtonSprite").GetComponent(); diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index d8ac9e1..cc46c13 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -1,7 +1,9 @@ using HarmonyLib; using InnerNet; using MiraAPI.Roles; +using MiraAPI.Utilities; using Reactor.Utilities.Extensions; +using UnityEngine; namespace MiraAPI.Patches.Roles; @@ -69,9 +71,10 @@ public static class HudManagerPatches CustomRoleManager.UpdateRoleTab(RoleTab, customRole); } - else if (RoleTab) + else if (RoleTab != null) { - RoleTab?.gameObject.Destroy(); + RoleTab.gameObject.FakeDestroy(); + RoleTab = null; } } } diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index ba4289f..2ef0c55 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -4,6 +4,7 @@ using System.Linq; using BepInEx.Configuration; using MiraAPI.PluginLoading; using MiraAPI.Roles; +using MiraAPI.Utilities; using Reactor.Utilities; using UnityEngine; @@ -61,7 +62,7 @@ public static class PresetManager { if (btn != null) { - Object.DestroyImmediate(btn); + btn.FakeDestroy(); } } diff --git a/MiraAPI/Presets/SavePresetPopup.cs b/MiraAPI/Presets/SavePresetPopup.cs index 87959e7..721f46c 100644 --- a/MiraAPI/Presets/SavePresetPopup.cs +++ b/MiraAPI/Presets/SavePresetPopup.cs @@ -26,7 +26,7 @@ public class SavePresetPopup(nint cppPtr) : Minigame(cppPtr) // Cleanup holder object public void OnDestroy() { - transform.parent.gameObject.Destroy(); + transform.parent.gameObject.FakeDestroy(); } public override void Close() diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 8c4acc7..b594598 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -53,7 +53,7 @@ public static class Extensions bool isComplete; if (self.amClosing == Minigame.CloseState.Closing) { - UnityEngine.Object.Destroy(self.gameObject); + self.gameObject.FakeDestroy(); return; } if (self.CloseSound && Constants.ShouldPlaySfx()) @@ -219,6 +219,24 @@ public static class Extensions return Mathf.Approximately(number, Mathf.Round(number)); } + /// + /// Hides the object away rather than destroy it to prevent memory leaks. + /// + /// The object to hide. + public static void FakeDestroy(this GameObject obj) + { + obj.hideFlags = HideFlags.HideAndDontSave; + if (!toDestroyHolder) + { + toDestroyHolder = new GameObject("ToDestroyHolder"); + toDestroyHolder.gameObject.SetActive(false); + } + obj.transform.SetParent(toDestroyHolder.transform); + obj.SetActive(false); + } + + private static GameObject toDestroyHolder; + /// /// Gets a cache of player's vote data components to improve performance. /// From c846109d077e44a736ac1d5a8aea756c93c57144 Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Fri, 19 Jun 2026 17:07:31 -0600 Subject: [PATCH 04/42] Changed to use obsolete annotation --- MiraAPI/GameOptions/AbstractOptionGroup.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index 51e18bd..aee77d3 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -29,9 +29,12 @@ public abstract class AbstractOptionGroup public virtual Type? OptionableType => null; /// - /// Gets a value indicating whether the group should be shown in the modifiers menu. This is deprecated, please use ParentMenu! + /// Gets a value indicating whether the group should be shown in the modifiers menu. /// // TODO: make this not a boolean +#pragma warning disable S1133 + [Obsolete("Use ParentMenu instead.")] +#pragma warning restore S1133 public virtual bool ShowInModifiersMenu => false; /// From 3a5a3978469735a881c3e88aabb595a4c9cccb59 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 20 Jun 2026 14:28:08 -0500 Subject: [PATCH 05/42] Only run gc when using v17.4 --- .../ModifierDisplayComponent.cs | 4 +- MiraAPI/Patches/Freeplay/TaskAdderPatches.cs | 2 +- MiraAPI/Patches/HudManagerPatches.cs | 2 +- MiraAPI/Patches/Menu/HatsTabPatches.cs | 4 +- .../Patches/Menu/MainMenuManagerPatches.cs | 8 +- MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 4 +- MiraAPI/Patches/Menu/SkinsTabPatches.cs | 4 +- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 4 +- .../Patches/Options/GamePresetsTabPatches.cs | 2 +- .../Patches/Options/RoleSettingMenuPatches.cs | 18 +-- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 +- MiraAPI/Presets/PresetManager.cs | 2 +- MiraAPI/Presets/SavePresetPopup.cs | 2 +- MiraAPI/Utilities/Extensions.cs | 131 ++++++++++++++++-- 14 files changed, 154 insertions(+), 35 deletions(-) diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs index e47d775..18bd476 100644 --- a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs +++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs @@ -138,7 +138,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) internal void DestroyComponent(ModifierUiComponent component) { _modifiers.Remove(component.Modifier!); - component.gameObject.FakeDestroy(); + component.gameObject.DeepDestroy(); RefreshModifiers(); } @@ -208,7 +208,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) continue; } - mod.Value.gameObject.FakeDestroy(); + mod.Value.gameObject.DeepDestroy(); _modifiers.Remove(mod.Key); } diff --git a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs index ea13199..22cea2d 100644 --- a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs +++ b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs @@ -276,7 +276,7 @@ public static class TaskAdderPatches __instance.transform.FindChild("TitleText_TMP")?.gameObject.DestroyImmediate(); } - __instance.ActiveItems.ToArray().Do(x => x.gameObject.FakeDestroy()); + __instance.ActiveItems.ToArray().Do(x => x.gameObject.DeepDestroy()); __instance.ActiveItems.Clear(); float num = 0f; diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index 7af625e..1f19b5a 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -143,7 +143,7 @@ public static class HudManagerPatches foreach (var t in BottomLeft.GetComponentsInChildren(true)) { - t.gameObject.FakeDestroy(); + t.gameObject.DeepDestroy(); } var gridArrange = BottomLeft.GetComponent(); diff --git a/MiraAPI/Patches/Menu/HatsTabPatches.cs b/MiraAPI/Patches/Menu/HatsTabPatches.cs index 98bbc92..c6ad646 100644 --- a/MiraAPI/Patches/Menu/HatsTabPatches.cs +++ b/MiraAPI/Patches/Menu/HatsTabPatches.cs @@ -92,9 +92,9 @@ public static class HatsTabPatches if (loadRoutine != null) Coroutines.Stop(loadRoutine); hatIndex = 0; - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs b/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs index b2377fe..edc7e9b 100644 --- a/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs +++ b/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using HarmonyLib; using MiraAPI.LocalSettings; using MiraAPI.Utilities.Assets; @@ -13,6 +14,8 @@ namespace MiraAPI.Patches.Menu; [HarmonyPatch(typeof(MainMenuManager))] public static class MainMenuManagerPatches { + internal static bool NeedsDeepDestroy { get; private set; } + /// /// A postifix on Awake to load all the addressables registered. /// @@ -20,6 +23,9 @@ public static class MainMenuManagerPatches [HarmonyPostfix] public static void AwakePostfix() { + var requiredVersion = new Version(2026, 6, 5); + var version = Version.Parse(Application.version); + NeedsDeepDestroy = version >= requiredVersion; AddressablesLoader.LoadAll(); Coroutines.Start(SetFps()); } diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index 6fd1031..e8d15a8 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -81,9 +81,9 @@ public static class NameplatesTabPatches private static void GenerateHats(NameplatesTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); + foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/SkinsTabPatches.cs b/MiraAPI/Patches/Menu/SkinsTabPatches.cs index bc8e64e..64b0b54 100644 --- a/MiraAPI/Patches/Menu/SkinsTabPatches.cs +++ b/MiraAPI/Patches/Menu/SkinsTabPatches.cs @@ -83,9 +83,9 @@ public static class SkinsTabPatches private static void GenerateHats(SkinsTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); + foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index f3a8d93..385fe97 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -81,9 +81,9 @@ public static class VisorsTabPatches private static void GenerateHats(VisorsTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.FakeDestroy(); + foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.FakeDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs index bae9b8b..a4b6cca 100644 --- a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs +++ b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs @@ -262,7 +262,7 @@ internal static class GamePresetsTabPatches iconSpriteRend.sprite = MiraAssets.RefreshIcon.LoadAsset(); Helpers.DivideSize(refreshButton.gameObject, 2f); - refreshButton.buttonText.gameObject.FakeDestroy(); + refreshButton.buttonText.gameObject.DeepDestroy(); refreshButton.OnClick = new Button.ButtonClickedEvent(); refreshButton.OnClick.AddListener((UnityAction)Refresh); diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 6e28cd9..1d17d70 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -59,7 +59,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.FakeDestroy(); + obj.DeepDestroy(); } Headers.Clear(); foreach (var obj in RoleOptionSettings) @@ -68,7 +68,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.gameObject.FakeDestroy(); + obj.gameObject.DeepDestroy(); } RoleOptionSettings.Clear(); CurrentRole = null; @@ -218,9 +218,9 @@ public static class RoleSettingMenuPatches var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; var countLabel = quotaInst.transform.FindChild("# Label").gameObject; - blankLabel.FakeDestroy(); - chanceLabel.FakeDestroy(); - countLabel.FakeDestroy(); + blankLabel.DeepDestroy(); + chanceLabel.DeepDestroy(); + countLabel.DeepDestroy(); categoryHeaderMasked.Background.sprite = MiraAssets.CategoryHeader.LoadAsset(); categoryHeaderMasked.Background.sprite.texture.filterMode = FilterMode.Bilinear; @@ -309,7 +309,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.FakeDestroy(); + obj.DeepDestroy(); } Headers.Clear(); foreach (var obj in RoleOptionSettings) @@ -318,7 +318,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.gameObject.FakeDestroy(); + obj.gameObject.DeepDestroy(); } RoleOptionSettings.Clear(); __instance.SetQuotaTab(); @@ -444,7 +444,7 @@ public static class RoleSettingMenuPatches { foreach (var optBehaviour in __instance.AdvancedRolesSettings.GetComponentsInChildren()) { - optBehaviour.gameObject.FakeDestroy(); + optBehaviour.gameObject.DeepDestroy(); } CurrentRole = role; @@ -640,7 +640,7 @@ public static class RoleSettingMenuPatches var newButton = Object.Instantiate(roleOptionSetting.buttons[0], roleOptionSetting.transform); newButton.name = "ConfigButton"; newButton.transform.localPosition = new Vector3(0.4473f, -0.3f, -2f); - newButton.transform.FindChild("Text_TMP").gameObject.FakeDestroy(); + newButton.transform.FindChild("Text_TMP").gameObject.DeepDestroy(); newButton.activeSprites.Destroy(); var btnRend = newButton.transform.FindChild("ButtonSprite").GetComponent(); diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index cc46c13..d5d23dc 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -73,7 +73,7 @@ public static class HudManagerPatches } else if (RoleTab != null) { - RoleTab.gameObject.FakeDestroy(); + RoleTab.gameObject.DeepDestroy(); RoleTab = null; } } diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index 2ef0c55..07f00cd 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -62,7 +62,7 @@ public static class PresetManager { if (btn != null) { - btn.FakeDestroy(); + btn.DeepDestroy(); } } diff --git a/MiraAPI/Presets/SavePresetPopup.cs b/MiraAPI/Presets/SavePresetPopup.cs index 721f46c..23ce48b 100644 --- a/MiraAPI/Presets/SavePresetPopup.cs +++ b/MiraAPI/Presets/SavePresetPopup.cs @@ -26,7 +26,7 @@ public class SavePresetPopup(nint cppPtr) : Minigame(cppPtr) // Cleanup holder object public void OnDestroy() { - transform.parent.gameObject.FakeDestroy(); + transform.parent.gameObject.DeepDestroy(); } public override void Close() diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index b594598..ffc8e72 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -7,9 +8,11 @@ using System.Text.RegularExpressions; using HarmonyLib; using MiraAPI.GameOptions; using MiraAPI.Networking; +using MiraAPI.Patches.Menu; using MiraAPI.Roles; using MiraAPI.Voting; using Reactor.Utilities; +using Reactor.Utilities.Extensions; using Rewired; using Rewired.Data; using TMPro; @@ -53,7 +56,7 @@ public static class Extensions bool isComplete; if (self.amClosing == Minigame.CloseState.Closing) { - self.gameObject.FakeDestroy(); + self.gameObject.DeepDestroy(); return; } if (self.CloseSound && Constants.ShouldPlaySfx()) @@ -223,19 +226,129 @@ public static class Extensions /// Hides the object away rather than destroy it to prevent memory leaks. /// /// The object to hide. - public static void FakeDestroy(this GameObject obj) + public static void DeepDestroy(this GameObject obj, bool clearGc = true) { - obj.hideFlags = HideFlags.HideAndDontSave; - if (!toDestroyHolder) + if (MainMenuManagerPatches.NeedsDeepDestroy) { - toDestroyHolder = new GameObject("ToDestroyHolder"); - toDestroyHolder.gameObject.SetActive(false); + Coroutines.Start(Nuke(obj, clearGc)); + } + else + { + obj?.Destroy(); } - obj.transform.SetParent(toDestroyHolder.transform); - obj.SetActive(false); } - private static GameObject toDestroyHolder; + private static IEnumerator Nuke(GameObject? go, bool clearGc) + { + if (go == null) + yield break; + + try + { + go.transform.SetParent(null, false); + } + catch + { + // ignored + } + + try + { + go.SetActive(false); + } + catch + { + // ignored + } + + foreach (var mb in go.GetComponentsInChildren(true)) + { + if (mb == null) + continue; + + try + { + mb.StopAllCoroutines(); + } + catch + { + // ignored + } + + try + { + mb.enabled = false; + } + catch + { + // ignored + } + } + + foreach (var renderer in go.GetComponentsInChildren(true)) + { + if (renderer == null) + continue; + + try + { + foreach (var mat in renderer.materials) + { + if (mat != null) + UnityEngine.Object.Destroy(mat); + } + } + catch + { + // ignored + } + } + + foreach (var filter in go.GetComponentsInChildren(true)) + { + if (filter == null) + continue; + + try + { + var mesh = filter.mesh; + if (mesh != null) + UnityEngine.Object.Destroy(mesh); + } + catch + { + // ignored + } + } + + UnityEngine.Object.Destroy(go); + yield return null; + if (clearGc) + { + yield return CoFreeResources(); + } + } + + /// + /// Clears up the Garbage Collector manually if necessary. + /// + public static void ClearGarbageCollector() + { + if (!MainMenuManagerPatches.NeedsDeepDestroy) + { + return; + } + Coroutines.Start(CoFreeResources()); + } + + private static IEnumerator CoFreeResources() + { + yield return Resources.UnloadUnusedAssets(); + + GC.Collect(0, GCCollectionMode.Forced, blocking: true); + GC.WaitForPendingFinalizers(); + GC.Collect(0, GCCollectionMode.Forced, blocking: true); + } /// /// Gets a cache of player's vote data components to improve performance. From 750e00d06d46061bcb19c07dd1a3c4a46c7793e8 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 20 Jun 2026 14:53:45 -0500 Subject: [PATCH 06/42] Run GC when destroying multiple objects --- MiraAPI/Patches/Freeplay/TaskAdderPatches.cs | 3 ++- MiraAPI/Patches/HudManagerPatches.cs | 3 ++- MiraAPI/Patches/Menu/HatsTabPatches.cs | 5 +++-- MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 5 +++-- MiraAPI/Patches/Menu/SkinsTabPatches.cs | 5 +++-- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 5 +++-- .../Patches/Options/RoleSettingMenuPatches.cs | 19 +++++++++++-------- MiraAPI/Utilities/Extensions.cs | 5 +++-- 8 files changed, 30 insertions(+), 20 deletions(-) diff --git a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs index 22cea2d..f1612d9 100644 --- a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs +++ b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs @@ -276,8 +276,9 @@ public static class TaskAdderPatches __instance.transform.FindChild("TitleText_TMP")?.gameObject.DestroyImmediate(); } - __instance.ActiveItems.ToArray().Do(x => x.gameObject.DeepDestroy()); + __instance.ActiveItems.ToArray().Do(x => x.gameObject.DeepDestroy(false)); __instance.ActiveItems.Clear(); + Utilities.Extensions.ClearGarbageCollector(); float num = 0f; float num2 = 0f; diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index 1f19b5a..e3a6b91 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -143,8 +143,9 @@ public static class HudManagerPatches foreach (var t in BottomLeft.GetComponentsInChildren(true)) { - t.gameObject.DeepDestroy(); + t.gameObject.DeepDestroy(false); } + Utilities.Extensions.ClearGarbageCollector(); var gridArrange = BottomLeft.GetComponent(); var aspectPosition = BottomLeft.GetComponent(); diff --git a/MiraAPI/Patches/Menu/HatsTabPatches.cs b/MiraAPI/Patches/Menu/HatsTabPatches.cs index c6ad646..25eca33 100644 --- a/MiraAPI/Patches/Menu/HatsTabPatches.cs +++ b/MiraAPI/Patches/Menu/HatsTabPatches.cs @@ -92,9 +92,10 @@ public static class HatsTabPatches if (loadRoutine != null) Coroutines.Stop(loadRoutine); hatIndex = 0; - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); + Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index e8d15a8..0875cb2 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -81,9 +81,10 @@ public static class NameplatesTabPatches private static void GenerateHats(NameplatesTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); + Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/SkinsTabPatches.cs b/MiraAPI/Patches/Menu/SkinsTabPatches.cs index 64b0b54..24bec7c 100644 --- a/MiraAPI/Patches/Menu/SkinsTabPatches.cs +++ b/MiraAPI/Patches/Menu/SkinsTabPatches.cs @@ -83,9 +83,10 @@ public static class SkinsTabPatches private static void GenerateHats(SkinsTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); + Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index 385fe97..86bfa24 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -81,9 +81,10 @@ public static class VisorsTabPatches private static void GenerateHats(VisorsTab __instance, int page) { - foreach (ColorChip instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); - __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy()); + __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); + Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 1d17d70..082cc9c 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -59,7 +59,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.DeepDestroy(); + obj.DeepDestroy(false); } Headers.Clear(); foreach (var obj in RoleOptionSettings) @@ -68,7 +68,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.gameObject.DeepDestroy(); + obj.gameObject.DeepDestroy(false); } RoleOptionSettings.Clear(); CurrentRole = null; @@ -76,6 +76,7 @@ public static class RoleSettingMenuPatches __instance.roleChances = new Il2CppSystem.Collections.Generic.List(); __instance.advancedSettingChildren = new Il2CppSystem.Collections.Generic.List(); + Utilities.Extensions.ClearGarbageCollector(); var maskBg = __instance.scrollBar.transform.FindChild("MaskBg"); var hitbox = __instance.scrollBar.transform.FindChild("Hitbox"); @@ -218,9 +219,9 @@ public static class RoleSettingMenuPatches var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; var countLabel = quotaInst.transform.FindChild("# Label").gameObject; - blankLabel.DeepDestroy(); - chanceLabel.DeepDestroy(); - countLabel.DeepDestroy(); + blankLabel.DeepDestroy(false); + chanceLabel.DeepDestroy(false); + countLabel.DeepDestroy(false); categoryHeaderMasked.Background.sprite = MiraAssets.CategoryHeader.LoadAsset(); categoryHeaderMasked.Background.sprite.texture.filterMode = FilterMode.Bilinear; @@ -309,7 +310,7 @@ public static class RoleSettingMenuPatches { continue; } - obj.DeepDestroy(); + obj.DeepDestroy(false); } Headers.Clear(); foreach (var obj in RoleOptionSettings) @@ -318,9 +319,10 @@ public static class RoleSettingMenuPatches { continue; } - obj.gameObject.DeepDestroy(); + obj.gameObject.DeepDestroy(false); } RoleOptionSettings.Clear(); + Utilities.Extensions.ClearGarbageCollector(); __instance.SetQuotaTab(); })); headerBtn.SetButtonEnableState(true); @@ -444,11 +446,12 @@ public static class RoleSettingMenuPatches { foreach (var optBehaviour in __instance.AdvancedRolesSettings.GetComponentsInChildren()) { - optBehaviour.gameObject.DeepDestroy(); + optBehaviour.gameObject.DeepDestroy(false); } CurrentRole = role; __instance.advancedSettingChildren.Clear(); + Utilities.Extensions.ClearGarbageCollector(); // TODO: create sub groups under the role settings. var filteredOptions = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index ffc8e72..9c6faa7 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -223,9 +223,10 @@ public static class Extensions } /// - /// Hides the object away rather than destroy it to prevent memory leaks. + /// Destroys the object properly. /// - /// The object to hide. + /// The object to destroy. + /// Whether to run the garbage collector immediately. public static void DeepDestroy(this GameObject obj, bool clearGc = true) { if (MainMenuManagerPatches.NeedsDeepDestroy) From ff658db6f10c4ea713a41782ff503983714245fb Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 20 Jun 2026 15:08:22 -0500 Subject: [PATCH 07/42] Remove destroyable singletons --- MiraAPI/Hud/CustomPlayerMenu.cs | 2 +- MiraAPI/Patches/DetectiveNotesMinigamePatch.cs | 2 +- .../LocalSettings/ToggleBehaviourPatch.cs | 4 ++-- MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 2 +- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 2 +- MiraAPI/Utilities/Assets/AddressablesLoader.cs | 16 ++++++++-------- MiraAPI/Utilities/Extensions.cs | 2 +- MiraAPI/Voting/VotingUtils.cs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/MiraAPI/Hud/CustomPlayerMenu.cs b/MiraAPI/Hud/CustomPlayerMenu.cs index 56d9f0e..bbe63a9 100644 --- a/MiraAPI/Hud/CustomPlayerMenu.cs +++ b/MiraAPI/Hud/CustomPlayerMenu.cs @@ -96,7 +96,7 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr) onClick(null); })); - DestroyableSingleton.Instance.Analytics.MinigameOpened(PlayerControl.LocalPlayer.Data, TaskType); + DebugAnalytics.Instance.Analytics.MinigameOpened(PlayerControl.LocalPlayer.Data, TaskType); var list = PlayerControl.AllPlayerControls.ToArray().Where(playerMatch).ToList(); potentialVictims = []; var list2 = new Il2CppSystem.Collections.Generic.List(); diff --git a/MiraAPI/Patches/DetectiveNotesMinigamePatch.cs b/MiraAPI/Patches/DetectiveNotesMinigamePatch.cs index b0e37e7..a11ec7e 100644 --- a/MiraAPI/Patches/DetectiveNotesMinigamePatch.cs +++ b/MiraAPI/Patches/DetectiveNotesMinigamePatch.cs @@ -26,7 +26,7 @@ public static class DetectiveNotesMinigamePatch return; } __instance.impostorButton = new List(); - var allRoles = DestroyableSingleton.Instance.AllRoles; + var allRoles = RoleManager.Instance.AllRoles; var customRoles = CustomRoleManager.CustomRoleBehaviours; foreach (var role in allRoles) { diff --git a/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs b/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs index ffbfdea..06d308b 100644 --- a/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs +++ b/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs @@ -21,8 +21,8 @@ public static class ToggleBehaviourPatch // Used to mask the text __instance.Text.richText = true; __instance.Text.text = $"" + - $"{DestroyableSingleton.Instance.GetString(__instance.BaseText)}: " + - $"{DestroyableSingleton.Instance.GetString(__instance.onState ? StringNames.SettingsOn : StringNames.SettingsOff)}"; + $"{TranslationController.Instance.GetString(__instance.BaseText)}: " + + $"{TranslationController.Instance.GetString(__instance.onState ? StringNames.SettingsOn : StringNames.SettingsOff)}"; __instance.Text.sortingOrder = 151; __instance.Text.renderer.sortingLayerName = "Default"; __instance.Text.renderer.sortingOrder = 151; diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index 0875cb2..ca4b79d 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -51,7 +51,7 @@ public static class NameplatesTabPatches } __instance.plateId = HatManager.Instance.GetNamePlateById(DataManager.Player.Customization.namePlate).ProdId; - if (!SortedNameplates.ContainsKey("Vanilla")) AddRange(DestroyableSingleton.Instance.GetUnlockedNamePlates().Select(x => ("Vanilla", x))); + if (!SortedNameplates.ContainsKey("Vanilla")) AddRange(HatManager.Instance.GetUnlockedNamePlates().Select(x => ("Vanilla", x))); InventoryUtility.CreateNextBackButtons(__instance, PreviousPage, NextPage); diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index 86bfa24..8d50ece 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -51,7 +51,7 @@ public static class VisorsTabPatches } __instance.visorId = HatManager.Instance.GetVisorById(DataManager.Player.Customization.Visor).ProdId; - if (!SortedVisors.ContainsKey("Vanilla")) AddRange(DestroyableSingleton.Instance.GetUnlockedVisors().Select(x => ("Vanilla", x))); + if (!SortedVisors.ContainsKey("Vanilla")) AddRange(HatManager.Instance.GetUnlockedVisors().Select(x => ("Vanilla", x))); InventoryUtility.CreateNextBackButtons(__instance, PreviousPage, NextPage); diff --git a/MiraAPI/Utilities/Assets/AddressablesLoader.cs b/MiraAPI/Utilities/Assets/AddressablesLoader.cs index f1ecddd..a309ed3 100644 --- a/MiraAPI/Utilities/Assets/AddressablesLoader.cs +++ b/MiraAPI/Utilities/Assets/AddressablesLoader.cs @@ -171,24 +171,24 @@ public static class AddressablesLoader var visorBehaviours = DiscoverAndReportData(RegisteredVisorKeys); var hatData = new List(); - hatData.AddRange(DestroyableSingleton.Instance.allHats); + hatData.AddRange(HatManager.Instance.allHats); hatData.ForEach(x => x.StoreName = "Vanilla"); - DestroyableSingleton.Instance.allHats = PrepareArray(hatData, hatBehaviours); + HatManager.Instance.allHats = PrepareArray(hatData, hatBehaviours); var skinData = new List(); - skinData.AddRange(DestroyableSingleton.Instance.allSkins); + skinData.AddRange(HatManager.Instance.allSkins); skinData.ForEach(x => x.StoreName = "Vanilla"); - DestroyableSingleton.Instance.allSkins = PrepareArray(skinData, skinBehaviours); + HatManager.Instance.allSkins = PrepareArray(skinData, skinBehaviours); var visorData = new List(); - visorData.AddRange(DestroyableSingleton.Instance.allVisors); + visorData.AddRange(HatManager.Instance.allVisors); VisorsTabPatches.AddRange(visorBehaviours); - DestroyableSingleton.Instance.allVisors = PrepareArray(visorData, visorBehaviours.Select(x=>x.Data).ToList()); + HatManager.Instance.allVisors = PrepareArray(visorData, visorBehaviours.Select(x=>x.Data).ToList()); var namePlateData = new List(); - namePlateData.AddRange(DestroyableSingleton.Instance.allNamePlates); + namePlateData.AddRange(HatManager.Instance.allNamePlates); NameplatesTabPatches.AddRange(namePlateBehaviours); - DestroyableSingleton.Instance.allNamePlates = PrepareArray(namePlateData, namePlateBehaviours.Select(x => x.Data).ToList()); + HatManager.Instance.allNamePlates = PrepareArray(namePlateData, namePlateBehaviours.Select(x => x.Data).ToList()); } private static T[] PrepareArray(List data, List behaviours) where T : CosmeticData diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 9c6faa7..882a15c 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -73,7 +73,7 @@ public static class Extensions } self.amClosing = Minigame.CloseState.Closing; self.logger.Info(string.Concat("Closing minigame ", self.GetType().Name)); - IAnalyticsReporter analytics = DestroyableSingleton.Instance.Analytics; + IAnalyticsReporter analytics = DebugAnalytics.Instance.Analytics; NetworkedPlayerInfo data = PlayerControl.LocalPlayer.Data; TaskTypes taskType = self.TaskType; float realtimeSinceStartup = Time.realtimeSinceStartup - self.timeOpened; diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs index 0edd081..716b712 100644 --- a/MiraAPI/Voting/VotingUtils.cs +++ b/MiraAPI/Voting/VotingUtils.cs @@ -208,7 +208,7 @@ public static class VotingUtils } MeetingHud.Instance.TitleText.text = - DestroyableSingleton.Instance.GetString( + TranslationController.Instance.GetString( StringNames.MeetingVotingResults, Il2CppSystem.Array.Empty()); From adb9a2823de688e56057a291e6a751b8ef916b01 Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Tue, 23 Jun 2026 15:26:39 -0600 Subject: [PATCH 08/42] Updated docstrings to reference classes, fields, and methods directly --- MiraAPI/Colors/PaletteManager.cs | 4 +- .../Colors/RegisterCustomColorsAttribute.cs | 2 +- .../Events/Mira/MiraButtonCancelledEvent.cs | 14 +- MiraAPI/Events/Mira/MiraButtonClickEvent.cs | 18 +- MiraAPI/Events/MiraEventHandle.cs | 2 +- MiraAPI/Events/MiraEventManager.cs | 24 +- MiraAPI/Events/MiraEventWrapper.cs | 2 +- MiraAPI/Events/RegisterEventAttribute.cs | 2 +- .../Vanilla/Gameplay/AfterMurderEvent.cs | 10 +- .../Vanilla/Gameplay/BeforeGameEndEvent.cs | 2 +- .../Vanilla/Gameplay/BeforeMurderEvent.cs | 14 +- .../Vanilla/Gameplay/BeforeRoundStartEvent.cs | 5 +- .../Events/Vanilla/Gameplay/GameEndEvent.cs | 4 +- .../Vanilla/Gameplay/IntroBeginEvent.cs | 2 +- .../Events/Vanilla/Gameplay/IntroEndEvent.cs | 2 +- .../Vanilla/Gameplay/IntroRoleRevealEvent.cs | 2 +- .../Vanilla/Gameplay/RoundStartEvent.cs | 5 +- .../Events/Vanilla/Gameplay/SetRoleEvent.cs | 2 +- .../Gameplay/VanillaButtonCancelledEvent.cs | 14 +- .../Gameplay/VanillaButtonClickEvent.cs | 26 +- .../Vanilla/Map/PlayerOpenSabotageEvent.cs | 4 +- .../Events/Vanilla/Map/UpdateSystemEvent.cs | 10 +- .../Events/Vanilla/Meeting/EjectionEvent.cs | 4 +- .../Events/Vanilla/Meeting/EndMeetingEvent.cs | 2 +- .../Events/Vanilla/Meeting/ReportBodyEvent.cs | 6 +- .../Vanilla/Meeting/StartMeetingEvent.cs | 4 +- .../Vanilla/Meeting/Voting/AfterVoteEvent.cs | 4 +- .../Vanilla/Meeting/Voting/BeforeVoteEvent.cs | 4 +- .../Vanilla/Meeting/Voting/DummyVoteEvent.cs | 2 +- .../Vanilla/Meeting/Voting/HandleVoteEvent.cs | 8 +- .../Meeting/Voting/MeetingSelectEvent.cs | 6 +- .../Meeting/Voting/PopulateResultsEvent.cs | 6 +- .../Meeting/Voting/ProcessVotesEvent.cs | 4 +- .../Meeting/Voting/VotingCompleteEvent.cs | 4 +- .../Vanilla/Player/CompleteHnsTaskEvent.cs | 4 +- .../Events/Vanilla/Player/PlayerDeathEvent.cs | 4 +- .../Events/Vanilla/Usables/EnterVentEvent.cs | 8 +- .../Events/Vanilla/Usables/ExitVentEvent.cs | 8 +- .../Vanilla/Usables/PlayerCanUseEvent.cs | 2 +- .../Events/Vanilla/Usables/PlayerUseEvent.cs | 6 +- MiraAPI/GameEnd/CustomGameOver.cs | 24 +- MiraAPI/GameEnd/GameOverManager.cs | 28 +- MiraAPI/GameModes/CustomGameMode.cs | 32 +- MiraAPI/GameModes/CustomGameModeManager.cs | 14 +- MiraAPI/GameOptions/AbstractOptionGroup.cs | 4 +- .../Attributes/ModdedEnumOptionAttribute.cs | 2 +- .../Attributes/ModdedNumberOptionAttribute.cs | 2 +- .../Attributes/ModdedOptionAttribute.cs | 6 +- .../Attributes/ModdedToggleOptionAttribute.cs | 2 +- MiraAPI/GameOptions/IModdedOption.cs | 36 +-- .../GameOptions/MiraNumberOptionComponent.cs | 2 +- MiraAPI/GameOptions/ModdedOptionsManager.cs | 2 +- MiraAPI/GameOptions/OptionGroupSingleton.cs | 4 +- .../OptionTypes/ModdedEnumOption.cs | 16 +- .../OptionTypes/ModdedNumberOption.cs | 2 +- .../OptionTypes/ModdedPlayerOption.cs | 4 +- MiraAPI/Hud/ButtonLocation.cs | 2 +- MiraAPI/Hud/ButtonUsesMode.cs | 2 +- MiraAPI/Hud/CustomActionButton.cs | 48 +-- MiraAPI/Hud/CustomButtonManager.cs | 4 +- MiraAPI/Hud/CustomButtonSingleton.cs | 4 +- MiraAPI/Hud/CustomPlayerMenu.cs | 10 +- MiraAPI/Hud/MultiTargetButton.cs | 4 +- MiraAPI/Keybinds/KeybindManager.cs | 10 +- MiraAPI/Keybinds/KeybindUtils.cs | 10 +- MiraAPI/Keybinds/MiraGlobalKeybinds.cs | 2 +- MiraAPI/Keybinds/MiraKeybind.cs | 6 +- .../RegisterCustomKeybindsAttribute.cs | 2 +- MiraAPI/Keybinds/VanillaKeybindSingleton.cs | 6 +- .../Attributes/LocalEnumSettingAttribute.cs | 4 +- .../Attributes/LocalNumberSettingAttribute.cs | 2 +- .../Attributes/LocalSettingAttribute.cs | 4 +- .../Attributes/LocalSliderSettingAttribute.cs | 2 +- .../Attributes/LocalToggleSettingAttribute.cs | 2 +- MiraAPI/LocalSettings/ILocalSetting.cs | 10 +- MiraAPI/LocalSettings/LocalSettingsButton.cs | 4 +- MiraAPI/LocalSettings/LocalSettingsManager.cs | 2 +- MiraAPI/LocalSettings/LocalSettingsTab.cs | 8 +- .../LocalSettingsTabAppearance.cs | 36 +-- .../LocalSettingsTabSingleton.cs | 4 +- .../SettingTypes/LocalEnumSetting.cs | 10 +- .../SettingTypes/LocalSettingBase.cs | 4 +- MiraAPI/MiraApiSettings.cs | 2 +- MiraAPI/Modifiers/AssignmentConfiguration.cs | 10 +- MiraAPI/Modifiers/BaseModifier.cs | 12 +- MiraAPI/Modifiers/ModifierComponent.cs | 206 ++++++------- .../ModifierDisplayComponent.cs | 8 +- .../ModifierDisplay/ModifierUiComponent.cs | 4 +- MiraAPI/Modifiers/ModifierExtensions.cs | 286 +++++++++--------- MiraAPI/Modifiers/ModifierFactory.cs | 14 +- MiraAPI/Modifiers/ModifierManager.cs | 6 +- MiraAPI/Modifiers/ModifierUtils.cs | 18 +- MiraAPI/Modifiers/Types/GameModifier.cs | 6 +- MiraAPI/Modifiers/Types/TimedModifier.cs | 4 +- MiraAPI/Networking/CustomMurderRpc.cs | 2 +- MiraAPI/Networking/GuidConverter.cs | 2 +- .../Networking/Modifiers/AddModifierRpc.cs | 2 +- .../Events/KillAnimationMurderEventPatch.cs | 2 +- MiraAPI/Patches/Events/MapBehaviourPatches.cs | 2 +- .../Patches/Events/SabotageEventPatches.cs | 2 +- .../Patches/Events/VanillaButtonPatches.cs | 2 +- MiraAPI/Patches/Events/VentEventPatches.cs | 2 +- MiraAPI/Patches/HudManagerPatches.cs | 10 +- .../LocalSettings/OptionsMenuPatches.cs | 2 +- .../LocalSettings/ToggleBehaviourPatch.cs | 2 +- .../Patches/Menu/MainMenuManagerPatches.cs | 2 +- MiraAPI/Patches/MinigameBeginErrorPatch.cs | 2 +- .../Patches/Options/GameSettingMenuPatches.cs | 2 +- MiraAPI/Patches/Options/SettingPatches.cs | 6 +- MiraAPI/Patches/PlayerControlPatches.cs | 2 +- MiraAPI/Patches/Roles/HauntMenuPatch.cs | 2 +- MiraAPI/Patches/Roles/HudManagerPatches.cs | 10 +- MiraAPI/Patches/Roles/KillButtonPatches.cs | 7 +- MiraAPI/Patches/Roles/RoleBehaviourPatch.cs | 2 +- .../Roles/RoleOptionsCollectionPatch.cs | 2 +- MiraAPI/Patches/Roles/SabotageButtonPatch.cs | 2 +- MiraAPI/Patches/Roles/VentPatches.cs | 4 +- MiraAPI/Patches/Stubs/MinigameStubs.cs | 6 +- MiraAPI/Patches/Stubs/RoleBehaviourStubs.cs | 114 +++---- MiraAPI/Patches/VentCanUsePatch.cs | 2 +- MiraAPI/PluginLoading/IMiraPlugin.cs | 4 +- MiraAPI/PluginLoading/MiraPluginInfo.cs | 16 +- MiraAPI/PluginLoading/MiraPluginManager.cs | 2 +- MiraAPI/Presets/OptionPreset.cs | 4 +- MiraAPI/Presets/PresetManager.cs | 10 +- MiraAPI/Roles/CustomRoleConfiguration.cs | 14 +- MiraAPI/Roles/CustomRoleManager.cs | 16 +- MiraAPI/Roles/CustomRoleSingleton.cs | 6 +- MiraAPI/Roles/CustomRoleUtils.cs | 28 +- MiraAPI/Roles/ICustomRole.cs | 24 +- MiraAPI/Roles/RoleId.cs | 2 +- MiraAPI/Roles/RoleOptionsGroup.cs | 2 +- MiraAPI/Roles/TeamIntroConfiguration.cs | 2 +- .../Utilities/Assets/LoadableAssetWrapper.cs | 4 +- .../Utilities/Assets/LoadableBundleAsset.cs | 6 +- MiraAPI/Utilities/Assets/MiraAssets.cs | 14 +- MiraAPI/Utilities/Assets/PreloadedAsset.cs | 2 +- MiraAPI/Utilities/Assets/SpriteTools.cs | 14 +- MiraAPI/Utilities/ColorExtensions.cs | 28 +- MiraAPI/Utilities/EnumerableExtensions.cs | 14 +- MiraAPI/Utilities/Extensions.cs | 140 ++++----- MiraAPI/Utilities/Helpers.cs | 92 +++--- MiraAPI/Utilities/StateMachineWrapper.cs | 4 +- MiraAPI/Voting/PlayerVoteData.cs | 6 +- MiraAPI/Voting/VotingUtils.cs | 16 +- 145 files changed, 941 insertions(+), 938 deletions(-) diff --git a/MiraAPI/Colors/PaletteManager.cs b/MiraAPI/Colors/PaletteManager.cs index c788353..fe7e725 100644 --- a/MiraAPI/Colors/PaletteManager.cs +++ b/MiraAPI/Colors/PaletteManager.cs @@ -5,12 +5,12 @@ using HarmonyLib; namespace MiraAPI.Colors; /// -/// Used to register and track custom colors. +/// Used to register and track s. /// public static class PaletteManager { /// - /// Gets all registered custom colors. + /// Gets all registered s. /// public static CustomColor[] RegisteredColors => [.. CustomColors]; diff --git a/MiraAPI/Colors/RegisterCustomColorsAttribute.cs b/MiraAPI/Colors/RegisterCustomColorsAttribute.cs index 0e9ace7..6356582 100644 --- a/MiraAPI/Colors/RegisterCustomColorsAttribute.cs +++ b/MiraAPI/Colors/RegisterCustomColorsAttribute.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Colors; /// -/// Used to mark a class for custom colors registration. +/// Used to mark a class for registration. /// [AttributeUsage(AttributeTargets.Class)] public class RegisterCustomColorsAttribute : Attribute; diff --git a/MiraAPI/Events/Mira/MiraButtonCancelledEvent.cs b/MiraAPI/Events/Mira/MiraButtonCancelledEvent.cs index f4a6ebf..e6c7c15 100644 --- a/MiraAPI/Events/Mira/MiraButtonCancelledEvent.cs +++ b/MiraAPI/Events/Mira/MiraButtonCancelledEvent.cs @@ -3,20 +3,20 @@ namespace MiraAPI.Events.Mira; /// -/// Invoked when a Mira Button click is cancelled. Do not use for vanilla buttons. +/// Invoked when a click is cancelled. Do not use for vanilla s. /// -/// The Mira Button type. +/// The type. public sealed class MiraButtonCancelledEvent : MiraEvent where T : CustomActionButton { /// - /// Gets Mira Button whose click was cancelled. + /// Gets the whose click was cancelled. /// public T Button { get; } /// /// Initializes a new instance of the class. /// - /// The Mira Button whose click was cancelled. + /// The whose click was cancelled. public MiraButtonCancelledEvent(T button) { Button = button; @@ -24,19 +24,19 @@ public sealed class MiraButtonCancelledEvent : MiraEvent where T : CustomActi } /// -/// Invoked when a Mira Button click is cancelled. Do not use for vanilla buttons. +/// Invoked when a click is cancelled. Do not use for vanilla s. /// public sealed class MiraButtonCancelledEvent : MiraEvent { /// - /// Gets Mira Button whose click was cancelled. + /// Gets the whose click was cancelled. /// public CustomActionButton Button { get; } /// /// Initializes a new instance of the class. /// - /// The Mira Button whose click was cancelled. + /// The whose click was cancelled. public MiraButtonCancelledEvent(CustomActionButton button) { Button = button; diff --git a/MiraAPI/Events/Mira/MiraButtonClickEvent.cs b/MiraAPI/Events/Mira/MiraButtonClickEvent.cs index c070383..401cc11 100644 --- a/MiraAPI/Events/Mira/MiraButtonClickEvent.cs +++ b/MiraAPI/Events/Mira/MiraButtonClickEvent.cs @@ -3,26 +3,26 @@ namespace MiraAPI.Events.Mira; /// -/// Button click event for Mira Buttons only. Do not use for vanilla buttons. +/// Button click event for s only. Do not use for vanilla s. /// -/// The Mira Button type. +/// The type. public sealed class MiraButtonClickEvent : MiraCancelableEvent where T : CustomActionButton { /// - /// Gets Mira Button that was clicked. + /// Gets the that was clicked. /// public T Button { get; } /// - /// Gets the generic click event that is invoked before this button-specific event. + /// Gets the generic that is invoked before this button-specific event. /// public MiraButtonClickEvent GenericClickEvent { get; } /// /// Initializes a new instance of the class. /// - /// The Mira Button that was clicked. - /// The generic click event invoked before button-specific events. + /// The that was clicked. + /// The generic invoked before button-specific events. public MiraButtonClickEvent(T button, MiraButtonClickEvent genericClickEvent) { GenericClickEvent = genericClickEvent; @@ -31,19 +31,19 @@ public sealed class MiraButtonClickEvent : MiraCancelableEvent where T : Cust } /// -/// Button click event for Mira Buttons only. Do not use for vanilla buttons. +/// Button click event for s only. Do not use for vanilla s. /// public sealed class MiraButtonClickEvent : MiraCancelableEvent { /// - /// Gets Mira Button that was clicked. + /// Gets the that was clicked. /// public CustomActionButton Button { get; } /// /// Initializes a new instance of the class. /// - /// The Mira Button that was clicked. + /// The that was clicked. public MiraButtonClickEvent(CustomActionButton button) { Button = button; diff --git a/MiraAPI/Events/MiraEventHandle.cs b/MiraAPI/Events/MiraEventHandle.cs index 70514c4..451e6a2 100644 --- a/MiraAPI/Events/MiraEventHandle.cs +++ b/MiraAPI/Events/MiraEventHandle.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Events; /// -/// Event handle to use when unregistering an event. +/// Event handle to use when unregistering a . /// public class MiraEventHandle { diff --git a/MiraAPI/Events/MiraEventManager.cs b/MiraAPI/Events/MiraEventManager.cs index bac91c5..592fb2c 100644 --- a/MiraAPI/Events/MiraEventManager.cs +++ b/MiraAPI/Events/MiraEventManager.cs @@ -13,9 +13,9 @@ public static class MiraEventManager private static readonly Dictionary> EventWrappers = []; /// - /// Invoke an event. + /// Invoke a . /// - /// The event instance. + /// The instance. /// Type of Event. /// If there was an event handler invoked for this event, return true. Otherwise, return false. public static bool InvokeEvent(T eventInstance) where T : MiraEvent @@ -42,9 +42,9 @@ public static class MiraEventManager } /// - /// Invoke an event and use a specific type to find the handlers. + /// Invoke a and use a specific type to find the handlers. /// - /// The event instance. + /// The instance. /// The type to use for handler lookup. /// If there was an event handler invoked for this event, return true. Otherwise, return false. public static bool InvokeEvent(MiraEvent eventInstance, Type type) @@ -71,12 +71,12 @@ public static class MiraEventManager } /// - /// Register an event. + /// Register a handler. /// - /// The type of event. - /// The MethodInfo of the event handler. + /// The type of event. + /// The of the event handler. /// The priority of the event handler. Lower values are called first. - /// An event handle to use when unregistering the event. + /// A to use when unregistering the event. public static MiraEventHandle RegisterEventHandler(Type type, MethodInfo methodInfo, int priority = 0) { if (!type.IsSubclassOf(typeof(MiraEvent))) @@ -102,12 +102,12 @@ public static class MiraEventManager } /// - /// Register an event. + /// Register a handler. /// /// The callback method/handler for the event. /// The priority of the event handler. Lower values are called first. - /// Type of event. - /// An event handle to use when unregistering the event. + /// Type of event. + /// A to use when unregistering the event. public static MiraEventHandle RegisterEventHandler(Action handler, int priority = 0) where T : MiraEvent { EventWrappers.TryAdd(typeof(T), []); @@ -127,7 +127,7 @@ public static class MiraEventManager } /// - /// Unregister an event using the event handle. + /// Unregister a handler using the . /// /// A handle to the event. /// True if the event was unregistered successfully, false otherwise. diff --git a/MiraAPI/Events/MiraEventWrapper.cs b/MiraAPI/Events/MiraEventWrapper.cs index 7e754c3..3784688 100644 --- a/MiraAPI/Events/MiraEventWrapper.cs +++ b/MiraAPI/Events/MiraEventWrapper.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Events; /// -/// Wrapper for event handlers. +/// Wrapper for handlers. /// public class MiraEventWrapper { diff --git a/MiraAPI/Events/RegisterEventAttribute.cs b/MiraAPI/Events/RegisterEventAttribute.cs index 169c125..2fee367 100644 --- a/MiraAPI/Events/RegisterEventAttribute.cs +++ b/MiraAPI/Events/RegisterEventAttribute.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Events; /// -/// Register an event. +/// Register a handler. /// [AttributeUsage(AttributeTargets.Method)] public class RegisterEventAttribute : Attribute diff --git a/MiraAPI/Events/Vanilla/Gameplay/AfterMurderEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/AfterMurderEvent.cs index 0f0da3b..8b85622 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/AfterMurderEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/AfterMurderEvent.cs @@ -6,17 +6,17 @@ public class AfterMurderEvent : MiraEvent { /// - /// Gets the player that killed the target. + /// Gets the that killed the . /// public PlayerControl Source { get; } /// - /// Gets the player that was killed. + /// Gets the that was killed. /// public PlayerControl Target { get; } /// - /// Gets the player's body, if it exists. + /// Gets the 's , if it exists. /// public DeadBody? DeadBody { get; } @@ -24,8 +24,8 @@ public class AfterMurderEvent : MiraEvent /// Initializes a new instance of the class. /// /// The killer. - /// The killed player. - /// The player's vody, if it exists. + /// The killed . + /// The 's , if it exists. public AfterMurderEvent(PlayerControl source, PlayerControl target, DeadBody? deadBody) { Source = source; diff --git a/MiraAPI/Events/Vanilla/Gameplay/BeforeGameEndEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/BeforeGameEndEvent.cs index 0a70a1d..9703bd5 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/BeforeGameEndEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/BeforeGameEndEvent.cs @@ -1,7 +1,7 @@ namespace MiraAPI.Events.Vanilla.Gameplay; /// -/// Invoked before RpcEndGame is called, allowing cancellation of the game end entirely. +/// Invoked before is called, allowing cancellation of the game end entirely. /// public class BeforeGameEndEvent : MiraCancelableEvent { diff --git a/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs index 84cc67e..cc07e21 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs @@ -8,25 +8,25 @@ namespace MiraAPI.Events.Vanilla.Gameplay; public sealed class BeforeMurderEvent : MiraCancelableEvent { /// - /// Gets the player that is killing the target. + /// Gets the that is killing the . /// public PlayerControl Source { get; } /// - /// Gets the player that is being killed. + /// Gets the that is being killed. /// public PlayerControl Target { get; } /// - /// Gets whether the murder was meant to be done in a meeting via an enum. + /// Gets whether the murder was meant to be done in a meeting, via an enum. /// public MeetingCheck InMeeting { get; } /// /// Initializes a new instance of the class. /// - /// The player that is killing the target. - /// The player that is being killed. + /// The that is killing the . + /// The that is being killed. /// Whether the murder is intended to be triggered in a meeting. public BeforeMurderEvent(PlayerControl source, PlayerControl target, MeetingCheck inMeeting) { @@ -38,8 +38,8 @@ public sealed class BeforeMurderEvent : MiraCancelableEvent /// /// Initializes a new instance of the class. /// - /// The player that is killing the target. - /// The player that is being killed. + /// The that is killing the . + /// The that is being killed. public BeforeMurderEvent(PlayerControl source, PlayerControl target) { Source = source; diff --git a/MiraAPI/Events/Vanilla/Gameplay/BeforeRoundStartEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/BeforeRoundStartEvent.cs index f9d41ee..77422af 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/BeforeRoundStartEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/BeforeRoundStartEvent.cs @@ -1,12 +1,13 @@ namespace MiraAPI.Events.Vanilla.Gameplay; /// -/// Event invoked on IntroCutscene.OnDestroy and ExileController.WrapUp to determine if it should run the round event or not. +/// Event invoked on and +/// to determine if it should run the event or not. /// public class BeforeRoundStartEvent : MiraCancelableEvent { /// - /// Gets a value indicating whether the event was triggered by the IntroCutscene or ExileController. + /// Gets a value indicating whether the event was triggered by the or . /// public bool TriggeredByIntro { get; } diff --git a/MiraAPI/Events/Vanilla/Gameplay/GameEndEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/GameEndEvent.cs index 1f06533..d44dae5 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/GameEndEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/GameEndEvent.cs @@ -6,14 +6,14 @@ public class GameEndEvent : MiraEvent { /// - /// Gets the instance of the EndGameManager. + /// Gets the instance. /// public EndGameManager EndGameManager { get; } /// /// Initializes a new instance of the class. /// - /// The instance of the EndGameManager. + /// The instance. public GameEndEvent(EndGameManager manager) { EndGameManager = manager; diff --git a/MiraAPI/Events/Vanilla/Gameplay/IntroBeginEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/IntroBeginEvent.cs index 5d5e8d8..b08ec56 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/IntroBeginEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/IntroBeginEvent.cs @@ -6,7 +6,7 @@ public class IntroBeginEvent : MiraEvent { /// - /// Gets the instance of the IntroCutscene. + /// Gets the instance. /// public IntroCutscene IntroCutscene { get; } diff --git a/MiraAPI/Events/Vanilla/Gameplay/IntroEndEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/IntroEndEvent.cs index b27bcec..a23b960 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/IntroEndEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/IntroEndEvent.cs @@ -6,7 +6,7 @@ public class IntroEndEvent(IntroCutscene introCutscene) : MiraEvent { /// - /// Gets the instance of the IntroCutscene. + /// Gets the instance. /// public IntroCutscene IntroCutscene { get; } = introCutscene; } diff --git a/MiraAPI/Events/Vanilla/Gameplay/IntroRoleRevealEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/IntroRoleRevealEvent.cs index 809ce11..1ffdf67 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/IntroRoleRevealEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/IntroRoleRevealEvent.cs @@ -6,7 +6,7 @@ public class IntroRoleRevealEvent : MiraEvent { /// - /// Gets the instance of the IntroCutscene. + /// Gets the instance. /// public IntroCutscene IntroCutscene { get; } diff --git a/MiraAPI/Events/Vanilla/Gameplay/RoundStartEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/RoundStartEvent.cs index 470f85a..93a7bfd 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/RoundStartEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/RoundStartEvent.cs @@ -1,12 +1,13 @@ namespace MiraAPI.Events.Vanilla.Gameplay; /// -/// Start Round event, invoked on IntroCutscene.OnDestroy and ExileController.WrapUp if the event isn't cancelled. +/// Start Round event, invoked on and +/// if the isn't cancelled. /// public class RoundStartEvent : MiraEvent { /// - /// Gets a value indicating whether the event was triggered by the IntroCutscene or ExileController. + /// Gets a value indicating whether the event was triggered by the or . /// public bool TriggeredByIntro { get; } diff --git a/MiraAPI/Events/Vanilla/Gameplay/SetRoleEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/SetRoleEvent.cs index 4c00cf2..1ebfd78 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/SetRoleEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/SetRoleEvent.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Events.Vanilla.Gameplay; public class SetRoleEvent : MiraEvent { /// - /// Gets the player whos role was changed. + /// Gets the whose role was changed. /// public PlayerControl Player { get; } diff --git a/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonCancelledEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonCancelledEvent.cs index 4265a3a..9e334b8 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonCancelledEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonCancelledEvent.cs @@ -3,20 +3,20 @@ namespace MiraAPI.Events.Vanilla.Gameplay; /// -/// Invoked when a Vanilla Button click is cancelled. Do not use for custom buttons. +/// Invoked when a Vanilla click is cancelled. Do not use for . /// -/// The Vanilla Button type. +/// The vanilla type. public sealed class VanillaButtonCancelledEvent : MiraEvent where T : AbilityButton { /// - /// Gets Vanilla Button whose click was cancelled. + /// Gets the Vanilla whose click was cancelled. /// public T Button { get; } /// /// Initializes a new instance of the class. /// - /// The Mira Button whose click was cancelled. + /// The vanilla whose click was cancelled. public VanillaButtonCancelledEvent(T button) { Button = button; @@ -24,19 +24,19 @@ public sealed class VanillaButtonCancelledEvent : MiraEvent where T : Ability } /// -/// Invoked when a Vanilla Button click is cancelled. Do not use for custom buttons. +/// Invoked when a Vanilla click is cancelled. Do not use for s. /// public sealed class VanillaButtonCancelledEvent : MiraEvent { /// - /// Gets Vanilla Button whose click was cancelled. + /// Gets the Vanilla whose click was cancelled. /// public AbilityButton Button { get; } /// /// Initializes a new instance of the class. /// - /// The Vanilla Button whose click was cancelled. + /// The vanilla whose click was cancelled. public VanillaButtonCancelledEvent(AbilityButton button) { Button = button; diff --git a/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonClickEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonClickEvent.cs index 3da499b..563cf66 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonClickEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/VanillaButtonClickEvent.cs @@ -3,26 +3,26 @@ namespace MiraAPI.Events.Vanilla.Gameplay; /// -/// Button click event for Vanilla Buttons only. Do not use for custom buttons. +/// Button click event for Vanilla s only. Do not use for s. /// -/// The Vanilla Button type. +/// The vanilla type. public sealed class VanillaButtonClickEvent : MiraCancelableEvent where T : AbilityButton { /// - /// Gets Vanilla Button that was clicked. + /// Gets the vanilla that was clicked. /// public T Button { get; } /// - /// Gets the generic click event that is invoked before this button-specific event. + /// Gets the generic that is invoked before this button-specific event. /// public VanillaButtonClickEvent GenericClickEvent { get; } /// /// Initializes a new instance of the class. /// - /// The Mira Button that was clicked. - /// The generic click event invoked before button-specific events. + /// The vanilla that was clicked. + /// The generic invoked before button-specific events. public VanillaButtonClickEvent(T button, VanillaButtonClickEvent genericClickEvent) { GenericClickEvent = genericClickEvent; @@ -31,31 +31,31 @@ public sealed class VanillaButtonClickEvent : MiraCancelableEvent where T : A } /// -/// Button click event for Vanilla Buttons only. Do not use for custom buttons. +/// Button click event for Vanilla only. Do not use for s. /// public sealed class VanillaButtonClickEvent : MiraCancelableEvent { /// - /// Gets Vanilla Button that was clicked. + /// Gets the Vanilla that was clicked. /// public AbilityButton Button { get; } /// - /// Gets the target player, if any, of the Vanilla Button that was clicked. + /// Gets the target , if any, of the Vanilla that was clicked. /// public PlayerControl? PlayerTarget { get; } /// - /// Gets the target vent, if any, of the Vanilla Button that was clicked. + /// Gets the target , if any, of the Vanilla that was clicked. /// public Vent? VentTarget { get; } /// /// Initializes a new instance of the class. /// - /// The Vanilla Button that was clicked. - /// The Player target, if any. - /// The Vent target, if any. + /// The Vanilla that was clicked. + /// The target, if any. + /// The target, if any. public VanillaButtonClickEvent(AbilityButton button, PlayerControl? playerTarget = null, Vent? ventTarget = null) { Button = button; diff --git a/MiraAPI/Events/Vanilla/Map/PlayerOpenSabotageEvent.cs b/MiraAPI/Events/Vanilla/Map/PlayerOpenSabotageEvent.cs index 8b2b6cb..6415d70 100644 --- a/MiraAPI/Events/Vanilla/Map/PlayerOpenSabotageEvent.cs +++ b/MiraAPI/Events/Vanilla/Map/PlayerOpenSabotageEvent.cs @@ -6,14 +6,14 @@ public class PlayerOpenSabotageEvent : MiraCancelableEvent { /// - /// Gets the MapBehaviour. + /// Gets the . /// public MapBehaviour MapBehaviour { get; } /// /// Initializes a new instance of the class. /// - /// The MapBehaviour. + /// The . public PlayerOpenSabotageEvent(MapBehaviour mapBehaviour) { MapBehaviour = mapBehaviour; diff --git a/MiraAPI/Events/Vanilla/Map/UpdateSystemEvent.cs b/MiraAPI/Events/Vanilla/Map/UpdateSystemEvent.cs index 5b70090..5e2219c 100644 --- a/MiraAPI/Events/Vanilla/Map/UpdateSystemEvent.cs +++ b/MiraAPI/Events/Vanilla/Map/UpdateSystemEvent.cs @@ -1,7 +1,7 @@ namespace MiraAPI.Events.Vanilla.Map; /// -/// Cancelable event that is invoked before a system is updated. Usually used for sabotage events. +/// that is invoked before a system is updated. Usually used for sabotage events. /// public class UpdateSystemEvent : MiraCancelableEvent { @@ -11,7 +11,7 @@ public class UpdateSystemEvent : MiraCancelableEvent public SystemTypes SystemType { get; } /// - /// Gets the player that is updating the system. + /// Gets the that is updating the system. /// public PlayerControl Player { get; } @@ -21,10 +21,10 @@ public class UpdateSystemEvent : MiraCancelableEvent public byte Amount { get; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The SystemType being updated. - /// The player that is updating the system. + /// The being updated. + /// The that is updating the system. /// Amount to update System to. public UpdateSystemEvent(SystemTypes systemType, PlayerControl player, byte amount) { diff --git a/MiraAPI/Events/Vanilla/Meeting/EjectionEvent.cs b/MiraAPI/Events/Vanilla/Meeting/EjectionEvent.cs index 1d25098..054335c 100644 --- a/MiraAPI/Events/Vanilla/Meeting/EjectionEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/EjectionEvent.cs @@ -6,14 +6,14 @@ public class EjectionEvent : MiraEvent { /// - /// Gets the instance of the ExileController. + /// Gets the instance. /// public ExileController ExileController { get; } /// /// Initializes a new instance of the class. /// - /// The exile controller. + /// The instance. public EjectionEvent(ExileController controller) { ExileController = controller; diff --git a/MiraAPI/Events/Vanilla/Meeting/EndMeetingEvent.cs b/MiraAPI/Events/Vanilla/Meeting/EndMeetingEvent.cs index 55cdae9..98ccaa1 100644 --- a/MiraAPI/Events/Vanilla/Meeting/EndMeetingEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/EndMeetingEvent.cs @@ -6,7 +6,7 @@ public class EndMeetingEvent(MeetingHud meetingHud) : MiraEvent { /// - /// Gets the MeetingHud instance. + /// Gets the instance. /// public MeetingHud MeetingHud { get; } = meetingHud; } diff --git a/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs b/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs index 5c51576..dc93d96 100644 --- a/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs @@ -2,7 +2,7 @@ /// /// The event that is invoked when a body is reported. -/// This is invoked in CmdReportBody. +/// This is invoked in . /// public class ReportBodyEvent : MiraCancelableEvent { @@ -17,7 +17,7 @@ public class ReportBodyEvent : MiraCancelableEvent public NetworkedPlayerInfo? Target { get; } /// - /// Gets the body that is being reported. Will be null for emergency meeting. + /// Gets the that is being reported. Will be null for emergency meeting. /// public DeadBody? Body { get; } @@ -26,7 +26,7 @@ public class ReportBodyEvent : MiraCancelableEvent /// /// The player who reported the body. /// The player being reported. - /// The body being reported. + /// The being reported. public ReportBodyEvent(PlayerControl reporter, NetworkedPlayerInfo? target, DeadBody? body) { Reporter = reporter; diff --git a/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs b/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs index 78e58f3..0a15d99 100644 --- a/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs @@ -7,14 +7,14 @@ public class StartMeetingEvent : MiraEvent { /// - /// Gets the MeetingHud instance. + /// Gets the instance. /// public MeetingHud MeetingHud { get; } /// /// Initializes a new instance of the class. /// - /// The MeetingHud instance. + /// The instance. public StartMeetingEvent(MeetingHud meetingHud) { MeetingHud = meetingHud; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs index 714d3b8..95583f3 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; public class AfterVoteEvent : MiraEvent { /// - /// Gets the instance of the voter's vote data. + /// Gets the instance of the voter's . /// public PlayerVoteArea VoteArea { get; } @@ -20,7 +20,7 @@ public class AfterVoteEvent : MiraEvent /// /// Initializes a new instance of the class. /// - /// The player vote area that was voted on. + /// The that was voted on. /// The player who voted. public AfterVoteEvent(PlayerVoteArea playerVoteArea, PlayerControl voter) { diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs index 1d8d907..74fde38 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; public class BeforeVoteEvent : MiraCancelableEvent { /// - /// Gets the instance of the voter's vote data. + /// Gets the instance of the voter's . /// public PlayerVoteArea VoteArea { get; } @@ -20,7 +20,7 @@ public class BeforeVoteEvent : MiraCancelableEvent /// /// Initializes a new instance of the class. /// - /// The player vote area that was voted on. + /// The that was voted on. /// The player who voted. public BeforeVoteEvent(PlayerVoteArea playerVoteArea, PlayerControl voter) { diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/DummyVoteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/DummyVoteEvent.cs index 2f5cba0..ea3aa69 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/DummyVoteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/DummyVoteEvent.cs @@ -15,7 +15,7 @@ public class DummyVoteEvent : MiraCancelableEvent public DummyBehaviour Dummy { get; } /// - /// Gets the instance of the dummy's vote data. + /// Gets the instance of the dummy's . /// public PlayerVoteData VoteData { get; } diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/HandleVoteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/HandleVoteEvent.cs index 48ec40f..c445778 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/HandleVoteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/HandleVoteEvent.cs @@ -5,12 +5,12 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// /// The event that is invoked when Mira handles a vote. This is invoked before Mira's behaviour, so be cautious. /// If you intend on adding custom vote behaviour, cancel the event and do so. -/// If you are NOT canceling the event, keep in mind that Mira automatically removes a vote and adds the suspect to the VotedPlayers list after this event is invoked. +/// If you are NOT canceling the event, keep in mind that Mira automatically removes a vote and adds the suspect to the list after this event is invoked. /// public class HandleVoteEvent : MiraCancelableEvent { /// - /// Gets the instance of the voter's vote data. + /// Gets the instance of the voter's . /// public PlayerVoteData VoteData { get; } @@ -30,14 +30,14 @@ public class HandleVoteEvent : MiraCancelableEvent public bool PreventVote { get; } /// - /// Gets the player info of the target. + /// Gets the of the target. /// public NetworkedPlayerInfo TargetPlayerInfo { get; } /// /// Initializes a new instance of the class. /// - /// The voter's data. + /// The voter's . /// The target's playerId. public HandleVoteEvent(PlayerVoteData playerVoteData, byte targetId) { diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs index 6ea8eff..40d8f81 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; public class MeetingSelectEvent : MiraEvent { /// - /// Gets the instance of the voter's vote data. + /// Gets the instance of the voter's . /// public PlayerVoteData VoteData { get; } @@ -18,7 +18,7 @@ public class MeetingSelectEvent : MiraEvent public int TargetId { get; } /// - /// Gets the player info of the target. + /// Gets the of the target. /// public NetworkedPlayerInfo TargetPlayerInfo { get; } @@ -30,7 +30,7 @@ public class MeetingSelectEvent : MiraEvent /// /// Initializes a new instance of the class. /// - /// The voter's data. + /// The voter's . /// The target's playerId. /// >Whether the player is allowed to select the target. public MeetingSelectEvent(PlayerVoteData playerVoteData, int targetId, bool allowSelect) diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs index 131b6d5..f5e4001 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs @@ -4,20 +4,20 @@ using MiraAPI.Voting; namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// -/// Called in VotingUtils.HandlePopulateResults. +/// Called in . /// Cancelling is NOT advised but if you do plan on cancelling, please ensure you account for displaying ALL player's votes. /// public class PopulateResultsEvent : MiraCancelableEvent { /// - /// Gets a list of networked votes. + /// Gets a list of networked s. /// public List Votes { get; } /// /// Initializes a new instance of the class. /// - /// The list of votes. + /// The list of s. public PopulateResultsEvent(List votes) { Votes = votes; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs index 9ecaab0..0dbd585 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs @@ -10,7 +10,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// /// Initializes a new instance of the class. /// -/// >The list of votes that are being processed. +/// >The list of s that are being processed. /// The player to be exiled. Will be null if no player is to be exiled. public class ProcessVotesEvent(List votes, NetworkedPlayerInfo? exiledPlayer = null) : MiraEvent { @@ -29,7 +29,7 @@ public class ProcessVotesEvent(List votes, NetworkedPlayerInfo? exil public bool VotesModified => !Votes.SequenceEqual(_originalVotes); /// - /// Gets the list of votes that are being processed. + /// Gets the list of s that are being processed. /// public List Votes { get; } = votes; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/VotingCompleteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/VotingCompleteEvent.cs index 5f782bf..52d4c36 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/VotingCompleteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/VotingCompleteEvent.cs @@ -3,11 +3,11 @@ /// /// The event that is invoked when the voting phase of a meeting is complete. /// -/// The MeetingHud instance. +/// The instance. public class VotingCompleteEvent(MeetingHud meetingHud) : MiraEvent { /// - /// Gets the MeetingHud instance. + /// Gets the instance. /// public MeetingHud MeetingHud { get; } = meetingHud; } diff --git a/MiraAPI/Events/Vanilla/Player/CompleteHnsTaskEvent.cs b/MiraAPI/Events/Vanilla/Player/CompleteHnsTaskEvent.cs index 7d8f71d..5ac7190 100644 --- a/MiraAPI/Events/Vanilla/Player/CompleteHnsTaskEvent.cs +++ b/MiraAPI/Events/Vanilla/Player/CompleteHnsTaskEvent.cs @@ -16,14 +16,14 @@ public class CompleteHnsTaskEvent : MiraEvent public PlayerTask Task { get; } /// - /// Gets the instance of the attached to the game. + /// Gets the instance of the attached to the game. /// public HideAndSeekManager HnsManager { get; } /// /// Initializes a new instance of the class. /// - /// The Hide and Seek Manager currently active. + /// The currently active. /// The player who completed the task. /// The task that the player completed. public CompleteHnsTaskEvent(HideAndSeekManager hnsManager, PlayerControl player, PlayerTask task) diff --git a/MiraAPI/Events/Vanilla/Player/PlayerDeathEvent.cs b/MiraAPI/Events/Vanilla/Player/PlayerDeathEvent.cs index 9b1ae49..3821af4 100644 --- a/MiraAPI/Events/Vanilla/Player/PlayerDeathEvent.cs +++ b/MiraAPI/Events/Vanilla/Player/PlayerDeathEvent.cs @@ -16,7 +16,7 @@ public class PlayerDeathEvent : MiraEvent public DeathReason DeathReason { get; } /// - /// Gets the dead body associated with the player, if any. + /// Gets the associated with the player, if any. /// public DeadBody? DeadBody { get; } @@ -25,7 +25,7 @@ public class PlayerDeathEvent : MiraEvent /// /// The player who died. /// The reason the player died. - /// The player's body, if it exists. + /// The player's , if it exists. public PlayerDeathEvent(PlayerControl player, DeathReason reason, DeadBody? deadBody) { Player = player; diff --git a/MiraAPI/Events/Vanilla/Usables/EnterVentEvent.cs b/MiraAPI/Events/Vanilla/Usables/EnterVentEvent.cs index ce3b3ca..233e6ee 100644 --- a/MiraAPI/Events/Vanilla/Usables/EnterVentEvent.cs +++ b/MiraAPI/Events/Vanilla/Usables/EnterVentEvent.cs @@ -6,20 +6,20 @@ public class EnterVentEvent : MiraCancelableEvent { /// - /// Gets the player that is entering the vent. + /// Gets the that is entering the . /// public PlayerControl Player { get; } /// - /// Gets the vent that the player is entering. + /// Gets the that the is entering. /// public Vent? Vent { get; } /// /// Initializes a new instance of the class. /// - /// The player that is entering the vent. - /// The vent being entered. + /// The that is entering the . + /// The being entered. public EnterVentEvent(PlayerControl player, Vent? vent) { Player = player; diff --git a/MiraAPI/Events/Vanilla/Usables/ExitVentEvent.cs b/MiraAPI/Events/Vanilla/Usables/ExitVentEvent.cs index 351411f..6194905 100644 --- a/MiraAPI/Events/Vanilla/Usables/ExitVentEvent.cs +++ b/MiraAPI/Events/Vanilla/Usables/ExitVentEvent.cs @@ -6,20 +6,20 @@ public class ExitVentEvent : MiraCancelableEvent { /// - /// Gets the player that is exiting the vent. + /// Gets the that is exiting the . /// public PlayerControl Player { get; } /// - /// Gets the vent that the player is exiting. + /// Gets the that the is exiting. /// public Vent? Vent { get; } /// /// Initializes a new instance of the class. /// - /// The player who is exiting the vent. - /// The vent being exited from. + /// The who is exiting the . + /// The being exited from. public ExitVentEvent(PlayerControl player, Vent? vent) { Player = player; diff --git a/MiraAPI/Events/Vanilla/Usables/PlayerCanUseEvent.cs b/MiraAPI/Events/Vanilla/Usables/PlayerCanUseEvent.cs index f9ba115..9dced79 100644 --- a/MiraAPI/Events/Vanilla/Usables/PlayerCanUseEvent.cs +++ b/MiraAPI/Events/Vanilla/Usables/PlayerCanUseEvent.cs @@ -8,7 +8,7 @@ public class PlayerCanUseEvent : PlayerUseEvent /// /// Initializes a new instance of the class. /// - /// The IUsable. + /// The . public PlayerCanUseEvent(IUsable usable) : base(usable) { } diff --git a/MiraAPI/Events/Vanilla/Usables/PlayerUseEvent.cs b/MiraAPI/Events/Vanilla/Usables/PlayerUseEvent.cs index 5f05676..7fc5cd5 100644 --- a/MiraAPI/Events/Vanilla/Usables/PlayerUseEvent.cs +++ b/MiraAPI/Events/Vanilla/Usables/PlayerUseEvent.cs @@ -11,19 +11,19 @@ public class PlayerUseEvent : MiraCancelableEvent public IUsable Usable { get; } /// - /// Gets a value indicating whether the IUsable is a , , or . + /// Gets a value indicating whether the is a , , or . /// public bool IsPrimaryConsole { get; } /// - /// Gets a value indicating whether the IUsable is a . + /// Gets a value indicating whether the is a . /// public bool IsVent { get; } /// /// Initializes a new instance of the class. /// - /// The IUsable. + /// The . public PlayerUseEvent(IUsable usable) { Usable = usable; diff --git a/MiraAPI/GameEnd/CustomGameOver.cs b/MiraAPI/GameEnd/CustomGameOver.cs index 70d7b27..885504e 100644 --- a/MiraAPI/GameEnd/CustomGameOver.cs +++ b/MiraAPI/GameEnd/CustomGameOver.cs @@ -10,14 +10,14 @@ namespace MiraAPI.GameEnd; public abstract class CustomGameOver { /// - /// Gets the current CustomGameOver. + /// Gets the current . /// public static CustomGameOver? Instance { get; internal set; } /// - /// Verifies if the condition for this CustomGameOver is met. + /// Verifies if the condition for this is met. /// - /// The PlayerControl that requested the Game Over. + /// The that requested the Game Over. /// The collection of winners. /// True if the condition is met, otherwise false. public virtual bool VerifyCondition(PlayerControl playerControl, NetworkedPlayerInfo[] winners) @@ -26,9 +26,9 @@ public abstract class CustomGameOver } /// - /// Runs before the base game calls EndGameManager.SetEverythingUp. + /// Runs before the base game calls . /// - /// The EndGameManager instance. + /// The instance. /// Return True to use the run the original method, return False to skip it. public virtual bool BeforeEndGameSetup(EndGameManager endGameManager) { @@ -36,18 +36,18 @@ public abstract class CustomGameOver } /// - /// Runs after the base game calls EndGameManager.SetEverythingUp. + /// Runs after the base game calls . /// - /// The EndGameManager instance. + /// The instance. public virtual void AfterEndGameSetup(EndGameManager endGameManager) { } /// - /// Get the GameOverReason associated with this CustomGameOver. + /// Get the associated with this . /// /// Type of the custom game over. - /// The GameOverReason associated with the custom game over. + /// The associated with the custom game over. public static GameOverReason GameOverReason() where T : CustomGameOver { return (GameOverReason)GameOverManager.GetGameOverId(); @@ -67,10 +67,10 @@ public abstract class CustomGameOver } /// - /// Implicitly convert a CustomGameOver to a GameOverReason. + /// Implicitly convert a to a . /// - /// The CustomGameOver instance. - /// The GameOverReason associated with the CustomGameOver. + /// The instance. + /// The associated with the CustomGameOver. public static implicit operator GameOverReason(CustomGameOver gameOver) { return (GameOverReason)GameOverManager.GetGameOverId(gameOver.GetType()); diff --git a/MiraAPI/GameEnd/GameOverManager.cs b/MiraAPI/GameEnd/GameOverManager.cs index 8bc6f1e..ac4fef8 100644 --- a/MiraAPI/GameEnd/GameOverManager.cs +++ b/MiraAPI/GameEnd/GameOverManager.cs @@ -6,7 +6,7 @@ using Reactor.Utilities; namespace MiraAPI.GameEnd; /// -/// Manage custom game overs. +/// Manage s. /// public static class GameOverManager { @@ -16,10 +16,10 @@ public static class GameOverManager private static int _nextId = Enum.GetNames().Length; /// - /// Register a custom game over. + /// Register a . /// - /// Type of the custom game over. - /// Thrown when the type is not a subclass of CustomGameOver, is abstract, or does not have a parameterless constructor. + /// Type of the . + /// Thrown when the type is not a subclass of , is abstract, or does not have a parameterless constructor. /// >True if the game over was registered successfully, false otherwise. public static bool RegisterGameOver(Type gameOverType) { @@ -47,11 +47,11 @@ public static class GameOverManager } /// - /// Create an instance of a custom game over. + /// Create an instance of a . /// - /// ID of the custom game over. - /// The created instance of the custom game over. - /// An instance of the custom game over. + /// ID of the . + /// The created instance of the . + /// An instance of the . public static bool TryGetGameOver(int id, [NotNullWhen(true)] out CustomGameOver? customGameOver) { if (GameOverTypes.TryGetValue(id, out var gameOverType)) @@ -65,20 +65,20 @@ public static class GameOverManager } /// - /// Get the ID of a custom game over. + /// Get the ID of a . /// - /// Type of the custom game over. - /// The ID of the custom game over. + /// Type of the . + /// The ID of the . public static int GetGameOverId() where T : CustomGameOver { return GetGameOverId(typeof(T)); } /// - /// Get the ID of a custom game over. + /// Get the ID of a . /// - /// Type of the custom game over. - /// The ID of the custom game over. + /// Type of the . + /// The ID of the . /// Thrown when the type is not registered. public static int GetGameOverId(Type gameOverType) { diff --git a/MiraAPI/GameModes/CustomGameMode.cs b/MiraAPI/GameModes/CustomGameMode.cs index c7cf639..58d9e58 100644 --- a/MiraAPI/GameModes/CustomGameMode.cs +++ b/MiraAPI/GameModes/CustomGameMode.cs @@ -23,24 +23,24 @@ public abstract class CustomGameMode public abstract int Id { get; } /// - /// Called when Intro Cutscene is destroyed. + /// Called when is destroyed. /// public virtual void Initialize() { } /// - /// Called on HudManager.Start(). + /// Called on . /// - /// Instance of HudManager. + /// Instance of . public virtual void HudStart(HudManager instance) { } /// - /// Called every frame on HudManager.Update(). + /// Called every frame on . /// - /// Instance of HudManager. + /// Instance of . public virtual void HudUpdate(HudManager instance) { } @@ -48,7 +48,7 @@ public abstract class CustomGameMode /// /// Called when a player is killed. /// - /// PlayerControl that was killed. + /// that was killed. public virtual void OnDeath(PlayerControl player) { } @@ -57,7 +57,7 @@ public abstract class CustomGameMode /// Calculate Game End logic. /// /// Should original game end logic be used. - /// Instance of LogicGameFlowNormal. + /// Instance of . public virtual void CheckGameEnd(out bool runOriginal, LogicGameFlowNormal instance) { runOriginal = true; @@ -67,7 +67,7 @@ public abstract class CustomGameMode /// Custom role assignment. /// /// Should original role assignment be used. - /// Instance of LogicRoleSelection. + /// Instance of . public virtual void AssignRoles(out bool runOriginal, LogicRoleSelectionNormal instance) { runOriginal = true; @@ -78,7 +78,7 @@ public abstract class CustomGameMode /// /// Should the original murder logic be used. /// Result of custom murder logic. - /// Target player for murder. + /// Target for murder. public virtual void CanKill(out bool runOriginal, out bool result, PlayerControl target) { result = false; @@ -104,7 +104,7 @@ public abstract class CustomGameMode public virtual List? CalculateWinners() => null; /// - /// Show gamemode in Intro Cutscene. + /// Show gamemode in . /// /// True if the game mode should be shown in the intro cutscene. public virtual bool ShowGameModeIntroCutscene() => false; @@ -117,17 +117,17 @@ public abstract class CustomGameMode public virtual bool CanUseMapConsole(MapConsole console) => true; /// - /// Can a body be reported in this gamemode. + /// Can a be reported in this gamemode. /// - /// Target body for reporting. - /// True if dead bodies can be reported. + /// Target for reporting. + /// True if s can be reported. public virtual bool CanReport(DeadBody body) => true; /// - /// Can system consoles be used in this gamemode. + /// Can s be used in this gamemode. /// /// System Console. - /// True if system consoles are enabled in this mode. + /// True if s are enabled in this mode. public virtual bool CanUseSystemConsole(SystemConsole console) => true; /// @@ -140,7 +140,7 @@ public abstract class CustomGameMode /// /// Should the sabotage map be used when attempting to open sabotage overlay. /// - /// MapBehaviour object. + /// object. /// True if the sabotage map should be shown. public virtual bool ShouldShowSabotageMap(MapBehaviour map) => true; diff --git a/MiraAPI/GameModes/CustomGameModeManager.cs b/MiraAPI/GameModes/CustomGameModeManager.cs index 0e5d2d7..7e274c4 100644 --- a/MiraAPI/GameModes/CustomGameModeManager.cs +++ b/MiraAPI/GameModes/CustomGameModeManager.cs @@ -6,12 +6,12 @@ using Reactor.Utilities; namespace MiraAPI.GameModes; /// -/// Manages custom gamemodes. +/// Manages s. /// public static class CustomGameModeManager { /// - /// List of registered gamemodes. + /// List of registered . /// internal static readonly Dictionary GameModes = []; @@ -21,14 +21,14 @@ public static class CustomGameModeManager } /// - /// Gets the current gamemode. + /// Gets the current . /// public static CustomGameMode? ActiveMode { get; internal set; } = new DefaultMode(); /// - /// Set current gamemode. + /// Set current . /// - /// gamemode ID. + /// ID. public static void SetGameMode(int id) { if (GameModes.TryGetValue(id, out var gameMode)) @@ -41,9 +41,9 @@ public static class CustomGameModeManager } /// - /// Register gamemode from type. + /// Register from type. /// - /// Type of gamemode class, should inherit from . + /// Type of , should inherit from . internal static void RegisterGameMode(Type gameModeType) { if (!typeof(CustomGameMode).IsAssignableFrom(gameModeType)) diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index aee77d3..35b1426 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -48,13 +48,13 @@ public abstract class AbstractOptionGroup public virtual Func GroupVisible => () => true; /// - /// Gets the group color. This is used to color the group in the options menu. + /// Gets the group . This is used to color the group in the options menu. /// public virtual Color GroupColor => MiraApiPlugin.DefaultHeaderColor; /// /// Gets the group priority. This is used to determine the order in which groups are displayed in the options menu. - /// Zero is the highest priority, and the default value is the max uint value. + /// Zero is the highest priority, and the default value is the max value. /// public virtual uint GroupPriority => uint.MaxValue; diff --git a/MiraAPI/GameOptions/Attributes/ModdedEnumOptionAttribute.cs b/MiraAPI/GameOptions/Attributes/ModdedEnumOptionAttribute.cs index 54680f2..5c937b6 100644 --- a/MiraAPI/GameOptions/Attributes/ModdedEnumOptionAttribute.cs +++ b/MiraAPI/GameOptions/Attributes/ModdedEnumOptionAttribute.cs @@ -5,7 +5,7 @@ using MiraAPI.GameOptions.OptionTypes; namespace MiraAPI.GameOptions.Attributes; /// -/// Attribute for creating an enum option. +/// Attribute for creating a . /// [AttributeUsage(AttributeTargets.Property)] public class ModdedEnumOptionAttribute(string title, Type enumType, string[]? values = null) diff --git a/MiraAPI/GameOptions/Attributes/ModdedNumberOptionAttribute.cs b/MiraAPI/GameOptions/Attributes/ModdedNumberOptionAttribute.cs index 63dc82f..6ff98dc 100644 --- a/MiraAPI/GameOptions/Attributes/ModdedNumberOptionAttribute.cs +++ b/MiraAPI/GameOptions/Attributes/ModdedNumberOptionAttribute.cs @@ -6,7 +6,7 @@ using MiraAPI.Utilities; namespace MiraAPI.GameOptions.Attributes; /// -/// A number option attribute for the modded options system. +/// Attribute for a . /// [AttributeUsage(AttributeTargets.Property)] public class ModdedNumberOptionAttribute( diff --git a/MiraAPI/GameOptions/Attributes/ModdedOptionAttribute.cs b/MiraAPI/GameOptions/Attributes/ModdedOptionAttribute.cs index 702d75e..02daa25 100644 --- a/MiraAPI/GameOptions/Attributes/ModdedOptionAttribute.cs +++ b/MiraAPI/GameOptions/Attributes/ModdedOptionAttribute.cs @@ -4,7 +4,7 @@ using System.Reflection; namespace MiraAPI.GameOptions.Attributes; /// -/// Represents an attribute that is used to define a modded option. +/// Represents an attribute that is used to define an . /// /// The option title. /// Optional parameter to specify a role Type. @@ -26,13 +26,13 @@ public abstract class ModdedOptionAttribute(string title, Type? roleType = null) /// /// Sets the value of the option. /// - /// The new value as an object. + /// The new value as an . public abstract void SetValue(object value); /// /// Gets the value of the option. /// - /// The value of the option as an object. + /// The value of the option as an . public abstract object GetValue(); internal abstract IModdedOption? CreateOption(object? value, PropertyInfo property); diff --git a/MiraAPI/GameOptions/Attributes/ModdedToggleOptionAttribute.cs b/MiraAPI/GameOptions/Attributes/ModdedToggleOptionAttribute.cs index 0ad64da..2fccf1f 100644 --- a/MiraAPI/GameOptions/Attributes/ModdedToggleOptionAttribute.cs +++ b/MiraAPI/GameOptions/Attributes/ModdedToggleOptionAttribute.cs @@ -5,7 +5,7 @@ using MiraAPI.GameOptions.OptionTypes; namespace MiraAPI.GameOptions.Attributes; /// -/// Attribute for a toggle option. +/// Attribute for a . /// /// The option title. [AttributeUsage(AttributeTargets.Property)] diff --git a/MiraAPI/GameOptions/IModdedOption.cs b/MiraAPI/GameOptions/IModdedOption.cs index 5a3c3f8..0de5212 100644 --- a/MiraAPI/GameOptions/IModdedOption.cs +++ b/MiraAPI/GameOptions/IModdedOption.cs @@ -22,22 +22,22 @@ public interface IModdedOption string Title { get; set; } /// - /// Gets the StringName for the option, used for localization. + /// Gets the for the option, used for localization. /// StringNames StringName { get; } /// - /// Gets or sets the MiraPlugin that created this option. + /// Gets or sets the that created this option. /// IMiraPlugin? ParentMod { get; set; } /// - /// Gets the game setting data for the option. + /// Gets the for the option. /// BaseGameSetting Data { get; } /// - /// Gets the OptionBehaviour object of the option. + /// Gets the object of the option. /// OptionBehaviour? OptionBehaviour { get; } @@ -52,31 +52,31 @@ public interface IModdedOption bool IncludeInPreset { get; set; } /// - /// Gets or sets the ConfigDefinition for the option, used for BepInEx configuration. + /// Gets or sets the for the option, used for BepInEx configuration. /// ConfigDefinition? ConfigDefinition { get; set; } /// /// Creates the option behaviour for the modded option. /// - /// The ToggleOption template. - /// The NumberOption template. - /// The StringOption template. - /// The PlayerOption template. - /// >The Transform container for the option. - /// >The created OptionBehaviour object. + /// The template. + /// The template. + /// The template. + /// The template. + /// >The container for the option. + /// >The created object. OptionBehaviour CreateOption(ToggleOption toggleOpt, NumberOption numberOpt, StringOption stringOpt, PlayerOption playerOpt, Transform container); /// - /// Gets the value as a float. + /// Gets the value as a . /// - /// >The value of the option as a float. + /// >The value of the option as a . float GetFloatData(); /// - /// Gets the NetData for the option, used for network synchronization. + /// Gets the for the option, used for network synchronization. /// - /// >Returns the NetData object for the option. + /// >Returns the object for the option. NetData GetNetData(); /// @@ -88,19 +88,19 @@ public interface IModdedOption /// /// Saves the option to a preset configuration file. /// - /// The ConfigFile representing the preset configuration. + /// The representing the preset configuration. /// Indicates whether to save the default value instead of the current value. void SaveToPreset(ConfigFile presetConfig, bool saveDefault = false); /// /// Binds the option to a configuration file. /// - /// The ConfigFile to bind the option to. + /// The to bind the option to. void Bind(ConfigFile config); /// /// Loads the option from a preset configuration file, applying the values to the option's configuration. /// - /// The ConfigFile representing the preset configuration. + /// The representing the preset configuration. void LoadFromPreset(ConfigFile presetConfig); } diff --git a/MiraAPI/GameOptions/MiraNumberOptionComponent.cs b/MiraAPI/GameOptions/MiraNumberOptionComponent.cs index dce033d..8cfa456 100644 --- a/MiraAPI/GameOptions/MiraNumberOptionComponent.cs +++ b/MiraAPI/GameOptions/MiraNumberOptionComponent.cs @@ -13,7 +13,7 @@ namespace MiraAPI.GameOptions; public class MiraNumberOptionComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) { /// - /// Gets or sets the modded option associated with the object. + /// Gets or sets the associated with the object. /// [HideFromIl2Cpp] public ModdedNumberOption NumberOption { get; set; } diff --git a/MiraAPI/GameOptions/ModdedOptionsManager.cs b/MiraAPI/GameOptions/ModdedOptionsManager.cs index 3b85a73..4ff527b 100644 --- a/MiraAPI/GameOptions/ModdedOptionsManager.cs +++ b/MiraAPI/GameOptions/ModdedOptionsManager.cs @@ -16,7 +16,7 @@ using Reactor.Utilities; namespace MiraAPI.GameOptions; /// -/// Handles modded options. +/// Handles s. /// public static class ModdedOptionsManager { diff --git a/MiraAPI/GameOptions/OptionGroupSingleton.cs b/MiraAPI/GameOptions/OptionGroupSingleton.cs index 53b2029..a521d7d 100644 --- a/MiraAPI/GameOptions/OptionGroupSingleton.cs +++ b/MiraAPI/GameOptions/OptionGroupSingleton.cs @@ -3,7 +3,7 @@ namespace MiraAPI.GameOptions; /// -/// Singleton for option groups. +/// Singleton for s. /// /// The option group type. public static class OptionGroupSingleton where T : AbstractOptionGroup @@ -11,7 +11,7 @@ public static class OptionGroupSingleton where T : AbstractOptionGroup private static T? _instance; /// - /// Gets the instance of the option group. + /// Gets the instance of the group. /// #pragma warning disable CA1000 public static T Instance => _instance ??= ModdedOptionsManager.Groups.OfType().Single(); diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs index 48f7451..1f92418 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs @@ -11,7 +11,7 @@ using Object = UnityEngine.Object; namespace MiraAPI.GameOptions.OptionTypes; /// -/// An option for selecting an enum value. +/// An option for selecting an value. /// public class ModdedEnumOption : ModdedOption { @@ -25,8 +25,8 @@ public class ModdedEnumOption : ModdedOption /// /// The title of the option. /// The default value as an int. - /// The Enum type. - /// An option list of string values to use in place of the enum name. + /// The type. + /// An option list of string values to use in place of the name. /// Whether to include this option in the preset or not. public ModdedEnumOption(string title, int defaultValue, Type enumType, string[]? values = null, bool includeInPreset=true) : base(title, defaultValue, includeInPreset) { @@ -104,13 +104,13 @@ public class ModdedEnumOption : ModdedOption } /// -/// An option for selecting an enum value. +/// An option for selecting an value. /// -/// The enum type. +/// The type. public class ModdedEnumOption : ModdedOption where T : Enum { /// - /// Gets the string values of the enum. + /// Gets the string values of the . /// public string[] Values { get; } @@ -118,8 +118,8 @@ public class ModdedEnumOption : ModdedOption where T : Enum /// Initializes a new instance of the class. /// /// The title of the option. - /// The default value as an int. - /// An option list of string values to use in place of the enum name. + /// The default value as an . + /// An option list of string values to use in place of the name. /// Whether to include this option in the preset or not. public ModdedEnumOption(string title, T defaultValue, string[]? values = null, bool includeInPreset=true) : base(title, defaultValue, includeInPreset) { diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs index b9a1f59..1a5ef33 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs @@ -237,7 +237,7 @@ public class ModdedNumberOption : ModdedOption } /// - /// Implicitly converts the option to an int. + /// Implicitly converts the option to an . /// /// The option. /// Integer value. diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs index dd2f772..1b30d16 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs @@ -9,7 +9,7 @@ using Object = UnityEngine.Object; namespace MiraAPI.GameOptions.OptionTypes; /// -/// An option for selecting an ingame player. It returns an index of the values list, NOT A PLAYER ID. To get a player out of this, index the Values list. +/// An option for selecting an ingame player. It returns an index of the values list, NOT A PLAYER ID. To get a player out of this, index the list. /// public class ModdedPlayerOption : ModdedOption { @@ -91,7 +91,7 @@ public class ModdedPlayerOption : ModdedOption } /// - /// Returns a player from the value. If AllowNone is enabled and none is enabled this will return null. + /// Returns a player from the value. If is enabled and none is enabled this will return null. /// /// A player or null if chosen none. public NetworkedPlayerInfo? GetPlayerValue() diff --git a/MiraAPI/Hud/ButtonLocation.cs b/MiraAPI/Hud/ButtonLocation.cs index da11737..a8045d7 100644 --- a/MiraAPI/Hud/ButtonLocation.cs +++ b/MiraAPI/Hud/ButtonLocation.cs @@ -1,7 +1,7 @@ namespace MiraAPI.Hud; /// -/// The location of the custom button on the screen. +/// The location of the on the screen. /// public enum ButtonLocation { diff --git a/MiraAPI/Hud/ButtonUsesMode.cs b/MiraAPI/Hud/ButtonUsesMode.cs index 2c43300..82558d7 100644 --- a/MiraAPI/Hud/ButtonUsesMode.cs +++ b/MiraAPI/Hud/ButtonUsesMode.cs @@ -1,7 +1,7 @@ namespace MiraAPI.Hud; /// -/// The uses mode for custom buttons. +/// The uses mode for s. /// public enum ButtonUsesMode { diff --git a/MiraAPI/Hud/CustomActionButton.cs b/MiraAPI/Hud/CustomActionButton.cs index e54c10c..4cac55e 100644 --- a/MiraAPI/Hud/CustomActionButton.cs +++ b/MiraAPI/Hud/CustomActionButton.cs @@ -18,7 +18,7 @@ using Object = UnityEngine.Object; namespace MiraAPI.Hud; /// -/// Class for making custom action buttons. More customizable than the default Action/Ability buttons in the base game. +/// Class for making custom action buttons. More customizable than the default /s in the base game. /// public abstract class CustomActionButton { @@ -84,12 +84,12 @@ public abstract class CustomActionButton public virtual BaseKeybind? Keybind => null; /// - /// Gets the button's text outline color. + /// Gets the button's text outline . /// public virtual Color TextOutlineColor => Color.clear; /// - /// Gets or sets the location of the button on the screen. + /// Gets or sets the on the screen. /// public virtual ButtonLocation Location { get; set; } = ButtonLocation.BottomLeft; @@ -119,12 +119,12 @@ public abstract class CustomActionButton public float Timer { get; set; } /// - /// Gets or sets the button object in game. This is created by Mira API automatically. + /// Gets or sets the object in game. This is created by Mira API automatically. /// public ActionButton? Button { get; set; } /// - /// Gets the gameObject used for the keybind icon. + /// Gets the used for the keybind icon. /// public GameObject? KeybindIcon { get; private set; } @@ -316,18 +316,18 @@ public abstract class CustomActionButton } /// - /// A utility function to change the outline color of the button's text. + /// A utility function to change the outline of the button's text. /// - /// The new color. + /// The new . public virtual void SetTextOutline(Color color) { Button?.buttonLabelText.SetOutlineColor(color); } /// - /// A utility function to override the sprite of the button. + /// A utility function to override the of the button. /// - /// The new sprite to override with. + /// The new to override with. public virtual void OverrideSprite(Sprite sprite) { if (Button != null) @@ -415,7 +415,7 @@ public abstract class CustomActionButton } /// - /// A utility function that runs with the local PlayerControl's FixedUpdate if the button is enabled. + /// A utility function that runs with the local player's if the button is enabled. /// /// the local PlayerControl. protected virtual void FixedUpdate(PlayerControl playerControl) @@ -431,7 +431,7 @@ public abstract class CustomActionButton /// This method determines if the button should be active or not. /// True means the button is active, false means the button is disabled. /// - /// The role of the local player. + /// The of the local player. /// True if the button is enabled, false otherwise. public abstract bool Enabled(RoleBehaviour? role); @@ -473,12 +473,12 @@ public abstract class CustomActionButton } /// - /// This method is called on the HudManager.SetHudActive method. It determines whether the button should be visible or not. + /// This method is called on the method. It determines whether the button should be visible or not. /// The default behavior is to show the button if the parameter and the method return true. /// It can be overridden for custom behavior. /// - /// Passed in from HudManager.SetHudActive, should hud be active. - /// Passed in from HudManager.SetHudActive, the current role of the player. + /// Passed in from , should hud be active. + /// Passed in from , the current role of the player. public virtual void SetActive(bool visible, RoleBehaviour role) { Button?.ToggleVisible(visible && Enabled(role)); @@ -522,7 +522,7 @@ public abstract class CustomActionButton } /// - /// This method is called on the PlayerControl.FixedUpdate method. It is a wrapper for the method. + /// This method is called on the method. It is a wrapper for the method. /// By default, it handles the cooldown and effect timers, and sets the button to enabled or disabled. /// It can be overridden for custom behavior. /// @@ -580,39 +580,39 @@ public abstract class CustomActionButton } /// -/// Custom action button that has a target object. +/// Custom action button that has a target . /// /// The type of the target object. public abstract class CustomActionButton : CustomActionButton where T : MonoBehaviour { /// - /// Gets or sets the target object of the button. + /// Gets or sets the target of the button. /// public T? Target { get; set; } /// - /// Gets the distance the player must be from the target object to use the button. + /// Gets the distance the player must be from the target to use the button. /// public virtual float Distance => PlayerControl.LocalPlayer.Data.Role.GetAbilityDistance(); /// - /// Determines if the target object is valid. + /// Determines if the target is valid. /// - /// The target object being checked. - /// True if the target object is valid, false otherwise. + /// The target being checked. + /// True if the target is valid, false otherwise. public virtual bool IsTargetValid(T? target) { return target != null; } /// - /// The method used to get the target object. + /// The method used to get the target . /// - /// The target object or null if it isn't found. + /// The target or null if it isn't found. public abstract T? GetTarget(); /// - /// Sets the outline of the target object. + /// Sets the outline of the target . /// /// Should the outline be active. public abstract void SetOutline(bool active); diff --git a/MiraAPI/Hud/CustomButtonManager.cs b/MiraAPI/Hud/CustomButtonManager.cs index 8e57c40..5a1ba3b 100644 --- a/MiraAPI/Hud/CustomButtonManager.cs +++ b/MiraAPI/Hud/CustomButtonManager.cs @@ -9,12 +9,12 @@ using UnityEngine; namespace MiraAPI.Hud; /// -/// Custom button manager for handling custom buttons. +/// Custom button manager for handling s. /// public static class CustomButtonManager { /// - /// Gets a list of all registered custom buttons. + /// Gets a list of all registered custom s. /// public static ReadOnlyCollection Buttons { get; internal set; } = new([]); diff --git a/MiraAPI/Hud/CustomButtonSingleton.cs b/MiraAPI/Hud/CustomButtonSingleton.cs index daa5467..957445b 100644 --- a/MiraAPI/Hud/CustomButtonSingleton.cs +++ b/MiraAPI/Hud/CustomButtonSingleton.cs @@ -4,7 +4,7 @@ using System.Linq; namespace MiraAPI.Hud; /// -/// A utility class to get the instance of a custom action button. +/// A utility class to get the instance of a . /// /// The type of the button you are trying to access. public static class CustomButtonSingleton where T : CustomActionButton @@ -12,7 +12,7 @@ public static class CustomButtonSingleton where T : CustomActionButton private static T? _instance; /// - /// Gets the instance of the button. + /// 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 custom action button.")] public static T Instance => _instance ??= CustomButtonManager.CustomButtons.OfType().Single(); diff --git a/MiraAPI/Hud/CustomPlayerMenu.cs b/MiraAPI/Hud/CustomPlayerMenu.cs index 56d9f0e..cf16706 100644 --- a/MiraAPI/Hud/CustomPlayerMenu.cs +++ b/MiraAPI/Hud/CustomPlayerMenu.cs @@ -15,9 +15,9 @@ using UnityEngine.Events; namespace MiraAPI.Hud; /// -/// Custom Player Menu using the ShapeshifterPanel as a base. +/// Custom Player Menu using the as a base. /// -/// Used by Il2Cpp. Do not use constructor, this is a MonoBehaviour. +/// Used by Il2Cpp. Do not use constructor, this is a . [RegisterInIl2Cpp] [SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Unity Convention")] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Unity Convention")] @@ -34,9 +34,9 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr) public List potentialVictims; /// - /// Creates a CustomPlayerMenu. + /// Creates a . /// - /// New CustomPlayerMenu object. + /// New object. public static CustomPlayerMenu Create() { var shapeShifterRole = RoleManager.Instance.GetRole(RoleTypes.Shapeshifter); @@ -84,7 +84,7 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr) /// Begins/opens the custom player menu. /// /// Function to determine if player should show in the custom menu. - /// Onclick action for player. + /// action for player. [HideFromIl2Cpp] public void Begin(Func playerMatch, Action onClick) { diff --git a/MiraAPI/Hud/MultiTargetButton.cs b/MiraAPI/Hud/MultiTargetButton.cs index 8c1ae34..8bdbbfd 100644 --- a/MiraAPI/Hud/MultiTargetButton.cs +++ b/MiraAPI/Hud/MultiTargetButton.cs @@ -6,7 +6,7 @@ using UnityEngine; namespace MiraAPI.Hud; /// -/// Custom action button that has multiple target objects. +/// that has multiple target objects. /// /// The type of the target objects. public abstract class MultiTargetButton : CustomActionButton where T : MonoBehaviour @@ -37,7 +37,7 @@ public abstract class MultiTargetButton : CustomActionButton where T : MonoBe public abstract T[] GetTargets(); /// - /// The target object to set the oultine. + /// The target to set the oultine. public abstract void SetOutline(T target, bool active); /// diff --git a/MiraAPI/Keybinds/KeybindManager.cs b/MiraAPI/Keybinds/KeybindManager.cs index c4e1cd1..207fab5 100644 --- a/MiraAPI/Keybinds/KeybindManager.cs +++ b/MiraAPI/Keybinds/KeybindManager.cs @@ -9,12 +9,12 @@ using Rewired; namespace MiraAPI.Keybinds; /// -/// Lets you register and manage mod keybinds with conflict checks and rebinding support. +/// Lets you register and manage mod s with conflict checks and rebinding support. /// public static class KeybindManager { /// - /// Gets a list of all registered keybinds. + /// Gets a list of all registered s. /// public static List Keybinds { get; } = new(); @@ -49,7 +49,7 @@ public static class KeybindManager } /// - /// Returns all conflicts where keybinds use the same key. + /// Returns all conflicts where s use the same key. /// /// A list of pairs of keybinds that conflict. public static Dictionary> GetConflicts() @@ -77,11 +77,11 @@ public static class KeybindManager } /// - /// Returns all keybinds for a specified keycode. + /// Returns all s for a specified keycode. /// /// The key to look for. /// /// Should only exlusive keybinds be present. - /// The list of keybinds. + /// The list of s. public static MiraKeybind[] GetKeybindsForKey(KeyboardKeyCode keyCode, bool exclusiveCheck = false) { var all = new List(); diff --git a/MiraAPI/Keybinds/KeybindUtils.cs b/MiraAPI/Keybinds/KeybindUtils.cs index f4371b3..7a316be 100644 --- a/MiraAPI/Keybinds/KeybindUtils.cs +++ b/MiraAPI/Keybinds/KeybindUtils.cs @@ -14,9 +14,9 @@ public static class KeybindUtils public static InputManager_Base? RewiredInputManager { get; internal set; } /// - /// Returns the currently assigned keycode of a keybind. + /// Returns the currently assigned keycode of a . /// - /// The keybind to get the keycode from. + /// The to get the keycode from. /// The currently assigned keycode. public static KeyboardKeyCode GetKeycodeByKeybind(BaseKeybind keybind) { @@ -29,7 +29,7 @@ public static class KeybindUtils } /// - /// Gets the keycode for an action with ReInput. + /// Gets the keycode for an action with . /// /// The action ID. /// The keyboard keycode. @@ -39,7 +39,7 @@ public static class KeybindUtils } /// - /// Gets a by id with ReInput. + /// Gets a by id with . /// /// The action ID. /// The keyboard keycode. @@ -65,7 +65,7 @@ public static class KeybindUtils /// The KeyCode to skip during the search. /// /// The first available KeyCode not currently used by any registered keybind, - /// or KeyCode.None if none are available. + /// or if none are available. /// public static KeyboardKeyCode FindAvailableKey(KeyboardKeyCode exclude) { diff --git a/MiraAPI/Keybinds/MiraGlobalKeybinds.cs b/MiraAPI/Keybinds/MiraGlobalKeybinds.cs index ab41c2c..f945ca9 100644 --- a/MiraAPI/Keybinds/MiraGlobalKeybinds.cs +++ b/MiraAPI/Keybinds/MiraGlobalKeybinds.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Keybinds; /// -/// Class containing all default keybinds. +/// Class containing all default s. /// Recommended for cross-mod compatibility. /// [RegisterCustomKeybinds] diff --git a/MiraAPI/Keybinds/MiraKeybind.cs b/MiraAPI/Keybinds/MiraKeybind.cs index 0ce47ea..d2b5847 100644 --- a/MiraAPI/Keybinds/MiraKeybind.cs +++ b/MiraAPI/Keybinds/MiraKeybind.cs @@ -19,8 +19,8 @@ public class MiraKeybind : BaseKeybind public KeyboardKeyCode DefaultKey { get; } /// - /// Gets the modifier keys assigned to this keybind. - /// Due to Rewired limitations, there can only be 3 modifier keys. + /// Gets the s assigned to this keybind. + /// Due to Rewired limitations, there can only be 3 s. /// public ModifierKey[] ModifierKeys { get; } @@ -36,7 +36,7 @@ public class MiraKeybind : BaseKeybind /// /// The name of the keybind. /// The default keycode. - /// Up to 3 optional modifier keys. + /// Up to 3 optional s. /// Is exclusive. public MiraKeybind( string name, diff --git a/MiraAPI/Keybinds/RegisterCustomKeybindsAttribute.cs b/MiraAPI/Keybinds/RegisterCustomKeybindsAttribute.cs index 3af9f4e..088f158 100644 --- a/MiraAPI/Keybinds/RegisterCustomKeybindsAttribute.cs +++ b/MiraAPI/Keybinds/RegisterCustomKeybindsAttribute.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Keybinds; /// -/// Used to mark a class for custom keybinds registration. +/// Used to mark a class for s registration. /// [AttributeUsage(AttributeTargets.Class)] public class RegisterCustomKeybindsAttribute : Attribute; diff --git a/MiraAPI/Keybinds/VanillaKeybindSingleton.cs b/MiraAPI/Keybinds/VanillaKeybindSingleton.cs index 980da77..5876fcb 100644 --- a/MiraAPI/Keybinds/VanillaKeybindSingleton.cs +++ b/MiraAPI/Keybinds/VanillaKeybindSingleton.cs @@ -1,15 +1,15 @@ namespace MiraAPI.Keybinds; /// -/// Singleton for getting a vanilla keybind by . +/// Singleton for getting a by . /// -/// ActionButton type. +/// type. public static class VanillaKeybinding where T : ActionButton { private static VanillaKeybind? _instance; /// - /// Gets the instance of the option group. + /// Gets the instance of the . /// #pragma warning disable CA1000 public static VanillaKeybind Instance => _instance ??= KeybindManager.VanillaKeybinds[typeof(T)]; diff --git a/MiraAPI/LocalSettings/Attributes/LocalEnumSettingAttribute.cs b/MiraAPI/LocalSettings/Attributes/LocalEnumSettingAttribute.cs index f114818..c0608ff 100644 --- a/MiraAPI/LocalSettings/Attributes/LocalEnumSettingAttribute.cs +++ b/MiraAPI/LocalSettings/Attributes/LocalEnumSettingAttribute.cs @@ -5,9 +5,9 @@ using MiraAPI.LocalSettings.SettingTypes; namespace MiraAPI.LocalSettings.Attributes; /// -/// Creates an enum setting for the . +/// Creates a for the . /// -/// Optional custom enum names. +/// Optional custom names. /// [AttributeUsage(AttributeTargets.Property)] public class LocalEnumSettingAttribute( diff --git a/MiraAPI/LocalSettings/Attributes/LocalNumberSettingAttribute.cs b/MiraAPI/LocalSettings/Attributes/LocalNumberSettingAttribute.cs index 79d4cc7..b5d681c 100644 --- a/MiraAPI/LocalSettings/Attributes/LocalNumberSettingAttribute.cs +++ b/MiraAPI/LocalSettings/Attributes/LocalNumberSettingAttribute.cs @@ -6,7 +6,7 @@ using MiraAPI.Utilities; namespace MiraAPI.LocalSettings.Attributes; /// -/// Creates a number setting for the . +/// Creates a for the . /// /// Minimum range. /// Maximum range. diff --git a/MiraAPI/LocalSettings/Attributes/LocalSettingAttribute.cs b/MiraAPI/LocalSettings/Attributes/LocalSettingAttribute.cs index d966cbb..5aaef81 100644 --- a/MiraAPI/LocalSettings/Attributes/LocalSettingAttribute.cs +++ b/MiraAPI/LocalSettings/Attributes/LocalSettingAttribute.cs @@ -15,10 +15,10 @@ public abstract class LocalSettingAttribute( ) : Attribute { /// - /// Returns the created setting object. + /// Returns the created object. /// /// Gets the tab where the setting is located. /// Gets the config entry the setting is attached to. - /// The created class. + /// The created . public abstract ILocalSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase); } diff --git a/MiraAPI/LocalSettings/Attributes/LocalSliderSettingAttribute.cs b/MiraAPI/LocalSettings/Attributes/LocalSliderSettingAttribute.cs index c8e5712..9e14a8e 100644 --- a/MiraAPI/LocalSettings/Attributes/LocalSliderSettingAttribute.cs +++ b/MiraAPI/LocalSettings/Attributes/LocalSliderSettingAttribute.cs @@ -6,7 +6,7 @@ using MiraAPI.Utilities; namespace MiraAPI.LocalSettings.Attributes; /// -/// Creates a slider setting for the . +/// Creates a for the . /// /// /// Minimum range. diff --git a/MiraAPI/LocalSettings/Attributes/LocalToggleSettingAttribute.cs b/MiraAPI/LocalSettings/Attributes/LocalToggleSettingAttribute.cs index 2d2aa14..22ca7aa 100644 --- a/MiraAPI/LocalSettings/Attributes/LocalToggleSettingAttribute.cs +++ b/MiraAPI/LocalSettings/Attributes/LocalToggleSettingAttribute.cs @@ -5,7 +5,7 @@ using MiraAPI.LocalSettings.SettingTypes; namespace MiraAPI.LocalSettings.Attributes; /// -/// Creates a toggle setting for the . +/// Creates a for the . /// /// [AttributeUsage(AttributeTargets.Property)] diff --git a/MiraAPI/LocalSettings/ILocalSetting.cs b/MiraAPI/LocalSettings/ILocalSetting.cs index a94e102..b51a13d 100644 --- a/MiraAPI/LocalSettings/ILocalSetting.cs +++ b/MiraAPI/LocalSettings/ILocalSetting.cs @@ -19,7 +19,7 @@ public interface ILocalSetting string Description { get; } /// - /// Gets the setting's gameobject. + /// Gets the setting's . /// GameObject? Setting { get; } @@ -31,12 +31,12 @@ public interface ILocalSetting /// /// Used to create the setting. /// - /// Toggle template. - /// Slider template. - /// The parent of the setting. + /// template. + /// template. + /// The parent of the setting. /// The offset. /// The order. /// Whether it's the last on the row. - /// The created setting. + /// The created setting's . GameObject? CreateOption(ToggleButtonBehaviour toggle, SlideBar slider, Transform parent, ref float offset, ref int order, bool last); } diff --git a/MiraAPI/LocalSettings/LocalSettingsButton.cs b/MiraAPI/LocalSettings/LocalSettingsButton.cs index fa0c0bf..6f1fa57 100644 --- a/MiraAPI/LocalSettings/LocalSettingsButton.cs +++ b/MiraAPI/LocalSettings/LocalSettingsButton.cs @@ -10,7 +10,7 @@ using Object = UnityEngine.Object; namespace MiraAPI.LocalSettings; /// -/// Represents a local settings button. +/// Represents a button. /// public class LocalSettingsButton(string text, Action onClick) { @@ -25,7 +25,7 @@ public class LocalSettingsButton(string text, Action onClick) public Action OnClick { get; set; } = onClick; /// - /// Gets the tab instance this button belongs to. + /// Gets the instance this button belongs to. /// public LocalSettingsTab? Tab { get; internal set; } diff --git a/MiraAPI/LocalSettings/LocalSettingsManager.cs b/MiraAPI/LocalSettings/LocalSettingsManager.cs index 79e15f7..2f6fc16 100644 --- a/MiraAPI/LocalSettings/LocalSettingsManager.cs +++ b/MiraAPI/LocalSettings/LocalSettingsManager.cs @@ -8,7 +8,7 @@ using Reactor.Utilities; namespace MiraAPI.LocalSettings; /// -/// Manages local settings. +/// Manages s. /// public static class LocalSettingsManager { diff --git a/MiraAPI/LocalSettings/LocalSettingsTab.cs b/MiraAPI/LocalSettings/LocalSettingsTab.cs index 8b9ede8..074d7db 100644 --- a/MiraAPI/LocalSettings/LocalSettingsTab.cs +++ b/MiraAPI/LocalSettings/LocalSettingsTab.cs @@ -23,7 +23,7 @@ public abstract class LocalSettingsTab(ConfigFile config) public abstract string TabName { get; } /// - /// Gets the tab appearance. + /// Gets the tab's . /// public virtual LocalSettingTabAppearance TabAppearance { get; } = new(); @@ -38,7 +38,7 @@ public abstract class LocalSettingsTab(ConfigFile config) protected virtual bool ShouldCreateLabels => true; /// - /// Gets the mod's config file. Automatically found in the plugin loader. + /// Gets the mod's . Automatically found in the plugin loader. /// public ConfigFile Config { get; } = config ?? throw new ArgumentNullException(nameof(config)); @@ -48,12 +48,12 @@ public abstract class LocalSettingsTab(ConfigFile config) public TabGroup? TabButton { get; internal set; } /// - /// Gets the list of settings. + /// Gets the list of s. /// public List Settings { get; } = []; /// - /// Gets the list of buttons. + /// Gets the list of s. /// public List Buttons { get; } = []; diff --git a/MiraAPI/LocalSettings/LocalSettingsTabAppearance.cs b/MiraAPI/LocalSettings/LocalSettingsTabAppearance.cs index 9692be4..34b3646 100644 --- a/MiraAPI/LocalSettings/LocalSettingsTabAppearance.cs +++ b/MiraAPI/LocalSettings/LocalSettingsTabAppearance.cs @@ -4,93 +4,93 @@ using UnityEngine; namespace MiraAPI.LocalSettings; /// -/// Struct for modifying tab appearance. +/// Struct for modifying appearance. /// Defines how the settings look. /// public record struct LocalSettingTabAppearance() { /// - /// Gets or sets main color of the tab. + /// Gets or sets the main of the . /// public Color TabColor { get; set; } = Color.white; /// - /// Gets or sets tab button icon. No icon by default. + /// Gets or sets the button icon. No icon by default. /// public LoadableAsset? TabIcon { get; set; } /// - /// Gets or sets color of the tab button. + /// Gets or sets the of the button. /// public Color TabButtonColor { get; set; } = Color.white; /// - /// Gets or sets a value indicating whether the icon should be hidden when tab button is hovered. + /// Gets or sets a value indicating whether the icon should be hidden when the button is hovered. /// public bool HideIconOnHover { get; set; } = true; /// - /// Gets or sets hover color of the tab button. + /// Gets or sets the hover of the button. /// public Color TabButtonHoverColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets active color of the tab button. + /// Gets or sets the active of the button. /// public Color TabButtonActiveColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets hover color of toggles. + /// Gets or sets the hover of s. /// public Color ToggleHoverColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets active color of toggles. + /// Gets or sets the active of s. /// public Color ToggleActiveColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets inactive color of toggles. + /// Gets or sets the inactive of s. /// public Color ToggleInactiveColor { get; set; } = Color.red; /// - /// Gets or sets color of number buttons. + /// Gets or sets the of buttons. /// public Color NumberColor { get; set; } = Color.white; /// - /// Gets or sets hover color of number buttons. + /// Gets or sets the hover of buttons. /// public Color NumberHoverColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets color of sliders. + /// Gets or sets the of s. /// public Color SliderColor { get; set; } = Color.white; /// - /// Gets or sets hover color of sliders. + /// Gets or sets the hover of s. /// public Color SliderHoverColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets color of enum buttons. + /// Gets or sets the of buttons. /// public Color EnumColor { get; set; } = Color.white; /// - /// Gets or sets hover color of enum buttons. + /// Gets or sets the hover of buttons. /// public Color EnumHoverColor { get; set; } = Palette.AcceptedGreen; /// - /// Gets or sets color of buttons. + /// Gets or sets the of buttons. /// public Color ButtonColor { get; set; } = Color.white; /// - /// Gets or sets hover color of buttons. + /// Gets or sets the hover of buttons. /// public Color ButtonHoverColor { get; set; } = Palette.AcceptedGreen; } diff --git a/MiraAPI/LocalSettings/LocalSettingsTabSingleton.cs b/MiraAPI/LocalSettings/LocalSettingsTabSingleton.cs index eec81a2..a435fa4 100644 --- a/MiraAPI/LocalSettings/LocalSettingsTabSingleton.cs +++ b/MiraAPI/LocalSettings/LocalSettingsTabSingleton.cs @@ -3,7 +3,7 @@ namespace MiraAPI.LocalSettings; /// -/// Singleton for local settings tabs. +/// Singleton for s. /// /// The settings tab type. public static class LocalSettingsTabSingleton where T : LocalSettingsTab @@ -11,7 +11,7 @@ public static class LocalSettingsTabSingleton where T : LocalSettingsTab private static T? _instance; /// - /// Gets the instance of the setting tab. + /// Gets the instance of the setting tab. /// #pragma warning disable CA1000 public static T Instance => _instance ??= LocalSettingsManager.Tabs.OfType().Single(); diff --git a/MiraAPI/LocalSettings/SettingTypes/LocalEnumSetting.cs b/MiraAPI/LocalSettings/SettingTypes/LocalEnumSetting.cs index 437eed1..78b0278 100644 --- a/MiraAPI/LocalSettings/SettingTypes/LocalEnumSetting.cs +++ b/MiraAPI/LocalSettings/SettingTypes/LocalEnumSetting.cs @@ -11,17 +11,17 @@ using Object = UnityEngine.Object; namespace MiraAPI.LocalSettings.SettingTypes; /// -/// Local setting class for enums. +/// Local setting class for s. /// public class LocalEnumSetting : LocalSettingBase { /// - /// Gets the enum type of the setting. + /// Gets the type of the setting. /// public Type EnumType { get; } /// - /// Gets the enum values. + /// Gets the values. /// public string[] Values { get; } @@ -29,8 +29,8 @@ public class LocalEnumSetting : LocalSettingBase /// Initializes a new instance of the class. /// /// - /// The enum type. - /// The optional values array to replace the enum names. + /// The type. + /// The optional values array to replace the names. public LocalEnumSetting( Type tab, ConfigEntryBase configEntry, diff --git a/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs b/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs index c25f04e..3f87a48 100644 --- a/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs +++ b/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs @@ -56,9 +56,9 @@ public abstract class LocalSettingBase : ILocalSetting } /// - /// Gets the value of the config entry, cast to the setting type. + /// Gets the value of the config entry, cast to . /// - /// The value. + /// The value. public virtual T GetValue() { return (T)ConfigEntry.BoxedValue; diff --git a/MiraAPI/MiraApiSettings.cs b/MiraAPI/MiraApiSettings.cs index 8e87bde..fbead71 100644 --- a/MiraAPI/MiraApiSettings.cs +++ b/MiraAPI/MiraApiSettings.cs @@ -9,7 +9,7 @@ using UnityEngine; namespace MiraAPI; /// -/// Mira API Config File Handler. +/// Mira API Handler. /// public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config) { diff --git a/MiraAPI/Modifiers/AssignmentConfiguration.cs b/MiraAPI/Modifiers/AssignmentConfiguration.cs index fd4f3ba..b594820 100644 --- a/MiraAPI/Modifiers/AssignmentConfiguration.cs +++ b/MiraAPI/Modifiers/AssignmentConfiguration.cs @@ -1,10 +1,10 @@ namespace MiraAPI.Modifiers; /// -/// Represents the assignment configuration for a game modifier. +/// Represents the assignment configuration for a . /// -/// The default amount of players that can have this modifier in a game. -/// The default chance of the modifier being assigned to a player. -/// Whether Mira should create an amount option for the modifier. -/// Whether Mira should create a chance option for the modifier. +/// The default amount of players that can have this in a game. +/// The default chance of the being assigned to a player. +/// Whether Mira should create an amount option for the . +/// Whether Mira should create a chance option for the . public record struct AssignmentConfiguration(int DefaultAmount, int DefaultChance, bool CreateAmountOption, bool CreateChanceOption); diff --git a/MiraAPI/Modifiers/BaseModifier.cs b/MiraAPI/Modifiers/BaseModifier.cs index 0e31779..dd4ac9f 100644 --- a/MiraAPI/Modifiers/BaseModifier.cs +++ b/MiraAPI/Modifiers/BaseModifier.cs @@ -12,12 +12,12 @@ namespace MiraAPI.Modifiers; public abstract class BaseModifier : IOptionable { /// - /// Gets the player that the modifier is attached to. + /// Gets the that the modifier is attached to. /// public PlayerControl Player { get; internal set; } = null!; /// - /// Gets the modifier component that the modifier is attached to. + /// Gets the that the modifier is attached to. /// public ModifierComponent? ModifierComponent { get; internal set; } @@ -50,7 +50,7 @@ public abstract class BaseModifier : IOptionable public abstract string ModifierName { get; } /// - /// Gets the modifier icon. Useless if HideOnUi is true. + /// Gets the modifier icon. Useless if is true. /// public virtual LoadableAsset? ModifierIcon => null; @@ -65,7 +65,7 @@ public abstract class BaseModifier : IOptionable public virtual bool ShowInFreeplay => false; /// - /// Gets a value indicating the color that should be used for the modifier within freeplay. + /// Gets a value indicating the that should be used for the modifier within freeplay. /// public virtual Color FreeplayFileColor => Color.gray; @@ -95,14 +95,14 @@ public abstract class BaseModifier : IOptionable } /// - /// Called when the modifier is updated. Attached to the ModifierComponent's Update method. + /// Called when the modifier is updated. Attached to 's method. /// public virtual void Update() { } /// - /// Called when the modifier is updated. Attached to the ModifierComponent's FixedUpdate method. + /// Called when the modifier is updated. Attached to 's method. /// public virtual void FixedUpdate() { diff --git a/MiraAPI/Modifiers/ModifierComponent.cs b/MiraAPI/Modifiers/ModifierComponent.cs index d64f366..e8a7de3 100644 --- a/MiraAPI/Modifiers/ModifierComponent.cs +++ b/MiraAPI/Modifiers/ModifierComponent.cs @@ -15,13 +15,13 @@ using UnityEngine; namespace MiraAPI.Modifiers; /// -/// The component for handling modifiers. +/// The component for handling s. /// [RegisterInIl2Cpp] public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) { /// - /// Gets the active modifiers on the player. + /// Gets the active s on the player. /// [HideFromIl2Cpp] public ImmutableList ActiveModifiers { get; private set; } = ImmutableList.Empty; @@ -165,11 +165,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a collection of modifiers by type. + /// Gets a collection of . /// - /// The predicate to check the modifier by. - /// The Type of the Modifier. - /// A collection of modifiers. + /// The predicate to check the by. + /// The Type of the e. + /// An of s. [HideFromIl2Cpp] public IEnumerable GetModifiers(Func? predicate=null) where T : BaseModifier { @@ -177,11 +177,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a collection of modifiers by type. + /// Gets a collection of s by type. /// /// The modifier type. - /// The predicate to check the modifier by. - /// A collection of modifiers. + /// The predicate to check the by. + /// An of s. [HideFromIl2Cpp] public IEnumerable GetModifiers(Type type, Func? predicate=null) { @@ -189,11 +189,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a collection of modifiers by type ID. + /// Gets a collection of s by type ID. /// - /// The modifier's type ID. - /// The predicate to check the modifier by. - /// A collection of modifiers. + /// The 's type ID. + /// The predicate to check the by. + /// An of s. [HideFromIl2Cpp] public IEnumerable GetModifiers(uint id, Func? predicate=null) { @@ -204,12 +204,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Tries to get a modifier by its type. + /// Tries to get a . /// - /// The modifier or null. - /// The predicate to check the modifier by. - /// The Type of the Modifier. - /// True if the modifier was found, false otherwise. + /// The or null. + /// The predicate to check the by. + /// The Type of the . + /// True if the was found, false otherwise. [HideFromIl2Cpp] public bool TryGetModifier([NotNullWhen(true)] out T? modifier, Func? predicate = null) where T : BaseModifier { @@ -218,12 +218,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Tries to get a modifier by its type. + /// Tries to get a by its type. /// /// The modifier type. - /// The modifier or null. - /// The predicate to check the modifier by. - /// True if the modifier was found, false otherwise. + /// The or null. + /// The predicate to check the by. + /// True if the was found, false otherwise. [HideFromIl2Cpp] public bool TryGetModifier(Type type, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { @@ -232,12 +232,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Tries to get a modifier by its type ID. + /// Tries to get a by its type ID. /// - /// The modifier type ID. - /// The modifier or null. - /// The predicate to check the modifier by. - /// True if the modifier was found, false otherwise. + /// The 's type ID. + /// The or null. + /// The predicate to check the by. + /// True if the was found, false otherwise. [HideFromIl2Cpp] public bool TryGetModifier(uint id, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { @@ -246,11 +246,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Tries to get a modifier by its unique ID. + /// Tries to get a by its unique ID. /// - /// The modifier unique ID. - /// The modifier or null. - /// True if the modifier was found, false otherwise. + /// The 's unique ID. + /// The or null. + /// True if the was found, false otherwise. [HideFromIl2Cpp] public bool TryGetModifier(Guid modifierGuid, [NotNullWhen(true)] out BaseModifier? modifier) { @@ -259,11 +259,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a modifier by its type. + /// Gets a . /// - /// The predicate to check the modifier by. - /// The Type of the Modifier. - /// The Modifier if it is found, null otherwise. + /// The predicate to check the by. + /// The Type of the . + /// The if it is found, null otherwise. [HideFromIl2Cpp] public T? GetModifier(Func? predicate = null) where T : BaseModifier { @@ -271,11 +271,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a modifier by its type. + /// Gets a by its type. /// /// The modifier type. - /// The predicate to check the modifier by. - /// The Modifier if it is found, null otherwise. + /// The predicate to check the by. + /// The if it is found, null otherwise. [HideFromIl2Cpp] public BaseModifier? GetModifier(Type type, Func? predicate = null) { @@ -283,11 +283,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a modifier by its type ID. + /// Gets a by its type ID. /// - /// The modifier ID. - /// The predicate to check the modifier by. - /// The Modifier if it is found, null otherwise. + /// The ID. + /// The predicate to check the by. + /// The if it is found, null otherwise. [HideFromIl2Cpp] public BaseModifier? GetModifier(uint id, Func? predicate = null) { @@ -298,10 +298,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Gets a modifier by unique ID. + /// Gets a by unique ID. /// - /// The modifier's unique ID. - /// The modifier if it is found, or null. + /// The 's unique ID. + /// The if it is found, or null. [HideFromIl2Cpp] public BaseModifier? GetModifier(Guid modifierGuid) { @@ -309,10 +309,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Removes a modifier from the player. + /// Removes a from the player. /// - /// The modifier type. - /// The predicate to check the modifier by. + /// The type. + /// The predicate to check the by. [HideFromIl2Cpp] public void RemoveModifier(Func? predicate = null) where T : BaseModifier { @@ -320,10 +320,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Removes a modifier from the player. + /// Removes a from the player. /// /// The modifier type. - /// The predicate to check the modifier by. + /// The predicate to check the by. [HideFromIl2Cpp] public void RemoveModifier(Type type, Func? predicate = null) { @@ -344,9 +344,9 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Removes a modifier from the player. + /// Removes a from the player. /// - /// The modifier object. + /// The object. [HideFromIl2Cpp] public void RemoveModifier(BaseModifier modifier) { @@ -360,10 +360,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Removes a modifier from the player. + /// Removes a from the player. /// - /// The modifier's type ID. - /// The predicate to check the modifier by. + /// The 's type ID. + /// The predicate to check the by. [HideFromIl2Cpp] public void RemoveModifier(uint typeId, Func? predicate = null) { @@ -373,9 +373,9 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Removes a modifier from the player. + /// Removes a from the player. /// - /// The modifier's unique ID. + /// The 's unique ID. [HideFromIl2Cpp] public void RemoveModifier(Guid uniqueId) { @@ -390,11 +390,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Adds a modifier to the player. + /// Adds a to the player. /// - /// The arguments to initialize the modifier constructor with. - /// The Type of the modifier. - /// The new modifier. + /// The arguments to initialize the with. + /// The Type of the . + /// The new . [HideFromIl2Cpp] public T? AddModifier(params object[] args) where T : BaseModifier { @@ -402,10 +402,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Adds a modifier to the player. + /// Adds a to the player. /// - /// The modifier to add. - /// The modifier that was added. + /// The to add. + /// The that was added. [HideFromIl2Cpp] public BaseModifier? AddModifier(BaseModifier modifier) { @@ -439,11 +439,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Adds a modifier to the player. + /// Adds a to the player. /// /// The modifier type. - /// The arguments to initialize the modifier constructor with. - /// The modifier that was added. + /// The arguments to initialize the with. + /// The that was added. [HideFromIl2Cpp] public BaseModifier? AddModifier(Type type, params object[] args) { @@ -465,11 +465,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Adds a modifier to the player. + /// Adds a to the player. /// - /// The ID of the modifier. - /// The arguments to initialize the modifier constructor with. - /// The modifier if it was created, or null if it failed. + /// The ID of the . + /// The arguments to initialize the with. + /// The if it was created, or null if it failed. [HideFromIl2Cpp] public BaseModifier? AddModifier(uint id, params object[] args) { @@ -480,11 +480,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its type. + /// Checks if a player has an active . /// - /// The predicate to check the modifier. - /// The Type of the Modifier. - /// True if the Modifier is present, false otherwise. + /// The predicate to check the . + /// The Type of the . + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(Func? predicate=null) where T : BaseModifier { @@ -492,11 +492,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its type. + /// Checks if a player has an active by its type. /// /// The modifier type. - /// The predicate to check the modifier. - /// True if the Modifier is present, false otherwise. + /// The predicate to check the . + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(Type type, Func? predicate=null) { @@ -504,11 +504,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its type ID. + /// Checks if a player has an active by its type ID. /// - /// The modifier's type ID. - /// The predicate to check the modifier. - /// True if the modifier is present, false otherwise. + /// The 's type ID. + /// The predicate to check the . + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(uint id, Func? predicate=null) { @@ -519,10 +519,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its unique ID. + /// Checks if a player has an active by its unique ID. /// - /// The modifier's guid. - /// True if the modifier is present, false otherwise. + /// The 's guid. + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(Guid id) { @@ -530,12 +530,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its type. + /// Checks if a player has an active . /// - /// Whether to check inactive modifiers (those pending to be added). - /// The predicate to check the modifier. - /// The Type of the Modifier. - /// True if the Modifier is present, false otherwise. + /// Whether to check inactive s (those pending to be added). + /// The predicate to check the . + /// The Type of the . + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(bool checkInactive, Func? predicate=null) where T : BaseModifier { @@ -544,12 +544,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its type. + /// Checks if a player has an active by its type. /// /// The modifier type. - /// Whether to check inactive modifiers (those pending to be added). - /// The predicate to check the modifier. - /// True if the Modifier is present, false otherwise. + /// Whether to check inactive s (those pending to be added). + /// The predicate to check the . + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(Type type, bool checkInactive, Func? predicate=null) { @@ -558,12 +558,12 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its type ID. + /// Checks if a player has an active by its type ID. /// - /// The modifier's type ID. - /// Whether to check inactive modifiers (those pending to be added). - /// The predicate to check the modifier. - /// True if the modifier is present, false otherwise. + /// The 's type ID. + /// Whether to check inactive s (those pending to be added). + /// The predicate to check the . + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(uint id, bool checkInactive, Func? predicate=null) { @@ -574,11 +574,11 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) } /// - /// Checks if a player has an active modifier by its unique ID. + /// Checks if a player has an active by its unique ID. /// - /// The modifier's guid. - /// Whether to check inactive modifiers (those pending to be added). - /// True if the modifier is present, false otherwise. + /// The 's guid. + /// Whether to check inactive s (those pending to be added). + /// True if the is present, false otherwise. [HideFromIl2Cpp] public bool HasModifier(Guid id, bool checkInactive) { diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs index 2982f67..fb24d6f 100644 --- a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs +++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs @@ -15,13 +15,13 @@ using UnityEngine.UI; namespace MiraAPI.Modifiers.ModifierDisplay; /// -/// The code used to display Mira modifiers. +/// The code used to display s. /// [RegisterInIl2Cpp] public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) { /// - /// Gets the instance of the Modifier Display. + /// Gets the instance of the . /// public static ModifierDisplayComponent? Instance { get; private set; } @@ -41,7 +41,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) private readonly Dictionary _modifiers = []; /// - /// Gets a read only dictionary of the created modifier UI components. + /// Gets a of the created s. /// [HideFromIl2Cpp] public ReadOnlyDictionary Modifiers => new(_modifiers); @@ -108,7 +108,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) } /// - /// Use this to refresh the modifiers UI. Useful if you hide modifiers uis based on options. + /// Use this to refresh the modifiers UI. Useful if you hide modifiers UIs based on options. /// public void RefreshModifiers() { diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierUiComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierUiComponent.cs index ef8b0bb..66ded67 100644 --- a/MiraAPI/Modifiers/ModifierDisplay/ModifierUiComponent.cs +++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierUiComponent.cs @@ -6,13 +6,13 @@ using UnityEngine; namespace MiraAPI.Modifiers.ModifierDisplay; /// -/// The code placed on every Modifier HUD object. Used to handle updating. +/// The code placed on every HUD object. Used to handle updating. /// [RegisterInIl2Cpp] public class ModifierUiComponent(nint cppPtr) : MonoBehaviour(cppPtr) { /// - /// Gets the modifier which this component is for. + /// Gets the which this component is for. /// [HideFromIl2Cpp] public BaseModifier? Modifier { get; internal set; } diff --git a/MiraAPI/Modifiers/ModifierExtensions.cs b/MiraAPI/Modifiers/ModifierExtensions.cs index 7a0ef23..ad10adb 100644 --- a/MiraAPI/Modifiers/ModifierExtensions.cs +++ b/MiraAPI/Modifiers/ModifierExtensions.cs @@ -10,21 +10,21 @@ using Reactor.Utilities; namespace MiraAPI.Modifiers; /// -/// Extensions for modifiers. +/// Extensions for s. /// public static class ModifierExtensions { /// - /// Gets the dictionary to cache ModifierComponents. + /// Gets the to cache s. /// public static Dictionary ModifierComponents { get; } = []; /// - /// Remote Procedure Call to add a modifier to a player. + /// Remote Procedure Call to add a to a . /// - /// The player to add the modifier to. - /// The modifier type ID. - /// The arguments to initialize the modifier constructor with. + /// The to add the to. + /// The type ID. + /// The arguments to initialize the with. public static void RpcAddModifier(this PlayerControl target, uint typeId, params object[] args) { _ = ModifierManager.GetModifierType(typeId) ?? throw new InvalidOperationException( @@ -34,11 +34,11 @@ public static class ModifierExtensions } /// - /// Remote Procedure Call to add a modifier to a player. + /// Remote Procedure Call to add a to a . /// - /// The player to add the modifier to. - /// The type of the modifier. - /// The arguments to initialize the modifier constructor with. + /// The to add the to. + /// The type of the . + /// The arguments to initialize the with. public static void RpcAddModifier(this PlayerControl player, Type type, params object[] args) { var id = ModifierManager.GetModifierTypeId(type) ?? throw new InvalidOperationException( @@ -48,21 +48,21 @@ public static class ModifierExtensions } /// - /// Remote Procedure Call to add a modifier to a player. + /// Remote Procedure Call to add a to a . /// - /// The player to add the modifier to. - /// The arguments to initialize the modifier constructor with. - /// The modifier Type. + /// The to add the to. + /// The arguments to initialize the with. + /// The Type. public static void RpcAddModifier(this PlayerControl player, params object[] args) where T : BaseModifier { player.RpcAddModifier(typeof(T), args); } /// - /// Remote Procedure Call to remove a modifier from a player. + /// Remote Procedure Call to remove a from a . /// - /// The player to remove the modifier from. - /// The unique ID of the modifier. + /// The to remove the from. + /// The unique ID of the . [MethodRpc((uint)MiraRpc.RemoveModifier)] public static void RpcRemoveModifier(this PlayerControl target, Guid uniqueId) { @@ -70,11 +70,11 @@ public static class ModifierExtensions } /// - /// Remote Procedure Call to remove a modifier from a player by type ID. + /// Remote Procedure Call to remove a from a by type ID. /// - /// The player to remove the modifier from. - /// The type ID of the modifier. - /// Optional predicate to filter the modifiers. + /// The to remove the from. + /// The type ID of the . + /// Optional predicate to filter the s. public static void RpcRemoveModifier( this PlayerControl target, uint typeId, @@ -91,11 +91,11 @@ public static class ModifierExtensions } /// - /// Remote Procedure Call to remove a modifier from a player. + /// Remote Procedure Call to remove a from a . /// - /// The player to remove the modifier from. - /// The type of the modifier. - /// Optional predicate to filter the modifiers. + /// The to remove the from. + /// The type of the . + /// Optional predicate to filter the s. public static void RpcRemoveModifier( this PlayerControl player, Type type, @@ -108,11 +108,11 @@ public static class ModifierExtensions } /// - /// Remote Procedure Call to remove a modifier from a player. + /// Remote Procedure Call to remove a from a . /// - /// The player to remove the modifier from. - /// Optional predicate to filter the modifiers. - /// The Type of the Modifier. + /// The to remove the from. + /// Optional predicate to filter the s. + /// The Type of the . public static void RpcRemoveModifier(this PlayerControl player, Func? predicate = null) where T : BaseModifier { @@ -120,10 +120,10 @@ public static class ModifierExtensions } /// - /// Gets the ModifierComponent for a player. + /// Gets the for a . /// - /// The PlayerControl object. - /// A ModifierComponent if there is one, null otherwise. + /// The object. + /// A if there is one, null otherwise. public static ModifierComponent GetModifierComponent(this PlayerControl player) { if (ModifierComponents.TryGetValue(player, out var component)) @@ -142,36 +142,36 @@ public static class ModifierExtensions } /// - /// Checks if the player has a specific modifier. + /// Checks if the has a specific . /// - /// The type of the modifier. - /// The PlayerControl instance. - /// Optional predicate to filter the modifiers. - /// True if the player has the modifier, false otherwise. + /// The type of the . + /// The instance. + /// Optional predicate to filter the s. + /// True if the has the , false otherwise. public static bool HasModifier(this PlayerControl player, Func? predicate = null) where T : BaseModifier { return player.GetModifierComponent().HasModifier(predicate); } /// - /// Checks if the player has a specific modifier by type. + /// Checks if the has a specific by type. /// - /// The PlayerControl instance. + /// The instance. /// The type of the modifier. - /// Optional predicate to filter the modifiers. - /// True if the player has the modifier, false otherwise. + /// Optional predicate to filter the s. + /// True if the has the , false otherwise. public static bool HasModifier(this PlayerControl player, Type type, Func? predicate = null) { return player.GetModifierComponent().HasModifier(type, predicate); } /// - /// Checks if the player has a specific modifier by type ID. + /// Checks if the has a specific by type ID. /// - /// The PlayerControl instance. - /// The type ID of the modifier. - /// Optional predicate to filter the modifiers. - /// True if the player has the modifier, false otherwise. + /// The instance. + /// The type ID of the . + /// Optional predicate to filter the s. + /// True if the has the , false otherwise. public static bool HasModifier( this PlayerControl player, uint typeId, @@ -181,20 +181,20 @@ public static class ModifierExtensions } /// - /// Checks if the player has a specific modifier by its GUID. + /// Checks if the has a specific modifier by its GUID. /// - /// The PlayerControl instance. - /// The unique ID of the modifier. - /// True if the player has the modifier, false otherwise. + /// The instance. + /// The unique ID of the . + /// True if the has the , false otherwise. public static bool HasModifier(this PlayerControl player, Guid uniqueId) { return player.GetModifierComponent().HasModifier(uniqueId); } /// - /// Clears all modifiers from a player. + /// Clears all s from the . /// - /// The player you want to clear modifiers for. + /// The player you want to clear s for. public static void ClearModifiers(this PlayerControl plr) { foreach (var mod in plr.GetModifierComponent().ActiveModifiers) @@ -204,9 +204,9 @@ public static class ModifierExtensions } /// - /// Clears all modifiers from a player. + /// Clears all s from the . /// - /// The player you want to clear modifiers for. + /// The player you want to clear s for. public static void RpcClearModifiers(this PlayerControl plr) { foreach (var mod in plr.GetModifierComponent().ActiveModifiers) @@ -216,75 +216,75 @@ public static class ModifierExtensions } /// - /// Tries to get a modifier by its type. + /// Tries to get a . /// - /// The PlayerControl instance. - /// The modifier or null. - /// The predicate to check the modifier by. - /// The Type of the Modifier. - /// True if the modifier was found, false otherwise. + /// The instance. + /// The or null. + /// The predicate to check the by. + /// The Type of the . + /// True if the was found, false otherwise. public static bool TryGetModifier(this PlayerControl player, [NotNullWhen(true)] out T? modifier, Func? predicate = null) where T : BaseModifier { return player.GetModifierComponent().TryGetModifier(out modifier, predicate); } /// - /// Tries to get a modifier by its type. + /// Tries to get a by its type. /// - /// The PlayerControl instance. + /// The instance. /// The modifier type. - /// The modifier or null. - /// The predicate to check the modifier by. - /// True if the modifier was found, false otherwise. + /// The or null. + /// The predicate to check the by. + /// True if the was found, false otherwise. public static bool TryGetModifier(this PlayerControl player, Type type, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { return player.GetModifierComponent().TryGetModifier(type, out modifier, predicate); } /// - /// Tries to get a modifier by its type ID. + /// Tries to get a by its type ID. /// - /// The PlayerControl instance. - /// The modifier type ID. - /// The modifier or null. - /// The predicate to check the modifier by. - /// True if the modifier was found, false otherwise. + /// The instance. + /// The type ID. + /// The or null. + /// The predicate to check the by. + /// True if the was found, false otherwise. public static bool TryGetModifier(this PlayerControl player, uint id, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { return player.GetModifierComponent().TryGetModifier(id, out modifier, predicate); } /// - /// Tries to get a modifier by its unique ID. + /// Tries to get a by its unique ID. /// - /// The PlayerControl instance. - /// The modifier unique ID. - /// The modifier or null. - /// True if the modifier was found, false otherwise. + /// The instance. + /// The unique ID. + /// The or null. + /// True if the was found, false otherwise. public static bool TryGetModifier(this PlayerControl player, Guid modifierGuid, [NotNullWhen(true)] out BaseModifier? modifier) { return player.GetModifierComponent().TryGetModifier(modifierGuid, out modifier); } /// - /// Gets a specific modifier from the player. + /// Gets a specific from the . /// - /// The type of the modifier. - /// The PlayerControl instance. - /// Optional predicate to filter the modifiers. - /// The modifier if found, null otherwise. + /// The type of the . + /// The instance. + /// Optional predicate to filter the s. + /// The if found, null otherwise. public static T? GetModifier(this PlayerControl player, Func? predicate = null) where T : BaseModifier { return player.GetModifierComponent().GetModifier(predicate); } /// - /// Gets a specific modifier from the player by type. + /// Gets a specific from the by type. /// - /// The PlayerControl instance. + /// The instance. /// The type of the modifier. - /// Optional predicate to filter the modifiers. - /// The modifier if found, null otherwise. + /// Optional predicate to filter the s. + /// The if found, null otherwise. public static BaseModifier? GetModifier( this PlayerControl player, Type type, @@ -294,12 +294,12 @@ public static class ModifierExtensions } /// - /// Gets a specific modifier from the player by its type ID. + /// Gets a specific from the by its type ID. /// - /// The PlayerControl instance. - /// The type ID of the modifier. - /// Optional predicate to filter the modifiers. - /// The modifier if found, null otherwise. + /// The instance. + /// The type ID of the . + /// Optional predicate to filter the s. + /// The if found, null otherwise. public static BaseModifier? GetModifier( this PlayerControl player, uint typeId, @@ -309,11 +309,11 @@ public static class ModifierExtensions } /// - /// Gets a specific modifier from the player by its GUID. + /// Gets a specific from the by its GUID. /// - /// The PlayerControl instance. - /// The GUID of the modifier. - /// The modifier if found, null otherwise. + /// The instance. + /// The GUID of the . + /// The if found, null otherwise. public static BaseModifier? GetModifier( this PlayerControl player, Guid uniqueId) @@ -322,12 +322,12 @@ public static class ModifierExtensions } /// - /// Gets all modifiers of a specific type from the player. + /// Gets all s from the . /// - /// The type of the modifiers. - /// The PlayerControl instance. - /// Optional predicate to filter the modifiers. - /// A collection of modifiers. + /// The type of the s. + /// The instance. + /// Optional predicate to filter the s. + /// An of s. public static IEnumerable GetModifiers(this PlayerControl player, Func? predicate = null) where T : BaseModifier { @@ -335,12 +335,12 @@ public static class ModifierExtensions } /// - /// Gets all modifiers of a specific type from the player. + /// Gets all s of a specific type from the . /// - /// The PlayerControl instance. + /// The instance. /// The type of the modifiers. - /// Optional predicate to filter the modifiers. - /// A collection of modifiers. + /// Optional predicate to filter the s. + /// An of s. public static IEnumerable GetModifiers( this PlayerControl player, Type type, @@ -350,12 +350,12 @@ public static class ModifierExtensions } /// - /// Gets all modifiers of a specific type from the player by type ID. + /// Gets all s of a specific type from the by type ID. /// - /// The PlayerControl instance. - /// The type ID of the modifiers. - /// Optional predicate to filter the modifiers. - /// A collection of modifiers. + /// The instance. + /// The type ID of the s. + /// Optional predicate to filter the s. + /// An of s. public static IEnumerable GetModifiers( this PlayerControl player, uint typeId, @@ -365,21 +365,21 @@ public static class ModifierExtensions } /// - /// Removes a specific modifier from the player. + /// Removes a specific from the . /// - /// The PlayerControl instance. - /// The modifier to remove. + /// The instance. + /// The to remove. public static void RemoveModifier(this PlayerControl player, BaseModifier modifier) { player.GetModifierComponent().RemoveModifier(modifier); } /// - /// Removes a specific modifier from the player. + /// Removes a specific from the . /// - /// The type of the modifier. - /// The PlayerControl instance. - /// Optional predicate to filter the modifiers. + /// The type of the . + /// The instance. + /// Optional predicate to filter the s. public static void RemoveModifier(this PlayerControl player, Func? predicate = null) where T : BaseModifier { @@ -387,22 +387,22 @@ public static class ModifierExtensions } /// - /// Removes a specific modifier from the player by type. + /// Removes a specific from the by type. /// - /// The PlayerControl instance. + /// The instance. /// The type of the modifier. - /// Optional predicate to filter the modifiers. + /// Optional predicate to filter the s. public static void RemoveModifier(this PlayerControl player, Type type, Func? predicate = null) { player.GetModifierComponent().RemoveModifier(type, predicate); } /// - /// Removes a specific modifier from the player by its type ID. + /// Removes a specific from the by its type ID. /// - /// The PlayerControl instance. - /// The type ID of the modifier. - /// Optional predicate to filter the modifiers. + /// The instance. + /// The type ID of the . + /// Optional predicate to filter the s. public static void RemoveModifier( this PlayerControl player, uint typeId, @@ -412,10 +412,10 @@ public static class ModifierExtensions } /// - /// Removes a specific modifier from the player by its GUID. + /// Removes a specific from the by its GUID. /// - /// The PlayerControl instance. - /// The GUID of the modifier. + /// The instance. + /// The GUID of the . public static void RemoveModifier( this PlayerControl player, Guid uniqueId) @@ -424,47 +424,47 @@ public static class ModifierExtensions } /// - /// Adds a specific modifier to the player. + /// Adds a specific to the . /// - /// The type of the modifier. - /// The PlayerControl instance. - /// The arguments to initialize the modifier constructor with. - /// The added modifier. + /// The type of the . + /// The instance. + /// The arguments to initialize the with. + /// The added . public static T? AddModifier(this PlayerControl player, params object[] args) where T : BaseModifier { return player.GetModifierComponent().AddModifier(args); } /// - /// Adds a specific modifier to the player. + /// Adds a specific to the . /// - /// The PlayerControl instance. - /// The modifier to add. - /// The added modifier. + /// The instance. + /// The to add. + /// The added . public static BaseModifier? AddModifier(this PlayerControl player, BaseModifier modifier) { return player.GetModifierComponent().AddModifier(modifier); } /// - /// Adds a specific modifier to the player by type. + /// Adds a specific to the by type. /// - /// The PlayerControl instance. + /// The instance. /// The type of the modifier. - /// The arguments to initialize the modifier constructor with. - /// The added modifier. + /// The arguments to initialize the with. + /// The added . public static BaseModifier? AddModifier(this PlayerControl player, Type type, params object[] args) { return player.GetModifierComponent().AddModifier(type, args); } /// - /// Adds a specific modifier to the player by type ID. + /// Adds a specific to the by type ID. /// - /// The PlayerControl instance. - /// The type ID of the modifier. - /// The arguments to initialize the modifier constructor with. - /// The added modifier. + /// The instance. + /// The type ID of the . + /// The arguments to initialize the with. + /// The added . public static BaseModifier? AddModifier(this PlayerControl player, uint typeId, params object[] args) { return player.GetModifierComponent().AddModifier(typeId, args); diff --git a/MiraAPI/Modifiers/ModifierFactory.cs b/MiraAPI/Modifiers/ModifierFactory.cs index 4f84db0..cd3c9be 100644 --- a/MiraAPI/Modifiers/ModifierFactory.cs +++ b/MiraAPI/Modifiers/ModifierFactory.cs @@ -8,7 +8,7 @@ using MiraAPI.Utilities; namespace MiraAPI.Modifiers; /// -/// Factory for creating instances of a modifier. More efficient than using reflection. +/// Factory for creating instances of a . More efficient than using reflection. /// public static class ModifierFactory { @@ -39,11 +39,11 @@ public static class ModifierFactory } /// - /// Creates a modifier with the specified type and arguments. + /// Creates a with the specified type and arguments. /// /// Modifier type. /// Arguments. - /// An instance of the modifier. + /// An instance of the . public static BaseModifier CreateInstance(Type type, params object[] args) { var argTypes = args.Select(arg => arg.GetType()).ToArray(); @@ -60,9 +60,9 @@ public static class ModifierFactory } /// -/// Factory for creating instances of a modifier. More efficient than using reflection. +/// Factory for creating instances of . More efficient than using reflection. /// -/// The modifier type. +/// The type. public static class ModifierFactory where T : BaseModifier { private static readonly Func Constructor = CreateConstructor(); @@ -92,10 +92,10 @@ public static class ModifierFactory where T : BaseModifier } /// - /// Creates an instance of the modifier. + /// Creates an instance of . /// /// Parameters for the constructor. - /// An instance of the modifier. + /// An instance of . [SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "This is a factory class.")] public static T CreateInstance(params object[] args) { diff --git a/MiraAPI/Modifiers/ModifierManager.cs b/MiraAPI/Modifiers/ModifierManager.cs index 2456af0..877e43b 100644 --- a/MiraAPI/Modifiers/ModifierManager.cs +++ b/MiraAPI/Modifiers/ModifierManager.cs @@ -13,17 +13,17 @@ using Random = System.Random; namespace MiraAPI.Modifiers; /// -/// The manager for handling modifiers. +/// The manager for handling s. /// public static class ModifierManager { /// - /// Gets or sets a value indicating whether modifiers should be assigned to players. + /// Gets or sets a value indicating whether s should be assigned to players. /// public static bool MiraAssignsModifiers { get; set; } = true; /// - /// Gets the list of all registered modifiers. + /// Gets the list of all registered s. /// public static IReadOnlyList Modifiers { get; internal set; } = []; diff --git a/MiraAPI/Modifiers/ModifierUtils.cs b/MiraAPI/Modifiers/ModifierUtils.cs index b69e7bc..f536489 100644 --- a/MiraAPI/Modifiers/ModifierUtils.cs +++ b/MiraAPI/Modifiers/ModifierUtils.cs @@ -5,27 +5,27 @@ using System.Linq; namespace MiraAPI.Modifiers; /// -/// Utilities to make handling modifiers in-game easier. +/// Utilities to make handling s in-game easier. /// public static class ModifierUtils { /// - /// Gets a list of all active in-game modifiers. + /// Gets a list of all active in-game s. /// - /// Select if modifier is valid to be added to list. - /// The modifier type. - /// A list of modifiers. + /// Select if is valid to be added to list. + /// The type. + /// An of s. public static IEnumerable GetActiveModifiers(Func? predicate = null) where T : BaseModifier { return PlayerControl.AllPlayerControls.ToArray().SelectMany(x => x.GetModifiers(predicate)).OfType(); } /// - /// Gets all players with a certain modifier. + /// Gets all s with a certain . /// - /// Select if modifier is valid. - /// The modifier type. - /// A list of players with that modifier. + /// Select if is valid. + /// The type. + /// An of s with that . public static IEnumerable GetPlayersWithModifier(Func? predicate = null) where T : BaseModifier { return PlayerControl.AllPlayerControls.ToArray().Where(x => x.HasModifier(predicate)); diff --git a/MiraAPI/Modifiers/Types/GameModifier.cs b/MiraAPI/Modifiers/Types/GameModifier.cs index 144ff51..83680b7 100644 --- a/MiraAPI/Modifiers/Types/GameModifier.cs +++ b/MiraAPI/Modifiers/Types/GameModifier.cs @@ -11,19 +11,19 @@ public abstract class GameModifier : BaseModifier /// /// Gets the chance of the modifier being assigned to a player. /// - /// An int value between 0 and 100 representing percent. + /// An value between 0 and 100 representing percent. public abstract int GetAssignmentChance(); /// /// Gets the amount of players that can have this modifier in a game. /// - /// An int value greater than or equal to zero. + /// An value greater than or equal to zero. public abstract int GetAmountPerGame(); /// /// Gets the priority at which the modifier will spawn. The higher the value, the higher up on the assignment list. /// - /// An int value greater than or equal to -1. + /// An value greater than or equal to -1. public virtual int Priority() => -1; /// diff --git a/MiraAPI/Modifiers/Types/TimedModifier.cs b/MiraAPI/Modifiers/Types/TimedModifier.cs index cd86992..6fe1c1d 100644 --- a/MiraAPI/Modifiers/Types/TimedModifier.cs +++ b/MiraAPI/Modifiers/Types/TimedModifier.cs @@ -89,7 +89,7 @@ public abstract class TimedModifier : BaseModifier } /// - /// Stops the timer and calls OnTimerComplete(). + /// Stops the timer and calls . /// public void StopTimer() { @@ -109,7 +109,7 @@ public abstract class TimedModifier : BaseModifier } /// - /// Resets the timer. Does not call OnTimerComplete(). + /// Resets the timer. Does not call . /// public void ResetTimer() { diff --git a/MiraAPI/Networking/CustomMurderRpc.cs b/MiraAPI/Networking/CustomMurderRpc.cs index f9c6e87..9a6ff0b 100644 --- a/MiraAPI/Networking/CustomMurderRpc.cs +++ b/MiraAPI/Networking/CustomMurderRpc.cs @@ -168,7 +168,7 @@ public static class CustomMurderRpc } /// - /// Custom Murder method without networking. If you need a networked version, use . + /// Custom Murder method without networking. If you need a networked version, use . /// /// The killer. /// The player to murder. diff --git a/MiraAPI/Networking/GuidConverter.cs b/MiraAPI/Networking/GuidConverter.cs index c00d759..f9d9d7a 100644 --- a/MiraAPI/Networking/GuidConverter.cs +++ b/MiraAPI/Networking/GuidConverter.cs @@ -24,7 +24,7 @@ public class GuidConverter : MessageConverter /// Reads a from the reader. /// /// - /// A GUID object. + /// A object. public override Guid Read(MessageReader reader, Type objectType) { return new Guid(reader.ReadBytesAndSize()); diff --git a/MiraAPI/Networking/Modifiers/AddModifierRpc.cs b/MiraAPI/Networking/Modifiers/AddModifierRpc.cs index 2e7b19e..d3bcaee 100644 --- a/MiraAPI/Networking/Modifiers/AddModifierRpc.cs +++ b/MiraAPI/Networking/Modifiers/AddModifierRpc.cs @@ -8,7 +8,7 @@ using Reactor.Networking.Serialization; namespace MiraAPI.Networking.Modifiers; /// -/// Remote procedure call for adding a modifier. +/// Remote procedure call for adding a . /// /// Mira plugin. /// RPC ID. diff --git a/MiraAPI/Patches/Events/KillAnimationMurderEventPatch.cs b/MiraAPI/Patches/Events/KillAnimationMurderEventPatch.cs index 2618153..d102664 100644 --- a/MiraAPI/Patches/Events/KillAnimationMurderEventPatch.cs +++ b/MiraAPI/Patches/Events/KillAnimationMurderEventPatch.cs @@ -8,7 +8,7 @@ using MiraAPI.Utilities; namespace MiraAPI.Patches.Events; /// -/// Patch to invoke AfterMurderEvent after a kill animation is performed. +/// Patch to invoke after a kill animation is performed. /// [HarmonyPatch] public static class KillAnimationMurderEventPatch diff --git a/MiraAPI/Patches/Events/MapBehaviourPatches.cs b/MiraAPI/Patches/Events/MapBehaviourPatches.cs index a409226..246b6e5 100644 --- a/MiraAPI/Patches/Events/MapBehaviourPatches.cs +++ b/MiraAPI/Patches/Events/MapBehaviourPatches.cs @@ -5,7 +5,7 @@ using MiraAPI.Events.Vanilla.Map; namespace MiraAPI.Patches.Events; /// -/// Patch for map related MiraEvents. +/// Patch for related s. /// [HarmonyPatch] public static class MapBehaviourPatches diff --git a/MiraAPI/Patches/Events/SabotageEventPatches.cs b/MiraAPI/Patches/Events/SabotageEventPatches.cs index 4f04d7e..8df8750 100644 --- a/MiraAPI/Patches/Events/SabotageEventPatches.cs +++ b/MiraAPI/Patches/Events/SabotageEventPatches.cs @@ -5,7 +5,7 @@ using MiraAPI.Events.Vanilla.Map; namespace MiraAPI.Patches.Events; /// -/// Used for patching sabotage/system related MiraEvents. +/// Used for patching sabotage/system related s. /// [HarmonyPatch] public static class SabotageEventPatches diff --git a/MiraAPI/Patches/Events/VanillaButtonPatches.cs b/MiraAPI/Patches/Events/VanillaButtonPatches.cs index 278de09..490e401 100644 --- a/MiraAPI/Patches/Events/VanillaButtonPatches.cs +++ b/MiraAPI/Patches/Events/VanillaButtonPatches.cs @@ -8,7 +8,7 @@ using MiraAPI.Events.Vanilla.Usables; namespace MiraAPI.Patches.Events; /// -/// Patches to invoke vent related MiraEvents. +/// Patches to invoke related s. /// [HarmonyPatch] public static class VanillaButtonPatches diff --git a/MiraAPI/Patches/Events/VentEventPatches.cs b/MiraAPI/Patches/Events/VentEventPatches.cs index 33e3dbf..9d4ad9f 100644 --- a/MiraAPI/Patches/Events/VentEventPatches.cs +++ b/MiraAPI/Patches/Events/VentEventPatches.cs @@ -6,7 +6,7 @@ using MiraAPI.Events.Vanilla.Usables; namespace MiraAPI.Patches.Events; /// -/// Patches to invoke vent related MiraEvents. +/// Patches to invoke related s. /// [HarmonyPatch] public static class VentEventPatches diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index de8593b..4214491 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -15,7 +15,7 @@ using Object = UnityEngine.Object; namespace MiraAPI.Patches; /// -/// General patches for the HudManager class. +/// General patches for the class. /// [HarmonyPatch(typeof(HudManager))] public static class HudManagerPatches @@ -121,7 +121,7 @@ public static class HudManagerPatches /// /// Create custom buttons and arrange them on the hud. /// - /// The HudManager instance. + /// The instance. [HarmonyPostfix] [HarmonyPatch(nameof(HudManager.Start))] public static void StartPostfix(HudManager __instance) @@ -238,9 +238,9 @@ public static class HudManagerPatches /// /// Set the custom buttons active when the hud is active. /// - /// HudManager instance. - /// The local PlayerControl. - /// The player's RoleBehaviour. + /// instance. + /// The local . + /// The player's . /// Whether the Hud should be set active or not. [HarmonyPostfix] [HarmonyPatch(nameof(HudManager.SetHudActive), typeof(PlayerControl), typeof(RoleBehaviour), typeof(bool))] diff --git a/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs b/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs index 7434aae..3defc75 100644 --- a/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs +++ b/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs @@ -22,7 +22,7 @@ public static class OptionsMenuPatches private static Dictionary> tabButtons = new(); /// - /// Creates the tabs and their content. + /// Creates the s and their content. /// [HarmonyPostfix] [HarmonyPatch(nameof(OptionsMenuBehaviour.Start))] diff --git a/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs b/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs index ffbfdea..ea137c8 100644 --- a/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs +++ b/MiraAPI/Patches/LocalSettings/ToggleBehaviourPatch.cs @@ -7,7 +7,7 @@ namespace MiraAPI.Patches.LocalSettings; public static class ToggleBehaviourPatch { /// - /// ResetText was inlined ofc. + /// was inlined ofc. /// Skill issue. /// [HarmonyPrefix] diff --git a/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs b/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs index b2377fe..90f04fb 100644 --- a/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs +++ b/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs @@ -8,7 +8,7 @@ using UnityEngine; namespace MiraAPI.Patches.Menu; /// -/// General MainMenuManage patches. +/// General patches. /// [HarmonyPatch(typeof(MainMenuManager))] public static class MainMenuManagerPatches diff --git a/MiraAPI/Patches/MinigameBeginErrorPatch.cs b/MiraAPI/Patches/MinigameBeginErrorPatch.cs index ce59415..da7de72 100644 --- a/MiraAPI/Patches/MinigameBeginErrorPatch.cs +++ b/MiraAPI/Patches/MinigameBeginErrorPatch.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Patches; /// -/// Used to fix the Minigame crash errors (credits Submerged/PH Gaming for the fix). +/// Used to fix the crash errors (credits Submerged/PH Gaming for the fix). /// [HarmonyPatch] public static class MinigameBeginErrorPatch diff --git a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs index 89e6f57..4d7ae36 100644 --- a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs @@ -162,7 +162,7 @@ internal static class GameSettingMenuPatches /// /// Prefix for the method. Sets up the custom options. /// - /// The GameSettingMenu instance. + /// The instance. [HarmonyPrefix] [HarmonyPatch(nameof(GameSettingMenu.Start))] public static void StartPrefix(GameSettingMenu __instance) diff --git a/MiraAPI/Patches/Options/SettingPatches.cs b/MiraAPI/Patches/Options/SettingPatches.cs index e33633a..d740349 100644 --- a/MiraAPI/Patches/Options/SettingPatches.cs +++ b/MiraAPI/Patches/Options/SettingPatches.cs @@ -17,9 +17,9 @@ public static class SettingPatches /// /// Prefix for the method. Adds support for custom number suffixes. /// - /// The FloatGameSetting instance. - /// The result of the GetValueString method. - /// The float value. + /// The instance. + /// The result of the method. + /// The value. /// False to skip original method. [HarmonyPrefix] [HarmonyPatch(typeof(FloatGameSetting), nameof(FloatGameSetting.GetValueString))] diff --git a/MiraAPI/Patches/PlayerControlPatches.cs b/MiraAPI/Patches/PlayerControlPatches.cs index 946b6f2..3c851b0 100644 --- a/MiraAPI/Patches/PlayerControlPatches.cs +++ b/MiraAPI/Patches/PlayerControlPatches.cs @@ -14,7 +14,7 @@ using Reactor.Utilities.Extensions; namespace MiraAPI.Patches; /// -/// General patches for the PlayerControl class. +/// General patches for the class. /// [HarmonyPatch(typeof(PlayerControl))] internal static class PlayerControlPatches diff --git a/MiraAPI/Patches/Roles/HauntMenuPatch.cs b/MiraAPI/Patches/Roles/HauntMenuPatch.cs index da272a6..851ddaa 100644 --- a/MiraAPI/Patches/Roles/HauntMenuPatch.cs +++ b/MiraAPI/Patches/Roles/HauntMenuPatch.cs @@ -6,7 +6,7 @@ using UnityEngine; namespace MiraAPI.Patches.Roles; /// -/// Patches the haunt menu to show the actual role name rather than team. +/// Patches the to show the actual role name rather than team. /// [HarmonyPatch(typeof(HauntMenuMinigame), nameof(HauntMenuMinigame.SetHauntTarget))] // SetFilterText was INLINED diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index d8ac9e1..5ae8cc6 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -6,7 +6,7 @@ using Reactor.Utilities.Extensions; namespace MiraAPI.Patches.Roles; /// -/// HudManager patches for roles. +/// patches for roles. /// [HarmonyPatch(typeof(HudManager))] public static class HudManagerPatches @@ -15,11 +15,11 @@ public static class HudManagerPatches public static TaskPanelBehaviour? RoleTab; /// - /// Fixes Kill Button not showing for Neutral killing role. + /// Fixes not showing for Neutral killing role. /// - /// HudManager instance. - /// The local PlayerControl. - /// The player's RoleBehaviour. + /// instance. + /// The local . + /// The player's . /// Whether the Hud should be set active or not. [HarmonyPostfix] [HarmonyPatch(nameof(HudManager.SetHudActive), typeof(PlayerControl), typeof(RoleBehaviour), typeof(bool))] diff --git a/MiraAPI/Patches/Roles/KillButtonPatches.cs b/MiraAPI/Patches/Roles/KillButtonPatches.cs index d8f14c7..9a00422 100644 --- a/MiraAPI/Patches/Roles/KillButtonPatches.cs +++ b/MiraAPI/Patches/Roles/KillButtonPatches.cs @@ -7,13 +7,13 @@ using UnityEngine; namespace MiraAPI.Patches.Roles; /// -/// Fix kill button issues for neutral killers. +/// Fix issues for neutral killers. /// [HarmonyPatch(typeof(KillButton))] public static class KillButtonPatches { /// - /// SetTarget for custom roles. + /// for custom roles. /// [HarmonyPrefix] [HarmonyPatch(nameof(KillButton.SetTarget))] @@ -46,7 +46,8 @@ public static class KillButtonPatches } /// - /// Use Custom Murder instead of Murder Player from vanilla. + /// Use + /// instead of from vanilla. /// [HarmonyPrefix] [HarmonyPatch(nameof(KillButton.DoClick))] diff --git a/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs b/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs index 1caba49..315f2b2 100644 --- a/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs +++ b/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Patches.Roles; public static class RoleBehaviourPatch { /// - /// Update TeamColor text for Mira roles. + /// Update text for s. /// [HarmonyPrefix] [HarmonyPatch(nameof(RoleBehaviour.TeamColor), MethodType.Getter)] diff --git a/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs b/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs index d933a28..18a380c 100644 --- a/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs +++ b/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs @@ -13,7 +13,7 @@ namespace MiraAPI.Patches.Roles; public static class RoleOptionsCollectionPatch { /// - /// This patch fixes GetNumPerGame being inlined (2025.9.9) in the original code. + /// This patch fixes being inlined (2025.9.9) in the original code. /// [HarmonyPrefix] [HarmonyPatch(nameof(RoleOptionsCollectionV10.AnyRolesEnabled))] diff --git a/MiraAPI/Patches/Roles/SabotageButtonPatch.cs b/MiraAPI/Patches/Roles/SabotageButtonPatch.cs index 258af83..50c6133 100644 --- a/MiraAPI/Patches/Roles/SabotageButtonPatch.cs +++ b/MiraAPI/Patches/Roles/SabotageButtonPatch.cs @@ -7,7 +7,7 @@ namespace MiraAPI.Patches.Roles; public static class SabotageButtonPatch { /// - /// Patches the Sabotage button to check if the player's custom role can use sabotage. + /// Patches the to check if the player's custom role can use sabotage. /// [HarmonyPatch(nameof(SabotageButton.DoClick))] [HarmonyPrefix] diff --git a/MiraAPI/Patches/Roles/VentPatches.cs b/MiraAPI/Patches/Roles/VentPatches.cs index 6ff28f8..b475ddf 100644 --- a/MiraAPI/Patches/Roles/VentPatches.cs +++ b/MiraAPI/Patches/Roles/VentPatches.cs @@ -6,13 +6,13 @@ using UnityEngine; namespace MiraAPI.Patches.Roles; /// -/// Vent patches for Roles. +/// patches for s. /// [HarmonyPatch(typeof(Vent))] public static class VentPatches { /// - /// Set outline to player's custom role color. + /// Set outline to player's . /// [HarmonyPostfix] [HarmonyPatch(nameof(Vent.SetOutline))] diff --git a/MiraAPI/Patches/Stubs/MinigameStubs.cs b/MiraAPI/Patches/Stubs/MinigameStubs.cs index 3818d09..4c2628f 100644 --- a/MiraAPI/Patches/Stubs/MinigameStubs.cs +++ b/MiraAPI/Patches/Stubs/MinigameStubs.cs @@ -4,13 +4,13 @@ using HarmonyLib; namespace MiraAPI.Patches.Stubs; /// -/// Reverse patches for Minigames. +/// Reverse patches for s. /// [HarmonyPatch] public static class MinigameStubs { /// - /// Reverse patch for Minigame.Begin. + /// Reverse patch for . /// /// The Minigame instance. /// Associated PlayerTask. @@ -23,7 +23,7 @@ public static class MinigameStubs } /// - /// Reverse patch for Minigame.Close. + /// Reverse patch for . /// /// The Minigame instance. [HarmonyReversePatch] diff --git a/MiraAPI/Patches/Stubs/RoleBehaviourStubs.cs b/MiraAPI/Patches/Stubs/RoleBehaviourStubs.cs index 356bf68..8743f3b 100644 --- a/MiraAPI/Patches/Stubs/RoleBehaviourStubs.cs +++ b/MiraAPI/Patches/Stubs/RoleBehaviourStubs.cs @@ -6,16 +6,16 @@ using Il2CppSystem.Text; namespace MiraAPI.Patches.Stubs; /// -/// Stub methods for the RoleBehaviour class. Needed because of Il2Cpp limitations on injected classes. +/// Stub methods for the class. Needed because of Il2Cpp limitations on injected classes. /// [HarmonyPatch] public static class RoleBehaviourStubs { /// - /// Stub method for RoleBehaviour.Initialize. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The PlayerControl to initialize. + /// The object. + /// The to initialize. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.Initialize))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -25,10 +25,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.AdjustTasks. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The PlayerControl to adjust tasks for. + /// The object. + /// The to adjust tasks for. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.AdjustTasks))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -38,10 +38,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.AppendTaskHint. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The StringBuilder to append the task hint to. + /// The object. + /// The to append the task hint to. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.AppendTaskHint), typeof(StringBuilder))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -51,10 +51,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.CanUse. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The IUsable console to check. + /// The object. + /// The console to check. /// Whether the console can be used. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.CanUse))] @@ -65,10 +65,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.Deinitialize. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The PlayerControl to deinitialize for. + /// The object. + /// The to deinitialize for. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.Deinitialize))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -78,9 +78,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.DidWin. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. /// The reason for game over. /// Whether the role won. [HarmonyReversePatch] @@ -92,10 +92,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.FindClosestTarget. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The closest target PlayerControl. + /// The object. + /// The closest target . [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.FindClosestTarget))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -105,9 +105,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.GetAbilityDistance. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. /// The ability distance. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.GetAbilityDistance))] @@ -118,10 +118,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.IsValidTarget. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The NetworkedPlayerInfo to validate. + /// The object. + /// The to validate. /// Whether the target is valid. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.IsValidTarget))] @@ -132,9 +132,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.OnDeath. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. /// The reason for death. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.OnDeath))] @@ -145,9 +145,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.OnMeetingStart. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.OnMeetingStart))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -157,9 +157,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.OnVotingComplete. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.OnVotingComplete))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -169,9 +169,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.SetCooldown. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.SetCooldown))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -181,10 +181,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.SetPlayerTarget. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The PlayerControl target to set. + /// The object. + /// The target to set. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.SetPlayerTarget))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -194,10 +194,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.SetUsableTarget. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The IUsable target to set. + /// The object. + /// The target to set. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.SetUsableTarget))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -207,10 +207,10 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.SpawnTaskHeader. + /// Stub method for . /// - /// The RoleBehaviour object. - /// The PlayerControl to spawn the task header for. + /// The object. + /// The to spawn the task header for. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.SpawnTaskHeader))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -220,9 +220,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.UseAbility. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.UseAbility))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -232,9 +232,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.UseSecondaryAbility. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.UseSecondaryAbility))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -244,9 +244,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.OnRoleSet. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.OnRoleSet))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -256,9 +256,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.InitializeMeetingAbilityButton. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.InitializeMeetingAbilityButton))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -268,9 +268,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.FindClosestBody. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.FindClosestBody))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -280,9 +280,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.HandleRoleRpc. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.HandleRoleRpc))] [MethodImpl(MethodImplOptions.NoInlining)] @@ -292,9 +292,9 @@ public static class RoleBehaviourStubs } /// - /// Stub method for RoleBehaviour.KillAnimSpecialSetup. + /// Stub method for . /// - /// The RoleBehaviour object. + /// The object. [HarmonyReversePatch] [HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.KillAnimSpecialSetup))] [MethodImpl(MethodImplOptions.NoInlining)] diff --git a/MiraAPI/Patches/VentCanUsePatch.cs b/MiraAPI/Patches/VentCanUsePatch.cs index ff584b7..cc4e9e5 100644 --- a/MiraAPI/Patches/VentCanUsePatch.cs +++ b/MiraAPI/Patches/VentCanUsePatch.cs @@ -8,7 +8,7 @@ using UnityEngine; namespace MiraAPI.Patches; /// -/// Used to change vent behaviour for the event system, custom roles, and modifiers. +/// Used to change behaviour for the system, s, and s. /// [HarmonyPatch(typeof(Vent), nameof(Vent.CanUse))] internal static class VentCanUsePatch diff --git a/MiraAPI/PluginLoading/IMiraPlugin.cs b/MiraAPI/PluginLoading/IMiraPlugin.cs index e6b2dbb..f1ef793 100644 --- a/MiraAPI/PluginLoading/IMiraPlugin.cs +++ b/MiraAPI/PluginLoading/IMiraPlugin.cs @@ -38,8 +38,8 @@ public interface IMiraPlugin public virtual string CustomOptionMenuTwoDescription => "Apply game settings for this mod!"; /// - /// Gets the BepInEx configuration file for the plugin. + /// Gets the for the plugin. /// - /// The BepInEx configuration file for the plugin. + /// The for the plugin. public ConfigFile GetConfigFile(); } diff --git a/MiraAPI/PluginLoading/MiraPluginInfo.cs b/MiraAPI/PluginLoading/MiraPluginInfo.cs index 7168a70..0df7cb5 100644 --- a/MiraAPI/PluginLoading/MiraPluginInfo.cs +++ b/MiraAPI/PluginLoading/MiraPluginInfo.cs @@ -13,7 +13,7 @@ using MiraAPI.Presets; namespace MiraAPI.PluginLoading; /// -/// Represents a Mira plugin. +/// Represents an . /// public class MiraPluginInfo { @@ -26,32 +26,32 @@ public class MiraPluginInfo } /// - /// Gets a read only collection of this plugin's modifiers. This is not safe for modifiers with constructors. + /// Gets a of this 's s. This is not safe for s with constructors. /// public IReadOnlyCollection Modifiers { get; private set; } = null!; /// - /// Gets a read only collection of this plugin's Option Groups. + /// Gets a of this 's s. /// public IReadOnlyCollection OptionGroups { get; private set; } = null!; /// - /// Gets a read only collection of this plugin's options. + /// Gets a of this 's s. /// public IReadOnlyCollection Options { get; private set; } = null!; /// - /// Gets a read only dictionary of Role IDs and the RoleBehaviour object they are associated with. + /// Gets a of Role IDs and the object they are associated with. /// public ReadOnlyDictionary Roles { get; private set; } = null!; /// - /// Gets a read only collection of this plugin's custom buttons. + /// Gets a of this 's . /// public IReadOnlyCollection Buttons { get; private set; } = null!; /// - /// Gets a read only dictionary of this plugin's custom presets. + /// Gets a of this 's s. /// public IReadOnlyCollection Presets { get; internal set; } = null!; @@ -95,7 +95,7 @@ public class MiraPluginInfo public PluginInfo PluginInfo { get; } /// - /// Gets the plugin's configuration file. + /// Gets the plugin's . /// public ConfigFile PluginConfig { get; } } diff --git a/MiraAPI/PluginLoading/MiraPluginManager.cs b/MiraAPI/PluginLoading/MiraPluginManager.cs index 26a881f..4639b4f 100644 --- a/MiraAPI/PluginLoading/MiraPluginManager.cs +++ b/MiraAPI/PluginLoading/MiraPluginManager.cs @@ -153,7 +153,7 @@ public sealed class MiraPluginManager /// Get a mira plugin by its GUID. /// /// The plugin GUID. - /// A MiraPluginInfo. + /// A . public static MiraPluginInfo? GetPluginByGuid(string pluginId) { return Instance._registeredPlugins.Values.FirstOrDefault(plugin => plugin.PluginId == pluginId); diff --git a/MiraAPI/Presets/OptionPreset.cs b/MiraAPI/Presets/OptionPreset.cs index 89786e4..94add31 100644 --- a/MiraAPI/Presets/OptionPreset.cs +++ b/MiraAPI/Presets/OptionPreset.cs @@ -23,12 +23,12 @@ public class OptionPreset public MiraPluginInfo Plugin { get; } /// - /// Gets the configuration file of the plugin associated with the preset. + /// Gets the of the plugin associated with the preset. /// public ConfigFile PluginConfig { get; } /// - /// Gets the configuration file for the preset. + /// Gets the for the preset. /// public ConfigFile PresetConfig { get; } diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index ba4289f..ac34256 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -10,7 +10,7 @@ using UnityEngine; namespace MiraAPI.Presets; /// -/// Provides functionality to manage and load game option presets for plugins. +/// Provides functionality to manage and load game s for plugins. /// public static class PresetManager { @@ -23,7 +23,7 @@ public static class PresetManager internal static List InternalMasterPresets { get; } = []; /// - /// Gets a read only dictionary of this plugin's custom presets. + /// Gets a of this plugin's s. /// public static IReadOnlyCollection MasterPresets { get; internal set; } = null!; @@ -52,9 +52,9 @@ public static class PresetManager } /// - /// Loads the presets for the specified plugin by reading the configuration files from the preset directory. + /// Loads the s for the specified plugin by reading the s from the preset directory. /// - /// >The plugin for which the presets should be loaded. + /// >The plugin for which the s should be loaded. public static void LoadPresets(MiraPluginInfo plugin) { foreach (var btn in plugin.InternalPresets.Select(x=>x.PresetButton)) @@ -105,7 +105,7 @@ public static class PresetManager } /// - /// Loads the master presets by reading the configuration files from the preset directory. + /// Loads the master presets by reading the s from the preset directory. /// public static void LoadMasterPreset() { diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index d597fa8..3ba3170 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -24,7 +24,7 @@ public record struct CustomRoleConfiguration /// /// Initializes a new instance of the struct. /// - /// The role in which you are configuring. + /// The in which you are configuring. public CustomRoleConfiguration(ICustomRole role) { var roleBehaviour = role as RoleBehaviour; @@ -76,13 +76,13 @@ public record struct CustomRoleConfiguration public bool CanModifyChance { get; set; } = true; /// - /// Gets or sets the Sprite used for the Role Options menu screenshot. + /// Gets or sets the used for the Role Options menu screenshot. /// [HideFromIl2Cpp] public LoadableAsset? OptionsScreenshot { get; set; } = null; /// - /// Gets or sets the Sprite used for the Role Icon. + /// Gets or sets the used for the Role Icon. /// [HideFromIl2Cpp] public LoadableAsset? Icon { get; set; } = null; @@ -109,12 +109,12 @@ public record struct CustomRoleConfiguration public bool UseVanillaKillButton { get; set; } /// - /// Gets or sets a value indicating whether the role can use vents. Also sends vanilla vent data. + /// Gets or sets a value indicating whether the role can use s. Also sends vanilla data. /// public bool CanUseVent { get; set; } /// - /// Gets or sets a value indicating whether the role can receive vanilla vent data. + /// Gets or sets a value indicating whether the role can receive vanilla data. /// public bool GetsVentData { get; set; } @@ -144,12 +144,12 @@ public record struct CustomRoleConfiguration public string FreeplayFolder { get; set; } /// - /// Gets or sets the outline color for the KillButton if is true. + /// Gets or sets the outline for the if is true. /// public Color KillButtonOutlineColor { get; set; } /// - /// Gets or sets the role hint style. See enum for all options. + /// Gets or sets the role hint style. See for all options. /// public RoleHintType RoleHintType { get; set; } = RoleHintType.RoleTab; diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index f306c68..5da309e 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -37,17 +37,17 @@ public static class CustomRoleManager CustomRoleUtils.GetIntroSound(RoleTypes.Impostor)!; /// - /// Gets the list of all roles from vanilla RoleManager. + /// Gets the array of all roles from vanilla . /// public static RoleBehaviour[] AllRoles => RoleManager.Instance.AllRoles.ToArray(); /// - /// Gets the list of custom roles as RoleBehaviour objects. + /// Gets the of custom roles as objects. /// public static IReadOnlyList CustomRoleBehaviours { get; private set; } = []; /// - /// Gets the list of custom roles as ICustomRole objects. + /// Gets the of custom roles as objects. /// public static IReadOnlyList CustomMiraRoles { get; private set; } = []; @@ -195,18 +195,18 @@ public static class CustomRoleManager /// /// Finds the parent mod of a custom role. /// - /// The ICustomRole object. - /// A MiraPluginInfo object representing the parent mod of the role. + /// The object. + /// A object representing the parent mod of the role. public static MiraPluginInfo FindParentMod(ICustomRole role) { return MiraPluginManager.Instance.RegisteredPlugins.First(plugin => plugin.InternalRoles.ContainsValue(role as RoleBehaviour ?? throw new InvalidOperationException())); } /// - /// Gets a custom role behaviour by role type. + /// Gets a custom role behaviour by . /// - /// The role type enum. - /// The ICustomRole result. + /// The . + /// The result. /// True if the role was found. public static bool GetCustomRoleBehaviour(RoleTypes roleType, out ICustomRole? result) { diff --git a/MiraAPI/Roles/CustomRoleSingleton.cs b/MiraAPI/Roles/CustomRoleSingleton.cs index 90867af..fe69eb0 100644 --- a/MiraAPI/Roles/CustomRoleSingleton.cs +++ b/MiraAPI/Roles/CustomRoleSingleton.cs @@ -4,15 +4,15 @@ using System.Linq; namespace MiraAPI.Roles; /// -/// A utility class to get the instance of a custom role. +/// A utility class to get the instance of a custom role. /// -/// The role you are trying to access. +/// The you are trying to access. public static class CustomRoleSingleton where T : ICustomRole { private static T? _instance; /// - /// Gets the instance of the role. + /// Gets the instance of the role. /// [SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "This is a utility class to get the instance of a custom role.")] public static T Instance => _instance ??= CustomRoleManager.CustomRoles.Values.OfType().Single(); diff --git a/MiraAPI/Roles/CustomRoleUtils.cs b/MiraAPI/Roles/CustomRoleUtils.cs index fba91bf..af8c5d4 100644 --- a/MiraAPI/Roles/CustomRoleUtils.cs +++ b/MiraAPI/Roles/CustomRoleUtils.cs @@ -15,10 +15,10 @@ namespace MiraAPI.Roles; public static class CustomRoleUtils { /// - /// Determines whether the specified role can spawn in general, accounting for gamemodes and everything else. + /// Determines whether the specified can spawn in general, accounting for gamemodes and everything else. /// - /// The role you would like to check for. - /// True if the role is able to spawn, otherwise false. + /// The you would like to check for. + /// True if the is able to spawn, otherwise false. public static bool CanSpawnOnCurrentMode(RoleBehaviour role) { if (role is ICustomRole custom) @@ -73,7 +73,7 @@ public static class CustomRoleUtils /// /// Gets all active in-game roles. /// - /// A list of roles. + /// An of s. // ReSharper disable once MemberCanBePrivate.Global public static IEnumerable GetActiveRoles() => PlayerControl.AllPlayerControls.ToArray().Select(x => x.Data.Role); @@ -85,17 +85,17 @@ public static class CustomRoleUtils public static IEnumerable GetActiveRolesOfTeam(ModdedRoleTeams team) => GetActiveRoles().Where(x => x is ICustomRole customRole && customRole.Team == team); /// - /// Gets all active in-game roles of a certain type. + /// Gets all active in-game roles. /// - /// The role Type you would like to check for. Must be a RoleBehaviour. - /// A list of roles with that specific type. + /// The you would like to check for. + /// An of s. public static IEnumerable GetActiveRolesOfType() where T : RoleBehaviour => GetActiveRoles().OfType(); /// - /// Creates a string builder for the Role Tab. + /// Creates a for the Role Tab. /// - /// The ICustomRole object. - /// A StringBuilder. + /// The object. + /// A . public static StringBuilder CreateForRole(ICustomRole role) { var taskStringBuilder = new StringBuilder(); @@ -109,7 +109,7 @@ public static class CustomRoleUtils /// Returns an intro sound from a role. /// /// The role type. - /// The intro sound. + /// The intro . public static LoadableAsset? GetIntroSound(RoleTypes roleType) { var role = CustomRoleManager.AllRoles.FirstOrDefault(role => role.Role == roleType); @@ -122,10 +122,10 @@ public static class CustomRoleUtils } /// - /// Determines if a role is a custom role or not. + /// Determines if a is a custom role or not. /// - /// The RoleBehaviour to check. - /// True if the role is a custom role, false otherwise. + /// The to check. + /// True if the is a custom role, false otherwise. public static bool IsCustomRole(this RoleBehaviour role) { return CustomRoleManager.CustomRoles.ContainsKey((ushort)role.Role); diff --git a/MiraAPI/Roles/ICustomRole.cs b/MiraAPI/Roles/ICustomRole.cs index 3570654..944eb46 100644 --- a/MiraAPI/Roles/ICustomRole.cs +++ b/MiraAPI/Roles/ICustomRole.cs @@ -30,17 +30,17 @@ public interface ICustomRole : IOptionable string RoleLongDescription { get; } /// - /// Gets the color of the role. + /// Gets the of the role. /// Color RoleColor { get; } /// - /// Gets the color that should be used in the options menu. + /// Gets the that should be used in the options menu. /// Color OptionsMenuColor => RoleColor; /// - /// Gets the team of the role. + /// Gets the of the role. /// ModdedRoleTeams Team { get; } @@ -50,7 +50,7 @@ public interface ICustomRole : IOptionable CustomRoleConfiguration Configuration { get; } /// - /// Gets the role options group. + /// Gets the . /// RoleOptionsGroup RoleOptionsGroup => Team switch { @@ -88,9 +88,9 @@ public interface ICustomRole : IOptionable } /// - /// Saves the role's configuration to a preset ConfigFile. + /// Saves the role's configuration to a preset . /// - /// The ConfigFile to save the preset configuration to. + /// The to save the preset configuration to. /// Whether to use the default values for the configuration. public virtual void SaveToPreset(ConfigFile presetConfig, bool useDefault=false) { @@ -100,9 +100,9 @@ public interface ICustomRole : IOptionable } /// - /// Loads the role's configuration from a preset ConfigFile. + /// Loads the role's configuration from a preset . /// - /// The ConfigFile containing the preset configuration. + /// The containing the preset configuration. public virtual void LoadFromPreset(ConfigFile presetConfig) { if (presetConfig.TryGetEntry(NumConfigDefinition, out ConfigEntry numEntry)) @@ -186,7 +186,7 @@ public interface ICustomRole : IOptionable } /// - /// Whether the local player can see this role. + /// Whether the can see this role. /// /// The player with the role. /// Whether they can see the role (name color) or not. @@ -228,14 +228,14 @@ public interface ICustomRole : IOptionable /// /// Get the custom Role Tab text for this role. /// - /// A StringBuilder with the role tab text. + /// A with the role tab text. StringBuilder SetTabText() => CustomRoleUtils.CreateForRole(this); /// - /// Determine whether a given modifier can be applied to this role. + /// Determine whether a given can be applied to this role. /// /// The modifier to be tested. - /// True if the modifier is valid on this role, false otherwise. + /// True if the is valid on this role, false otherwise. bool IsModifierApplicable(BaseModifier modifier) { return true; diff --git a/MiraAPI/Roles/RoleId.cs b/MiraAPI/Roles/RoleId.cs index 91044fb..189682b 100644 --- a/MiraAPI/Roles/RoleId.cs +++ b/MiraAPI/Roles/RoleId.cs @@ -8,7 +8,7 @@ namespace MiraAPI.Roles; public static class RoleId { /// - /// Gets the ID of a role. + /// Gets the ID of an . /// /// The type of the role. /// The role ID as a ushort. diff --git a/MiraAPI/Roles/RoleOptionsGroup.cs b/MiraAPI/Roles/RoleOptionsGroup.cs index a1785b0..46b6067 100644 --- a/MiraAPI/Roles/RoleOptionsGroup.cs +++ b/MiraAPI/Roles/RoleOptionsGroup.cs @@ -6,7 +6,7 @@ namespace MiraAPI.Roles; /// Represents a group of roles. /// /// The group's name. -/// The group's color. +/// The group's . /// The priority to sort by on role setting screen. Negative means first. public record struct RoleOptionsGroup(string Name, Color Color, int Priority = 0) { diff --git a/MiraAPI/Roles/TeamIntroConfiguration.cs b/MiraAPI/Roles/TeamIntroConfiguration.cs index 9177722..b01fe0e 100644 --- a/MiraAPI/Roles/TeamIntroConfiguration.cs +++ b/MiraAPI/Roles/TeamIntroConfiguration.cs @@ -5,7 +5,7 @@ namespace MiraAPI.Roles; /// /// Used to configure the TEAM part of the intro cutscene. /// -/// The color to show during the "Team" part of the intro cutscene. +/// The to show during the "Team" part of the intro cutscene. /// The title text to show during the "Team" part of the intro cutscene. /// The description text to show during the "Team" part of the intro cutscene. public record struct TeamIntroConfiguration(Color IntroTeamColor, string IntroTeamTitle, string IntroTeamDescription) diff --git a/MiraAPI/Utilities/Assets/LoadableAssetWrapper.cs b/MiraAPI/Utilities/Assets/LoadableAssetWrapper.cs index 578c051..a368492 100644 --- a/MiraAPI/Utilities/Assets/LoadableAssetWrapper.cs +++ b/MiraAPI/Utilities/Assets/LoadableAssetWrapper.cs @@ -3,7 +3,7 @@ namespace MiraAPI.Utilities.Assets; /// -/// Wrapper class to turn any UnityEngine.Object into a . +/// Wrapper class to turn any into a . /// /// The type of the asset to be loaded. Must be a subclass of . public class LoadableAssetWrapper : LoadableAsset where T : UnityEngine.Object @@ -11,7 +11,7 @@ public class LoadableAssetWrapper : LoadableAsset where T : UnityEngine.Ob /// /// Initializes a new instance of the class. /// - /// The asset to wrap. This should be a reference to a UnityEngine.Object. + /// The asset to wrap. This should be a reference to a . public LoadableAssetWrapper(T asset) { LoadedAsset = asset.DontDestroy(); diff --git a/MiraAPI/Utilities/Assets/LoadableBundleAsset.cs b/MiraAPI/Utilities/Assets/LoadableBundleAsset.cs index 6f46eef..3476a9a 100644 --- a/MiraAPI/Utilities/Assets/LoadableBundleAsset.cs +++ b/MiraAPI/Utilities/Assets/LoadableBundleAsset.cs @@ -5,15 +5,15 @@ using UnityEngine; namespace MiraAPI.Utilities.Assets; /// -/// A utility class for loading assets from an asset bundle. +/// A utility class for loading assets from an . /// /// The name of the asset. -/// The AssetBundle that contains the asset. +/// The that contains the asset. /// The type of the asset to be loaded. public class LoadableBundleAsset(string name, AssetBundle bundle) : LoadableAsset where T : UnityEngine.Object { /// - /// Loads the asset from the asset bundle. + /// Loads the asset from the . /// /// The asset. /// The asset did not load properly. diff --git a/MiraAPI/Utilities/Assets/MiraAssets.cs b/MiraAPI/Utilities/Assets/MiraAssets.cs index bb91416..8ae8986 100644 --- a/MiraAPI/Utilities/Assets/MiraAssets.cs +++ b/MiraAPI/Utilities/Assets/MiraAssets.cs @@ -26,12 +26,12 @@ public static class MiraAssets } /// - /// Gets the color used for teal highlighting in UI. + /// Gets the used for teal highlighting in UI. /// public static Color32 AcceptedTeal { get; } = new(43, 233, 198, 255); /// - /// Gets the Mira API asset bundle. + /// Gets the Mira API . /// public static AssetBundle MiraAssetBundle { get; } = AssetBundleManager.Load("mirabundle"); @@ -46,22 +46,22 @@ public static class MiraAssets public static LoadableAsset PresetSavePopup { get; } = new LoadableBundleAsset("PresetSavePopup", MiraAssetBundle); /// - /// Gets the Refresh Icon sprite. + /// Gets the Refresh Icon . /// public static LoadableAsset RefreshIcon { get; } = new LoadableBundleAsset("refresh", MiraAssetBundle); /// - /// Gets the Folder Icon sprite. + /// Gets the Folder Icon . /// public static LoadableAsset FolderIcon { get; } = new LoadableBundleAsset("freePlay_folderTaskRoom", MiraAssetBundle); /// - /// Gets the empty sprite asset. + /// Gets the empty asset. /// public static LoadableResourceAsset Empty { get; } = new("MiraAPI.Resources.Empty.png"); /// - /// Gets the RoundedBox sprite, which is a rounded rectangle used for UI elements. + /// Gets the RoundedBox , which is a rounded rectangle used for UI elements. /// public static LoadableAsset RoundedBox { get; } @@ -71,7 +71,7 @@ public static class MiraAssets public static LoadableResourceAsset NextButton { get; } = new("MiraAPI.Resources.NextButton.png"); /// - /// Gets the Mira settings icon.. + /// Gets the Mira settings icon. /// public static LoadableResourceAsset SettingsIcon { get; } = new("MiraAPI.Resources.Settings.png"); diff --git a/MiraAPI/Utilities/Assets/PreloadedAsset.cs b/MiraAPI/Utilities/Assets/PreloadedAsset.cs index 5f7cd99..cf4ef7c 100644 --- a/MiraAPI/Utilities/Assets/PreloadedAsset.cs +++ b/MiraAPI/Utilities/Assets/PreloadedAsset.cs @@ -4,9 +4,9 @@ namespace MiraAPI.Utilities.Assets; /// /// An implementation for creating loadable assets from existing assets. +/// /// /// -/// public class PreloadedAsset(T asset) : LoadableAsset where T : UnityEngine.Object { private readonly T _loadedAsset = asset ?? throw new ArgumentNullException(nameof(asset)); diff --git a/MiraAPI/Utilities/Assets/SpriteTools.cs b/MiraAPI/Utilities/Assets/SpriteTools.cs index 8bea6f1..b0d4a1e 100644 --- a/MiraAPI/Utilities/Assets/SpriteTools.cs +++ b/MiraAPI/Utilities/Assets/SpriteTools.cs @@ -11,12 +11,12 @@ namespace MiraAPI.Utilities.Assets; public static class SpriteTools { /// - /// Loads and returns a texture from a resource path using the specified assembly. + /// Loads and returns a texture from a resource path using the specified . /// - /// The path to the resource within the assembly. - /// The assembly from which to load the resource. + /// The path to the resource within the . + /// The from which to load the resource. /// A object loaded from the specified resource path. - /// Thrown when the resource cannot be found in the specified assembly. + /// Thrown when the resource cannot be found in the specified . public static Texture2D LoadTextureFromResourcePath(string resourcePath, Assembly assembly) { var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false) @@ -39,10 +39,10 @@ public static class SpriteTools } /// - /// Loads and returns a from a resource path using the specified assembly. + /// Loads and returns a from a resource path using the specified . /// - /// The path to the resource within the assembly. - /// The assembly from which to load the resource. + /// The path to the resource within the . + /// The from which to load the resource. /// The number of pixels per unit for the sprite. /// A object created from the texture loaded from the specified resource path. public static Sprite LoadSpriteFromPath(string resourcePath, Assembly assembly, float pixelsPerUnit) diff --git a/MiraAPI/Utilities/ColorExtensions.cs b/MiraAPI/Utilities/ColorExtensions.cs index f6a121e..0bf4ebf 100644 --- a/MiraAPI/Utilities/ColorExtensions.cs +++ b/MiraAPI/Utilities/ColorExtensions.cs @@ -3,14 +3,14 @@ namespace MiraAPI.Utilities; /// -/// Extension methods for the Color struct. +/// Extension methods for the struct. /// public static class ColorExtensions { /// - /// Gets the relative luminance of a color (WCAG 2.1 specification). 0 is black, 1 is white. + /// Gets the relative luminance of a (WCAG 2.1 specification). 0 is black, 1 is white. /// - /// Color to calculate luminance for. + /// to calculate luminance for. /// Luminance value between 0 and 1. public static float GetRelativeLuminance(this Color color) { @@ -21,11 +21,11 @@ public static class ColorExtensions } /// - /// Calculates the contrast ratio between two colors (WCAG 2.1 specification). + /// Calculates the contrast ratio between two s (WCAG 2.1 specification). /// - /// First color. - /// Second color. - /// Contrast ratio between the two colors. + /// First . + /// Second . + /// Contrast ratio between the two s. public static float GetContrastRatio(this Color colorA, Color colorB) { var luminanceA = colorA.GetRelativeLuminance(); @@ -34,11 +34,11 @@ public static class ColorExtensions } /// - /// Generates an accessible alternate color with sufficient contrast. + /// Generates an accessible alternate with sufficient contrast. /// - /// Base color. + /// Base . /// Target contrast ratio (default 4.5f for AA). - /// Alternate color with sufficient contrast. + /// Alternate with sufficient contrast. public static Color FindAlternateColor(this Color color, float desiredRatio = 4.5f) { var lightColor = FindMinimumContrastColor(color, Color.white, desiredRatio); @@ -48,12 +48,12 @@ public static class ColorExtensions } /// - /// Finds the color with the minimum contrast ratio to the target color. + /// Finds the with the minimum contrast ratio to the target . /// - /// The base color to start from. - /// The target color to compare against. + /// The base to start from. + /// The target to compare against. /// The desired contrast ratio. - /// The color with the minimum contrast ratio to the target color. + /// The with the minimum contrast ratio to the target . public static Color FindMinimumContrastColor(Color baseColor, Color targetColor, float desiredRatio) { var baseLuminance = baseColor.GetRelativeLuminance(); diff --git a/MiraAPI/Utilities/EnumerableExtensions.cs b/MiraAPI/Utilities/EnumerableExtensions.cs index 5e0bc35..7733c43 100644 --- a/MiraAPI/Utilities/EnumerableExtensions.cs +++ b/MiraAPI/Utilities/EnumerableExtensions.cs @@ -10,23 +10,23 @@ namespace MiraAPI.Utilities; public static class EnumerableExtensions { /// - /// Shuffle the elements of the source enumerable using a new instance of Random. + /// Shuffle the elements of the using a new instance of . /// - /// The source enumerable. + /// The source . /// The type of the elements. - /// >The shuffled enumerable. + /// >The shuffled . public static IEnumerable Shuffle(this IEnumerable source) { return source.Shuffle(new Random()); } /// - /// Shuffle the elements of the source enumerable using the provided Random instance. + /// Shuffle the elements of the using the provided instance. /// - /// The source enumerable. - /// The Random instance to use for shuffling. + /// The source . + /// The instance to use for shuffling. /// The type of the elements. - /// >The shuffled enumerable. + /// >The shuffled . public static IEnumerable Shuffle(this IEnumerable source, Random rng) { ArgumentNullException.ThrowIfNull(source); diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 8c4acc7..3b67e5d 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -45,9 +45,9 @@ public static class Extensions } /// - /// Used if you override Minigame.Close. + /// Used if you override . /// - /// The minigame. + /// The . public static void BaseClose(this Minigame self) { bool isComplete; @@ -88,9 +88,9 @@ public static class Extensions } /// - /// Sets the cooldown of a button with a formatted string. + /// Sets the cooldown of an with a formatted string. /// - /// The ActionButton to set the cooldown for. + /// The to set the cooldown for. /// The current timer value. /// The maximum timer value. /// The format string to use for the timer text. @@ -109,9 +109,9 @@ public static class Extensions } /// - /// Sets the fill-up variant of a cooldown button with a formatted string. + /// Sets the fill-up variant of a cooldown with a formatted string. /// - /// The ActionButton to set the cooldown for. + /// The to set the cooldown for. /// The current timer value. /// The maximum timer value. /// The format string to use for the timer text. @@ -158,23 +158,23 @@ public static class Extensions } /// - /// Gets a PlayerControl from their PlayerVoteArea in a meeting. + /// Gets a from their in a meeting. /// - /// The vote area. - /// The player's PlayerControl. + /// The . + /// The player's . public static PlayerControl? GetPlayer(this PlayerVoteArea state) => GameData.Instance.GetPlayerById(state.TargetPlayerId)?.Object; /// - /// Gets an int representing the amount of tasks a player has left. + /// Gets an representing the amount of tasks a player has left. /// /// The player. /// A count of how many tasks the player has left. public static int GetTasksLeft(this PlayerControl player) => player.Data.Tasks.ToArray().Count(x => !x.Complete); /// - /// Checks if a PlayerControl is the game's host. + /// Checks if a is the game's host. /// - /// The player you're checking for. + /// The you're checking for. /// If the player is the host, true, else false. public static bool IsHost(this PlayerControl playerControl) { @@ -182,9 +182,9 @@ public static class Extensions } /// - /// Checks if a PlayerControl is protected by a Guardian Angel. + /// Checks if a is protected by a Guardian Angel. /// - /// The player you're checking for. + /// The you're checking for. /// If the player is protected, true, else false. public static bool ProtectedByGa(this PlayerControl playerControl) { @@ -192,9 +192,9 @@ public static class Extensions } /// - /// Used to convert a System.Collections.Generic.List to Il2cppSystem. + /// Used to convert a to . /// - /// The list. + /// The . /// The type in the list. /// The converted list. public static Il2CppSystem.Collections.Generic.List ToIl2CppList(this List systemList) @@ -210,25 +210,25 @@ public static class Extensions } /// - /// Determines if a float is an integer. + /// Determines if a is an integer. /// - /// The float number. - /// True if the float is an integer, false otherwise. + /// The number. + /// True if the is an integer, false otherwise. public static bool IsInteger(this float number) { return Mathf.Approximately(number, Mathf.Round(number)); } /// - /// Gets a cache of player's vote data components to improve performance. + /// Gets a cache of 's to improve performance. /// public static Dictionary VoteDataComponents { get; } = []; /// - /// Gets the PlayerVoteData of a player. + /// Gets the of a . /// - /// The PlayerControl object. - /// A PlayerVoteData if there is one, null otherwise. + /// The object. + /// A if there is one, null otherwise. public static PlayerVoteData GetVoteData(this PlayerControl player) { if (VoteDataComponents.TryGetValue(player, out var component)) @@ -247,11 +247,11 @@ public static class Extensions } /// - /// Gets the maximum value from a dictionary of integers, returning the key and value. + /// Gets the maximum value from a of integers, returning the key and value. /// - /// The dictionary to search. + /// The to search. /// Whether there is a tie for the maximum value. - /// The key-value pair with the maximum value. + /// The with the maximum value. public static KeyValuePair MaxPair(this Dictionary self, out bool tie) { tie = true; @@ -272,11 +272,11 @@ public static class Extensions } /// - /// Gets the maximum value from a dictionary of floats, returning the key and value. + /// Gets the maximum value from a of floats, returning the key and value. /// - /// The dictionary to search. + /// The to search. /// Whether there is a tie for the maximum value. - /// The key-value pair with the maximum value. + /// The with the maximum value. public static KeyValuePair MaxPair(this Dictionary self, out bool tie) { tie = true; @@ -313,10 +313,10 @@ public static class Extensions } /// - /// Gets a proper string for an enum. (with spaces). + /// Gets a proper string for an . (with spaces). /// - /// The enum you would like to change. - /// A proper string for the enum. + /// The you would like to change. + /// A proper string for the . public static string ToDisplayString(this Enum @enum) { var regex = new Regex(@"([^\^])([A-Z][a-z$])"); @@ -366,9 +366,9 @@ public static class Extensions } /// - /// Enables stencil masking on a TMP text object. + /// Enables stencil masking on a object. /// - /// The TMP text. + /// The . public static void EnableStencilMasking(this TMP_Text text) { text.fontMaterial.SetFloat(ShaderID.Stencil, 1); @@ -386,11 +386,11 @@ public static class Extensions } /// - /// Gets a darkened version of a color. + /// Gets a darkened version of a . /// - /// The original color. + /// The original . /// A darkness amount between 0 and 255. - /// The darkened color. + /// The darkened . public static Color32 GetShadowColor(this Color32 color, byte darknessAmount) { return @@ -416,11 +416,11 @@ public static class Extensions } /// - /// Chunks a collection of NetData into smaller arrays. + /// Chunks a collection of into smaller arrays. /// - /// A collection of NetData objects. + /// An of s. /// The max chunk size in bytes. - /// A Queue of NetData arrays. + /// A of arrays. public static Queue ChunkNetData(this IEnumerable dataCollection, int chunkSize) { Queue chunks = []; @@ -457,10 +457,10 @@ public static class Extensions } /// - /// Determines if a given OptionBehaviour is for a custom option. + /// Determines if a given is for a custom option. /// - /// The OptionBehaviour to be tested. - /// True if the OptionBehaviour is for a custom options, false otherwise. + /// The to be tested. + /// True if the is for a custom options, false otherwise. public static bool IsCustom(this OptionBehaviour optionBehaviour) { return ModdedOptionsManager.ModdedOptions.Values.Any( @@ -468,11 +468,11 @@ public static class Extensions } /// - /// Randomizes a list. + /// Randomizes a . /// - /// The list object. - /// The type of object the list contains. - /// A randomized list made from the original list. + /// The object. + /// The type of object the contains. + /// A randomized made from the original . public static List Randomize(this List list) { List randomizedList = []; @@ -488,33 +488,33 @@ public static class Extensions } /// - /// Darkens a color by a specified amount. + /// Darkens a by a specified amount. /// - /// The original color. - /// A float amount between 0 and 1. - /// The darkened color. + /// The original . + /// A amount between 0 and 1. + /// The darkened . public static Color DarkenColor(this Color color, float amount = 0.45f) { return new Color(color.r - amount, color.g - amount, color.b - amount); } /// - /// Lightens a color by a specified amount. + /// Lightens a by a specified amount. /// - /// The original color. - /// A float amount between 0.0 and 1.0. - /// The lightened color. + /// The original . + /// A amount between 0.0 and 1.0. + /// The lightened . public static Color LightenColor(this Color color, float amount = 0.45f) { return new Color(color.r + amount, color.g + amount, color.b + amount); } /// - /// Gets the nearest dead body to a player. + /// Gets the nearest to a . /// - /// The player object. + /// The object. /// The radius to search within. - /// The dead body if it is found, or null there is none within the radius. + /// The if it is found, or null there is none within the radius. public static DeadBody? GetNearestDeadBody(this PlayerControl playerControl, float radius) { return Helpers @@ -523,15 +523,15 @@ public static class Extensions } /// - /// Finds the nearest object of a specified type to a player. It will only work if the object has a collider. + /// Finds the nearest to a . It will only work if the object has a collider. /// - /// The player object. + /// The object. /// The radius to search within. /// The contact filter. /// An optional collider tag. - /// Optional predicate to test if the object is valid. + /// Optional predicate to test if the is valid. /// The type of the object. - /// The object if it was found, or null if there is none within the radius. + /// The if it was found, or null if there is none within the radius. public static T? GetNearestObjectOfType( this PlayerControl playerControl, float radius, @@ -544,15 +544,15 @@ public static class Extensions } /// - /// Gets the closest player that matches the given criteria. + /// Gets the closest that matches the given criteria. /// - /// The player object. + /// The object. /// Whether impostors should be included in the search. /// The radius to search within. /// Whether colliders should be ignored when searching. /// Determines if Ghosts are included. - /// Optional predicate to test if the object is valid. - /// The closest player if there is one, false otherwise. + /// Optional predicate to test if the is valid. + /// The closest if there is one, false otherwise. public static PlayerControl? GetClosestPlayer( this PlayerControl playerControl, bool includeImpostors, @@ -572,10 +572,10 @@ public static class Extensions } /// - /// Fixed version of Reactor's SetOutline. + /// Fixed version of . /// - /// The renderer you want to update the outline for. - /// The outline color. + /// The you want to update the outline for. + /// The outline . public static void UpdateOutline(this Renderer renderer, Color? color) { renderer.material.SetFloat(ShaderID.Outline, color.HasValue ? 1 : 0); @@ -588,7 +588,7 @@ public static class Extensions /// /// Registers a new mod keybind as a user-assignable button action in Rewired. /// - /// The Rewired user data to add the action to. + /// The Rewired to add the action to. /// The internal name of the action. /// Text shown in the rebinding UI. /// /// Group shown above the label. diff --git a/MiraAPI/Utilities/Helpers.cs b/MiraAPI/Utilities/Helpers.cs index b537ef0..cd08d8a 100644 --- a/MiraAPI/Utilities/Helpers.cs +++ b/MiraAPI/Utilities/Helpers.cs @@ -66,11 +66,11 @@ public static class Helpers } /// - /// Creates a draggable scroller. Add items into the scroller.Inner transform. This does not automatically position children. + /// Creates a draggable . Add items into the transform. This does not automatically position children. /// - /// Where the scroller should be parented to. - /// The collider of the scroller. Used to drag. - /// The created scroller object. + /// Where the should be parented to. + /// The collider of the . Used to drag. + /// The created object. public static Scroller CreateScroller(Transform parent, BoxCollider2D hitBoxCollider) { var scrollObj = new GameObject("Scroller"); @@ -95,7 +95,7 @@ public static class Helpers /// /// Divides a button/etc by a certain amount by resizing colliders and renderer sizes. /// - /// The object you want to divide. + /// The you want to divide. /// How much you want to divide by. public static void DivideSize(GameObject obj, float amount) { @@ -147,21 +147,21 @@ public static class Helpers } /// - /// Retrieves a vent from the ID. + /// Retrieves a from the ID. /// /// The vent ID. - /// The vent. + /// The . public static Vent? GetVentById(int id) { return ShipStatus.Instance.AllVents.FirstOrDefault(vent => vent.Id == id); } /// - /// Creates an arrow. + /// Creates an . /// - /// The arrow gameObject's parent. + /// The arrow 's parent. /// The color of the arrow. - /// The created ArrowBehaviour. + /// The created . public static ArrowBehaviour CreateArrow(Transform parent, Color color) { var prefab = Object.FindObjectOfType(true); @@ -174,10 +174,10 @@ public static class Helpers } /// - /// Get the closest object of a specific type. + /// Get the closest . /// - /// A list of all the objects you'd like to check the distance for. - /// The position of where you want to check from. For example: PlayerControl.LocalPlayer.transform.position. + /// A list of all s you'd like to check the distance for. + /// The position of where you want to check from. For example: PlayerControl.LocalPlayer.transform.position. /// The object type. /// The closest object. public static T? FindClosestObjectOfType(List objectList, Vector3 position) where T : MonoBehaviour @@ -207,9 +207,9 @@ public static class Helpers /// Creates and shows a notification. /// /// The text you want to display. - /// The color of the text and image. + /// The of the text and image. /// The sound you want to play with the notification. - /// The sprite beside the notification. + /// The beside the notification. /// The created notification. public static LobbyNotificationMessage CreateAndShowNotification(string text, Color color, AudioClip? clip = null, Sprite? spr = null) { @@ -220,10 +220,10 @@ public static class Helpers /// Creates and shows a notification. /// /// The text you want to display. - /// The color of the text and image. + /// The of the text and image. /// The position of the notification. /// The sound you want to play with the notification. - /// The sprite beside the notification. + /// The beside the notification. /// The created notification. public static LobbyNotificationMessage CreateAndShowNotification(string text, Color color, Vector3 localPos, AudioClip? clip = null, Sprite? spr = null) { @@ -252,10 +252,10 @@ public static class Helpers } /// - /// Creates a ContactFilter2D from a layer mask. + /// Creates a from a layer mask. /// /// The layer mask. - /// A new ContactFilter2D that represents the layer mask. + /// A new that represents the layer mask. public static ContactFilter2D CreateFilter(int layerMask) { return ContactFilter2D.CreateLegacyFilter(layerMask, float.MinValue, float.MaxValue); @@ -272,12 +272,12 @@ public static class Helpers } /// - /// Gets a list of dead bodies within a radius. + /// Gets a list of s within a radius. /// /// The source location. /// The radius to search in. /// The contact filter. - /// A list of dead bodies. + /// A of s. public static List GetNearestDeadBodies(Vector2 source, float radius, ContactFilter2D filter) { var results = new Il2CppSystem.Collections.Generic.List(); @@ -288,14 +288,14 @@ public static class Helpers } /// - /// Gets a list of objects within a radius. + /// Gets a list of within a radius. /// /// The source point. /// The radius to search in. /// The contact filter. /// An optional collider tag. /// The type of the object. - /// A list of objects of type T. + /// A of s. public static List GetNearestObjectsOfType(Vector2 source, float radius, ContactFilter2D filter, string? colliderTag = null) where T : Component { @@ -307,12 +307,12 @@ public static class Helpers } /// - /// Gets the closest players to a specific point. + /// Gets the closest s to a specific point. /// /// The source point. /// The radius to search in. /// Whether colliders should be ignored. - /// A list of Player Controls in the radius. + /// A of s in the radius. public static List GetClosestPlayersInCircle( Vector2 source, float radius, @@ -337,13 +337,13 @@ public static class Helpers } /// - /// Gets the closest players to a specific player. + /// Gets the closest s to a specific . /// - /// The source player. + /// The source . /// Distance to search in. /// Whether to ignore colliders. - /// Whether to ignore the source player. - /// A list of PlayerControls. + /// Whether to ignore the player. + /// A of s. public static List GetClosestPlayers( PlayerControl source, float distance = 2f, @@ -362,12 +362,12 @@ public static class Helpers } /// - /// Gets the closest players to a specific point. + /// Gets the closest s to a specific point. /// /// The source point. /// The distance to search in. /// Whether to ignore colliders. - /// A list of Player Controls. + /// A of s. public static List GetClosestPlayers( Vector2 source, float distance = 2f, @@ -415,15 +415,15 @@ public static class Helpers } /// - /// Creates a TextMeshPro object with the specified parameters. + /// Creates a with the specified parameters. /// /// The name of the object. - /// The object parent. - /// The alignment of the TMP object. + /// The object's parent. + /// The alignment of the . /// The distance from the edge. /// The font size. /// The text alignment. - /// A new TMP object. + /// A new . public static TextMeshPro CreateTextLabel( string name, Transform parent, @@ -456,20 +456,20 @@ public static class Helpers } /// - /// Gets a DeadBody by its parent ID. + /// Gets a by its parent ID. /// /// The player ID. - /// A dead body or null if its not found. + /// A or null if its not found. public static DeadBody? GetBodyById(byte id) { return Object.FindObjectsOfType().FirstOrDefault(body => body.ParentId == id); } /// - /// Gets the suffix for a MiraNumberSuffixes enum. + /// Gets the suffix for a . /// - /// The MiraNumberSuffixes enum. - /// A suffix based on the enum. + /// The . + /// A suffix based on the . public static string GetSuffix(MiraNumberSuffixes suffix) { return suffix switch @@ -525,10 +525,10 @@ public static class Helpers } /// - /// Returns the string of a role. + /// Returns the string of a . /// - /// The role to find. - /// The role name. + /// The to find. + /// The 's name. public static string GetRoleName(this RoleBehaviour role) { if (role is ICustomRole custom) @@ -539,10 +539,10 @@ public static class Helpers } /// - /// Returns whether the role is blacklisted from appearing and spawning. (Only applicable to vanilla roles) + /// Returns whether the is blacklisted from appearing and spawning. (Only applicable to vanilla roles). /// - /// The role to check. - /// The role's blacklist status. + /// The to check. + /// The 's blacklist status. public static bool IsRoleBlacklisted(this RoleBehaviour role) { // This should be patchable by mods when a vanilla role is meant to be replaced by a custom role. diff --git a/MiraAPI/Utilities/StateMachineWrapper.cs b/MiraAPI/Utilities/StateMachineWrapper.cs index e590f57..1b2007b 100644 --- a/MiraAPI/Utilities/StateMachineWrapper.cs +++ b/MiraAPI/Utilities/StateMachineWrapper.cs @@ -24,7 +24,7 @@ public class StateMachineWrapper where T : Il2CppObjectBase private T? _parentInstance; /// - /// Gets the instance of the parent class that owns the state machine. + /// Gets the instance of the . /// public T Instance => _parentInstance ??= (T)_thisProperty.GetValue(_stateMachine)!; @@ -68,7 +68,7 @@ public class StateMachineWrapper where T : Il2CppObjectBase public void SetRecentReturn(Object newReturn) => _currentProperty.SetValue(_stateMachine, newReturn); /// - /// Gets a parameter from the state machine by its name. + /// Gets a parameter of type from the state machine by its name. /// /// The name of the parameter to retrieve. /// The type of the parameter to retrieve. diff --git a/MiraAPI/Voting/PlayerVoteData.cs b/MiraAPI/Voting/PlayerVoteData.cs index f673bc4..6e102ee 100644 --- a/MiraAPI/Voting/PlayerVoteData.cs +++ b/MiraAPI/Voting/PlayerVoteData.cs @@ -18,7 +18,7 @@ public class PlayerVoteData(nint cppPtr) : MonoBehaviour(cppPtr) public PlayerControl Owner { get; private set; } = null!; /// - /// Gets the list of votes the owner has. + /// Gets the list of s the owner has. /// [HideFromIl2Cpp] public List Votes { get; private set; } = []; @@ -64,9 +64,9 @@ public class PlayerVoteData(nint cppPtr) : MonoBehaviour(cppPtr) } /// - /// Removes the specified vote. + /// Removes the specified . /// - /// The vote you would like to remove. + /// The you would like to remove. public void RemovePlayerVote(CustomVote vote) { Votes.Remove(vote); diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs index 0edd081..069157d 100644 --- a/MiraAPI/Voting/VotingUtils.cs +++ b/MiraAPI/Voting/VotingUtils.cs @@ -17,9 +17,9 @@ public static class VotingUtils private const byte SkipVoteId = 253; /// - /// Gets the exiled player from the list of votes. Returns null if no player is to be exiled. + /// Gets the exiled player from the list of s. Returns null if no player is to be exiled. /// - /// >The list of votes to check. + /// >The list of s to check. /// Whether the vote is a tie. /// The player to be exiled. Will be null if no player is to be exiled. public static NetworkedPlayerInfo? GetExiled(List votes, out bool isTie) @@ -39,7 +39,7 @@ public static class VotingUtils /// /// Handles when a vote is added and allows for other mods to override/modify. /// - /// The player's vote data. + /// The player's . /// Who the player voted for. /// Whether you want the vote to commence or not. private static void HandleVote(PlayerVoteData voteData, byte suspectIdx, out bool cancelVote) @@ -68,7 +68,7 @@ public static class VotingUtils /// /// Networks the removal of votes. Used to remove votes when a player disconnects. /// - /// The player who is sending the RPC. Should be the host. + /// The who is sending the RPC. Should be the host. /// The player who voted. /// The player who the voter voted for. [MethodRpc((uint)MiraRpc.RemoveVote)] @@ -104,7 +104,7 @@ public static class VotingUtils /// /// Networks the casting of a vote. We replace the vanilla solution with a custom version that works for the use case. /// - /// The player who sent this RPC. + /// The who sent this RPC. /// The id of the player who casted the vote. /// The voted player's id. [MethodRpc((uint)MiraRpc.CastVote)] @@ -163,7 +163,7 @@ public static class VotingUtils /// /// Calculates the total number of votes. /// - /// A list of calculated votes. + /// A list of calculated s. /// The total votes. public static Dictionary CalculateNumVotes(IEnumerable votes) { @@ -183,7 +183,7 @@ public static class VotingUtils /// /// Calculates votes to check if all players have voted. /// - /// The list of votes. + /// The of s. public static List CalculateVotes() { return @@ -196,7 +196,7 @@ public static class VotingUtils /// /// Handles the populating of results locally. Called by the PopulateResultsRpc. /// - /// The list of networked votes. + /// The list of s. public static void HandlePopulateResults(List votes) { PopulateResultsEvent @event = new PopulateResultsEvent(votes); From 8852c014ab32e2b06120fd0f7a28dc7ecc56b091 Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Tue, 23 Jun 2026 20:54:23 -0600 Subject: [PATCH 09/42] Replaced true, false, and null with langword annotations --- MiraAPI/Events/MiraEventManager.cs | 6 +-- .../Events/Vanilla/Meeting/ReportBodyEvent.cs | 4 +- .../Meeting/Voting/CheckForEndVotingEvent.cs | 2 +- .../Meeting/Voting/ProcessVotesEvent.cs | 4 +- MiraAPI/GameEnd/CustomGameOver.cs | 4 +- MiraAPI/GameEnd/GameOverManager.cs | 2 +- MiraAPI/GameModes/CustomGameMode.cs | 20 ++++----- MiraAPI/GameOptions/ModdedOptionsManager.cs | 2 +- .../OptionTypes/ModdedPlayerOption.cs | 4 +- MiraAPI/Hud/CustomActionButton.cs | 16 +++---- MiraAPI/ModCompatibility.cs | 4 +- MiraAPI/Modifiers/BaseModifier.cs | 8 ++-- MiraAPI/Modifiers/ModifierComponent.cs | 42 +++++++++---------- MiraAPI/Modifiers/ModifierExtensions.cs | 34 +++++++-------- MiraAPI/Modifiers/Types/GameModifier.cs | 6 +-- MiraAPI/Patches/Options/SettingPatches.cs | 2 +- .../Roles/RoleOptionsCollectionPatch.cs | 4 +- MiraAPI/Roles/CustomRoleConfiguration.cs | 2 +- MiraAPI/Roles/CustomRoleManager.cs | 2 +- MiraAPI/Roles/CustomRoleUtils.cs | 4 +- MiraAPI/Roles/ICustomRole.cs | 10 ++--- MiraAPI/Utilities/Extensions.cs | 18 ++++---- MiraAPI/Utilities/Helpers.cs | 4 +- MiraAPI/Voting/PlayerVoteData.cs | 2 +- MiraAPI/Voting/VotingUtils.cs | 4 +- 25 files changed, 105 insertions(+), 105 deletions(-) diff --git a/MiraAPI/Events/MiraEventManager.cs b/MiraAPI/Events/MiraEventManager.cs index 592fb2c..005415b 100644 --- a/MiraAPI/Events/MiraEventManager.cs +++ b/MiraAPI/Events/MiraEventManager.cs @@ -17,7 +17,7 @@ public static class MiraEventManager /// /// The instance. /// Type of Event. - /// If there was an event handler invoked for this event, return true. Otherwise, return false. + /// If there was an event handler invoked for this event, return . Otherwise, return . public static bool InvokeEvent(T eventInstance) where T : MiraEvent { EventWrappers.TryGetValue(typeof(T), out var handlers); @@ -46,7 +46,7 @@ public static class MiraEventManager /// /// The instance. /// The type to use for handler lookup. - /// If there was an event handler invoked for this event, return true. Otherwise, return false. + /// If there was an event handler invoked for this event, return . Otherwise, return . public static bool InvokeEvent(MiraEvent eventInstance, Type type) { EventWrappers.TryGetValue(type, out var handlers); @@ -130,7 +130,7 @@ public static class MiraEventManager /// Unregister a handler using the . /// /// A handle to the event. - /// True if the event was unregistered successfully, false otherwise. + /// if the event was unregistered successfully, otherwise. public static bool UnregisterEventHandler(MiraEventHandle eventHandle) { if (!EventWrappers.TryGetValue(eventHandle.EventType, out var handlers)) diff --git a/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs b/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs index dc93d96..fb085b6 100644 --- a/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs @@ -12,12 +12,12 @@ public class ReportBodyEvent : MiraCancelableEvent public PlayerControl Reporter { get; } /// - /// Gets the player that is being reported. Will be null for emergency meeting. + /// Gets the player that is being reported. Will be for emergency meeting. /// public NetworkedPlayerInfo? Target { get; } /// - /// Gets the that is being reported. Will be null for emergency meeting. + /// Gets the that is being reported. Will be for emergency meeting. /// public DeadBody? Body { get; } diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs index b0bdae5..a9b2d8e 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs @@ -18,7 +18,7 @@ public class CheckForEndVotingEvent : MiraCancelableEvent /// /// Initializes a new instance of the class. /// - /// >True if voting is complete, false otherwise. + /// > if voting is complete, otherwise. public CheckForEndVotingEvent(bool isVotingComplete) { IsVotingComplete = isVotingComplete; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs index 0dbd585..e35d1b4 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs @@ -11,7 +11,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// Initializes a new instance of the class. /// /// >The list of s that are being processed. -/// The player to be exiled. Will be null if no player is to be exiled. +/// The player to be exiled. Will be if no player is to be exiled. public class ProcessVotesEvent(List votes, NetworkedPlayerInfo? exiledPlayer = null) : MiraEvent { private readonly List _originalVotes = [.. votes]; @@ -34,7 +34,7 @@ public class ProcessVotesEvent(List votes, NetworkedPlayerInfo? exil public List Votes { get; } = votes; /// - /// Gets or sets the player to be exiled. Will be null if no player is to be exiled. + /// Gets or sets the player to be exiled. Will be if no player is to be exiled. /// public NetworkedPlayerInfo? ExiledPlayer { diff --git a/MiraAPI/GameEnd/CustomGameOver.cs b/MiraAPI/GameEnd/CustomGameOver.cs index 885504e..bb9e23b 100644 --- a/MiraAPI/GameEnd/CustomGameOver.cs +++ b/MiraAPI/GameEnd/CustomGameOver.cs @@ -19,7 +19,7 @@ public abstract class CustomGameOver /// /// The that requested the Game Over. /// The collection of winners. - /// True if the condition is met, otherwise false. + /// if the condition is met, otherwise . public virtual bool VerifyCondition(PlayerControl playerControl, NetworkedPlayerInfo[] winners) { return true; @@ -29,7 +29,7 @@ public abstract class CustomGameOver /// Runs before the base game calls . /// /// The instance. - /// Return True to use the run the original method, return False to skip it. + /// Return to use the run the original method, return to skip it. public virtual bool BeforeEndGameSetup(EndGameManager endGameManager) { return true; diff --git a/MiraAPI/GameEnd/GameOverManager.cs b/MiraAPI/GameEnd/GameOverManager.cs index ac4fef8..c0a144d 100644 --- a/MiraAPI/GameEnd/GameOverManager.cs +++ b/MiraAPI/GameEnd/GameOverManager.cs @@ -20,7 +20,7 @@ public static class GameOverManager /// /// Type of the . /// Thrown when the type is not a subclass of , is abstract, or does not have a parameterless constructor. - /// >True if the game over was registered successfully, false otherwise. + /// > if the game over was registered successfully, otherwise. public static bool RegisterGameOver(Type gameOverType) { if (!typeof(CustomGameOver).IsAssignableFrom(gameOverType)) diff --git a/MiraAPI/GameModes/CustomGameMode.cs b/MiraAPI/GameModes/CustomGameMode.cs index 58d9e58..f4dc43d 100644 --- a/MiraAPI/GameModes/CustomGameMode.cs +++ b/MiraAPI/GameModes/CustomGameMode.cs @@ -88,60 +88,60 @@ public abstract class CustomGameMode /// /// Should Roles Settings be available when this gamemode is selected. /// - /// True if Role Settings are enabled in this game mode. + /// if Role Settings are enabled in this game mode. public virtual bool AreRoleSettingsEnabled() => true; /// /// Should Game Settings be available when this gamemode is selected. /// - /// True if Game Settings are enabled in this mode. + /// if Game Settings are enabled in this mode. public virtual bool AreGameSettingsEnabled() => true; /// /// Custom winner selection. /// - /// List of winners or null. + /// List of winners or . public virtual List? CalculateWinners() => null; /// /// Show gamemode in . /// - /// True if the game mode should be shown in the intro cutscene. + /// if the game mode should be shown in the intro cutscene. public virtual bool ShowGameModeIntroCutscene() => false; /// /// Can Admin be used in this gamemode. /// /// Admin Console. - /// True if Admin console is enabled. + /// if Admin console is enabled. public virtual bool CanUseMapConsole(MapConsole console) => true; /// /// Can a be reported in this gamemode. /// /// Target for reporting. - /// True if s can be reported. + /// if s can be reported. public virtual bool CanReport(DeadBody body) => true; /// /// Can s be used in this gamemode. /// /// System Console. - /// True if s are enabled in this mode. + /// if s are enabled in this mode. public virtual bool CanUseSystemConsole(SystemConsole console) => true; /// /// Can tasks be interacted with in this gamemode. /// /// Task console. - /// True if tasks are enabled in this mode. + /// if tasks are enabled in this mode. public virtual bool CanUseTasks(Console console) => true; /// /// Should the sabotage map be used when attempting to open sabotage overlay. /// /// object. - /// True if the sabotage map should be shown. + /// if the sabotage map should be shown. public virtual bool ShouldShowSabotageMap(MapBehaviour map) => true; /// @@ -149,6 +149,6 @@ public abstract class CustomGameMode /// /// Target vent. /// Player attempting to vent. - /// True if venting is enabled in this mode. + /// if venting is enabled in this mode. public virtual bool CanVent(Vent vent, NetworkedPlayerInfo playerInfo) => true; } diff --git a/MiraAPI/GameOptions/ModdedOptionsManager.cs b/MiraAPI/GameOptions/ModdedOptionsManager.cs index 4ff527b..3e6e04e 100644 --- a/MiraAPI/GameOptions/ModdedOptionsManager.cs +++ b/MiraAPI/GameOptions/ModdedOptionsManager.cs @@ -192,7 +192,7 @@ public static class ModdedOptionsManager /// /// The original getter method. /// The result of the property getter. - /// False so the original getter gets skipped. + /// so the original getter gets skipped. #pragma warning disable CA1707 [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Harmony naming convention")] public static bool PropertyGetterPatch(MethodBase __originalMethod, ref object __result) diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs index 1b30d16..f6516cd 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs @@ -91,9 +91,9 @@ public class ModdedPlayerOption : ModdedOption } /// - /// Returns a player from the value. If is enabled and none is enabled this will return null. + /// Returns a player from the value. If is enabled and none is enabled this will return . /// - /// A player or null if chosen none. + /// A player or if chosen none. public NetworkedPlayerInfo? GetPlayerValue() { return Value < 0 ? null : Values[Value]; diff --git a/MiraAPI/Hud/CustomActionButton.cs b/MiraAPI/Hud/CustomActionButton.cs index 4cac55e..f5cf521 100644 --- a/MiraAPI/Hud/CustomActionButton.cs +++ b/MiraAPI/Hud/CustomActionButton.cs @@ -54,7 +54,7 @@ public abstract class CustomActionButton public virtual string CooldownTimerFormatString => "0"; /// - /// Gets a value indicating whether the button has an effect ability. By default true if is greater than 0. + /// Gets a value indicating whether the button has an effect ability. By default if is greater than 0. /// public virtual bool HasEffect => EffectDuration > 0; @@ -79,7 +79,7 @@ public abstract class CustomActionButton public virtual ButtonUsesMode UsesMode => ButtonUsesMode.PerGame; /// - /// Gets the keybind for this button. If null, no keybind will be added. + /// Gets the keybind for this button. If , no keybind will be added. /// public virtual BaseKeybind? Keybind => null; @@ -429,10 +429,10 @@ public abstract class CustomActionButton /// /// This method determines if the button should be active or not. - /// True means the button is active, false means the button is disabled. + /// means the button is active, means the button is disabled. /// /// The of the local player. - /// True if the button is enabled, false otherwise. + /// if the button is enabled, otherwise. public abstract bool Enabled(RoleBehaviour? role); /// @@ -445,7 +445,7 @@ public abstract class CustomActionButton /// /// Returns a value indicating whether the effect can be ended early by the player. - /// Always false by default. + /// Always by default. /// /// Can the effect be canceled. public virtual bool IsEffectCancellable() => false; @@ -474,7 +474,7 @@ public abstract class CustomActionButton /// /// This method is called on the method. It determines whether the button should be visible or not. - /// The default behavior is to show the button if the parameter and the method return true. + /// The default behavior is to show the button if the parameter and the method return . /// It can be overridden for custom behavior. /// /// Passed in from , should hud be active. @@ -599,7 +599,7 @@ public abstract class CustomActionButton : CustomActionButton where T : MonoB /// Determines if the target is valid. /// /// The target being checked. - /// True if the target is valid, false otherwise. + /// if the target is valid, otherwise. public virtual bool IsTargetValid(T? target) { return target != null; @@ -608,7 +608,7 @@ public abstract class CustomActionButton : CustomActionButton where T : MonoB /// /// The method used to get the target . /// - /// The target or null if it isn't found. + /// The target or if it isn't found. public abstract T? GetTarget(); /// diff --git a/MiraAPI/ModCompatibility.cs b/MiraAPI/ModCompatibility.cs index 23744ab..073453b 100644 --- a/MiraAPI/ModCompatibility.cs +++ b/MiraAPI/ModCompatibility.cs @@ -17,8 +17,8 @@ public static class ModCompatibility /// /// Checks if the Submerged mod is loaded. /// - /// Submerged mod assembly if loaded, null otherwise. - /// True if the Submerged mod is loaded, false otherwise. + /// Submerged mod assembly if loaded, otherwise. + /// if the Submerged mod is loaded, otherwise. public static bool SubmergedLoaded([NotNullWhen(true)] out Assembly? submergedAssembly) { var result = IL2CPPChainloader.Instance.Plugins.TryGetValue(SubmergedId, out var plugin); diff --git a/MiraAPI/Modifiers/BaseModifier.cs b/MiraAPI/Modifiers/BaseModifier.cs index dd4ac9f..930cc29 100644 --- a/MiraAPI/Modifiers/BaseModifier.cs +++ b/MiraAPI/Modifiers/BaseModifier.cs @@ -50,7 +50,7 @@ public abstract class BaseModifier : IOptionable public abstract string ModifierName { get; } /// - /// Gets the modifier icon. Useless if is true. + /// Gets the modifier icon. Useless if is . /// public virtual LoadableAsset? ModifierIcon => null; @@ -70,12 +70,12 @@ public abstract class BaseModifier : IOptionable public virtual Color FreeplayFileColor => Color.gray; /// - /// Gets a value indicating whether the modifier is unique. If true, the player can only have one instance of this modifier. + /// Gets a value indicating whether the modifier is unique. If , the player can only have one instance of this modifier. /// public virtual bool Unique => true; /// - /// Gets the HUD description for this modifier. Does nothing if is true. Required to be visible on UI. + /// Gets the HUD description for this modifier. Does nothing if is . Required to be visible on UI. /// /// The description string for the HUD. public virtual string GetDescription() => string.Empty; @@ -126,6 +126,6 @@ public abstract class BaseModifier : IOptionable /// /// Determines whether the player can vent. /// - /// True if the player can vent, false otherwise. Null for no effect. + /// if the player can vent, otherwise. for no effect. public virtual bool? CanVent() => null; } diff --git a/MiraAPI/Modifiers/ModifierComponent.cs b/MiraAPI/Modifiers/ModifierComponent.cs index e8a7de3..09e411a 100644 --- a/MiraAPI/Modifiers/ModifierComponent.cs +++ b/MiraAPI/Modifiers/ModifierComponent.cs @@ -206,10 +206,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// Tries to get a . /// - /// The or null. + /// The or . /// The predicate to check the by. /// The Type of the . - /// True if the was found, false otherwise. + /// if the was found, otherwise. [HideFromIl2Cpp] public bool TryGetModifier([NotNullWhen(true)] out T? modifier, Func? predicate = null) where T : BaseModifier { @@ -221,9 +221,9 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// Tries to get a by its type. /// /// The modifier type. - /// The or null. + /// The or . /// The predicate to check the by. - /// True if the was found, false otherwise. + /// if the was found, otherwise. [HideFromIl2Cpp] public bool TryGetModifier(Type type, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { @@ -235,9 +235,9 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// Tries to get a by its type ID. /// /// The 's type ID. - /// The or null. + /// The or . /// The predicate to check the by. - /// True if the was found, false otherwise. + /// if the was found, otherwise. [HideFromIl2Cpp] public bool TryGetModifier(uint id, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { @@ -249,8 +249,8 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// Tries to get a by its unique ID. /// /// The 's unique ID. - /// The or null. - /// True if the was found, false otherwise. + /// The or . + /// if the was found, otherwise. [HideFromIl2Cpp] public bool TryGetModifier(Guid modifierGuid, [NotNullWhen(true)] out BaseModifier? modifier) { @@ -263,7 +263,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The predicate to check the by. /// The Type of the . - /// The if it is found, null otherwise. + /// The if it is found, otherwise. [HideFromIl2Cpp] public T? GetModifier(Func? predicate = null) where T : BaseModifier { @@ -275,7 +275,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The modifier type. /// The predicate to check the by. - /// The if it is found, null otherwise. + /// The if it is found, otherwise. [HideFromIl2Cpp] public BaseModifier? GetModifier(Type type, Func? predicate = null) { @@ -287,7 +287,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The ID. /// The predicate to check the by. - /// The if it is found, null otherwise. + /// The if it is found, otherwise. [HideFromIl2Cpp] public BaseModifier? GetModifier(uint id, Func? predicate = null) { @@ -301,7 +301,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// Gets a by unique ID. /// /// The 's unique ID. - /// The if it is found, or null. + /// The if it is found, or . [HideFromIl2Cpp] public BaseModifier? GetModifier(Guid modifierGuid) { @@ -469,7 +469,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The ID of the . /// The arguments to initialize the with. - /// The if it was created, or null if it failed. + /// The if it was created, or if it failed. [HideFromIl2Cpp] public BaseModifier? AddModifier(uint id, params object[] args) { @@ -484,7 +484,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The predicate to check the . /// The Type of the . - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(Func? predicate=null) where T : BaseModifier { @@ -496,7 +496,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The modifier type. /// The predicate to check the . - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(Type type, Func? predicate=null) { @@ -508,7 +508,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The 's type ID. /// The predicate to check the . - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(uint id, Func? predicate=null) { @@ -522,7 +522,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// Checks if a player has an active by its unique ID. /// /// The 's guid. - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(Guid id) { @@ -535,7 +535,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// Whether to check inactive s (those pending to be added). /// The predicate to check the . /// The Type of the . - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(bool checkInactive, Func? predicate=null) where T : BaseModifier { @@ -549,7 +549,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// The modifier type. /// Whether to check inactive s (those pending to be added). /// The predicate to check the . - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(Type type, bool checkInactive, Func? predicate=null) { @@ -563,7 +563,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// The 's type ID. /// Whether to check inactive s (those pending to be added). /// The predicate to check the . - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(uint id, bool checkInactive, Func? predicate=null) { @@ -578,7 +578,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr) /// /// The 's guid. /// Whether to check inactive s (those pending to be added). - /// True if the is present, false otherwise. + /// if the is present, otherwise. [HideFromIl2Cpp] public bool HasModifier(Guid id, bool checkInactive) { diff --git a/MiraAPI/Modifiers/ModifierExtensions.cs b/MiraAPI/Modifiers/ModifierExtensions.cs index ad10adb..20f08be 100644 --- a/MiraAPI/Modifiers/ModifierExtensions.cs +++ b/MiraAPI/Modifiers/ModifierExtensions.cs @@ -123,7 +123,7 @@ public static class ModifierExtensions /// Gets the for a . /// /// The object. - /// A if there is one, null otherwise. + /// A if there is one, otherwise. public static ModifierComponent GetModifierComponent(this PlayerControl player) { if (ModifierComponents.TryGetValue(player, out var component)) @@ -147,7 +147,7 @@ public static class ModifierExtensions /// The type of the . /// The instance. /// Optional predicate to filter the s. - /// True if the has the , false otherwise. + /// if the has the , otherwise. public static bool HasModifier(this PlayerControl player, Func? predicate = null) where T : BaseModifier { return player.GetModifierComponent().HasModifier(predicate); @@ -159,7 +159,7 @@ public static class ModifierExtensions /// The instance. /// The type of the modifier. /// Optional predicate to filter the s. - /// True if the has the , false otherwise. + /// if the has the , otherwise. public static bool HasModifier(this PlayerControl player, Type type, Func? predicate = null) { return player.GetModifierComponent().HasModifier(type, predicate); @@ -171,7 +171,7 @@ public static class ModifierExtensions /// The instance. /// The type ID of the . /// Optional predicate to filter the s. - /// True if the has the , false otherwise. + /// if the has the , otherwise. public static bool HasModifier( this PlayerControl player, uint typeId, @@ -185,7 +185,7 @@ public static class ModifierExtensions /// /// The instance. /// The unique ID of the . - /// True if the has the , false otherwise. + /// if the has the , otherwise. public static bool HasModifier(this PlayerControl player, Guid uniqueId) { return player.GetModifierComponent().HasModifier(uniqueId); @@ -219,10 +219,10 @@ public static class ModifierExtensions /// Tries to get a . /// /// The instance. - /// The or null. + /// The or . /// The predicate to check the by. /// The Type of the . - /// True if the was found, false otherwise. + /// if the was found, otherwise. public static bool TryGetModifier(this PlayerControl player, [NotNullWhen(true)] out T? modifier, Func? predicate = null) where T : BaseModifier { return player.GetModifierComponent().TryGetModifier(out modifier, predicate); @@ -233,9 +233,9 @@ public static class ModifierExtensions /// /// The instance. /// The modifier type. - /// The or null. + /// The or . /// The predicate to check the by. - /// True if the was found, false otherwise. + /// if the was found, otherwise. public static bool TryGetModifier(this PlayerControl player, Type type, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { return player.GetModifierComponent().TryGetModifier(type, out modifier, predicate); @@ -246,9 +246,9 @@ public static class ModifierExtensions /// /// The instance. /// The type ID. - /// The or null. + /// The or . /// The predicate to check the by. - /// True if the was found, false otherwise. + /// if the was found, otherwise. public static bool TryGetModifier(this PlayerControl player, uint id, [NotNullWhen(true)] out BaseModifier? modifier, Func? predicate = null) { return player.GetModifierComponent().TryGetModifier(id, out modifier, predicate); @@ -259,8 +259,8 @@ public static class ModifierExtensions /// /// The instance. /// The unique ID. - /// The or null. - /// True if the was found, false otherwise. + /// The or . + /// if the was found, otherwise. public static bool TryGetModifier(this PlayerControl player, Guid modifierGuid, [NotNullWhen(true)] out BaseModifier? modifier) { return player.GetModifierComponent().TryGetModifier(modifierGuid, out modifier); @@ -272,7 +272,7 @@ public static class ModifierExtensions /// The type of the . /// The instance. /// Optional predicate to filter the s. - /// The if found, null otherwise. + /// The if found, otherwise. public static T? GetModifier(this PlayerControl player, Func? predicate = null) where T : BaseModifier { return player.GetModifierComponent().GetModifier(predicate); @@ -284,7 +284,7 @@ public static class ModifierExtensions /// The instance. /// The type of the modifier. /// Optional predicate to filter the s. - /// The if found, null otherwise. + /// The if found, otherwise. public static BaseModifier? GetModifier( this PlayerControl player, Type type, @@ -299,7 +299,7 @@ public static class ModifierExtensions /// The instance. /// The type ID of the . /// Optional predicate to filter the s. - /// The if found, null otherwise. + /// The if found, otherwise. public static BaseModifier? GetModifier( this PlayerControl player, uint typeId, @@ -313,7 +313,7 @@ public static class ModifierExtensions /// /// The instance. /// The GUID of the . - /// The if found, null otherwise. + /// The if found, otherwise. public static BaseModifier? GetModifier( this PlayerControl player, Guid uniqueId) diff --git a/MiraAPI/Modifiers/Types/GameModifier.cs b/MiraAPI/Modifiers/Types/GameModifier.cs index 83680b7..b58f8e0 100644 --- a/MiraAPI/Modifiers/Types/GameModifier.cs +++ b/MiraAPI/Modifiers/Types/GameModifier.cs @@ -30,19 +30,19 @@ public abstract class GameModifier : BaseModifier /// Determines whether the modifier is valid on a role. /// /// The role to be checked. - /// True if the modifier is valid on the role, otherwise false. + /// if the modifier is valid on the role, otherwise . public virtual bool IsModifierValidOn(RoleBehaviour role) => true; /// /// Determines whether the player won the game with this modifier. The modifier with the highest priority will override other modifiers. /// /// The reason why the game ended. - /// True if the player won, false if they lost. Return null to use the player's default win condition. + /// if the player won, if they lost. Return to use the player's default win condition. public virtual bool? DidWin(GameOverReason reason) => null; /// /// Determines whether the modifier can spawn in general, accounting for gamemodes and everything else. /// - /// True if the modifier is able to spawn, otherwise false. + /// if the modifier is able to spawn, otherwise . public virtual bool CanSpawnOnCurrentMode() => !GameManager.Instance.IsHideAndSeek(); } diff --git a/MiraAPI/Patches/Options/SettingPatches.cs b/MiraAPI/Patches/Options/SettingPatches.cs index d740349..59b956c 100644 --- a/MiraAPI/Patches/Options/SettingPatches.cs +++ b/MiraAPI/Patches/Options/SettingPatches.cs @@ -20,7 +20,7 @@ public static class SettingPatches /// The instance. /// The result of the method. /// The value. - /// False to skip original method. + /// to skip original method. [HarmonyPrefix] [HarmonyPatch(typeof(FloatGameSetting), nameof(FloatGameSetting.GetValueString))] public static bool ValueStringPatch( diff --git a/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs b/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs index 18a380c..ff57b37 100644 --- a/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs +++ b/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs @@ -32,7 +32,7 @@ public static class RoleOptionsCollectionPatch /// /// Set the role chance for custom Launchpad roles based on config. /// - /// Return false to skip original method, true to not. + /// Return to skip original method, to not. [HarmonyPrefix] [HarmonyPatch(nameof(RoleOptionsCollectionV10.GetChancePerGame))] public static bool GetChancePrefix(RoleTypes role, ref int __result) @@ -62,7 +62,7 @@ public static class RoleOptionsCollectionPatch /// /// Set the amount for custom Launchpad roles based on config. /// - /// Return false to skip original method, true to not. + /// Return to skip original method, to not. [HarmonyPrefix] [HarmonyPatch(nameof(RoleOptionsCollectionV10.GetNumPerGame))] public static bool GetNumPrefix(RoleTypes role, ref int __result) diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index 3ba3170..819eb1c 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -144,7 +144,7 @@ public record struct CustomRoleConfiguration public string FreeplayFolder { get; set; } /// - /// Gets or sets the outline for the if is true. + /// Gets or sets the outline for the if is . /// public Color KillButtonOutlineColor { get; set; } diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index 5da309e..9e6540f 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -207,7 +207,7 @@ public static class CustomRoleManager /// /// The . /// The result. - /// True if the role was found. + /// if the role was found. public static bool GetCustomRoleBehaviour(RoleTypes roleType, out ICustomRole? result) { CustomRoles.TryGetValue((ushort)roleType, out var temp); diff --git a/MiraAPI/Roles/CustomRoleUtils.cs b/MiraAPI/Roles/CustomRoleUtils.cs index af8c5d4..1a2b9b5 100644 --- a/MiraAPI/Roles/CustomRoleUtils.cs +++ b/MiraAPI/Roles/CustomRoleUtils.cs @@ -18,7 +18,7 @@ public static class CustomRoleUtils /// Determines whether the specified can spawn in general, accounting for gamemodes and everything else. /// /// The you would like to check for. - /// True if the is able to spawn, otherwise false. + /// if the is able to spawn, otherwise . public static bool CanSpawnOnCurrentMode(RoleBehaviour role) { if (role is ICustomRole custom) @@ -125,7 +125,7 @@ public static class CustomRoleUtils /// Determines if a is a custom role or not. /// /// The to check. - /// True if the is a custom role, false otherwise. + /// if the is a custom role, otherwise. public static bool IsCustomRole(this RoleBehaviour role) { return CustomRoleManager.CustomRoles.ContainsKey((ushort)role.Role); diff --git a/MiraAPI/Roles/ICustomRole.cs b/MiraAPI/Roles/ICustomRole.cs index 944eb46..5b72650 100644 --- a/MiraAPI/Roles/ICustomRole.cs +++ b/MiraAPI/Roles/ICustomRole.cs @@ -200,7 +200,7 @@ public interface ICustomRole : IOptionable /// /// The intro cutscene instance. /// The reference to the list of player in the team. - /// True to use the original team intro code, false to skip. + /// to use the original team intro code, to skip. public virtual bool SetupIntroTeam(IntroCutscene instance, ref Il2CppSystem.Collections.Generic.List yourTeam) { if (Team == ModdedRoleTeams.Custom) @@ -216,10 +216,10 @@ public interface ICustomRole : IOptionable } /// - /// Gets a custom ejection message for the role. Return null to use the default message. + /// Gets a custom ejection message for the role. Return to use the default message. /// /// The NetworkedPlayerInfo object for this player. - /// A string with a custom ejection message or null. + /// A string with a custom ejection message or . string? GetCustomEjectionMessage(NetworkedPlayerInfo player) { return Team == ModdedRoleTeams.Impostor ? $"{player.PlayerName} was The {RoleName}" : null; @@ -235,7 +235,7 @@ public interface ICustomRole : IOptionable /// Determine whether a given can be applied to this role. /// /// The modifier to be tested. - /// True if the is valid on this role, false otherwise. + /// if the is valid on this role, otherwise. bool IsModifierApplicable(BaseModifier modifier) { return true; @@ -244,7 +244,7 @@ public interface ICustomRole : IOptionable /// /// Determines whether the role can spawn in general, accounting for gamemodes and everything else. /// - /// True if the role is able to spawn, otherwise false. + /// if the role is able to spawn, otherwise . public virtual bool CanSpawnOnCurrentMode() => !GameManager.Instance.IsHideAndSeek(); /// diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 3b67e5d..7364e44 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -175,7 +175,7 @@ public static class Extensions /// Checks if a is the game's host. /// /// The you're checking for. - /// If the player is the host, true, else false. + /// If the player is the host, , else . public static bool IsHost(this PlayerControl playerControl) { return TutorialManager.InstanceExists || AmongUsClient.Instance.HostId == playerControl.OwnerId; @@ -185,7 +185,7 @@ public static class Extensions /// Checks if a is protected by a Guardian Angel. /// /// The you're checking for. - /// If the player is protected, true, else false. + /// If the player is protected, , else . public static bool ProtectedByGa(this PlayerControl playerControl) { return playerControl.protectedByGuardianId > -1; @@ -213,7 +213,7 @@ public static class Extensions /// Determines if a is an integer. /// /// The number. - /// True if the is an integer, false otherwise. + /// if the is an integer, otherwise. public static bool IsInteger(this float number) { return Mathf.Approximately(number, Mathf.Round(number)); @@ -228,7 +228,7 @@ public static class Extensions /// Gets the of a . /// /// The object. - /// A if there is one, null otherwise. + /// A if there is one, otherwise. public static PlayerVoteData GetVoteData(this PlayerControl player) { if (VoteDataComponents.TryGetValue(player, out var component)) @@ -379,7 +379,7 @@ public static class Extensions /// Checks if a type is static. /// /// The type being checked. - /// True if the type is static, false otherwise. + /// if the type is static, otherwise. public static bool IsStatic(this Type type) { return type is { IsClass: true, IsAbstract: true, IsSealed: true }; @@ -460,7 +460,7 @@ public static class Extensions /// Determines if a given is for a custom option. /// /// The to be tested. - /// True if the is for a custom options, false otherwise. + /// if the is for a custom options, otherwise. public static bool IsCustom(this OptionBehaviour optionBehaviour) { return ModdedOptionsManager.ModdedOptions.Values.Any( @@ -514,7 +514,7 @@ public static class Extensions /// /// The object. /// The radius to search within. - /// The if it is found, or null there is none within the radius. + /// The if it is found, or there is none within the radius. public static DeadBody? GetNearestDeadBody(this PlayerControl playerControl, float radius) { return Helpers @@ -531,7 +531,7 @@ public static class Extensions /// An optional collider tag. /// Optional predicate to test if the is valid. /// The type of the object. - /// The if it was found, or null if there is none within the radius. + /// The if it was found, or if there is none within the radius. public static T? GetNearestObjectOfType( this PlayerControl playerControl, float radius, @@ -552,7 +552,7 @@ public static class Extensions /// Whether colliders should be ignored when searching. /// Determines if Ghosts are included. /// Optional predicate to test if the is valid. - /// The closest if there is one, false otherwise. + /// The closest if there is one, otherwise. public static PlayerControl? GetClosestPlayer( this PlayerControl playerControl, bool includeImpostors, diff --git a/MiraAPI/Utilities/Helpers.cs b/MiraAPI/Utilities/Helpers.cs index cd08d8a..b58d395 100644 --- a/MiraAPI/Utilities/Helpers.cs +++ b/MiraAPI/Utilities/Helpers.cs @@ -129,7 +129,7 @@ public static class Helpers /// Determines whether a given probability check succeeds. /// /// An integer value representing the success probability (0-100). - /// True if the number falls in the range, false if not. + /// if the number falls in the range, if not. public static bool CheckChance(int probability) { switch (probability) @@ -459,7 +459,7 @@ public static class Helpers /// Gets a by its parent ID. /// /// The player ID. - /// A or null if its not found. + /// A or if its not found. public static DeadBody? GetBodyById(byte id) { return Object.FindObjectsOfType().FirstOrDefault(body => body.ParentId == id); diff --git a/MiraAPI/Voting/PlayerVoteData.cs b/MiraAPI/Voting/PlayerVoteData.cs index 6e102ee..0e52078 100644 --- a/MiraAPI/Voting/PlayerVoteData.cs +++ b/MiraAPI/Voting/PlayerVoteData.cs @@ -48,7 +48,7 @@ public class PlayerVoteData(nint cppPtr) : MonoBehaviour(cppPtr) /// Returns whether the owner has voted for the specified player. /// /// The target's playerId. - /// True if the owner voted for the specified player, false otherwise. + /// if the owner voted for the specified player, otherwise. public bool VotedFor(byte playerId) { return Votes.Exists(x => x.Suspect == playerId); diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs index 069157d..dbdf74c 100644 --- a/MiraAPI/Voting/VotingUtils.cs +++ b/MiraAPI/Voting/VotingUtils.cs @@ -17,11 +17,11 @@ public static class VotingUtils private const byte SkipVoteId = 253; /// - /// Gets the exiled player from the list of s. Returns null if no player is to be exiled. + /// Gets the exiled player from the list of s. Returns if no player is to be exiled. /// /// >The list of s to check. /// Whether the vote is a tie. - /// The player to be exiled. Will be null if no player is to be exiled. + /// The player to be exiled. Will be if no player is to be exiled. public static NetworkedPlayerInfo? GetExiled(List votes, out bool isTie) { var max = CalculateNumVotes(votes).MaxPair(out var tie); From 62c8e2753596b7a8fdd3ce73e296b044d06a63fd Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Tue, 23 Jun 2026 20:55:47 -0600 Subject: [PATCH 10/42] Fixed annotations with double > annotations --- .../Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs | 2 +- .../Vanilla/Meeting/Voting/MeetingSelectEvent.cs | 2 +- .../Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs | 2 +- MiraAPI/GameEnd/GameOverManager.cs | 2 +- MiraAPI/GameOptions/IModdedOption.cs | 10 +++++----- MiraAPI/Presets/OptionPreset.cs | 6 +++--- MiraAPI/Presets/PresetManager.cs | 2 +- MiraAPI/Utilities/EnumerableExtensions.cs | 4 ++-- MiraAPI/Utilities/StateMachineWrapper.cs | 2 +- MiraAPI/Voting/VotingUtils.cs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs index a9b2d8e..988cdc4 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/CheckForEndVotingEvent.cs @@ -18,7 +18,7 @@ public class CheckForEndVotingEvent : MiraCancelableEvent /// /// Initializes a new instance of the class. /// - /// > if voting is complete, otherwise. + /// if voting is complete, otherwise. public CheckForEndVotingEvent(bool isVotingComplete) { IsVotingComplete = isVotingComplete; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs index 40d8f81..0c3f6d5 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs @@ -32,7 +32,7 @@ public class MeetingSelectEvent : MiraEvent /// /// The voter's . /// The target's playerId. - /// >Whether the player is allowed to select the target. + /// Whether the player is allowed to select the target. public MeetingSelectEvent(PlayerVoteData playerVoteData, int targetId, bool allowSelect) { VoteData = playerVoteData; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs index e35d1b4..a61cc51 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/ProcessVotesEvent.cs @@ -10,7 +10,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// /// Initializes a new instance of the class. /// -/// >The list of s that are being processed. +/// The list of s that are being processed. /// The player to be exiled. Will be if no player is to be exiled. public class ProcessVotesEvent(List votes, NetworkedPlayerInfo? exiledPlayer = null) : MiraEvent { diff --git a/MiraAPI/GameEnd/GameOverManager.cs b/MiraAPI/GameEnd/GameOverManager.cs index c0a144d..eb39835 100644 --- a/MiraAPI/GameEnd/GameOverManager.cs +++ b/MiraAPI/GameEnd/GameOverManager.cs @@ -20,7 +20,7 @@ public static class GameOverManager /// /// Type of the . /// Thrown when the type is not a subclass of , is abstract, or does not have a parameterless constructor. - /// > if the game over was registered successfully, otherwise. + /// if the game over was registered successfully, otherwise. public static bool RegisterGameOver(Type gameOverType) { if (!typeof(CustomGameOver).IsAssignableFrom(gameOverType)) diff --git a/MiraAPI/GameOptions/IModdedOption.cs b/MiraAPI/GameOptions/IModdedOption.cs index 0de5212..907ab7d 100644 --- a/MiraAPI/GameOptions/IModdedOption.cs +++ b/MiraAPI/GameOptions/IModdedOption.cs @@ -63,26 +63,26 @@ public interface IModdedOption /// The template. /// The template. /// The template. - /// >The container for the option. - /// >The created object. + /// The container for the option. + /// The created object. OptionBehaviour CreateOption(ToggleOption toggleOpt, NumberOption numberOpt, StringOption stringOpt, PlayerOption playerOpt, Transform container); /// /// Gets the value as a . /// - /// >The value of the option as a . + /// The value of the option as a . float GetFloatData(); /// /// Gets the for the option, used for network synchronization. /// - /// >Returns the object for the option. + /// Returns the object for the option. NetData GetNetData(); /// /// Handles incoming network data for the option. /// - /// >The byte array representing the network data. + /// The byte array representing the network data. void HandleNetData(byte[] data); /// diff --git a/MiraAPI/Presets/OptionPreset.cs b/MiraAPI/Presets/OptionPreset.cs index 94add31..27703fb 100644 --- a/MiraAPI/Presets/OptionPreset.cs +++ b/MiraAPI/Presets/OptionPreset.cs @@ -40,9 +40,9 @@ public class OptionPreset /// /// Initializes a new instance of the class with the specified name and configuration file. /// - /// >The name of the preset. + /// The name of the preset. /// The plugin associated with the preset. - /// >The configuration file for the preset. + /// The configuration file for the preset. public OptionPreset(string name, MiraPluginInfo plugin, ConfigFile presetConfig) { Name = name; @@ -87,7 +87,7 @@ public class OptionPreset /// /// Gets whether the specified option is included in the preset. /// - /// >The value of whether the option is in the preset. + /// The value of whether the option is in the preset. public bool IsOptionInPreset(OptionBehaviour baseOption) { var selectedOpt = Plugin.InternalOptions.First(x => x.OptionBehaviour == baseOption); diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index ac34256..2a33b4d 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -54,7 +54,7 @@ public static class PresetManager /// /// Loads the s for the specified plugin by reading the s from the preset directory. /// - /// >The plugin for which the s should be loaded. + /// The plugin for which the s should be loaded. public static void LoadPresets(MiraPluginInfo plugin) { foreach (var btn in plugin.InternalPresets.Select(x=>x.PresetButton)) diff --git a/MiraAPI/Utilities/EnumerableExtensions.cs b/MiraAPI/Utilities/EnumerableExtensions.cs index 7733c43..f86391a 100644 --- a/MiraAPI/Utilities/EnumerableExtensions.cs +++ b/MiraAPI/Utilities/EnumerableExtensions.cs @@ -14,7 +14,7 @@ public static class EnumerableExtensions /// /// The source . /// The type of the elements. - /// >The shuffled . + /// The shuffled . public static IEnumerable Shuffle(this IEnumerable source) { return source.Shuffle(new Random()); @@ -26,7 +26,7 @@ public static class EnumerableExtensions /// The source . /// The instance to use for shuffling. /// The type of the elements. - /// >The shuffled . + /// The shuffled . public static IEnumerable Shuffle(this IEnumerable source, Random rng) { ArgumentNullException.ThrowIfNull(source); diff --git a/MiraAPI/Utilities/StateMachineWrapper.cs b/MiraAPI/Utilities/StateMachineWrapper.cs index 1b2007b..3c05334 100644 --- a/MiraAPI/Utilities/StateMachineWrapper.cs +++ b/MiraAPI/Utilities/StateMachineWrapper.cs @@ -72,7 +72,7 @@ public class StateMachineWrapper where T : Il2CppObjectBase /// /// The name of the parameter to retrieve. /// The type of the parameter to retrieve. - /// >The value of the specified parameter. + /// The value of the specified parameter. /// Thrown if the specified parameter does not exist. public TField GetParameter(string parameterName) { diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs index dbdf74c..f6bccb5 100644 --- a/MiraAPI/Voting/VotingUtils.cs +++ b/MiraAPI/Voting/VotingUtils.cs @@ -19,7 +19,7 @@ public static class VotingUtils /// /// Gets the exiled player from the list of s. Returns if no player is to be exiled. /// - /// >The list of s to check. + /// The list of s to check. /// Whether the vote is a tie. /// The player to be exiled. Will be if no player is to be exiled. public static NetworkedPlayerInfo? GetExiled(List votes, out bool isTie) From e4d25098950446206bf8977f18ba78fb9625fa50 Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Tue, 23 Jun 2026 21:01:45 -0600 Subject: [PATCH 11/42] Added href tags for links --- MiraAPI/Patches/ChatControllerPatch.cs | 2 +- MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs | 2 +- MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MiraAPI/Patches/ChatControllerPatch.cs b/MiraAPI/Patches/ChatControllerPatch.cs index e65be7f..c9a6565 100644 --- a/MiraAPI/Patches/ChatControllerPatch.cs +++ b/MiraAPI/Patches/ChatControllerPatch.cs @@ -6,7 +6,7 @@ namespace MiraAPI.Patches; #pragma warning disable SA1629 /// /// Allows players to paste text into chat. -/// Source: https://github.com/CallOfCreator/NewMod/blob/main/NewMod/Patches/ClipboardPatch.cs +/// Source: /// #pragma warning restore SA1629 [HarmonyPatch(typeof(ChatController), nameof(ChatController.Update))] diff --git a/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs b/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs index bde950c..b9e8c55 100644 --- a/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs +++ b/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs @@ -15,7 +15,7 @@ public class LoadableAddressableAsset(string uid) : LoadableAsset where T /// /// Initializes a new instance of the class, with added garbageCollector logic, - /// to help with https://github.com/BepInEx/Il2CppInterop/issues/40. + /// to help with . /// /// The guid of the asset. /// A lambda that allows GCHandle.Alloc calls without garbage collection interferences. diff --git a/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs b/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs index a6edbf7..9cabf83 100644 --- a/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs +++ b/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs @@ -22,7 +22,7 @@ public class LoadableAddressableAssets(string key) where T : UnityEngine.Obje /// /// Initializes a new instance of the class, with added garbageCollector logic, - /// to help with https://github.com/BepInEx/Il2CppInterop/issues/40. + /// to help with . /// /// The key of the assets. /// A lambda that allows GCHandle.Alloc calls without garbage collection interferences. From edf61e722f473fc509a0a662fabea73184a364b9 Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Tue, 23 Jun 2026 21:17:43 -0600 Subject: [PATCH 12/42] Updated added method --- MiraAPI/Utilities/Extensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index c74fadc..606e583 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -223,9 +223,9 @@ public static class Extensions } /// - /// Destroys the object properly. + /// Destroys the properly. /// - /// The object to destroy. + /// The to destroy. /// Whether to run the garbage collector immediately. public static void DeepDestroy(this GameObject obj, bool clearGc = true) { From 7fdfd506e0096965f705a9a1db97a2e5e582e6d2 Mon Sep 17 00:00:00 2001 From: David Higueros <111460331+TheDavSmasher@users.noreply.github.com> Date: Tue, 23 Jun 2026 21:18:05 -0600 Subject: [PATCH 13/42] Added missing method cref --- MiraAPI/Patches/Menu/MainMenuManagerPatches.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs b/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs index a52bc78..f69e374 100644 --- a/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs +++ b/MiraAPI/Patches/Menu/MainMenuManagerPatches.cs @@ -17,7 +17,7 @@ public static class MainMenuManagerPatches internal static bool NeedsDeepDestroy { get; private set; } /// - /// A postifix on Awake to load all the addressables registered. + /// A postifix on to load all the addressables registered. /// [HarmonyPatch(nameof(MainMenuManager.Awake))] [HarmonyPostfix] From 57e3f20cba14d6433437d5ed07d415f942545659 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 27 Jun 2026 21:00:57 -0500 Subject: [PATCH 14/42] Improve role option garbage collection further --- .../Patches/Options/RoleSettingMenuPatches.cs | 18 ++++++++++++------ MiraAPI/Utilities/Extensions.cs | 4 ---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 082cc9c..d123161 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -178,6 +178,7 @@ public static class RoleSettingMenuPatches .ThenBy(x => x.Key.Name); var quotaThing = __instance.categoryHeaderEditRoleOrigin.transform.FindChild("QuotaHeader"); + var usingNewQuota = false; var template = __instance.transform.parent.parent.GetComponent().GameSettingsTab.categoryHeaderOrigin; foreach (var grouping in sortedRoleGroups) @@ -216,12 +217,17 @@ public static class RoleSettingMenuPatches var countText = quotaInst.transform.FindChild("# Text"); countText.transform.localPosition = new Vector3(1.9f, 0.0993f, 0f); - var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; - var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; - var countLabel = quotaInst.transform.FindChild("# Label").gameObject; - blankLabel.DeepDestroy(false); - chanceLabel.DeepDestroy(false); - countLabel.DeepDestroy(false); + if (!usingNewQuota) + { + var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; + var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; + var countLabel = quotaInst.transform.FindChild("# Label").gameObject; + blankLabel.DeepDestroy(false); + chanceLabel.DeepDestroy(false); + countLabel.DeepDestroy(false); + usingNewQuota = true; + quotaThing = quotaInst; + } categoryHeaderMasked.Background.sprite = MiraAssets.CategoryHeader.LoadAsset(); categoryHeaderMasked.Background.sprite.texture.filterMode = FilterMode.Bilinear; diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 882a15c..e9ad300 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -335,10 +335,6 @@ public static class Extensions /// public static void ClearGarbageCollector() { - if (!MainMenuManagerPatches.NeedsDeepDestroy) - { - return; - } Coroutines.Start(CoFreeResources()); } From d0d5056e399cd3f79e4c591d2928a103a9f891c7 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sun, 28 Jun 2026 20:30:28 -0500 Subject: [PATCH 15/42] Fix hat tab being severely broken on v17.4 --- MiraAPI/Patches/Menu/HatsTabPatches.cs | 45 ++++++++++++------- .../Utilities/Assets/AddressablesLoader.cs | 4 ++ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/MiraAPI/Patches/Menu/HatsTabPatches.cs b/MiraAPI/Patches/Menu/HatsTabPatches.cs index 25eca33..3ad0fa3 100644 --- a/MiraAPI/Patches/Menu/HatsTabPatches.cs +++ b/MiraAPI/Patches/Menu/HatsTabPatches.cs @@ -19,6 +19,7 @@ namespace MiraAPI.Patches.Menu; public static class HatsTabPatches { private static SortedList> sortedHats = []; + private static Dictionary storeNames = []; private static int currentPage; private static void PreviousPage(HatsTab hatsTab) @@ -48,12 +49,19 @@ public static class HatsTabPatches if (sortedHats.Count == 0) { + var num = 0; var comparer = new ControllableComparer(["vanilla"], [], StringComparer.InvariantCulture); sortedHats = new SortedList>(comparer); foreach (var hat in allHats) { if (!sortedHats.ContainsKey(hat.StoreName)) sortedHats[hat.StoreName] = []; sortedHats[hat.StoreName].Add(hat); + + if (!storeNames.ContainsValue(hat.StoreName)) + { + storeNames.Add(num, hat.StoreName); + num++; + } } } @@ -98,24 +106,29 @@ public static class HatsTabPatches Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); + var group = sortedHats.Where(x => x.Key == storeNames[page]); - var (groupName, hats) = sortedHats.ToArray()[page]; - var text = Object.Instantiate(groupNameText, __instance.scroller.Inner); - text.enabled = true; - text.gameObject.transform.localScale = Vector3.one; - text.GetComponent().Destroy(); - text.EnableStencilMasking(); - text.text = $"{groupName} ({currentPage + 1}/{sortedHats.Count})"; - text.alignment = TextAlignmentOptions.Center; - text.fontSize = 5f; - text.fontSizeMax = 5f; - text.fontSizeMin = 0f; - var xLerp = __instance.XRange.Lerp(0.5f); - var yLerp = __instance.YStart - hatIndex / __instance.NumPerRow * __instance.YOffset; - text.transform.localPosition = new Vector3(xLerp, yLerp, -1f); + foreach ((string groupName, List hats) in group) + { + var text = Object.Instantiate(groupNameText, __instance.scroller.Inner); + text.enabled = true; + text.gameObject.transform.localScale = Vector3.one; + text.GetComponent().Destroy(); + text.EnableStencilMasking(); + text.text = $"{groupName} ({currentPage + 1}/{sortedHats.Count})"; + text.alignment = TextAlignmentOptions.Center; + text.fontSize = 5f; + text.fontSizeMax = 5f; + text.fontSizeMin = 0f; + var xLerp = __instance.XRange.Lerp(0.5f); + var yLerp = __instance.YStart - hatIndex / __instance.NumPerRow * __instance.YOffset; + text.transform.localPosition = new Vector3(xLerp, yLerp, -1f); - hatIndex += 5; - loadRoutine = Coroutines.Start(CoGenerateChips(__instance, hats)); + hatIndex += 5; + loadRoutine = Coroutines.Start(CoGenerateChips(__instance, hats)); + } + __instance.scroller.ContentYBounds.max = -(__instance.YStart - (hatIndex + 1) / __instance.NumPerRow * __instance.YOffset) - 3f; + __instance.currentHatIsEquipped = true; } private static IEnumerator CoGenerateChips(HatsTab __instance, List hats) diff --git a/MiraAPI/Utilities/Assets/AddressablesLoader.cs b/MiraAPI/Utilities/Assets/AddressablesLoader.cs index a309ed3..7acf73d 100644 --- a/MiraAPI/Utilities/Assets/AddressablesLoader.cs +++ b/MiraAPI/Utilities/Assets/AddressablesLoader.cs @@ -166,9 +166,13 @@ public static class AddressablesLoader while (!AmongUsClient.Instance || CatalogLocations.Select(x=>x.Location).Any(x=>!LoadedLocations.Contains(x))) yield return null; var hatBehaviours = DiscoverData(RegisteredHatKeys); + hatBehaviours = hatBehaviours.OrderBy(x => x.StoreName).ToList(); var skinBehaviours = DiscoverData(RegisteredSkinKeys); + skinBehaviours = skinBehaviours.OrderBy(x => x.StoreName).ToList(); var namePlateBehaviours = DiscoverAndReportData(RegisteredNameplateKeys); + namePlateBehaviours = namePlateBehaviours.OrderBy(x => x.Category).ToList(); var visorBehaviours = DiscoverAndReportData(RegisteredVisorKeys); + visorBehaviours = visorBehaviours.OrderBy(x => x.Category).ToList(); var hatData = new List(); hatData.AddRange(HatManager.Instance.allHats); From b1f0ec6da36168e11d9124b1531d5db6ce25bc7f Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sun, 28 Jun 2026 21:15:30 -0500 Subject: [PATCH 16/42] Fix settings button breaking --- MiraAPI/Patches/HudManagerPatches.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index e3a6b91..d138532 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -47,7 +47,12 @@ public static class HudManagerPatches { foreach (var aspect in baseButtons.GetComponentsInChildren(true)) { - if (aspect.gameObject == null) + if (!aspect.gameObject) + { + continue; + } + + if (aspect.gameObject.transform.parent.name == "TopRight") { continue; } @@ -65,7 +70,7 @@ public static class HudManagerPatches foreach (var button in HudManager.Instance.GetComponentsInChildren(true)) { - if (button.gameObject == null) + if (!button.gameObject) { continue; } From f53e4fdc38482be096aae01c15f9320437649fc5 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Mon, 29 Jun 2026 08:44:56 -0500 Subject: [PATCH 17/42] Add more option documentation --- MiraAPI/Hud/MultiTargetButton.cs | 5 ++++- MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs | 6 ++++++ MiraAPI/Patches/Freeplay/TaskAdderPatches.cs | 4 ++-- MiraAPI/Patches/IntroCutscenePatches.cs | 1 - MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs | 2 +- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 1 - MiraAPI/Patches/Options/GameOptionsMenuPatch.cs | 8 ++++---- MiraAPI/Patches/Options/GameSettingMenuPatches.cs | 6 +++--- MiraAPI/Patches/Options/LobbyViewPanePatches.cs | 4 ++-- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 +- MiraAPI/Presets/OptionPreset.cs | 2 ++ MiraAPI/Presets/PresetManager.cs | 2 +- MiraAPI/Roles/CustomRoleUtils.cs | 4 +++- MiraAPI/Utilities/Extensions.cs | 2 +- 14 files changed, 30 insertions(+), 19 deletions(-) diff --git a/MiraAPI/Hud/MultiTargetButton.cs b/MiraAPI/Hud/MultiTargetButton.cs index 8bdbbfd..12458d4 100644 --- a/MiraAPI/Hud/MultiTargetButton.cs +++ b/MiraAPI/Hud/MultiTargetButton.cs @@ -36,8 +36,11 @@ public abstract class MultiTargetButton : CustomActionButton where T : MonoBe /// The list of target objects. public abstract T[] GetTargets(); - /// + /// + /// Sets the outline of the target . + /// /// The target to set the oultine. + /// Should the outline be active. public abstract void SetOutline(T target, bool active); /// diff --git a/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs b/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs index 3f87a48..52abe60 100644 --- a/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs +++ b/MiraAPI/LocalSettings/SettingTypes/LocalSettingBase.cs @@ -43,6 +43,12 @@ public abstract class LocalSettingBase : ILocalSetting /// /// Creates an instance of the setting. /// + /// Toggle option to create. + /// Slider option to create. + /// The parent options menu. + /// the Y Offset for the option in the menu. + /// The order of the option. + /// Whether the option is the last in a row. /// The created setting. public abstract GameObject CreateOption(ToggleButtonBehaviour toggle, SlideBar slider, Transform parent, ref float offset, ref int order, bool last); diff --git a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs index f1612d9..3e4adc9 100644 --- a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs +++ b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs @@ -72,13 +72,13 @@ public static class TaskAdderPatches __instance.TaskParent = inner.transform; var crewmateFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == CrewmateName)!; var impostorFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == ImpostorName)!; - //var neutralFolder = __instance.CreateFolder("Neutral", __instance.Root, 2, Color.gray); + // var neutralFolder = __instance.CreateFolder("Neutral", __instance.Root, 2, Color.gray); var modifiersFolder = __instance.CreateFolder(ModifiersName, __instance.Root, 0, Color.blue); folders.Clear(); folders.Add(crewmateFolder.FolderName, crewmateFolder); folders.Add(impostorFolder.FolderName, impostorFolder); - //folders.Add("Neutrals", neutralFolder); + // folders.Add("Neutrals", neutralFolder); folders.Add(ModifiersName, modifiersFolder); int folderIdx = 2; diff --git a/MiraAPI/Patches/IntroCutscenePatches.cs b/MiraAPI/Patches/IntroCutscenePatches.cs index e2cf987..7d52287 100644 --- a/MiraAPI/Patches/IntroCutscenePatches.cs +++ b/MiraAPI/Patches/IntroCutscenePatches.cs @@ -123,7 +123,6 @@ public static class IntroCutscenePatches introCutscene = __instance.Cast(); } - Info("IntroCutscene ended"); MiraEventManager.InvokeEvent(new IntroEndEvent(introCutscene)); diff --git a/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs b/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs index 3defc75..ab8ed2c 100644 --- a/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs +++ b/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs @@ -15,7 +15,7 @@ namespace MiraAPI.Patches.LocalSettings; public static class OptionsMenuPatches { internal static OptionsMenuBehaviour? Instance { get; private set; } - internal static BoxCollider2D MaskCollider; + internal static BoxCollider2D MaskCollider = null!; private static SpriteRenderer? background; private static int currentPage = 1; diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index 8d50ece..0527fc0 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -40,7 +40,6 @@ public static class VisorsTabPatches GenerateHats(tab, currentPage); } - [HarmonyPatch(nameof(VisorsTab.OnEnable))] [HarmonyPrefix] public static bool OnEnablePrefix(VisorsTab __instance) diff --git a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs index dee3fa3..7b5e7a8 100644 --- a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs +++ b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs @@ -63,7 +63,7 @@ internal static class GameOptionsMenuPatch var filteredGroups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups .Where(x => x.OptionableType == null && - !x.ShowInModifiersMenu && x.ParentMenu == MenuCategory.Roles) ?? []; + x.ParentMenu == MenuCategory.Roles) ?? []; foreach (var group in filteredGroups) { @@ -171,7 +171,7 @@ internal static class GameOptionsMenuPatch private static void ModifiersUpdate(ref float num) { var groups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups - .Where(x => x.ShowInModifiersMenu || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; + .Where(x => x.ParentMenu is MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; foreach (var modGroup in groups) { @@ -182,7 +182,7 @@ internal static class GameOptionsMenuPatch private static void ModifiersCreate(GameOptionsMenu menu) { var groups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups - .Where(x => x.ShowInModifiersMenu || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; + .Where(x => x.ParentMenu is MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; foreach (var group in groups) { CreateGroup(menu, group); @@ -218,7 +218,7 @@ internal static class GameOptionsMenuPatch } var filteredGroups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups - .Where(x => x.OptionableType == null && !x.ShowInModifiersMenu && x.ParentMenu == MenuCategory.Roles) ?? []; + .Where(x => x.OptionableType == null && x.ParentMenu == MenuCategory.Roles) ?? []; foreach (var group in filteredGroups) { diff --git a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs index 4d7ae36..30ed1dd 100644 --- a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs @@ -429,10 +429,10 @@ internal static class GameSettingMenuPatches var modHasCustomTwo = SelectedMod.InternalOptionGroups.Exists( x => x.ParentMenu == MenuCategory.CustomTwo); var modHasModifiers = SelectedMod.InternalOptionGroups.Exists( - x => x.ShowInModifiersMenu || x.ParentMenu == MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true); + x => x.ParentMenu == MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true); var modHasOptions = - SelectedMod.InternalOptionGroups.Exists(x => x.OptionableType == null && (!x.ShowInModifiersMenu || - (x.ParentMenu != MenuCategory.Modifiers && x.ParentMenu != MenuCategory.Roles))); + SelectedMod.InternalOptionGroups.Exists(x => x.OptionableType == null && + x.ParentMenu != MenuCategory.Modifiers && x.ParentMenu != MenuCategory.Roles); _modifiersButton.gameObject.SetActive(true); _smallRolesButton.gameObject.SetActive(true); diff --git a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs index 4a629f5..c543447 100644 --- a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs +++ b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs @@ -132,7 +132,7 @@ public static class LobbyViewPanePatches ModifiersTabButton?.SelectButton(true); var filteredGroups = SelectedMod.InternalOptionGroups - .Where(x => x.GroupVisible() && (x.ShowInModifiersMenu || (x.OptionableType != null && x.OptionableType.IsAssignableTo(typeof(BaseModifier))))); + .Where(x => x.GroupVisible() && (x.ParentMenu is MenuCategory.Modifiers || (x.OptionableType != null && x.OptionableType.IsAssignableTo(typeof(BaseModifier))))); DrawOptions(__instance, filteredGroups); } @@ -152,7 +152,7 @@ public static class LobbyViewPanePatches } var filteredGroups = SelectedMod.InternalOptionGroups - .Where(x => x is { ShowInModifiersMenu: false, OptionableType: null } && x.GroupVisible()); + .Where(x => x is { ParentMenu: not MenuCategory.Modifiers, OptionableType: null } && x.GroupVisible()); DrawOptions(__instance, filteredGroups); return false; diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index cdf7382..79c2306 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -36,7 +36,7 @@ public static class HudManagerPatches if (role is ICustomRole customRole) { __instance.KillButton.ToggleVisible(isActive && customRole.Configuration.UseVanillaKillButton && !flag); - __instance.ImpostorVentButton.ToggleVisible(isActive && (customRole.Configuration.CanUseVent) && !flag); + __instance.ImpostorVentButton.ToggleVisible(isActive && customRole.Configuration.CanUseVent && !flag); __instance.SabotageButton.gameObject.SetActive(isActive && customRole.Configuration.CanUseSabotage); } diff --git a/MiraAPI/Presets/OptionPreset.cs b/MiraAPI/Presets/OptionPreset.cs index 27703fb..11b6d75 100644 --- a/MiraAPI/Presets/OptionPreset.cs +++ b/MiraAPI/Presets/OptionPreset.cs @@ -75,6 +75,7 @@ public class OptionPreset /// /// Resets the specified option with the preset provided. /// + /// The option to reset. public void ResetOption(OptionBehaviour baseOption) { var selectedOpt = Plugin.InternalOptions.First(x => x.OptionBehaviour == baseOption); @@ -87,6 +88,7 @@ public class OptionPreset /// /// Gets whether the specified option is included in the preset. /// + /// The option to check. /// The value of whether the option is in the preset. public bool IsOptionInPreset(OptionBehaviour baseOption) { diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index 83b352f..bec1216 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -134,7 +134,7 @@ public static class PresetManager { var fileName = Path.GetFileName(file); Info($"Loading preset file {fileName}"); - var presetName = Path.GetFileNameWithoutExtension(file); + // var presetName = Path.GetFileNameWithoutExtension(file); var presetConfig = new ConfigFile(file, false) { SaveOnConfigSet = false, diff --git a/MiraAPI/Roles/CustomRoleUtils.cs b/MiraAPI/Roles/CustomRoleUtils.cs index 1a2b9b5..08c5cd4 100644 --- a/MiraAPI/Roles/CustomRoleUtils.cs +++ b/MiraAPI/Roles/CustomRoleUtils.cs @@ -56,7 +56,9 @@ public static class CustomRoleUtils var roleOptions = currentGameOptions.RoleOptions; var role = GetRegisteredRole(roleType); - var assignmentData = new RoleManager.RoleAssignmentData(role, roleOptions.GetNumPerGame(role!.Role), + var assignmentData = new RoleManager.RoleAssignmentData( + role, + roleOptions.GetNumPerGame(role!.Role), roleOptions.GetChancePerGame(role.Role)); return assignmentData; diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 606e583..643a43d 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -100,7 +100,7 @@ public static class Extensions public static void SetCooldownFormat(this ActionButton? button, float timer, float maxTimer, string format = "0") { var num = Mathf.Clamp(timer / maxTimer, 0f, 1f); - button.isCoolingDown = num > 0f; + button!.isCoolingDown = num > 0f; button.SetCooldownFill(num); if (button.isCoolingDown) { From 47e02d3dcf21e67bff04774fd0e180670ff4c1bf Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Mon, 29 Jun 2026 08:47:21 -0500 Subject: [PATCH 18/42] Add documentation for menu categories --- MiraAPI/GameOptions/AbstractOptionGroup.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index 35b1426..8bb8caa 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -93,11 +93,33 @@ public abstract class AbstractOptionGroup : AbstractOptionGroup where T : IOp } } +/// +/// Menu categories for option groups. +/// public enum MenuCategory { + /// + /// Determines the option group is in the game settings tab. + /// Game, + + /// + /// Determines the option group is in the role settings tab. + /// Roles, + + /// + /// Determines the option group is in the modifier settings tab. + /// Modifiers, + + /// + /// Determines the option group is in the first custom settings tab. + /// CustomOne, + + /// + /// Determines the option group is in the second custom settings tab. + /// CustomTwo } From 127e3f600ec9f39c6f3ae91e50924aefdc47d523 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Mon, 29 Jun 2026 09:05:35 -0500 Subject: [PATCH 19/42] Fix misc warnings --- MiraAPI/GameOptions/AbstractOptionGroup.cs | 2 +- MiraAPI/Keybinds/BaseKeybind.cs | 2 +- MiraAPI/Keybinds/VanillaKeybind.cs | 5 +++-- MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 2 +- MiraAPI/Patches/Menu/SkinsTabPatches.cs | 2 +- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 2 +- MiraAPI/Patches/Roles/HowToPlayPatch.cs | 2 +- MiraAPI/Utilities/Helpers.cs | 5 +++++ 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index 8bb8caa..f21a3cb 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -121,5 +121,5 @@ public enum MenuCategory /// /// Determines the option group is in the second custom settings tab. /// - CustomTwo + CustomTwo, } diff --git a/MiraAPI/Keybinds/BaseKeybind.cs b/MiraAPI/Keybinds/BaseKeybind.cs index 525ffef..e9407ed 100644 --- a/MiraAPI/Keybinds/BaseKeybind.cs +++ b/MiraAPI/Keybinds/BaseKeybind.cs @@ -14,7 +14,7 @@ public class BaseKeybind public InputAction? RewiredInputAction { get; internal set; } /// - /// Gets the unique identifier for this keybind. Used in Rewired. + /// Gets or sets the unique identifier for this keybind. Used in Rewired. /// public string Id { get; protected set; } diff --git a/MiraAPI/Keybinds/VanillaKeybind.cs b/MiraAPI/Keybinds/VanillaKeybind.cs index 8911b49..594e583 100644 --- a/MiraAPI/Keybinds/VanillaKeybind.cs +++ b/MiraAPI/Keybinds/VanillaKeybind.cs @@ -1,4 +1,5 @@ -using Rewired; +using System.Globalization; +using Rewired; namespace MiraAPI.Keybinds; @@ -19,6 +20,6 @@ public class VanillaKeybind : BaseKeybind public VanillaKeybind(int id) { RewiredInputAction = KeybindUtils.GetInputActionById(id); - Id = RewiredInputAction != null ? RewiredInputAction.name : id.ToString(); + Id = RewiredInputAction != null ? RewiredInputAction.name : id.ToString(CultureInfo.InvariantCulture); } } diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index ca4b79d..bd9a6ce 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -2,11 +2,11 @@ using HarmonyLib; using Innersloth.Assets; using MiraAPI.Utilities; +using MiraAPI.Utilities.Assets; using Reactor.Utilities.Extensions; using System; using System.Collections.Generic; using System.Linq; -using MiraAPI.Utilities.Assets; using TMPro; using UnityEngine; using Object = UnityEngine.Object; diff --git a/MiraAPI/Patches/Menu/SkinsTabPatches.cs b/MiraAPI/Patches/Menu/SkinsTabPatches.cs index 24bec7c..5395ff6 100644 --- a/MiraAPI/Patches/Menu/SkinsTabPatches.cs +++ b/MiraAPI/Patches/Menu/SkinsTabPatches.cs @@ -1,12 +1,12 @@ using AmongUs.Data; using HarmonyLib; using MiraAPI.Utilities; +using MiraAPI.Utilities.Assets; using Reactor.Utilities.Extensions; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using MiraAPI.Utilities.Assets; using TMPro; using UnityEngine; using Object = UnityEngine.Object; diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index 0527fc0..ed5f103 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -1,11 +1,11 @@ using AmongUs.Data; using HarmonyLib; using MiraAPI.Utilities; +using MiraAPI.Utilities.Assets; using Reactor.Utilities.Extensions; using System; using System.Collections.Generic; using System.Linq; -using MiraAPI.Utilities.Assets; using TMPro; using UnityEngine; using Object = UnityEngine.Object; diff --git a/MiraAPI/Patches/Roles/HowToPlayPatch.cs b/MiraAPI/Patches/Roles/HowToPlayPatch.cs index 551abbb..ee6e5ff 100644 --- a/MiraAPI/Patches/Roles/HowToPlayPatch.cs +++ b/MiraAPI/Patches/Roles/HowToPlayPatch.cs @@ -11,7 +11,7 @@ namespace MiraAPI.Patches.Roles; internal static class HowToPlayPatch { // yes i patched the entire method - private static void Prefix(HowToPlayScene __instance) + public static void Prefix(HowToPlayScene __instance) { if (RoleManager.Instance.AllRoles.ToArray().All(x => !x.IsCustomRole())) { diff --git a/MiraAPI/Utilities/Helpers.cs b/MiraAPI/Utilities/Helpers.cs index b58d395..c089e40 100644 --- a/MiraAPI/Utilities/Helpers.cs +++ b/MiraAPI/Utilities/Helpers.cs @@ -40,6 +40,11 @@ public static class Helpers return keybindIcon; } + /// + /// Gets the move next of an on . + /// + /// Where the should be parented to. + /// THe corresponding method to patch. public static MethodBase? GetStateMachineMoveNext(string methodName) { var typeName = typeof(T).FullName; From a5f0ed59754011a9abdc30fd25a44c680a3871c9 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Mon, 29 Jun 2026 09:13:24 -0500 Subject: [PATCH 20/42] Bump version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index e60aaf9..b09c823 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,7 @@ true - 0.4.0 + 0.4.1 dev All Of Us, XtraCube, Angxl From 84321f290e8874a32f5694f2e21ff7755950f6e3 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Tue, 30 Jun 2026 16:25:53 -0500 Subject: [PATCH 21/42] Fix game option checks --- MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs | 2 +- MiraAPI/GameOptions/AbstractOptionGroup.cs | 2 +- MiraAPI/Patches/Options/GameOptionsMenuPatch.cs | 4 ++-- MiraAPI/Patches/Options/GameSettingMenuPatches.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs b/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs index 1414799..0bcbcdc 100644 --- a/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs +++ b/MiraAPI.Example/Options/Modifiers/GeneralModifierOptions.cs @@ -9,7 +9,7 @@ public class GeneralModifierOptions : AbstractOptionGroup public override uint GroupPriority => 0; - public override bool ShowInModifiersMenu => true; + public override MenuCategory ParentMenu => MenuCategory.Modifiers; [ModdedToggleOption("Some Boolean Option")] public bool SomeBooleanOption { get; set; } = true; diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index f21a3cb..cb82e1c 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -40,7 +40,7 @@ public abstract class AbstractOptionGroup /// /// Gets a value indicating which menu the group is in. /// - public virtual MenuCategory ParentMenu => MenuCategory.Roles; + public virtual MenuCategory ParentMenu => MenuCategory.Game; /// /// Gets the function that determines whether the group should be visible or not. diff --git a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs index 7b5e7a8..fa393c2 100644 --- a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs +++ b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs @@ -63,7 +63,7 @@ internal static class GameOptionsMenuPatch var filteredGroups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups .Where(x => x.OptionableType == null && - x.ParentMenu == MenuCategory.Roles) ?? []; + x.ParentMenu == MenuCategory.Game) ?? []; foreach (var group in filteredGroups) { @@ -218,7 +218,7 @@ internal static class GameOptionsMenuPatch } var filteredGroups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups - .Where(x => x.OptionableType == null && x.ParentMenu == MenuCategory.Roles) ?? []; + .Where(x => x.OptionableType == null && x.ParentMenu == MenuCategory.Game) ?? []; foreach (var group in filteredGroups) { diff --git a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs index 30ed1dd..6e12c61 100644 --- a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs @@ -432,7 +432,7 @@ internal static class GameSettingMenuPatches x => x.ParentMenu == MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true); var modHasOptions = SelectedMod.InternalOptionGroups.Exists(x => x.OptionableType == null && - x.ParentMenu != MenuCategory.Modifiers && x.ParentMenu != MenuCategory.Roles); + x.ParentMenu == MenuCategory.Game); _modifiersButton.gameObject.SetActive(true); _smallRolesButton.gameObject.SetActive(true); From 2eecba2e5166484b9034117080e161f0e4e81f35 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 1 Jul 2026 19:57:29 -0500 Subject: [PATCH 22/42] Add TMP icon support for roles --- MiraAPI.Example/Roles/ChameleonRole.cs | 3 + MiraAPI.Example/Roles/FreezerRole.cs | 3 + .../Options/NotificationPopperPatch.cs | 2 + .../Patches/Options/RoleSettingMenuPatches.cs | 3 +- MiraAPI/Patches/TmpAwakePatch.cs | 32 +++++++ MiraAPI/Resources/BlankSprite.png | Bin 0 -> 96 bytes MiraAPI/Roles/CustomRoleConfiguration.cs | 7 ++ MiraAPI/Roles/ICustomRole.cs | 1 + MiraAPI/Utilities/Assets/MiraAssets.cs | 2 + MiraAPI/Utilities/Assets/TmpSpriteUtils.cs | 83 ++++++++++++++++++ 10 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 MiraAPI/Patches/TmpAwakePatch.cs create mode 100644 MiraAPI/Resources/BlankSprite.png create mode 100644 MiraAPI/Utilities/Assets/TmpSpriteUtils.cs diff --git a/MiraAPI.Example/Roles/ChameleonRole.cs b/MiraAPI.Example/Roles/ChameleonRole.cs index c1d7779..f601551 100644 --- a/MiraAPI.Example/Roles/ChameleonRole.cs +++ b/MiraAPI.Example/Roles/ChameleonRole.cs @@ -1,6 +1,7 @@ using AmongUs.GameOptions; using MiraAPI.Patches.Stubs; using MiraAPI.Roles; +using MiraAPI.Utilities.Assets; using Reactor.Utilities; using TMPro; using UnityEngine; @@ -20,6 +21,8 @@ public class ChameloenRole : CrewmateRole, ICustomRole public CustomRoleConfiguration Configuration => new(this) { OptionsScreenshot = ExampleAssets.Banner, + Icon = MiraAssets.CrewmateFile, + IconTmp = TmpSpriteUtils.CreateSpriteAsset(MiraAssets.CrewmateFile.LoadAsset(), "ApiExample.Role.Impostor.ChameleonRole"), IntroSound = CustomRoleUtils.GetIntroSound(RoleTypes.Shapeshifter), }; diff --git a/MiraAPI.Example/Roles/FreezerRole.cs b/MiraAPI.Example/Roles/FreezerRole.cs index bef24d2..5a7f4bd 100644 --- a/MiraAPI.Example/Roles/FreezerRole.cs +++ b/MiraAPI.Example/Roles/FreezerRole.cs @@ -1,4 +1,5 @@ using MiraAPI.Roles; +using MiraAPI.Utilities.Assets; using UnityEngine; namespace MiraAPI.Example.Roles; @@ -13,6 +14,8 @@ public class FreezerRole : ImpostorRole, ICustomRole public CustomRoleConfiguration Configuration => new CustomRoleConfiguration(this) { + Icon = MiraAssets.ImpostorFile, + IconTmp = TmpSpriteUtils.CreateSpriteAsset(MiraAssets.ImpostorFile.LoadAsset(), "ApiExample.Role.Impostor.FreezerRole"), OptionsScreenshot = ExampleAssets.Banner, MaxRoleCount = 2, }; diff --git a/MiraAPI/Patches/Options/NotificationPopperPatch.cs b/MiraAPI/Patches/Options/NotificationPopperPatch.cs index b2c51e9..0ba8605 100644 --- a/MiraAPI/Patches/Options/NotificationPopperPatch.cs +++ b/MiraAPI/Patches/Options/NotificationPopperPatch.cs @@ -26,9 +26,11 @@ public static class NotificationPopperPatch var textColor = customRole.OptionsMenuColor.ToTextColor(); + var icon = customRole.Configuration.IconTmp ? $"" : string.Empty; var item = TranslationController.Instance.GetString( StringNames.LobbyChangeSettingNotificationRole, string.Concat( + icon, "", textColor, TranslationController.Instance.GetString(key, Array.Empty()), diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index d123161..67a4894 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -437,8 +437,7 @@ public static class RoleSettingMenuPatches roleSetting.Role.StringName, roleSetting.RoleMaxCount, roleSetting.RoleChance, - roleSetting.Role.TeamType, - false); + roleSetting.Role.TeamType); if (AmongUsClient.Instance.AmHost) { diff --git a/MiraAPI/Patches/TmpAwakePatch.cs b/MiraAPI/Patches/TmpAwakePatch.cs new file mode 100644 index 0000000..3cb9ee6 --- /dev/null +++ b/MiraAPI/Patches/TmpAwakePatch.cs @@ -0,0 +1,32 @@ +using System.Linq; +using HarmonyLib; +using MiraAPI.Utilities.Assets; +using TMPro; + +namespace MiraAPI.Patches; +[HarmonyPatch] +public static class TmpAwakePatch +{ + [HarmonyPatch(typeof(TextMeshPro), nameof(TextMeshPro.Awake))] + [HarmonyPostfix] + public static void TmpAwakePostfix(TextMeshPro __instance) + { + if (!TmpSpriteUtils.AssetHolder || !__instance.m_spriteAsset) + { + return; + } + + /* + if (__instance.m_spriteAsset.name == "RoleIcons") + { + Error($"Stencil Comp: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilComp)}"); + Error($"Stencil ID: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilID)}"); + Error($"Stencil Op: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilOp)}"); + Error($"Stencil Write: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilWriteMask)}"); + Error($"Stencil Read: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilReadMask)}"); + Error($"Cull Mode: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ShaderTag_CullMode)}"); + }*/ + __instance.m_spriteAsset.fallbackSpriteAssets.Add(TmpSpriteUtils.AssetHolder); + __instance.UpdateMeshPadding(); + } +} diff --git a/MiraAPI/Resources/BlankSprite.png b/MiraAPI/Resources/BlankSprite.png new file mode 100644 index 0000000000000000000000000000000000000000..9523fc80e377918a9872497a16ba0276bf690c35 GIT binary patch literal 96 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1|;Q0k92}1TpU97 jtAP@HsS%!OzP=1vKsE;ugTSTW$so$p)z4*}Q$iB}m<<%} literal 0 HcmV?d00001 diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index 819eb1c..f756fed 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -3,6 +3,7 @@ using System; using Il2CppInterop.Runtime.Attributes; using MiraAPI.Patches.Freeplay; using MiraAPI.Utilities.Assets; +using TMPro; using UnityEngine; namespace MiraAPI.Roles; @@ -87,6 +88,12 @@ public record struct CustomRoleConfiguration [HideFromIl2Cpp] public LoadableAsset? Icon { get; set; } = null; + /// + /// Gets or sets the for the Role Icon. + /// + [HideFromIl2Cpp] + public TMP_SpriteAsset IconTmp { get; set; } + /// /// Gets or sets the Intro sound for the Role. /// diff --git a/MiraAPI/Roles/ICustomRole.cs b/MiraAPI/Roles/ICustomRole.cs index 5b72650..1915949 100644 --- a/MiraAPI/Roles/ICustomRole.cs +++ b/MiraAPI/Roles/ICustomRole.cs @@ -5,6 +5,7 @@ using MiraAPI.GameOptions; using MiraAPI.Modifiers; using MiraAPI.PluginLoading; using Reactor.Utilities; +using TMPro; using UnityEngine; namespace MiraAPI.Roles; diff --git a/MiraAPI/Utilities/Assets/MiraAssets.cs b/MiraAPI/Utilities/Assets/MiraAssets.cs index 8ae8986..10bceda 100644 --- a/MiraAPI/Utilities/Assets/MiraAssets.cs +++ b/MiraAPI/Utilities/Assets/MiraAssets.cs @@ -134,4 +134,6 @@ public static class MiraAssets /// Gets the sprite used for timed modifier file in TaskAdderGame. /// public static LoadableResourceAsset TimedModifierFile { get; } = new("MiraAPI.Resources.TimedModifierFile.png"); + + internal static LoadableResourceAsset BlankSprite { get; } = new("MiraAPI.Resources.BlankSprite.png"); } diff --git a/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs b/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs new file mode 100644 index 0000000..8256eb9 --- /dev/null +++ b/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using Reactor.Utilities.Extensions; +using TMPro; +using UnityEngine; + +namespace MiraAPI.Utilities.Assets; +public static class TmpSpriteUtils +{ + private static Shader _spriteShader; + private static Dictionary LoadedSprites = []; + public static TMP_SpriteAsset AssetHolder; + public static TMP_SpriteAsset CreateSpriteAsset(Sprite sprite, string assetName) + { + return CreateSpriteAsset(sprite.texture, sprite.rect, assetName); + } + public static TMP_SpriteAsset CreateSpriteAsset(Texture2D sourceTexture, Rect rect, string assetName) + { + if (LoadedSprites.TryGetValue(assetName, out var existingAsset)) + { + return existingAsset; + } + + if (!AssetHolder) + { + AssetHolder = ScriptableObject.CreateInstance(); + AssetHolder.DontUnload().DontDestroy(); + AssetHolder.fallbackSpriteAssets = new(); + } + TMP_SpriteAsset spriteAsset = ScriptableObject.CreateInstance(); + spriteAsset.name = assetName; + spriteAsset.spriteSheet = sourceTexture; + + if (!_spriteShader) + { + _spriteShader = Shader.Find("TextMeshPro/Sprite"); + } + + var material = new Material(_spriteShader) + { + name = assetName + " Material", + }; + material.SetTexture(ShaderUtilities.ID_MainTex, sourceTexture); + material.SetFloat(ShaderUtilities.ID_StencilComp, 0); + material.SetFloat(ShaderUtilities.ID_StencilID, 0); + material.SetFloat(ShaderUtilities.ID_StencilOp, 0); + material.SetFloat(ShaderUtilities.ID_StencilWriteMask, 255); + material.SetFloat(ShaderUtilities.ID_StencilReadMask, 255); + material.SetFloat(ShaderUtilities.ShaderTag_CullMode, 0); + spriteAsset.material = material; + + spriteAsset.spriteInfoList = new Il2CppSystem.Collections.Generic.List(); + + AddSpriteToAsset(spriteAsset, rect, assetName); + + spriteAsset.DontUnload().DontDestroy(); + spriteAsset.UpdateLookupTables(); + spriteAsset.fallbackSpriteAssets = new(); + AssetHolder.fallbackSpriteAssets.Add(spriteAsset); + AssetHolder.UpdateLookupTables(); + + LoadedSprites.Add(assetName, spriteAsset); + return spriteAsset; + } + + private static void AddSpriteToAsset(TMP_SpriteAsset spriteAsset, Rect rect, string spriteName) + { + TMP_Sprite newSprite = new TMP_Sprite + { + name = spriteName, + hashCode = TMP_TextUtilities.GetSimpleHashCode(spriteName), + x = 0, + y = 0, + width = rect.width, + height = rect.height, + xOffset = -(rect.width / 3), + yOffset = rect.height / 1.25f, + xAdvance = rect.width, + scale = 1, + }; + + spriteAsset.spriteInfoList.Add(newSprite); + } +} From ff30d5fdd63075d61622d444e5eb1e5e043e53d9 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 1 Jul 2026 20:30:44 -0500 Subject: [PATCH 23/42] Add tmp sprite scaling support --- MiraAPI/Utilities/Assets/TmpSpriteUtils.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs b/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs index 8256eb9..b3ab8eb 100644 --- a/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs +++ b/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs @@ -9,11 +9,11 @@ public static class TmpSpriteUtils private static Shader _spriteShader; private static Dictionary LoadedSprites = []; public static TMP_SpriteAsset AssetHolder; - public static TMP_SpriteAsset CreateSpriteAsset(Sprite sprite, string assetName) + public static TMP_SpriteAsset CreateSpriteAsset(Sprite sprite, string assetName, float scale = 1) { - return CreateSpriteAsset(sprite.texture, sprite.rect, assetName); + return CreateSpriteAsset(sprite.texture, sprite.rect, assetName, scale); } - public static TMP_SpriteAsset CreateSpriteAsset(Texture2D sourceTexture, Rect rect, string assetName) + public static TMP_SpriteAsset CreateSpriteAsset(Texture2D sourceTexture, Rect rect, string assetName, float scale = 1) { if (LoadedSprites.TryGetValue(assetName, out var existingAsset)) { @@ -50,7 +50,7 @@ public static class TmpSpriteUtils spriteAsset.spriteInfoList = new Il2CppSystem.Collections.Generic.List(); - AddSpriteToAsset(spriteAsset, rect, assetName); + AddSpriteToAsset(spriteAsset, rect, assetName, scale); spriteAsset.DontUnload().DontDestroy(); spriteAsset.UpdateLookupTables(); @@ -62,7 +62,7 @@ public static class TmpSpriteUtils return spriteAsset; } - private static void AddSpriteToAsset(TMP_SpriteAsset spriteAsset, Rect rect, string spriteName) + private static void AddSpriteToAsset(TMP_SpriteAsset spriteAsset, Rect rect, string spriteName, float scale) { TMP_Sprite newSprite = new TMP_Sprite { @@ -75,7 +75,7 @@ public static class TmpSpriteUtils xOffset = -(rect.width / 3), yOffset = rect.height / 1.25f, xAdvance = rect.width, - scale = 1, + scale = scale, }; spriteAsset.spriteInfoList.Add(newSprite); From 850e82155cfa3e99cb5e8164845cd63364dc243b Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 1 Jul 2026 23:39:57 -0500 Subject: [PATCH 24/42] Improve tmp offsets --- MiraAPI/Patches/TmpAwakePatch.cs | 16 ++++++---------- MiraAPI/Utilities/Assets/TmpSpriteUtils.cs | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/MiraAPI/Patches/TmpAwakePatch.cs b/MiraAPI/Patches/TmpAwakePatch.cs index 3cb9ee6..2d43d23 100644 --- a/MiraAPI/Patches/TmpAwakePatch.cs +++ b/MiraAPI/Patches/TmpAwakePatch.cs @@ -11,21 +11,17 @@ public static class TmpAwakePatch [HarmonyPostfix] public static void TmpAwakePostfix(TextMeshPro __instance) { - if (!TmpSpriteUtils.AssetHolder || !__instance.m_spriteAsset) + if (!TmpSpriteUtils.AssetHolder || __instance.m_spriteAsset == TmpSpriteUtils.AssetHolder) { return; } - /* - if (__instance.m_spriteAsset.name == "RoleIcons") + if (!__instance.m_spriteAsset) { - Error($"Stencil Comp: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilComp)}"); - Error($"Stencil ID: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilID)}"); - Error($"Stencil Op: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilOp)}"); - Error($"Stencil Write: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilWriteMask)}"); - Error($"Stencil Read: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ID_StencilReadMask)}"); - Error($"Cull Mode: {__instance.m_spriteAsset.material.GetFloat(ShaderUtilities.ShaderTag_CullMode)}"); - }*/ + __instance.m_spriteAsset = TmpSpriteUtils.AssetHolder; + __instance.UpdateMeshPadding(); + return; + } __instance.m_spriteAsset.fallbackSpriteAssets.Add(TmpSpriteUtils.AssetHolder); __instance.UpdateMeshPadding(); } diff --git a/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs b/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs index b3ab8eb..cdb4315 100644 --- a/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs +++ b/MiraAPI/Utilities/Assets/TmpSpriteUtils.cs @@ -72,7 +72,7 @@ public static class TmpSpriteUtils y = 0, width = rect.width, height = rect.height, - xOffset = -(rect.width / 3), + xOffset = -(rect.width / 3) + (scale - 1) * (rect.width / 2), yOffset = rect.height / 1.25f, xAdvance = rect.width, scale = scale, From 3eb0a4fdb3eb382731e5a474403752a104db94bd Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 8 Jul 2026 17:31:20 -0500 Subject: [PATCH 25/42] Fix some instant crashing Happens very quickly on practice mode when spam switching tasks --- MiraAPI/Utilities/Extensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 6c8b74b..bc3ad0e 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -342,9 +342,8 @@ public static class Extensions { yield return Resources.UnloadUnusedAssets(); - GC.Collect(0, GCCollectionMode.Forced, blocking: true); GC.WaitForPendingFinalizers(); - GC.Collect(0, GCCollectionMode.Forced, blocking: true); + GC.Collect(0, GCCollectionMode.Forced); } /// From 1b718092eee566788f28c50c300ecdc7506e3258 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 8 Jul 2026 18:13:34 -0500 Subject: [PATCH 26/42] Move GC clearing out of coroutines --- MiraAPI/Utilities/Extensions.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index bc3ad0e..717f0b9 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -326,7 +326,7 @@ public static class Extensions yield return null; if (clearGc) { - yield return CoFreeResources(); + ClearGarbageCollector(); } } @@ -335,15 +335,8 @@ public static class Extensions /// public static void ClearGarbageCollector() { - Coroutines.Start(CoFreeResources()); - } - - private static IEnumerator CoFreeResources() - { - yield return Resources.UnloadUnusedAssets(); - - GC.WaitForPendingFinalizers(); - GC.Collect(0, GCCollectionMode.Forced); + Resources.UnloadUnusedAssets(); + GC.Collect(); } /// From dac1d82d5cbd7c775209e86f01a3f01602f760d8 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Thu, 9 Jul 2026 22:57:31 -0500 Subject: [PATCH 27/42] Reduce heavy garbage collection temporarily --- MiraAPI/Patches/Freeplay/TaskAdderPatches.cs | 7 ++++++- MiraAPI/Patches/Menu/HatsTabPatches.cs | 1 - MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 1 - MiraAPI/Patches/Menu/SkinsTabPatches.cs | 1 - MiraAPI/Patches/Menu/VisorsTabPatches.cs | 1 - MiraAPI/Patches/Options/GameOptionsMenuPatch.cs | 7 +++++++ MiraAPI/Patches/Options/RoleSettingMenuPatches.cs | 3 --- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs index 3e4adc9..fa91e7b 100644 --- a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs +++ b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs @@ -254,6 +254,12 @@ public static class TaskAdderPatches .ToArray() .Any(x => x.FolderName == child.FolderName); + [HarmonyPostfix] + [HarmonyPatch(nameof(TaskAdderGame.OnDisable))] + public static void ClosePatch() + { + Utilities.Extensions.ClearGarbageCollector(); + } // yes it might be crazy patching the entire method, but i tried so many other methods and only this works :cry: // true -chip [HarmonyPrefix] @@ -278,7 +284,6 @@ public static class TaskAdderPatches __instance.ActiveItems.ToArray().Do(x => x.gameObject.DeepDestroy(false)); __instance.ActiveItems.Clear(); - Utilities.Extensions.ClearGarbageCollector(); float num = 0f; float num2 = 0f; diff --git a/MiraAPI/Patches/Menu/HatsTabPatches.cs b/MiraAPI/Patches/Menu/HatsTabPatches.cs index 3ad0fa3..b06b11a 100644 --- a/MiraAPI/Patches/Menu/HatsTabPatches.cs +++ b/MiraAPI/Patches/Menu/HatsTabPatches.cs @@ -103,7 +103,6 @@ public static class HatsTabPatches foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); - Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); var group = sortedHats.Where(x => x.Key == storeNames[page]); diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index bd9a6ce..4e9b693 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -84,7 +84,6 @@ public static class NameplatesTabPatches foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); - Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/SkinsTabPatches.cs b/MiraAPI/Patches/Menu/SkinsTabPatches.cs index 5395ff6..44d08d5 100644 --- a/MiraAPI/Patches/Menu/SkinsTabPatches.cs +++ b/MiraAPI/Patches/Menu/SkinsTabPatches.cs @@ -86,7 +86,6 @@ public static class SkinsTabPatches foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); - Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index ed5f103..c5fe9a4 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -83,7 +83,6 @@ public static class VisorsTabPatches foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); - Utilities.Extensions.ClearGarbageCollector(); var groupNameText = __instance.GetComponentInChildren(false); diff --git a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs index fa393c2..cbc11aa 100644 --- a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs +++ b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs @@ -35,6 +35,13 @@ internal static class GameOptionsMenuPatch HudManager.Instance.PlayerCam.OverrideScreenShakeEnabled = true; } + [HarmonyPostfix] + [HarmonyPatch(nameof(GameOptionsMenu.CloseMenu))] + public static void FullMenuClosePatch(GameOptionsMenu __instance) + { + Utilities.Extensions.ClearGarbageCollector(); + } + [HarmonyPostfix] [HarmonyPatch(nameof(GameOptionsMenu.Update))] // ReSharper disable once InconsistentNaming diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 67a4894..55947c8 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -76,7 +76,6 @@ public static class RoleSettingMenuPatches __instance.roleChances = new Il2CppSystem.Collections.Generic.List(); __instance.advancedSettingChildren = new Il2CppSystem.Collections.Generic.List(); - Utilities.Extensions.ClearGarbageCollector(); var maskBg = __instance.scrollBar.transform.FindChild("MaskBg"); var hitbox = __instance.scrollBar.transform.FindChild("Hitbox"); @@ -328,7 +327,6 @@ public static class RoleSettingMenuPatches obj.gameObject.DeepDestroy(false); } RoleOptionSettings.Clear(); - Utilities.Extensions.ClearGarbageCollector(); __instance.SetQuotaTab(); })); headerBtn.SetButtonEnableState(true); @@ -456,7 +454,6 @@ public static class RoleSettingMenuPatches CurrentRole = role; __instance.advancedSettingChildren.Clear(); - Utilities.Extensions.ClearGarbageCollector(); // TODO: create sub groups under the role settings. var filteredOptions = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups From 662b52f78d06932dc9aec45ba7aa99be0d435c28 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Thu, 9 Jul 2026 22:57:59 -0500 Subject: [PATCH 28/42] Allow populated votes to be modified --- MiraAPI/Voting/VotingUtils.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs index abafdd0..130e4c4 100644 --- a/MiraAPI/Voting/VotingUtils.cs +++ b/MiraAPI/Voting/VotingUtils.cs @@ -207,6 +207,9 @@ public static class VotingUtils return; } + // If modified, these will visually change. + votes = @event.Votes; + MeetingHud.Instance.TitleText.text = TranslationController.Instance.GetString( StringNames.MeetingVotingResults, From 9d7e41a3c9f2e06317ead8a5de686080b3bccc6e Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Thu, 9 Jul 2026 23:03:02 -0500 Subject: [PATCH 29/42] Fix duplicated Populate Results Event --- MiraAPI/Patches/Voting/MeetingHudPatches.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/MiraAPI/Patches/Voting/MeetingHudPatches.cs b/MiraAPI/Patches/Voting/MeetingHudPatches.cs index 2aa9a82..7a4338a 100644 --- a/MiraAPI/Patches/Voting/MeetingHudPatches.cs +++ b/MiraAPI/Patches/Voting/MeetingHudPatches.cs @@ -208,13 +208,6 @@ internal static class MeetingHudPatches public static bool PopulateResultsPatch(MeetingHud __instance, ref Il2CppStructArray states) { var votes = states.Select(x=> new CustomVote(x.VoterId, x.VotedForId)).ToList(); - var @event = new PopulateResultsEvent(votes); - MiraEventManager.InvokeEvent(@event); - - if (@event.IsCancelled) - { - return false; - } VotingUtils.HandlePopulateResults(votes); return false; From 5cccc192b1b43539c95b1e0e87df4233b4dc3026 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Fri, 17 Jul 2026 15:07:40 -0500 Subject: [PATCH 30/42] Add support for better option notfs --- .../Options/Roles/FreezerRoleSettings.cs | 8 +++ MiraAPI/GameOptions/AbstractOptionGroup.cs | 7 +++ MiraAPI/GameOptions/IModdedOption.cs | 10 ++++ MiraAPI/GameOptions/ModdedOptionsManager.cs | 33 ++++++++++++ .../GameOptions/OptionNotifConfiguration.cs | 53 +++++++++++++++++++ .../OptionTypes/ModdedEnumOption.cs | 16 +++++- .../OptionTypes/ModdedNumberOption.cs | 7 ++- .../GameOptions/OptionTypes/ModdedOption.cs | 9 +++- .../OptionTypes/ModdedPlayerOption.cs | 8 ++- .../OptionTypes/ModdedToggleOption.cs | 8 ++- .../Options/NotificationPopperPatch.cs | 2 +- 11 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 MiraAPI/GameOptions/OptionNotifConfiguration.cs diff --git a/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs b/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs index 1473068..1be3649 100644 --- a/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs +++ b/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs @@ -2,11 +2,19 @@ using MiraAPI.GameOptions; using MiraAPI.GameOptions.Attributes; using MiraAPI.Utilities; +using MiraAPI.Utilities.Assets; +using TMPro; +using UnityEngine; namespace MiraAPI.Example.Options.Roles; public class FreezerRoleSettings : AbstractOptionGroup { + public override OptionNotifConfiguration Configuration => new( + Palette.Blue, + TmpSpriteUtils.CreateSpriteAsset( + MiraAssets.ImpostorFile.LoadAsset(), + "ApiExample.Role.Impostor.FreezerRole")); public override string GroupName => "Custom Role"; [ModdedNumberOption("Freeze Duration", 1, 15, 1, MiraNumberSuffixes.Seconds)] diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index cb82e1c..07d008a 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using Il2CppInterop.Runtime.Attributes; using MiraAPI.Modifiers; +using TMPro; using UnityEngine; namespace MiraAPI.GameOptions; @@ -58,6 +60,11 @@ public abstract class AbstractOptionGroup /// public virtual uint GroupPriority => uint.MaxValue; + /// + /// Gets the default notification settings for the group. + /// + public virtual OptionNotifConfiguration Configuration => new(new Color(0.7333f, 0.7333f, 0.7333f, 1)); + internal bool AllOptionsHidden { get; set; } internal CategoryHeaderMasked? Header { get; set; } diff --git a/MiraAPI/GameOptions/IModdedOption.cs b/MiraAPI/GameOptions/IModdedOption.cs index 907ab7d..646c22b 100644 --- a/MiraAPI/GameOptions/IModdedOption.cs +++ b/MiraAPI/GameOptions/IModdedOption.cs @@ -21,6 +21,16 @@ public interface IModdedOption /// string Title { get; set; } + /// + /// Gets or sets the parent of the option. + /// + AbstractOptionGroup ParentGroup { get; set; } + + /// + /// Gets the notification settings for the option. + /// + OptionNotifConfiguration Configuration { get; } + /// /// Gets the for the option, used for localization. /// diff --git a/MiraAPI/GameOptions/ModdedOptionsManager.cs b/MiraAPI/GameOptions/ModdedOptionsManager.cs index 3e6e04e..7dd26ee 100644 --- a/MiraAPI/GameOptions/ModdedOptionsManager.cs +++ b/MiraAPI/GameOptions/ModdedOptionsManager.cs @@ -12,6 +12,8 @@ using MiraAPI.PluginLoading; using MiraAPI.Utilities; using Reactor.Networking.Rpc; using Reactor.Utilities; +using TMPro; +using UnityEngine; namespace MiraAPI.GameOptions; @@ -30,6 +32,36 @@ public static class ModdedOptionsManager internal static uint NextId => _nextId++; private static uint _nextId = 1; + public static void AddSettingsChangeMessage(NotificationPopper notif, StringNames key, string value, Color textColor, TMP_SpriteAsset? sprite, bool playSound = true) + { + var item = string.Empty; + var text = textColor.ToTextColor(); + if (sprite != null) + { + item = TranslationController.Instance.GetString( + StringNames.LobbyChangeSettingNotification, + string.Concat( + "", + text, + TranslationController.Instance.GetString(key), + ""), + "" + value + "" + ); + } + else + { + item = TranslationController.Instance.GetString( + StringNames.LobbyChangeSettingNotification, + "" + + text + + TranslationController.Instance.GetString(key) + "", + "" + value + ""); + } + notif.SettingsChangeMessageLogic(key, item, playSound); + } + internal static bool RegisterGroup(Type type, MiraPluginInfo pluginInfo) { if (Activator.CreateInstance(type) is not AbstractOptionGroup group) @@ -123,6 +155,7 @@ public static class ModdedOptionsManager option.ConfigDefinition = new ConfigDefinition(groupName, propertyName); + option.ParentGroup = group; option.ParentMod = pluginInfo.MiraPlugin; pluginInfo.InternalOptions.Add(option); ModdedOptions.Add(option.Id, option); diff --git a/MiraAPI/GameOptions/OptionNotifConfiguration.cs b/MiraAPI/GameOptions/OptionNotifConfiguration.cs new file mode 100644 index 0000000..e16106f --- /dev/null +++ b/MiraAPI/GameOptions/OptionNotifConfiguration.cs @@ -0,0 +1,53 @@ +using System; +using Il2CppInterop.Runtime.Attributes; +using TMPro; +using UnityEngine; +namespace MiraAPI.GameOptions; + +/// +/// Used to configure the specific visuals for option notifications. +/// +public record struct OptionNotifConfiguration +{ +#pragma warning disable S1133 + [Obsolete("Default constructor is not supported")] +#pragma warning restore S1133 +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + public OptionNotifConfiguration() +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member + { + throw new NotImplementedException("Default constructor is not supported."); + } + + /// + /// Initializes a new instance of the struct based on a group. + /// + /// The in which you are configuring. + public OptionNotifConfiguration(AbstractOptionGroup group) + { + PopUpIconTmp = group.Configuration.PopUpIconTmp; + PopUpTextColor = group.Configuration.PopUpTextColor; + } + + /// + /// Initializes a new instance of the struct from scratch. + /// + /// The text for the configuration. + /// The icon for the configuration. + public OptionNotifConfiguration(Color color, TMP_SpriteAsset asset = null!) + { + PopUpIconTmp = asset; + PopUpTextColor = color; + } + + /// + /// Gets or sets the for the icon on the options pop-up. + /// + public TMP_SpriteAsset PopUpIconTmp { get; set; } + + /// + /// Gets or sets the for the text on the options pop-up. + /// + [HideFromIl2Cpp] + public Color PopUpTextColor { get; set; } +} diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs index 1f92418..30809bd 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedEnumOption.cs @@ -90,7 +90,13 @@ public class ModdedEnumOption : ModdedOption /// protected override void OnValueChanged(int newValue) { - HudManager.Instance.Notifier.AddSettingsChangeMessage(StringName, Data.GetValueString(newValue), false); + ModdedOptionsManager.AddSettingsChangeMessage( + HudManager.Instance.Notifier, + StringName, + Data.GetValueString(newValue), + Configuration.PopUpTextColor, + Configuration.PopUpIconTmp, + false); if (!OptionBehaviour) { return; @@ -183,7 +189,13 @@ public class ModdedEnumOption : ModdedOption where T : Enum /// protected override void OnValueChanged(T newValue) { - HudManager.Instance.Notifier.AddSettingsChangeMessage(StringName, Data.GetValueString(Convert.ToInt32(newValue, NumberFormatInfo.InvariantInfo)), false); + ModdedOptionsManager.AddSettingsChangeMessage( + HudManager.Instance.Notifier, + StringName, + Data.GetValueString(Convert.ToInt32(newValue, NumberFormatInfo.InvariantInfo)), + Configuration.PopUpTextColor, + Configuration.PopUpIconTmp, + false); if (!OptionBehaviour) { return; diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs index 1a5ef33..87f4ca9 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs @@ -225,9 +225,12 @@ public class ModdedNumberOption : ModdedOption protected override void OnValueChanged(float newValue) { Value = Mathf.Clamp(newValue, Min, Max); - HudManager.Instance.Notifier.AddSettingsChangeMessage( + ModdedOptionsManager.AddSettingsChangeMessage( + HudManager.Instance.Notifier, StringName, - Data.GetValueString(Value), + Data.GetValueString(newValue), + Configuration.PopUpTextColor, + Configuration.PopUpIconTmp, false); if (OptionBehaviour is NumberOption opt) diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs index 206894d..a023bac 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs @@ -1,10 +1,11 @@ using System; using BepInEx.Configuration; +using Il2CppInterop.Runtime.Attributes; using MiraAPI.Networking; using MiraAPI.PluginLoading; using Reactor.Localization.Utilities; using Reactor.Networking.Rpc; -using Reactor.Utilities; +using TMPro; using UnityEngine; namespace MiraAPI.GameOptions.OptionTypes; @@ -190,4 +191,10 @@ public abstract class ModdedOption : IModdedOption { return option.Value; } + + /// + public AbstractOptionGroup ParentGroup { get; set; } + + /// + public OptionNotifConfiguration Configuration => new(ParentGroup); } diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs index f6516cd..db397bd 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedPlayerOption.cs @@ -126,7 +126,13 @@ public class ModdedPlayerOption : ModdedOption /// protected override void OnValueChanged(int newValue) { - HudManager.Instance.Notifier.AddSettingsChangeMessage(StringName, Data.GetValueString(newValue), false); + ModdedOptionsManager.AddSettingsChangeMessage( + HudManager.Instance.Notifier, + StringName, + Data.GetValueString(newValue), + Configuration.PopUpTextColor, + Configuration.PopUpIconTmp, + false); if (!OptionBehaviour) { return; diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedToggleOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedToggleOption.cs index 0b13f97..55b69b9 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedToggleOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedToggleOption.cs @@ -71,7 +71,13 @@ public class ModdedToggleOption : ModdedOption /// protected override void OnValueChanged(bool newValue) { - HudManager.Instance.Notifier.AddSettingsChangeMessage(StringName, newValue ? "On" : "Off", false); + ModdedOptionsManager.AddSettingsChangeMessage( + HudManager.Instance.Notifier, + StringName, + newValue ? "On" : "Off", + Configuration.PopUpTextColor, + Configuration.PopUpIconTmp, + false); if (!OptionBehaviour) { return; diff --git a/MiraAPI/Patches/Options/NotificationPopperPatch.cs b/MiraAPI/Patches/Options/NotificationPopperPatch.cs index 0ba8605..349f103 100644 --- a/MiraAPI/Patches/Options/NotificationPopperPatch.cs +++ b/MiraAPI/Patches/Options/NotificationPopperPatch.cs @@ -33,7 +33,7 @@ public static class NotificationPopperPatch icon, "", textColor, - TranslationController.Instance.GetString(key, Array.Empty()), + TranslationController.Instance.GetString(key), "" ), "" + roleCount + "", From 7afd899e567bfa317f83227c864460b80ccb44ae Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Fri, 17 Jul 2026 15:47:53 -0500 Subject: [PATCH 31/42] Improve example options --- .../Options/Roles/TeleporterOptions.cs | 2 +- MiraAPI/GameOptions/AbstractOptionGroup.cs | 33 +++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/MiraAPI.Example/Options/Roles/TeleporterOptions.cs b/MiraAPI.Example/Options/Roles/TeleporterOptions.cs index b6d02a4..d05569b 100644 --- a/MiraAPI.Example/Options/Roles/TeleporterOptions.cs +++ b/MiraAPI.Example/Options/Roles/TeleporterOptions.cs @@ -6,7 +6,7 @@ using MiraAPI.Utilities; namespace MiraAPI.Example.Options.Roles; -public class TeleporterOptions : AbstractOptionGroup +public class TeleporterOptions : AbstractRoleOptionGroup { public override string GroupName => "Teleporter"; diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index 07d008a..8be08c6 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using Il2CppInterop.Runtime.Attributes; using MiraAPI.Modifiers; +using MiraAPI.Roles; using TMPro; using UnityEngine; @@ -79,9 +81,7 @@ public abstract class AbstractOptionGroup : AbstractOptionGroup where T : IOp /// public override Type OptionableType => typeof(T); - /// - /// Gets a value indicating which menu the group is in. - /// + /// public override MenuCategory ParentMenu { get @@ -100,6 +100,33 @@ public abstract class AbstractOptionGroup : AbstractOptionGroup where T : IOp } } +/// +/// Base class for option groups. An option group is a collection of options that are displayed together in the options menu. +/// +/// The custom role that the group is for. +public abstract class AbstractRoleOptionGroup() : AbstractOptionGroup where T : ICustomRole +{ + /// + public override Type OptionableType => typeof(T); + + /// + public override MenuCategory ParentMenu => MenuCategory.Roles; + + /// + public override OptionNotifConfiguration Configuration + { + get + { + var role = CustomRoleManager.CustomMiraRoles.FirstOrDefault(x => x.GetType() == OptionableType); + if (role == null) + { + return new(new Color(0.7333f, 0.7333f, 0.7333f, 1)); + } + return new(role.RoleColor, role.Configuration.IconTmp); + } + } +} + /// /// Menu categories for option groups. /// From eb18d82d8ee568a687febff4d88c2315e64e757f Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Fri, 17 Jul 2026 21:34:10 -0500 Subject: [PATCH 32/42] Allow overriding configuration on modded option --- MiraAPI/GameOptions/OptionTypes/ModdedOption.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs index a023bac..50457b6 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs @@ -196,5 +196,5 @@ public abstract class ModdedOption : IModdedOption public AbstractOptionGroup ParentGroup { get; set; } /// - public OptionNotifConfiguration Configuration => new(ParentGroup); + public virtual OptionNotifConfiguration Configuration => new(ParentGroup); } From e541840da997277ade8878ed4e628aece2360ce4 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:35:52 -0400 Subject: [PATCH 33/42] improve lag issues in settings menu on 17.4 --- .../Patches/Options/GameOptionsMenuPatch.cs | 232 +++++++++--------- .../Patches/Options/RoleSettingMenuPatches.cs | 145 ++++++----- MiraAPI/Utilities/Extensions.cs | 40 +++ 3 files changed, 244 insertions(+), 173 deletions(-) diff --git a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs index cbc11aa..e8ad1a2 100644 --- a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs +++ b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs @@ -1,6 +1,10 @@ using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using AmongUs.GameOptions; +using BepInEx.Unity.IL2CPP.Utils.Collections; using HarmonyLib; using Il2CppInterop.Runtime.Attributes; using MiraAPI.GameOptions; @@ -178,7 +182,8 @@ internal static class GameOptionsMenuPatch private static void ModifiersUpdate(ref float num) { var groups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups - .Where(x => x.ParentMenu is MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; + .Where(x => x.ParentMenu is MenuCategory.Modifiers || + x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; foreach (var modGroup in groups) { @@ -189,7 +194,8 @@ internal static class GameOptionsMenuPatch private static void ModifiersCreate(GameOptionsMenu menu) { var groups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups - .Where(x => x.ParentMenu is MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; + .Where(x => x.ParentMenu is MenuCategory.Modifiers || + x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? []; foreach (var group in groups) { CreateGroup(menu, group); @@ -208,20 +214,17 @@ internal static class GameOptionsMenuPatch __instance.MapPicker.gameObject.SetActive(false); - if (__instance.name == "MODIFIERS TAB") + switch (__instance.name) { - ModifiersCreate(__instance); - return false; - } - else if (__instance.name == "CUSTOM TAB 1") - { - CustomMenuOneCreate(__instance); - return false; - } - else if (__instance.name == "CUSTOM TAB 2") - { - CustomMenuTwoCreate(__instance); - return false; + case "MODIFIERS TAB": + ModifiersCreate(__instance); + return false; + case "CUSTOM TAB 1": + CustomMenuOneCreate(__instance); + return false; + case "CUSTOM TAB 2": + CustomMenuTwoCreate(__instance); + return false; } var filteredGroups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups @@ -318,117 +321,120 @@ internal static class GameOptionsMenuPatch defaultPreset = preset; } - foreach (var newOpt in options) - { - newOpt.SetClickMask(menu.ButtonClickMask); - - SpriteRenderer[] componentsInChildren = newOpt.GetComponentsInChildren(true); - foreach (var renderer in componentsInChildren) + menu.StartCoroutine( + options.CoLoopWithBudget((newOpt) => { - if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) + newOpt.SetClickMask(menu.ButtonClickMask); + + SpriteRenderer[] componentsInChildren = newOpt.GetComponentsInChildren(true); + foreach (var renderer in componentsInChildren) { - renderer.color = group.GroupColor.FindAlternateColor(); - if (renderer.transform.parent.TryGetComponent(out var btn)) + if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) { - btn.interactableColor = group.GroupColor.FindAlternateColor(); - btn.interactableHoveredColor = Color.white; + renderer.color = group.GroupColor.FindAlternateColor(); + if (renderer.transform.parent.TryGetComponent(out var btn)) + { + btn.interactableColor = group.GroupColor.FindAlternateColor(); + btn.interactableHoveredColor = Color.white; + } } + + renderer.material.SetInt(PlayerMaterial.MaskLayer, 20); } - renderer.material.SetInt(PlayerMaterial.MaskLayer, 20); - } - - foreach (var textMeshPro in newOpt.GetComponentsInChildren(true)) - { - if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) + foreach (var textMeshPro in newOpt.GetComponentsInChildren(true)) { - textMeshPro.color = group.GroupColor; + if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) + { + textMeshPro.color = group.GroupColor; + } + + textMeshPro.fontMaterial.SetFloat(ShaderID.StencilComp, 3f); + textMeshPro.fontMaterial.SetFloat(ShaderID.Stencil, 20); } - textMeshPro.fontMaterial.SetFloat(ShaderID.StencilComp, 3f); - textMeshPro.fontMaterial.SetFloat(ShaderID.Stencil, 20); - } - - if (newOpt is ToggleOption toggle) - { - toggle.CheckMark.sprite = MiraAssets.Checkmark.LoadAsset(); - toggle.CheckMark.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor - ? group.GroupColor - : MiraAssets.AcceptedTeal; - var rend = toggle.CheckMark.transform.parent.FindChild("ActiveSprite") - .GetComponent(); - rend.sprite = MiraAssets.CheckmarkBox.LoadAsset(); - rend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor - ? group.GroupColor - : MiraAssets.AcceptedTeal; - } - - menu.Children.Add(newOpt); - var resetBtn = new GameObject("ResetOption"); - resetBtn.transform.parent = newOpt.transform; - resetBtn.transform.localScale = new(.5f, .5f, 1); - resetBtn.layer = LayerMask.NameToLayer("UI"); - resetBtn.transform.localPosition = new Vector3(-3.1f, 0f, -2f); - var resetRend = resetBtn.AddComponent(); - resetRend.sprite = MiraAssets.ResetButton.LoadAsset(); - resetRend.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; - resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) - ? Color.white - : group.GroupColor.FindAlternateColor(); - var resetBoxCol = resetBtn.gameObject.AddComponent(); - resetBoxCol.size = new Vector2(1f, 1f); - resetBoxCol.offset = new Vector2(0, 0); - var passiveButton = resetBtn.AddComponent(); - passiveButton.OnClick = new Button.ButtonClickedEvent(); - passiveButton.ClickSound = menu.BackButton.GetComponent().ClickSound; - passiveButton.OnMouseOver = new UnityEvent(); - passiveButton.OnMouseOver.AddListener( - (UnityAction)(() => + if (newOpt is ToggleOption toggle) { - resetRend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor + toggle.CheckMark.sprite = MiraAssets.Checkmark.LoadAsset(); + toggle.CheckMark.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor ? group.GroupColor : MiraAssets.AcceptedTeal; - })); - passiveButton.OnMouseOut = new UnityEvent(); - passiveButton.OnMouseOut.AddListener( - (UnityAction)(() => - { - resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) - ? Color.white - : group.GroupColor.FindAlternateColor(); - })); - if (newOpt is ToggleOption toggleOpt) - { - passiveButton.OnClick.AddListener( - (UnityAction)(() => - { - defaultPreset!.ResetOption(toggleOpt); - })); - } - else if (newOpt is NumberOption numOpt) - { - passiveButton.OnClick.AddListener( - (UnityAction)(() => - { - defaultPreset!.ResetOption(numOpt); - })); - } - else if (newOpt is StringOption strOpt) - { - passiveButton.OnClick.AddListener( - (UnityAction)(() => - { - defaultPreset!.ResetOption(strOpt); - })); - } - if (!defaultPreset!.IsOptionInPreset(newOpt)) - { - resetBtn.Destroy(); - } + var rend = toggle.CheckMark.transform.parent.FindChild("ActiveSprite") + .GetComponent(); + rend.sprite = MiraAssets.CheckmarkBox.LoadAsset(); + rend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor + ? group.GroupColor + : MiraAssets.AcceptedTeal; + } - newOpt.Initialize(); - newOpt.gameObject.SetActive(false); - } + menu.Children.Add(newOpt); + var resetBtn = new GameObject("ResetOption"); + resetBtn.transform.parent = newOpt.transform; + resetBtn.transform.localScale = new(.5f, .5f, 1); + resetBtn.layer = LayerMask.NameToLayer("UI"); + resetBtn.transform.localPosition = new Vector3(-3.1f, 0f, -2f); + var resetRend = resetBtn.AddComponent(); + resetRend.sprite = MiraAssets.ResetButton.LoadAsset(); + resetRend.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; + resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) + ? Color.white + : group.GroupColor.FindAlternateColor(); + var resetBoxCol = resetBtn.gameObject.AddComponent(); + resetBoxCol.size = new Vector2(1f, 1f); + resetBoxCol.offset = new Vector2(0, 0); + var passiveButton = resetBtn.AddComponent(); + passiveButton.OnClick = new Button.ButtonClickedEvent(); + passiveButton.ClickSound = menu.BackButton.GetComponent().ClickSound; + passiveButton.OnMouseOver = new UnityEvent(); + passiveButton.OnMouseOver.AddListener( + (UnityAction)(() => + { + resetRend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor + ? group.GroupColor + : MiraAssets.AcceptedTeal; + })); + passiveButton.OnMouseOut = new UnityEvent(); + passiveButton.OnMouseOut.AddListener( + (UnityAction)(() => + { + resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) + ? Color.white + : group.GroupColor.FindAlternateColor(); + })); + if (newOpt is ToggleOption toggleOpt) + { + passiveButton.OnClick.AddListener( + (UnityAction)(() => + { + defaultPreset!.ResetOption(toggleOpt); + })); + } + else if (newOpt is NumberOption numOpt) + { + passiveButton.OnClick.AddListener( + (UnityAction)(() => + { + defaultPreset!.ResetOption(numOpt); + })); + } + else if (newOpt is StringOption strOpt) + { + passiveButton.OnClick.AddListener( + (UnityAction)(() => + { + defaultPreset!.ResetOption(strOpt); + })); + } + + if (!defaultPreset!.IsOptionInPreset(newOpt)) + { + resetBtn.Destroy(); + } + + newOpt.Initialize(); + newOpt.gameObject.SetActive(false); + }).WrapToIl2Cpp() + ); var boxCol = categoryHeaderMasked.gameObject.AddComponent(); boxCol.size = new Vector2(7, 0.7f); diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 55947c8..18daa7d 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -1,9 +1,10 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using AmongUs.GameOptions; +using BepInEx.Unity.IL2CPP.Utils.Collections; using HarmonyLib; -using Il2CppInterop.Runtime.InteropTypes.Arrays; using MiraAPI.GameOptions; using MiraAPI.Networking; using MiraAPI.Roles; @@ -11,7 +12,6 @@ using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; using Reactor.Localization.Utilities; using Reactor.Networking.Rpc; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using TMPro; using UnityEngine; @@ -49,9 +49,7 @@ public static class RoleSettingMenuPatches __instance.scrollBar.SetScrollBounds(__instance); } - [HarmonyPrefix] - [HarmonyPatch(nameof(RolesSettingsMenu.SetQuotaTab))] - public static bool SetQuotaTabPatch(RolesSettingsMenu __instance) + private static IEnumerator CoQuotaTabPatch(RolesSettingsMenu roleMenu) { foreach (var obj in Headers) { @@ -59,8 +57,10 @@ public static class RoleSettingMenuPatches { continue; } + obj.DeepDestroy(false); } + Headers.Clear(); foreach (var obj in RoleOptionSettings) { @@ -68,24 +68,26 @@ public static class RoleSettingMenuPatches { continue; } + obj.gameObject.DeepDestroy(false); } + RoleOptionSettings.Clear(); CurrentRole = null; CurrentRoleOptions = null; - __instance.roleChances = new Il2CppSystem.Collections.Generic.List(); - __instance.advancedSettingChildren = new Il2CppSystem.Collections.Generic.List(); + roleMenu.roleChances = new Il2CppSystem.Collections.Generic.List(); + roleMenu.advancedSettingChildren = new Il2CppSystem.Collections.Generic.List(); - var maskBg = __instance.scrollBar.transform.FindChild("MaskBg"); - var hitbox = __instance.scrollBar.transform.FindChild("Hitbox"); - var dividerImage = __instance.transform.FindChild("HeaderButtons/DividerImage"); + var maskBg = roleMenu.scrollBar.transform.FindChild("MaskBg"); + var hitbox = roleMenu.scrollBar.transform.FindChild("Hitbox"); + var dividerImage = roleMenu.transform.FindChild("HeaderButtons/DividerImage"); if (GameSettingMenuPatches.SelectedModIdx == 0) { - __instance.AllButton.transform.parent.gameObject.SetActive(true); - __instance.AllButton.gameObject.SetActive(true); - __instance.scrollBar.transform.localPosition = new Vector3(-1.4957f, 0.657f, -4); + roleMenu.AllButton.transform.parent.gameObject.SetActive(true); + roleMenu.AllButton.gameObject.SetActive(true); + roleMenu.scrollBar.transform.localPosition = new Vector3(-1.4957f, 0.657f, -4); maskBg.localPosition = new Vector3(1.5353f, -.5734f, -.1f); maskBg.localScale = new Vector3(6.6811f, 3.3563f, 0.5598f); hitbox.localPosition = new Vector3(0.3297f, -.2333f, 4f); @@ -94,67 +96,70 @@ public static class RoleSettingMenuPatches var num = 0.662f; - var list = CustomRoleManager.AllRoles.Where( - r => !r.IsCustomRole() && !r.IsRoleBlacklisted() && r.TeamType == RoleTeamTypes.Crewmate && r.Role != RoleTypes.Crewmate && - r.Role != RoleTypes.CrewmateGhost).ToList(); - var list2 = CustomRoleManager.AllRoles.Where( - r => !r.IsCustomRole() && !r.IsRoleBlacklisted() && r.TeamType == RoleTeamTypes.Impostor && r.Role != RoleTypes.Impostor && - r.Role != RoleTypes.ImpostorGhost).ToList(); + var list = CustomRoleManager.AllRoles.Where(r => + !r.IsCustomRole() && !r.IsRoleBlacklisted() && r.TeamType == RoleTeamTypes.Crewmate && + r.Role != RoleTypes.Crewmate && + r.Role != RoleTypes.CrewmateGhost).ToList(); + var list2 = CustomRoleManager.AllRoles.Where(r => + !r.IsCustomRole() && !r.IsRoleBlacklisted() && r.TeamType == RoleTeamTypes.Impostor && + r.Role != RoleTypes.Impostor && + r.Role != RoleTypes.ImpostorGhost).ToList(); - if (__instance.roleTabs == null || __instance.roleTabs.Count == 0) + if (roleMenu.roleTabs == null || roleMenu.roleTabs.Count == 0) { var num2 = -1.928f; - __instance.roleTabs = new(); - __instance.roleTabs.Add(__instance.AllButton); + roleMenu.roleTabs = new(); + roleMenu.roleTabs.Add(roleMenu.AllButton); foreach (var t in list) { - __instance.AddRoleTab(t, ref num2); + roleMenu.AddRoleTab(t, ref num2); } foreach (var t in list2) { - __instance.AddRoleTab(t, ref num2); + roleMenu.AddRoleTab(t, ref num2); } } var categoryHeaderEditRole = Object.Instantiate( - __instance.categoryHeaderEditRoleOrigin, + roleMenu.categoryHeaderEditRoleOrigin, Vector3.zero, Quaternion.identity, - __instance.RoleChancesSettings.transform); + roleMenu.RoleChancesSettings.transform); categoryHeaderEditRole.SetHeader(StringNames.CrewmateRolesHeader, 20); categoryHeaderEditRole.transform.localPosition = new Vector3(4.986f, num, -2f); num -= 0.522f; var num3 = 0; foreach (var t in list) { - __instance.CreateQuotaOption(t, ref num, num3); + roleMenu.CreateQuotaOption(t, ref num, num3); num3++; } num -= 0.22f; var categoryHeaderEditRole2 = Object.Instantiate( - __instance.categoryHeaderEditRoleOrigin, + roleMenu.categoryHeaderEditRoleOrigin, Vector3.zero, Quaternion.identity, - __instance.RoleChancesSettings.transform); + roleMenu.RoleChancesSettings.transform); categoryHeaderEditRole2.SetHeader(StringNames.ImpostorRolesHeader, 20); categoryHeaderEditRole2.transform.localPosition = new Vector3(4.986f, num, -2f); num -= 0.522f; foreach (var t in list2) { - __instance.CreateQuotaOption(t, ref num, num3); + roleMenu.CreateQuotaOption(t, ref num, num3); num3++; } - return false; + Info($"Created {num3} role options for the default game."); + yield return null; } ScrollerNum = 0.522f; - __instance.AllButton.transform.parent.gameObject.SetActive(false); - __instance.AllButton.gameObject.SetActive(false); - __instance.scrollBar.transform.localPosition = new Vector3(-1.4957f, 1.5261f, -4); + roleMenu.AllButton.transform.parent.gameObject.SetActive(false); + roleMenu.AllButton.gameObject.SetActive(false); + roleMenu.scrollBar.transform.localPosition = new Vector3(-1.4957f, 1.5261f, -4); maskBg.localPosition = new Vector3(1.5353f, -1.0607f, -.1f); maskBg.localScale = new Vector3(6.6811f, 4.1563f, 0.5598f); hitbox.localPosition = new Vector3(0.3297f, -.6333f, 4f); @@ -168,7 +173,8 @@ public static class RoleSettingMenuPatches if (roleGroups is null) { - return false; + Error("No role groups found for the selected mod."); + yield break; } // sort the groups by priority @@ -176,13 +182,14 @@ public static class RoleSettingMenuPatches .OrderBy(x => x.Key.Priority) .ThenBy(x => x.Key.Name); - var quotaThing = __instance.categoryHeaderEditRoleOrigin.transform.FindChild("QuotaHeader"); + var quotaThing = roleMenu.categoryHeaderEditRoleOrigin.transform.FindChild("QuotaHeader"); var usingNewQuota = false; - var template = __instance.transform.parent.parent.GetComponent().GameSettingsTab.categoryHeaderOrigin; + var template = roleMenu.transform.parent.parent.GetComponent().GameSettingsTab + .categoryHeaderOrigin; foreach (var grouping in sortedRoleGroups) { - if (!grouping.Any() || grouping.All(x=> x.Configuration.HideSettings || !x.VisibleInSettings())) + if (!grouping.Any() || grouping.All(x => x.Configuration.HideSettings || !x.VisibleInSettings())) { continue; } @@ -202,7 +209,7 @@ public static class RoleSettingMenuPatches template, Vector3.zero, Quaternion.identity, - __instance.RoleChancesSettings.transform); + roleMenu.RoleChancesSettings.transform); categoryHeaderMasked.SetHeader(name, 20); @@ -245,19 +252,23 @@ public static class RoleSettingMenuPatches categoryHeaderMasked.Background.color = Palette.ImpostorRoleHeaderRed; break; default: - categoryHeaderMasked.Title.color = group.Color.Equals(MiraApiPlugin.DefaultHeaderColor) ? Color.white : group.Color.FindAlternateColor(); + categoryHeaderMasked.Title.color = group.Color.Equals(MiraApiPlugin.DefaultHeaderColor) + ? Color.white + : group.Color.FindAlternateColor(); categoryHeaderMasked.Divider.color = group.Color; categoryHeaderMasked.Background.color = group.Color; break; } - categoryHeaderMasked.Title.fontStyle = __instance.categoryHeaderEditRoleOrigin.Title.fontStyle; - categoryHeaderMasked.Title.font = __instance.categoryHeaderEditRoleOrigin.Title.font; - categoryHeaderMasked.Title.fontMaterial = __instance.categoryHeaderEditRoleOrigin.Title.fontMaterial; + categoryHeaderMasked.Title.fontStyle = roleMenu.categoryHeaderEditRoleOrigin.Title.fontStyle; + categoryHeaderMasked.Title.font = roleMenu.categoryHeaderEditRoleOrigin.Title.font; + categoryHeaderMasked.Title.fontMaterial = roleMenu.categoryHeaderEditRoleOrigin.Title.fontMaterial; categoryHeaderMasked.Divider.color = categoryHeaderMasked.Background.color; categoryHeaderMasked.Background.transform.localPosition = new Vector3(0.55f, -0.1833f, 0); - categoryHeaderMasked.Background.size = new Vector2(categoryHeaderMasked.Background.size.x + 1.5f, categoryHeaderMasked.Background.size.y); + categoryHeaderMasked.Background.size = new Vector2( + categoryHeaderMasked.Background.size.x + 1.5f, + categoryHeaderMasked.Background.size.y); categoryHeaderMasked.transform.localScale = Vector3.one * 0.63f; categoryHeaderMasked.transform.localPosition = new Vector3(-0.44f, ScrollerNum, -2f); @@ -277,20 +288,21 @@ public static class RoleSettingMenuPatches if (!RoleGroupHidden[group]) { - foreach (var role in grouping) - { - if (role is not RoleBehaviour roleBehaviour) + yield return + grouping.CoLoopWithBudget(role => { - continue; - } + if (role is not RoleBehaviour roleBehaviour) + { + return; + } - var option = CreateQuotaOption(__instance, roleBehaviour, num4); - if (option is not null) - { - RoleOptionSettings.Add(option); - num4++; - } - } + var option = CreateQuotaOption(roleMenu, roleBehaviour, num4); + if (option is not null) + { + RoleOptionSettings.Add(option); + num4++; + } + }); } var boxCol = categoryHeaderMasked.gameObject.AddComponent(); @@ -298,25 +310,28 @@ public static class RoleSettingMenuPatches boxCol.offset = new Vector2(1.5f, -0.3f); var headerBtn = categoryHeaderMasked.gameObject.AddComponent(); - headerBtn.ClickSound = __instance.BackButton.GetComponent().ClickSound; + headerBtn.ClickSound = roleMenu.BackButton.GetComponent().ClickSound; headerBtn.OnMouseOver = new UnityEvent(); headerBtn.OnMouseOut = new UnityEvent(); headerBtn.OnClick.AddListener( (UnityAction)(() => { - RolePositions[GameSettingMenuPatches.SelectedModIdx] = __instance.scrollBar.Inner.localPosition; + RolePositions[GameSettingMenuPatches.SelectedModIdx] = roleMenu.scrollBar.Inner.localPosition; if (RoleGroupHidden.TryGetValue(group, out var groupHidden)) { RoleGroupHidden[group] = !groupHidden; } + foreach (var obj in Headers) { if (!obj) { continue; } + obj.DeepDestroy(false); } + Headers.Clear(); foreach (var obj in RoleOptionSettings) { @@ -324,10 +339,12 @@ public static class RoleSettingMenuPatches { continue; } + obj.gameObject.DeepDestroy(false); } + RoleOptionSettings.Clear(); - __instance.SetQuotaTab(); + roleMenu.SetQuotaTab(); })); headerBtn.SetButtonEnableState(true); @@ -337,7 +354,14 @@ public static class RoleSettingMenuPatches } } - __instance.scrollBar.SetScrollBounds(__instance); + roleMenu.scrollBar.SetScrollBounds(roleMenu); + } + + [HarmonyPrefix] + [HarmonyPatch(nameof(RolesSettingsMenu.SetQuotaTab))] + public static bool SetQuotaTabPatch(RolesSettingsMenu __instance) + { + __instance.StartCoroutine(CoQuotaTabPatch(__instance).WrapToIl2Cpp()); return false; } @@ -362,6 +386,7 @@ public static class RoleSettingMenuPatches } [HarmonyPrefix] + // TODO: turn this into a fixed update [HarmonyPatch(nameof(RolesSettingsMenu.Update))] public static bool UpdatePatch(RolesSettingsMenu __instance) { diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 717f0b9..4590ad6 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -1,10 +1,12 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; +using System.Timers; using HarmonyLib; using MiraAPI.GameOptions; using MiraAPI.Networking; @@ -239,6 +241,44 @@ public static class Extensions } } + /// + /// Runs a given action in a loop with a frame budget based on the current target frame rate. Once the budget is hit, the loop continues on the next frame. + /// + /// The collection to iterate over. + /// The action to perform on each item. + /// The type of the collection. + /// Coroutine. + public static IEnumerator CoLoopWithBudget(this IEnumerable collection, Action action) + { + var fps = Application.targetFrameRate > 0 ? Application.targetFrameRate : 60; + long budget = 1 / (fps * 2); // default is half of current frame time. + yield return collection.CoLoopWithBudget(budget, action); + } + + /// + /// Runs a given action in a loop with a given frame budget. Once the budget is hit, the loop continues on the next frame. + /// + /// The collection to iterate over. + /// The # of milliseconds to spend in the loop. + /// The action to perform on each item. + /// The type of the collection. + /// Coroutine. + public static IEnumerator CoLoopWithBudget(this IEnumerable collection, long frameBudget, Action action) + { + var timer = new Stopwatch(); + timer.Start(); + foreach (var item in collection) + { + action(item); + + if (timer.ElapsedMilliseconds > frameBudget) + { + timer.Restart(); + yield return null; + } + } + } + private static IEnumerator Nuke(GameObject? go, bool clearGc) { if (go == null) From f9721a8d698c980b44a839368d36651e3b1cdab2 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 20 Jul 2026 19:06:52 -0400 Subject: [PATCH 34/42] improve stability and FPS on 17.4+ --- MiraAPI/GameOptions/AbstractOptionGroup.cs | 2 + .../ModifierDisplayComponent.cs | 4 +- MiraAPI/Patches/HudManagerPatches.cs | 2 +- MiraAPI/Patches/Menu/HatsTabPatches.cs | 2 +- MiraAPI/Patches/Menu/NameplatesTabPatches.cs | 2 +- MiraAPI/Patches/Menu/SkinsTabPatches.cs | 2 +- MiraAPI/Patches/Menu/VisorsTabPatches.cs | 2 +- .../Patches/Options/GameOptionsMenuPatch.cs | 206 +++++++++--------- .../Patches/Options/GamePresetsTabPatches.cs | 2 +- .../Patches/Options/RoleSettingMenuPatches.cs | 31 ++- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 +- MiraAPI/Presets/PresetManager.cs | 3 +- MiraAPI/Presets/SavePresetPopup.cs | 2 +- MiraAPI/Utilities/Extensions.cs | 11 +- 14 files changed, 143 insertions(+), 130 deletions(-) diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index 8be08c6..5ee95c2 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -70,6 +70,8 @@ public abstract class AbstractOptionGroup internal bool AllOptionsHidden { get; set; } internal CategoryHeaderMasked? Header { get; set; } + + internal Coroutine? CreationCoroutine { get; set; } } /// diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs index 4a6411f..4b4c71e 100644 --- a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs +++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs @@ -138,7 +138,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) internal void DestroyComponent(ModifierUiComponent component) { _modifiers.Remove(component.Modifier!); - component.gameObject.DeepDestroy(); + component.gameObject.Destroy(); RefreshModifiers(); } @@ -208,7 +208,7 @@ public class ModifierDisplayComponent(nint cppPtr) : MonoBehaviour(cppPtr) continue; } - mod.Value.gameObject.DeepDestroy(); + mod.Value.gameObject.Destroy(); _modifiers.Remove(mod.Key); } diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index a6cd68b..a508ccf 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -148,7 +148,7 @@ public static class HudManagerPatches foreach (var t in BottomLeft.GetComponentsInChildren(true)) { - t.gameObject.DeepDestroy(false); + t.gameObject.Destroy(); } Utilities.Extensions.ClearGarbageCollector(); diff --git a/MiraAPI/Patches/Menu/HatsTabPatches.cs b/MiraAPI/Patches/Menu/HatsTabPatches.cs index b06b11a..43d96c3 100644 --- a/MiraAPI/Patches/Menu/HatsTabPatches.cs +++ b/MiraAPI/Patches/Menu/HatsTabPatches.cs @@ -100,7 +100,7 @@ public static class HatsTabPatches if (loadRoutine != null) Coroutines.Stop(loadRoutine); hatIndex = 0; - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); diff --git a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs index 4e9b693..6e96d5f 100644 --- a/MiraAPI/Patches/Menu/NameplatesTabPatches.cs +++ b/MiraAPI/Patches/Menu/NameplatesTabPatches.cs @@ -81,7 +81,7 @@ public static class NameplatesTabPatches private static void GenerateHats(NameplatesTab __instance, int page) { - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); diff --git a/MiraAPI/Patches/Menu/SkinsTabPatches.cs b/MiraAPI/Patches/Menu/SkinsTabPatches.cs index 44d08d5..e1c97a5 100644 --- a/MiraAPI/Patches/Menu/SkinsTabPatches.cs +++ b/MiraAPI/Patches/Menu/SkinsTabPatches.cs @@ -83,7 +83,7 @@ public static class SkinsTabPatches private static void GenerateHats(SkinsTab __instance, int page) { - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); diff --git a/MiraAPI/Patches/Menu/VisorsTabPatches.cs b/MiraAPI/Patches/Menu/VisorsTabPatches.cs index c5fe9a4..a1627cf 100644 --- a/MiraAPI/Patches/Menu/VisorsTabPatches.cs +++ b/MiraAPI/Patches/Menu/VisorsTabPatches.cs @@ -80,7 +80,7 @@ public static class VisorsTabPatches private static void GenerateHats(VisorsTab __instance, int page) { - foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.DeepDestroy(false); + foreach (var instanceColorChip in __instance.ColorChips) instanceColorChip.gameObject.Destroy(); __instance.ColorChips.Clear(); __instance.scroller.Inner.GetComponentsInChildren().Do(x => x.gameObject.DeepDestroy(false)); diff --git a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs index e8ad1a2..3068a1b 100644 --- a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs +++ b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs @@ -85,9 +85,9 @@ internal static class GameOptionsMenuPatch __instance.scrollBar.SetYBoundsMax(-num - 1.65f); } - private static void UpdateGroup(AbstractOptionGroup group, ref float num) + private static void UpdateGroup(AbstractOptionGroup? group, ref float num) { - if (group.Options.Count == 0 || group.Header is null) + if (group is null || group.Options.Count == 0 || group.Header is null || group.CreationCoroutine is not null) { return; } @@ -113,7 +113,7 @@ internal static class GameOptionsMenuPatch { var newOpt = opt.OptionBehaviour; - if (newOpt is null) + if (!newOpt || newOpt == null) { continue; } @@ -274,7 +274,7 @@ internal static class GameOptionsMenuPatch return false; } - private static void CreateGroup(GameOptionsMenu menu, AbstractOptionGroup group) + private static IEnumerator CoCreateGroup(GameOptionsMenu menu, AbstractOptionGroup group) { var categoryHeaderMasked = Object.Instantiate( menu.categoryHeaderOrigin, @@ -321,120 +321,118 @@ internal static class GameOptionsMenuPatch defaultPreset = preset; } - menu.StartCoroutine( - options.CoLoopWithBudget((newOpt) => + yield return options.CoLoopWithBudget(newOpt => + { + newOpt.SetClickMask(menu.ButtonClickMask); + + SpriteRenderer[] componentsInChildren = newOpt.GetComponentsInChildren(true); + foreach (var renderer in componentsInChildren) { - newOpt.SetClickMask(menu.ButtonClickMask); - - SpriteRenderer[] componentsInChildren = newOpt.GetComponentsInChildren(true); - foreach (var renderer in componentsInChildren) + if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) { - if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) + renderer.color = group.GroupColor.FindAlternateColor(); + if (renderer.transform.parent.TryGetComponent(out var btn)) { - renderer.color = group.GroupColor.FindAlternateColor(); - if (renderer.transform.parent.TryGetComponent(out var btn)) - { - btn.interactableColor = group.GroupColor.FindAlternateColor(); - btn.interactableHoveredColor = Color.white; - } + btn.interactableColor = group.GroupColor.FindAlternateColor(); + btn.interactableHoveredColor = Color.white; } - - renderer.material.SetInt(PlayerMaterial.MaskLayer, 20); } - foreach (var textMeshPro in newOpt.GetComponentsInChildren(true)) - { - if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) - { - textMeshPro.color = group.GroupColor; - } + renderer.material.SetInt(PlayerMaterial.MaskLayer, 20); + } - textMeshPro.fontMaterial.SetFloat(ShaderID.StencilComp, 3f); - textMeshPro.fontMaterial.SetFloat(ShaderID.Stencil, 20); + foreach (var textMeshPro in newOpt.GetComponentsInChildren(true)) + { + if (group.GroupColor != MiraApiPlugin.DefaultHeaderColor) + { + textMeshPro.color = group.GroupColor; } - if (newOpt is ToggleOption toggle) + textMeshPro.fontMaterial.SetFloat(ShaderID.StencilComp, 3f); + textMeshPro.fontMaterial.SetFloat(ShaderID.Stencil, 20); + } + + if (newOpt is ToggleOption toggle) + { + toggle.CheckMark.sprite = MiraAssets.Checkmark.LoadAsset(); + toggle.CheckMark.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor + ? group.GroupColor + : MiraAssets.AcceptedTeal; + var rend = toggle.CheckMark.transform.parent.FindChild("ActiveSprite") + .GetComponent(); + rend.sprite = MiraAssets.CheckmarkBox.LoadAsset(); + rend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor + ? group.GroupColor + : MiraAssets.AcceptedTeal; + } + + menu.Children.Add(newOpt); + var resetBtn = new GameObject("ResetOption"); + resetBtn.transform.parent = newOpt.transform; + resetBtn.transform.localScale = new(.5f, .5f, 1); + resetBtn.layer = LayerMask.NameToLayer("UI"); + resetBtn.transform.localPosition = new Vector3(-3.1f, 0f, -2f); + var resetRend = resetBtn.AddComponent(); + resetRend.sprite = MiraAssets.ResetButton.LoadAsset(); + resetRend.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; + resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) + ? Color.white + : group.GroupColor.FindAlternateColor(); + var resetBoxCol = resetBtn.gameObject.AddComponent(); + resetBoxCol.size = new Vector2(1f, 1f); + resetBoxCol.offset = new Vector2(0, 0); + var passiveButton = resetBtn.AddComponent(); + passiveButton.OnClick = new Button.ButtonClickedEvent(); + passiveButton.ClickSound = menu.BackButton.GetComponent().ClickSound; + passiveButton.OnMouseOver = new UnityEvent(); + passiveButton.OnMouseOver.AddListener( + (UnityAction)(() => { - toggle.CheckMark.sprite = MiraAssets.Checkmark.LoadAsset(); - toggle.CheckMark.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor + resetRend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor ? group.GroupColor : MiraAssets.AcceptedTeal; - var rend = toggle.CheckMark.transform.parent.FindChild("ActiveSprite") - .GetComponent(); - rend.sprite = MiraAssets.CheckmarkBox.LoadAsset(); - rend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor - ? group.GroupColor - : MiraAssets.AcceptedTeal; - } - - menu.Children.Add(newOpt); - var resetBtn = new GameObject("ResetOption"); - resetBtn.transform.parent = newOpt.transform; - resetBtn.transform.localScale = new(.5f, .5f, 1); - resetBtn.layer = LayerMask.NameToLayer("UI"); - resetBtn.transform.localPosition = new Vector3(-3.1f, 0f, -2f); - var resetRend = resetBtn.AddComponent(); - resetRend.sprite = MiraAssets.ResetButton.LoadAsset(); - resetRend.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; - resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) - ? Color.white - : group.GroupColor.FindAlternateColor(); - var resetBoxCol = resetBtn.gameObject.AddComponent(); - resetBoxCol.size = new Vector2(1f, 1f); - resetBoxCol.offset = new Vector2(0, 0); - var passiveButton = resetBtn.AddComponent(); - passiveButton.OnClick = new Button.ButtonClickedEvent(); - passiveButton.ClickSound = menu.BackButton.GetComponent().ClickSound; - passiveButton.OnMouseOver = new UnityEvent(); - passiveButton.OnMouseOver.AddListener( + })); + passiveButton.OnMouseOut = new UnityEvent(); + passiveButton.OnMouseOut.AddListener( + (UnityAction)(() => + { + resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) + ? Color.white + : group.GroupColor.FindAlternateColor(); + })); + if (newOpt is ToggleOption toggleOpt) + { + passiveButton.OnClick.AddListener( (UnityAction)(() => { - resetRend.color = group.GroupColor != MiraApiPlugin.DefaultHeaderColor - ? group.GroupColor - : MiraAssets.AcceptedTeal; + defaultPreset!.ResetOption(toggleOpt); })); - passiveButton.OnMouseOut = new UnityEvent(); - passiveButton.OnMouseOut.AddListener( + } + else if (newOpt is NumberOption numOpt) + { + passiveButton.OnClick.AddListener( (UnityAction)(() => { - resetRend.color = group.GroupColor.Equals(MiraApiPlugin.DefaultHeaderColor) - ? Color.white - : group.GroupColor.FindAlternateColor(); + defaultPreset!.ResetOption(numOpt); })); - if (newOpt is ToggleOption toggleOpt) - { - passiveButton.OnClick.AddListener( - (UnityAction)(() => - { - defaultPreset!.ResetOption(toggleOpt); - })); - } - else if (newOpt is NumberOption numOpt) - { - passiveButton.OnClick.AddListener( - (UnityAction)(() => - { - defaultPreset!.ResetOption(numOpt); - })); - } - else if (newOpt is StringOption strOpt) - { - passiveButton.OnClick.AddListener( - (UnityAction)(() => - { - defaultPreset!.ResetOption(strOpt); - })); - } + } + else if (newOpt is StringOption strOpt) + { + passiveButton.OnClick.AddListener( + (UnityAction)(() => + { + defaultPreset!.ResetOption(strOpt); + })); + } - if (!defaultPreset!.IsOptionInPreset(newOpt)) - { - resetBtn.Destroy(); - } + if (!defaultPreset!.IsOptionInPreset(newOpt)) + { + resetBtn.Destroy(); + } - newOpt.Initialize(); - newOpt.gameObject.SetActive(false); - }).WrapToIl2Cpp() - ); + newOpt.Initialize(); + newOpt.gameObject.SetActive(false); + }).WrapToIl2Cpp(); var boxCol = categoryHeaderMasked.gameObject.AddComponent(); boxCol.size = new Vector2(7, 0.7f); @@ -453,5 +451,17 @@ internal static class GameOptionsMenuPatch : "(Click to close)"; })); headerBtn.SetButtonEnableState(true); + + group.CreationCoroutine = null; + } + + private static void CreateGroup(GameOptionsMenu menu, AbstractOptionGroup group) + { + if (group.CreationCoroutine != null) + { + GameSettingMenu.Instance.StopCoroutine(group.CreationCoroutine); + } + + group.CreationCoroutine = GameSettingMenu.Instance.StartCoroutine(CoCreateGroup(menu, group).WrapToIl2Cpp()); } } diff --git a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs index a4b6cca..2c6cc68 100644 --- a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs +++ b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs @@ -262,7 +262,7 @@ internal static class GamePresetsTabPatches iconSpriteRend.sprite = MiraAssets.RefreshIcon.LoadAsset(); Helpers.DivideSize(refreshButton.gameObject, 2f); - refreshButton.buttonText.gameObject.DeepDestroy(); + refreshButton.buttonText.gameObject.Destroy(); refreshButton.OnClick = new Button.ButtonClickedEvent(); refreshButton.OnClick.AddListener((UnityAction)Refresh); diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 18daa7d..b6f61c4 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -58,7 +58,7 @@ public static class RoleSettingMenuPatches continue; } - obj.DeepDestroy(false); + obj.Destroy(); } Headers.Clear(); @@ -69,7 +69,7 @@ public static class RoleSettingMenuPatches continue; } - obj.gameObject.DeepDestroy(false); + obj.gameObject.Destroy(); } RoleOptionSettings.Clear(); @@ -228,9 +228,9 @@ public static class RoleSettingMenuPatches var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; var countLabel = quotaInst.transform.FindChild("# Label").gameObject; - blankLabel.DeepDestroy(false); - chanceLabel.DeepDestroy(false); - countLabel.DeepDestroy(false); + blankLabel.Destroy(); + chanceLabel.Destroy(); + countLabel.Destroy(); usingNewQuota = true; quotaThing = quotaInst; } @@ -329,7 +329,7 @@ public static class RoleSettingMenuPatches continue; } - obj.DeepDestroy(false); + obj.Destroy(); } Headers.Clear(); @@ -340,7 +340,7 @@ public static class RoleSettingMenuPatches continue; } - obj.gameObject.DeepDestroy(false); + obj.gameObject.Destroy(); } RoleOptionSettings.Clear(); @@ -355,13 +355,21 @@ public static class RoleSettingMenuPatches } roleMenu.scrollBar.SetScrollBounds(roleMenu); + _quotaTabCoroutine = null; } + private static Coroutine? _quotaTabCoroutine; + [HarmonyPrefix] [HarmonyPatch(nameof(RolesSettingsMenu.SetQuotaTab))] public static bool SetQuotaTabPatch(RolesSettingsMenu __instance) { - __instance.StartCoroutine(CoQuotaTabPatch(__instance).WrapToIl2Cpp()); + if (_quotaTabCoroutine != null) + { + GameSettingMenu.Instance.StopCoroutine(_quotaTabCoroutine); + } + + _quotaTabCoroutine = GameSettingMenu.Instance.StartCoroutine(CoQuotaTabPatch(__instance).WrapToIl2Cpp()); return false; } @@ -474,7 +482,7 @@ public static class RoleSettingMenuPatches { foreach (var optBehaviour in __instance.AdvancedRolesSettings.GetComponentsInChildren()) { - optBehaviour.gameObject.DeepDestroy(false); + optBehaviour.gameObject.Destroy(); } CurrentRole = role; @@ -486,8 +494,6 @@ public static class RoleSettingMenuPatches .SelectMany(x => x.Options) .ToList() ?? []; - CurrentRoleOptions = filteredOptions; - foreach (var option in filteredOptions) { var newOpt = option.CreateOption( @@ -518,6 +524,7 @@ public static class RoleSettingMenuPatches newOpt.Initialize(); } + CurrentRoleOptions = filteredOptions; __instance.scrollBar.ScrollToTop(); } @@ -670,7 +677,7 @@ public static class RoleSettingMenuPatches var newButton = Object.Instantiate(roleOptionSetting.buttons[0], roleOptionSetting.transform); newButton.name = "ConfigButton"; newButton.transform.localPosition = new Vector3(0.4473f, -0.3f, -2f); - newButton.transform.FindChild("Text_TMP").gameObject.DeepDestroy(); + newButton.transform.FindChild("Text_TMP").gameObject.Destroy(); newButton.activeSprites.Destroy(); var btnRend = newButton.transform.FindChild("ButtonSprite").GetComponent(); diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index 79c2306..6827341 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -73,7 +73,7 @@ public static class HudManagerPatches } else if (RoleTab != null) { - RoleTab.gameObject.DeepDestroy(); + RoleTab.gameObject.Destroy(); RoleTab = null; } } diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index bec1216..d346c52 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -6,6 +6,7 @@ using MiraAPI.PluginLoading; using MiraAPI.Roles; using MiraAPI.Utilities; using Reactor.Utilities; +using Reactor.Utilities.Extensions; using UnityEngine; namespace MiraAPI.Presets; @@ -62,7 +63,7 @@ public static class PresetManager { if (btn != null) { - btn.DeepDestroy(); + btn.Destroy(); } } diff --git a/MiraAPI/Presets/SavePresetPopup.cs b/MiraAPI/Presets/SavePresetPopup.cs index 23ce48b..87959e7 100644 --- a/MiraAPI/Presets/SavePresetPopup.cs +++ b/MiraAPI/Presets/SavePresetPopup.cs @@ -26,7 +26,7 @@ public class SavePresetPopup(nint cppPtr) : Minigame(cppPtr) // Cleanup holder object public void OnDestroy() { - transform.parent.gameObject.DeepDestroy(); + transform.parent.gameObject.Destroy(); } public override void Close() diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 4590ad6..c4b9ef3 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -58,7 +58,7 @@ public static class Extensions bool isComplete; if (self.amClosing == Minigame.CloseState.Closing) { - self.gameObject.DeepDestroy(); + self.gameObject.Destroy(); return; } if (self.CloseSound && Constants.ShouldPlaySfx()) @@ -231,14 +231,7 @@ public static class Extensions /// Whether to run the garbage collector immediately. public static void DeepDestroy(this GameObject obj, bool clearGc = true) { - if (MainMenuManagerPatches.NeedsDeepDestroy) - { - Coroutines.Start(Nuke(obj, clearGc)); - } - else - { - obj?.Destroy(); - } + obj.Destroy(); } /// From 992bdbcbf8310ff03073994b96d6b3f10a427176 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 20 Jul 2026 19:10:06 -0400 Subject: [PATCH 35/42] cleanup usings --- MiraAPI.Example/ExamplePlugin.cs | 3 +-- MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs | 2 -- MiraAPI/Events/MiraEventManager.cs | 1 - MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs | 4 +--- MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs | 4 +--- MiraAPI/GameEnd/GameOverManager.cs | 1 - MiraAPI/GameModes/CustomGameModeManager.cs | 1 - MiraAPI/GameOptions/AbstractOptionGroup.cs | 2 -- MiraAPI/GameOptions/OptionTypes/ModdedOption.cs | 2 -- MiraAPI/Hud/CustomActionButton.cs | 1 - MiraAPI/Hud/CustomButtonManager.cs | 1 - MiraAPI/Hud/MultiTargetButton.cs | 1 - MiraAPI/Keybinds/KeybindManager.cs | 1 - MiraAPI/Keybinds/VanillaKeybind.cs | 1 - .../Attributes/LocalSettingsButtonAttribute.cs | 1 - MiraAPI/LocalSettings/LocalSettingsButton.cs | 1 - MiraAPI/LocalSettings/LocalSettingsManager.cs | 2 -- MiraAPI/Modifiers/ModifierComponent.cs | 1 - .../Modifiers/ModifierDisplay/ModifierDisplayComponent.cs | 1 - MiraAPI/Modifiers/ModifierExtensions.cs | 1 - MiraAPI/Modifiers/ModifierManager.cs | 1 - MiraAPI/Modifiers/Types/TimedModifier.cs | 1 - MiraAPI/Networking/CustomGameOverRpc.cs | 1 - MiraAPI/Networking/CustomMurderRpc.cs | 3 --- MiraAPI/Patches/Events/ReportBodyEventPatch.cs | 1 - MiraAPI/Patches/Events/VanillaButtonPatches.cs | 4 +--- MiraAPI/Patches/Hud/ButtonResetPatches.cs | 1 - MiraAPI/Patches/IntroCutscenePatches.cs | 4 +--- MiraAPI/Patches/Keybinds/ControlMapperPatches.cs | 5 ----- MiraAPI/Patches/Keybinds/KeybindsPatch.cs | 1 - MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs | 1 - MiraAPI/Patches/Options/GameOptionsMenuPatch.cs | 4 ---- MiraAPI/Patches/Options/GamePresetsTabPatches.cs | 1 - MiraAPI/Patches/Options/NotificationPopperPatch.cs | 2 -- MiraAPI/Patches/Options/OptionsPatches.cs | 5 +---- MiraAPI/Patches/Options/PlayerOptionPatches.cs | 6 +----- MiraAPI/Patches/PlayerControlPatches.cs | 1 - MiraAPI/Patches/Roles/HowToPlayPatch.cs | 3 +-- MiraAPI/Patches/Roles/HudManagerPatches.cs | 2 -- MiraAPI/Patches/Roles/RoleManagerPatches.cs | 1 - MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs | 1 - MiraAPI/Patches/ServerDropdownPatch.cs | 1 - MiraAPI/Patches/TmpAwakePatch.cs | 1 - MiraAPI/Patches/Voting/DummyBehaviourPatch.cs | 1 - MiraAPI/PluginLoading/MiraPluginInfo.cs | 1 - MiraAPI/Presets/PresetManager.cs | 2 -- MiraAPI/Roles/CustomRoleManager.cs | 1 - MiraAPI/Roles/ICustomRole.cs | 2 -- MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs | 1 - MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs | 1 - MiraAPI/Utilities/Extensions.cs | 3 --- MiraAPI/Utilities/Helpers.cs | 2 -- MiraAPI/Voting/VotingUtils.cs | 1 - 53 files changed, 8 insertions(+), 90 deletions(-) diff --git a/MiraAPI.Example/ExamplePlugin.cs b/MiraAPI.Example/ExamplePlugin.cs index 0aed9c4..b20ec41 100644 --- a/MiraAPI.Example/ExamplePlugin.cs +++ b/MiraAPI.Example/ExamplePlugin.cs @@ -1,5 +1,4 @@ -using System.Linq; -using BepInEx; +using BepInEx; using BepInEx.Configuration; using BepInEx.Unity.IL2CPP; using HarmonyLib; diff --git a/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs b/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs index 1be3649..3c1fdeb 100644 --- a/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs +++ b/MiraAPI.Example/Options/Roles/FreezerRoleSettings.cs @@ -3,8 +3,6 @@ using MiraAPI.GameOptions; using MiraAPI.GameOptions.Attributes; using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; -using TMPro; -using UnityEngine; namespace MiraAPI.Example.Options.Roles; diff --git a/MiraAPI/Events/MiraEventManager.cs b/MiraAPI/Events/MiraEventManager.cs index 005415b..30ffb74 100644 --- a/MiraAPI/Events/MiraEventManager.cs +++ b/MiraAPI/Events/MiraEventManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Reflection; -using Reactor.Utilities; namespace MiraAPI.Events; diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs index 95583f3..60a3d36 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/AfterVoteEvent.cs @@ -1,6 +1,4 @@ -using MiraAPI.Voting; - -namespace MiraAPI.Events.Vanilla.Meeting.Voting; +namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// /// Event that is invoked after the local player successfully votes a player or skips. This event is not cancelable. diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs index 74fde38..e6b28f9 100644 --- a/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs +++ b/MiraAPI/Events/Vanilla/Meeting/Voting/BeforeVoteEvent.cs @@ -1,6 +1,4 @@ -using MiraAPI.Voting; - -namespace MiraAPI.Events.Vanilla.Meeting.Voting; +namespace MiraAPI.Events.Vanilla.Meeting.Voting; /// /// Event that is invoked before the local player confirms a vote on a player or when skipping. This event is cancelable. diff --git a/MiraAPI/GameEnd/GameOverManager.cs b/MiraAPI/GameEnd/GameOverManager.cs index eb39835..28d2f48 100644 --- a/MiraAPI/GameEnd/GameOverManager.cs +++ b/MiraAPI/GameEnd/GameOverManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using Reactor.Utilities; namespace MiraAPI.GameEnd; diff --git a/MiraAPI/GameModes/CustomGameModeManager.cs b/MiraAPI/GameModes/CustomGameModeManager.cs index 7e274c4..3edd028 100644 --- a/MiraAPI/GameModes/CustomGameModeManager.cs +++ b/MiraAPI/GameModes/CustomGameModeManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Reactor.Utilities; namespace MiraAPI.GameModes; diff --git a/MiraAPI/GameOptions/AbstractOptionGroup.cs b/MiraAPI/GameOptions/AbstractOptionGroup.cs index 5ee95c2..f8f0877 100644 --- a/MiraAPI/GameOptions/AbstractOptionGroup.cs +++ b/MiraAPI/GameOptions/AbstractOptionGroup.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using Il2CppInterop.Runtime.Attributes; using MiraAPI.Modifiers; using MiraAPI.Roles; -using TMPro; using UnityEngine; namespace MiraAPI.GameOptions; diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs index 50457b6..4300c4f 100644 --- a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs +++ b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs @@ -1,11 +1,9 @@ using System; using BepInEx.Configuration; -using Il2CppInterop.Runtime.Attributes; using MiraAPI.Networking; using MiraAPI.PluginLoading; using Reactor.Localization.Utilities; using Reactor.Networking.Rpc; -using TMPro; using UnityEngine; namespace MiraAPI.GameOptions.OptionTypes; diff --git a/MiraAPI/Hud/CustomActionButton.cs b/MiraAPI/Hud/CustomActionButton.cs index f5cf521..4c5df0c 100644 --- a/MiraAPI/Hud/CustomActionButton.cs +++ b/MiraAPI/Hud/CustomActionButton.cs @@ -7,7 +7,6 @@ using MiraAPI.LocalSettings; using MiraAPI.Patches; using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; -using Reactor.Utilities; using Rewired; using TMPro; using UnityEngine; diff --git a/MiraAPI/Hud/CustomButtonManager.cs b/MiraAPI/Hud/CustomButtonManager.cs index 5a1ba3b..70ca14b 100644 --- a/MiraAPI/Hud/CustomButtonManager.cs +++ b/MiraAPI/Hud/CustomButtonManager.cs @@ -4,7 +4,6 @@ using System.Collections.ObjectModel; using System.Reflection; using MiraAPI.Events.Mira; using MiraAPI.PluginLoading; -using UnityEngine; namespace MiraAPI.Hud; diff --git a/MiraAPI/Hud/MultiTargetButton.cs b/MiraAPI/Hud/MultiTargetButton.cs index 12458d4..d52d845 100644 --- a/MiraAPI/Hud/MultiTargetButton.cs +++ b/MiraAPI/Hud/MultiTargetButton.cs @@ -1,6 +1,5 @@ using System.Linq; using HarmonyLib; -using Reactor.Utilities.Extensions; using UnityEngine; namespace MiraAPI.Hud; diff --git a/MiraAPI/Keybinds/KeybindManager.cs b/MiraAPI/Keybinds/KeybindManager.cs index 207fab5..042322a 100644 --- a/MiraAPI/Keybinds/KeybindManager.cs +++ b/MiraAPI/Keybinds/KeybindManager.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using Il2CppInterop.Runtime.Attributes; using MiraAPI.Utilities; -using Reactor.Utilities; using Rewired; namespace MiraAPI.Keybinds; diff --git a/MiraAPI/Keybinds/VanillaKeybind.cs b/MiraAPI/Keybinds/VanillaKeybind.cs index 594e583..5f34288 100644 --- a/MiraAPI/Keybinds/VanillaKeybind.cs +++ b/MiraAPI/Keybinds/VanillaKeybind.cs @@ -1,5 +1,4 @@ using System.Globalization; -using Rewired; namespace MiraAPI.Keybinds; diff --git a/MiraAPI/LocalSettings/Attributes/LocalSettingsButtonAttribute.cs b/MiraAPI/LocalSettings/Attributes/LocalSettingsButtonAttribute.cs index 043a81d..83a3955 100644 --- a/MiraAPI/LocalSettings/Attributes/LocalSettingsButtonAttribute.cs +++ b/MiraAPI/LocalSettings/Attributes/LocalSettingsButtonAttribute.cs @@ -1,5 +1,4 @@ using System; -using BepInEx.Configuration; namespace MiraAPI.LocalSettings.Attributes; diff --git a/MiraAPI/LocalSettings/LocalSettingsButton.cs b/MiraAPI/LocalSettings/LocalSettingsButton.cs index 6f1fa57..5a1f371 100644 --- a/MiraAPI/LocalSettings/LocalSettingsButton.cs +++ b/MiraAPI/LocalSettings/LocalSettingsButton.cs @@ -1,6 +1,5 @@ using System; using MiraAPI.Utilities; -using Reactor.Localization.Utilities; using Reactor.Utilities.Extensions; using TMPro; using UnityEngine; diff --git a/MiraAPI/LocalSettings/LocalSettingsManager.cs b/MiraAPI/LocalSettings/LocalSettingsManager.cs index 2f6fc16..aa1c217 100644 --- a/MiraAPI/LocalSettings/LocalSettingsManager.cs +++ b/MiraAPI/LocalSettings/LocalSettingsManager.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Reflection; using BepInEx.Unity.IL2CPP; -using MiraAPI.GameOptions; -using Reactor.Utilities; namespace MiraAPI.LocalSettings; diff --git a/MiraAPI/Modifiers/ModifierComponent.cs b/MiraAPI/Modifiers/ModifierComponent.cs index 09e411a..6432b18 100644 --- a/MiraAPI/Modifiers/ModifierComponent.cs +++ b/MiraAPI/Modifiers/ModifierComponent.cs @@ -8,7 +8,6 @@ using MiraAPI.LocalSettings; using MiraAPI.Modifiers.ModifierDisplay; using MiraAPI.Modifiers.Types; using MiraAPI.Patches.Roles; -using Reactor.Utilities; using Reactor.Utilities.Attributes; using UnityEngine; diff --git a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs index 4b4c71e..e93f477 100644 --- a/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs +++ b/MiraAPI/Modifiers/ModifierDisplay/ModifierDisplayComponent.cs @@ -4,7 +4,6 @@ using System.Linq; using HarmonyLib; using Il2CppInterop.Runtime.Attributes; using MiraAPI.LocalSettings; -using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; using Reactor.Utilities.Attributes; using Reactor.Utilities.Extensions; diff --git a/MiraAPI/Modifiers/ModifierExtensions.cs b/MiraAPI/Modifiers/ModifierExtensions.cs index 20f08be..e70a26a 100644 --- a/MiraAPI/Modifiers/ModifierExtensions.cs +++ b/MiraAPI/Modifiers/ModifierExtensions.cs @@ -5,7 +5,6 @@ using MiraAPI.Networking; using MiraAPI.Networking.Modifiers; using Reactor.Networking.Attributes; using Reactor.Networking.Rpc; -using Reactor.Utilities; namespace MiraAPI.Modifiers; diff --git a/MiraAPI/Modifiers/ModifierManager.cs b/MiraAPI/Modifiers/ModifierManager.cs index 877e43b..8d5621e 100644 --- a/MiraAPI/Modifiers/ModifierManager.cs +++ b/MiraAPI/Modifiers/ModifierManager.cs @@ -6,7 +6,6 @@ using MiraAPI.Modifiers.Types; using MiraAPI.PluginLoading; using MiraAPI.Roles; using MiraAPI.Utilities; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using Random = System.Random; diff --git a/MiraAPI/Modifiers/Types/TimedModifier.cs b/MiraAPI/Modifiers/Types/TimedModifier.cs index 6fe1c1d..472b3cf 100644 --- a/MiraAPI/Modifiers/Types/TimedModifier.cs +++ b/MiraAPI/Modifiers/Types/TimedModifier.cs @@ -1,5 +1,4 @@ using System; -using Reactor.Utilities; using UnityEngine; namespace MiraAPI.Modifiers.Types; diff --git a/MiraAPI/Networking/CustomGameOverRpc.cs b/MiraAPI/Networking/CustomGameOverRpc.cs index f7df4a7..6475d6a 100644 --- a/MiraAPI/Networking/CustomGameOverRpc.cs +++ b/MiraAPI/Networking/CustomGameOverRpc.cs @@ -4,7 +4,6 @@ using InnerNet; using MiraAPI.GameEnd; using Reactor.Networking.Attributes; using Reactor.Networking.Rpc; -using Reactor.Utilities; namespace MiraAPI.Networking; diff --git a/MiraAPI/Networking/CustomMurderRpc.cs b/MiraAPI/Networking/CustomMurderRpc.cs index 9a6ff0b..7009819 100644 --- a/MiraAPI/Networking/CustomMurderRpc.cs +++ b/MiraAPI/Networking/CustomMurderRpc.cs @@ -10,9 +10,6 @@ using MiraAPI.Events.Vanilla.Gameplay; using MiraAPI.Utilities; using Reactor.Networking.Attributes; using Reactor.Networking.Rpc; -using Reactor.Utilities; -using Reactor.Utilities.Extensions; -using Rewired; using UnityEngine; using Object = UnityEngine.Object; diff --git a/MiraAPI/Patches/Events/ReportBodyEventPatch.cs b/MiraAPI/Patches/Events/ReportBodyEventPatch.cs index 305311e..3eb1c29 100644 --- a/MiraAPI/Patches/Events/ReportBodyEventPatch.cs +++ b/MiraAPI/Patches/Events/ReportBodyEventPatch.cs @@ -4,7 +4,6 @@ using InnerNet; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Meeting; using MiraAPI.Utilities; -using Reactor.Utilities; namespace MiraAPI.Patches.Events; diff --git a/MiraAPI/Patches/Events/VanillaButtonPatches.cs b/MiraAPI/Patches/Events/VanillaButtonPatches.cs index 490e401..71df73f 100644 --- a/MiraAPI/Patches/Events/VanillaButtonPatches.cs +++ b/MiraAPI/Patches/Events/VanillaButtonPatches.cs @@ -1,9 +1,7 @@ -using System.Linq; -using AmongUs.GameOptions; +using AmongUs.GameOptions; using HarmonyLib; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Gameplay; -using MiraAPI.Events.Vanilla.Usables; namespace MiraAPI.Patches.Events; diff --git a/MiraAPI/Patches/Hud/ButtonResetPatches.cs b/MiraAPI/Patches/Hud/ButtonResetPatches.cs index 5e46048..ab0dc32 100644 --- a/MiraAPI/Patches/Hud/ButtonResetPatches.cs +++ b/MiraAPI/Patches/Hud/ButtonResetPatches.cs @@ -1,6 +1,5 @@ using HarmonyLib; using MiraAPI.Hud; -using Reactor.Utilities; namespace MiraAPI.Patches.Hud; diff --git a/MiraAPI/Patches/IntroCutscenePatches.cs b/MiraAPI/Patches/IntroCutscenePatches.cs index 7d52287..4ee990c 100644 --- a/MiraAPI/Patches/IntroCutscenePatches.cs +++ b/MiraAPI/Patches/IntroCutscenePatches.cs @@ -1,12 +1,10 @@ -using System.Linq; -using System.Reflection; +using System.Reflection; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Gameplay; using MiraAPI.Roles; using MiraAPI.Utilities; -using Reactor.Utilities; namespace MiraAPI.Patches; diff --git a/MiraAPI/Patches/Keybinds/ControlMapperPatches.cs b/MiraAPI/Patches/Keybinds/ControlMapperPatches.cs index f0c51c0..6666a2c 100644 --- a/MiraAPI/Patches/Keybinds/ControlMapperPatches.cs +++ b/MiraAPI/Patches/Keybinds/ControlMapperPatches.cs @@ -1,13 +1,8 @@ using System.Linq; using HarmonyLib; using MiraAPI.Keybinds; -using MiraAPI.LocalSettings; -using Reactor.Utilities; -using Reactor.Utilities.Extensions; using Rewired.UI.ControlMapper; -using TMPro; using UnityEngine; -using UnityEngine.Events; using UnityEngine.UI; namespace MiraAPI.Patches.Keybinds; diff --git a/MiraAPI/Patches/Keybinds/KeybindsPatch.cs b/MiraAPI/Patches/Keybinds/KeybindsPatch.cs index c08a47f..9c1034f 100644 --- a/MiraAPI/Patches/Keybinds/KeybindsPatch.cs +++ b/MiraAPI/Patches/Keybinds/KeybindsPatch.cs @@ -1,6 +1,5 @@ using HarmonyLib; using MiraAPI.Keybinds; -using MonoMod.Utils; using Rewired; namespace MiraAPI.Patches.Keybinds; diff --git a/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs b/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs index ab8ed2c..10ab62d 100644 --- a/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs +++ b/MiraAPI/Patches/LocalSettings/OptionsMenuPatches.cs @@ -3,7 +3,6 @@ using System.Linq; using HarmonyLib; using MiraAPI.LocalSettings; using MiraAPI.Utilities.Assets; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using UnityEngine; using UnityEngine.Events; diff --git a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs index 3068a1b..b50b430 100644 --- a/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs +++ b/MiraAPI/Patches/Options/GameOptionsMenuPatch.cs @@ -1,12 +1,8 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using AmongUs.GameOptions; using BepInEx.Unity.IL2CPP.Utils.Collections; using HarmonyLib; -using Il2CppInterop.Runtime.Attributes; using MiraAPI.GameOptions; using MiraAPI.Modifiers; using MiraAPI.Presets; diff --git a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs index 2c6cc68..ff75606 100644 --- a/MiraAPI/Patches/Options/GamePresetsTabPatches.cs +++ b/MiraAPI/Patches/Options/GamePresetsTabPatches.cs @@ -8,7 +8,6 @@ using MiraAPI.Presets; using MiraAPI.Roles; using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using TMPro; using UnityEngine; diff --git a/MiraAPI/Patches/Options/NotificationPopperPatch.cs b/MiraAPI/Patches/Options/NotificationPopperPatch.cs index 349f103..8024ea4 100644 --- a/MiraAPI/Patches/Options/NotificationPopperPatch.cs +++ b/MiraAPI/Patches/Options/NotificationPopperPatch.cs @@ -1,8 +1,6 @@ using System.Linq; using HarmonyLib; -using Il2CppSystem; using MiraAPI.Roles; -using Object = Il2CppSystem.Object; namespace MiraAPI.Patches.Options; diff --git a/MiraAPI/Patches/Options/OptionsPatches.cs b/MiraAPI/Patches/Options/OptionsPatches.cs index 0f99691..36651f9 100644 --- a/MiraAPI/Patches/Options/OptionsPatches.cs +++ b/MiraAPI/Patches/Options/OptionsPatches.cs @@ -1,9 +1,6 @@ -using System.Collections.Generic; -using System.Linq; -using HarmonyLib; +using HarmonyLib; using Il2CppSystem; using MiraAPI.GameOptions; -using MiraAPI.GameOptions.OptionTypes; using MiraAPI.Roles; using MiraAPI.Utilities; using UnityEngine; diff --git a/MiraAPI/Patches/Options/PlayerOptionPatches.cs b/MiraAPI/Patches/Options/PlayerOptionPatches.cs index 2b77bc1..9cf0134 100644 --- a/MiraAPI/Patches/Options/PlayerOptionPatches.cs +++ b/MiraAPI/Patches/Options/PlayerOptionPatches.cs @@ -1,12 +1,8 @@ -using System; -using System.Linq; +using System.Linq; using HarmonyLib; using MiraAPI.GameOptions; -using MiraAPI.GameOptions.OptionTypes; using MiraAPI.Utilities; -using Reactor.Utilities; using UnityEngine; -using Object = Il2CppSystem.Object; namespace MiraAPI.Patches.Options; diff --git a/MiraAPI/Patches/PlayerControlPatches.cs b/MiraAPI/Patches/PlayerControlPatches.cs index 3c851b0..77b83c2 100644 --- a/MiraAPI/Patches/PlayerControlPatches.cs +++ b/MiraAPI/Patches/PlayerControlPatches.cs @@ -8,7 +8,6 @@ using MiraAPI.Hud; using MiraAPI.Modifiers; using MiraAPI.Utilities; using MiraAPI.Voting; -using Reactor.Utilities; using Reactor.Utilities.Extensions; namespace MiraAPI.Patches; diff --git a/MiraAPI/Patches/Roles/HowToPlayPatch.cs b/MiraAPI/Patches/Roles/HowToPlayPatch.cs index ee6e5ff..c7cc2e5 100644 --- a/MiraAPI/Patches/Roles/HowToPlayPatch.cs +++ b/MiraAPI/Patches/Roles/HowToPlayPatch.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using AmongUs.GameOptions; using HarmonyLib; using MiraAPI.Roles; diff --git a/MiraAPI/Patches/Roles/HudManagerPatches.cs b/MiraAPI/Patches/Roles/HudManagerPatches.cs index 6827341..3de9b71 100644 --- a/MiraAPI/Patches/Roles/HudManagerPatches.cs +++ b/MiraAPI/Patches/Roles/HudManagerPatches.cs @@ -1,9 +1,7 @@ using HarmonyLib; using InnerNet; using MiraAPI.Roles; -using MiraAPI.Utilities; using Reactor.Utilities.Extensions; -using UnityEngine; namespace MiraAPI.Patches.Roles; diff --git a/MiraAPI/Patches/Roles/RoleManagerPatches.cs b/MiraAPI/Patches/Roles/RoleManagerPatches.cs index 713ffdf..8d13595 100644 --- a/MiraAPI/Patches/Roles/RoleManagerPatches.cs +++ b/MiraAPI/Patches/Roles/RoleManagerPatches.cs @@ -1,7 +1,6 @@ using System.Linq; using AmongUs.GameOptions; using HarmonyLib; -using InnerNet; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Gameplay; using MiraAPI.Modifiers; diff --git a/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs b/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs index ff57b37..d4d80d3 100644 --- a/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs +++ b/MiraAPI/Patches/Roles/RoleOptionsCollectionPatch.cs @@ -2,7 +2,6 @@ using HarmonyLib; using Il2CppSystem.Collections.Generic; using MiraAPI.Roles; -using Reactor.Utilities; namespace MiraAPI.Patches.Roles; diff --git a/MiraAPI/Patches/ServerDropdownPatch.cs b/MiraAPI/Patches/ServerDropdownPatch.cs index 6ff7e68..7749c9b 100644 --- a/MiraAPI/Patches/ServerDropdownPatch.cs +++ b/MiraAPI/Patches/ServerDropdownPatch.cs @@ -1,6 +1,5 @@ using System.Linq; using HarmonyLib; -using Reactor.Utilities; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; diff --git a/MiraAPI/Patches/TmpAwakePatch.cs b/MiraAPI/Patches/TmpAwakePatch.cs index 2d43d23..9405e01 100644 --- a/MiraAPI/Patches/TmpAwakePatch.cs +++ b/MiraAPI/Patches/TmpAwakePatch.cs @@ -1,4 +1,3 @@ -using System.Linq; using HarmonyLib; using MiraAPI.Utilities.Assets; using TMPro; diff --git a/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs b/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs index 9e5c8a4..1d8c1e9 100644 --- a/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs +++ b/MiraAPI/Patches/Voting/DummyBehaviourPatch.cs @@ -7,7 +7,6 @@ using MiraAPI.Events; using MiraAPI.Events.Vanilla.Meeting.Voting; using MiraAPI.Utilities; using MiraAPI.Voting; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using UnityEngine; diff --git a/MiraAPI/PluginLoading/MiraPluginInfo.cs b/MiraAPI/PluginLoading/MiraPluginInfo.cs index 0df7cb5..db030b0 100644 --- a/MiraAPI/PluginLoading/MiraPluginInfo.cs +++ b/MiraAPI/PluginLoading/MiraPluginInfo.cs @@ -5,7 +5,6 @@ using BepInEx.Configuration; using MiraAPI.GameModes; using MiraAPI.GameOptions; using MiraAPI.Hud; -using MiraAPI.LocalSettings; using MiraAPI.Modifiers; using MiraAPI.Presets; diff --git a/MiraAPI/Presets/PresetManager.cs b/MiraAPI/Presets/PresetManager.cs index d346c52..f753db5 100644 --- a/MiraAPI/Presets/PresetManager.cs +++ b/MiraAPI/Presets/PresetManager.cs @@ -4,8 +4,6 @@ using System.Linq; using BepInEx.Configuration; using MiraAPI.PluginLoading; using MiraAPI.Roles; -using MiraAPI.Utilities; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using UnityEngine; diff --git a/MiraAPI/Roles/CustomRoleManager.cs b/MiraAPI/Roles/CustomRoleManager.cs index 9e6540f..d85ed19 100644 --- a/MiraAPI/Roles/CustomRoleManager.cs +++ b/MiraAPI/Roles/CustomRoleManager.cs @@ -11,7 +11,6 @@ using MiraAPI.Utilities; using MiraAPI.Utilities.Assets; using Reactor.Localization.Utilities; using Reactor.Networking.Rpc; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using TMPro; using UnityEngine; diff --git a/MiraAPI/Roles/ICustomRole.cs b/MiraAPI/Roles/ICustomRole.cs index 1915949..c0c97be 100644 --- a/MiraAPI/Roles/ICustomRole.cs +++ b/MiraAPI/Roles/ICustomRole.cs @@ -4,8 +4,6 @@ using BepInEx.Configuration; using MiraAPI.GameOptions; using MiraAPI.Modifiers; using MiraAPI.PluginLoading; -using Reactor.Utilities; -using TMPro; using UnityEngine; namespace MiraAPI.Roles; diff --git a/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs b/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs index b9e8c55..144f608 100644 --- a/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs +++ b/MiraAPI/Utilities/Assets/LoadableAddressableAsset.cs @@ -1,5 +1,4 @@ using System; -using Reactor.Utilities; using UnityEngine.AddressableAssets; namespace MiraAPI.Utilities.Assets; diff --git a/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs b/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs index 9cabf83..c70100a 100644 --- a/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs +++ b/MiraAPI/Utilities/Assets/LoadableAddressableAssets.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using Reactor.Utilities; using UnityEngine.AddressableAssets; namespace MiraAPI.Utilities.Assets; diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index c4b9ef3..a16d1e1 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -6,14 +6,11 @@ using System.Globalization; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; -using System.Timers; using HarmonyLib; using MiraAPI.GameOptions; using MiraAPI.Networking; -using MiraAPI.Patches.Menu; using MiraAPI.Roles; using MiraAPI.Voting; -using Reactor.Utilities; using Reactor.Utilities.Extensions; using Rewired; using Rewired.Data; diff --git a/MiraAPI/Utilities/Helpers.cs b/MiraAPI/Utilities/Helpers.cs index c089e40..9f66817 100644 --- a/MiraAPI/Utilities/Helpers.cs +++ b/MiraAPI/Utilities/Helpers.cs @@ -2,12 +2,10 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using AmongUs.GameOptions; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MiraAPI.Roles; using MiraAPI.Utilities.Assets; -using Reactor.Utilities; using Rewired; using TMPro; using UnityEngine; diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs index 130e4c4..fb117e4 100644 --- a/MiraAPI/Voting/VotingUtils.cs +++ b/MiraAPI/Voting/VotingUtils.cs @@ -5,7 +5,6 @@ using MiraAPI.Events.Vanilla.Meeting.Voting; using MiraAPI.Networking; using MiraAPI.Utilities; using Reactor.Networking.Attributes; -using Reactor.Utilities; namespace MiraAPI.Voting; From 0a0ad7441955a3928afb9fc7993d8db0950cde44 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 20 Jul 2026 20:02:29 -0400 Subject: [PATCH 36/42] improve GC collection --- MiraAPI/Utilities/Extensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index a16d1e1..9dd91e9 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -366,7 +366,8 @@ public static class Extensions public static void ClearGarbageCollector() { Resources.UnloadUnusedAssets(); - GC.Collect(); + Il2CppSystem.GC.Collect(0, Il2CppSystem.GCCollectionMode.Forced); + GC.Collect(0, GCCollectionMode.Forced); } /// From 1b40b1c5e43bb3a410078fbbd525c6be5521bbbe Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Mon, 20 Jul 2026 20:23:38 -0400 Subject: [PATCH 37/42] attempt to improve gc behavior --- MiraAPI/Patches/Options/GameSettingMenuPatches.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs index 6e12c61..995da8e 100644 --- a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs @@ -419,6 +419,8 @@ internal static class GameSettingMenuPatches _customTwoButton!.transform.localPosition = _customTwoBtnOgPos; menu.RoleSettingsButton.transform.localPosition = _roleBtnOgPos; + CleanupTab(settings, roles); + if (SelectedModIdx != 0) { _customOneButton.buttonText.text = SelectedMod!.MiraPlugin.CustomOptionMenuNameOne; @@ -560,8 +562,6 @@ internal static class GameSettingMenuPatches { menu.ChangeTab(0, false); } - - CleanupTab(settings, roles); } private static void ClearOptions(Il2CppSystem.Collections.Generic.List options) @@ -606,6 +606,8 @@ internal static class GameSettingMenuPatches CleanupSettings(_customTwoTab, MenuCategory.CustomTwo); } + Utilities.Extensions.ClearGarbageCollector(); + void CleanupRoleSettings(RolesSettingsMenu rolesMenu) { if (rolesMenu.advancedSettingChildren != null) From 8750e5c8948e73f655b72a09e2a4b3664af3e39e Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 25 Jul 2026 17:20:14 -0500 Subject: [PATCH 38/42] Reorder modifier validity checks --- MiraAPI/Modifiers/ModifierManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MiraAPI/Modifiers/ModifierManager.cs b/MiraAPI/Modifiers/ModifierManager.cs index 8d5621e..12a9519 100644 --- a/MiraAPI/Modifiers/ModifierManager.cs +++ b/MiraAPI/Modifiers/ModifierManager.cs @@ -178,7 +178,7 @@ public static class ModifierManager private static bool IsGameModifierValid(PlayerControl player, GameModifier modifier, uint modifierId) { return (player.Data.Role is not ICustomRole role || role.IsModifierApplicable(modifier)) && - modifier.IsModifierValidOn(player.Data.Role) && !player.HasModifier(modifierId) && + !player.HasModifier(modifierId) && modifier.IsModifierValidOn(player.Data.Role) && modifier.CanSpawnOnCurrentMode(); } } From 7c085b1072f8ed4b3ea2f0ce3af3f142ecef73a0 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 25 Jul 2026 18:03:29 -0500 Subject: [PATCH 39/42] Add modifier post assignment-check --- MiraAPI/Modifiers/ModifierManager.cs | 7 ++++++- MiraAPI/Modifiers/Types/GameModifier.cs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/MiraAPI/Modifiers/ModifierManager.cs b/MiraAPI/Modifiers/ModifierManager.cs index 12a9519..c2688a0 100644 --- a/MiraAPI/Modifiers/ModifierManager.cs +++ b/MiraAPI/Modifiers/ModifierManager.cs @@ -152,7 +152,7 @@ public static class ModifierManager } var candidates = availablePlayers - .Where(x => IsGameModifierValid(x, modifier, modifier.TypeId)) + .Where(x => IsGameModifierPostCheck(x, modifier, modifier.TypeId)) .ToList(); if (candidates.Count == 0) @@ -181,4 +181,9 @@ public static class ModifierManager !player.HasModifier(modifierId) && modifier.IsModifierValidOn(player.Data.Role) && modifier.CanSpawnOnCurrentMode(); } + private static bool IsGameModifierPostCheck(PlayerControl player, GameModifier modifier, uint modifierId) + { + return (player.Data.Role is not ICustomRole role || role.IsModifierApplicable(modifier)) && + !player.HasModifier(modifierId) && modifier.IsModifierValidOnPostCheck(player.Data.Role); + } } diff --git a/MiraAPI/Modifiers/Types/GameModifier.cs b/MiraAPI/Modifiers/Types/GameModifier.cs index b58f8e0..f5ae883 100644 --- a/MiraAPI/Modifiers/Types/GameModifier.cs +++ b/MiraAPI/Modifiers/Types/GameModifier.cs @@ -33,6 +33,13 @@ public abstract class GameModifier : BaseModifier /// if the modifier is valid on the role, otherwise . public virtual bool IsModifierValidOn(RoleBehaviour role) => true; + /// + /// Determines whether the modifier is valid on a role, which runs after players are determined but before the modifiers are given. + /// + /// The role to be checked. + /// if the modifier is valid on the role, otherwise . + public virtual bool IsModifierValidOnPostCheck(RoleBehaviour role) => IsModifierValidOn(role); + /// /// Determines whether the player won the game with this modifier. The modifier with the highest priority will override other modifiers. /// From 228ed9711ada2243a58fe0c9cf26ba8611191278 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sun, 26 Jul 2026 11:05:13 -0500 Subject: [PATCH 40/42] Add mod name abbreviation --- MiraAPI/PluginLoading/IMiraPlugin.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MiraAPI/PluginLoading/IMiraPlugin.cs b/MiraAPI/PluginLoading/IMiraPlugin.cs index f1ef793..05470cc 100644 --- a/MiraAPI/PluginLoading/IMiraPlugin.cs +++ b/MiraAPI/PluginLoading/IMiraPlugin.cs @@ -1,4 +1,5 @@ -using BepInEx.Configuration; +using System.Linq; +using BepInEx.Configuration; namespace MiraAPI.PluginLoading; @@ -12,6 +13,15 @@ public interface IMiraPlugin /// string OptionsTitleText { get; } + /// + /// Gets the abbreviated name to display for other mods to pick up. + /// + /// The text for the plugin. + public virtual string GetAbbreviatedModName() + { + return new(OptionsTitleText.Where(c => !char.IsLower(c) && !char.IsWhiteSpace(c)).ToArray()); + } + /// /// Gets the name for the first custom category in the game options menu, if any. /// From 30a39fa2239fee1e052c7828ccab61df2e767c9a Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sun, 26 Jul 2026 11:12:28 -0500 Subject: [PATCH 41/42] Add DisplayOnOptionsMenu for mira api mods --- MiraAPI/Patches/Options/GameSettingMenuPatches.cs | 10 +++++----- MiraAPI/Patches/Options/LobbyViewPanePatches.cs | 6 +++--- MiraAPI/PluginLoading/IMiraPlugin.cs | 5 +++++ MiraAPI/PluginLoading/MiraPluginManager.cs | 9 +++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs index 995da8e..d9cc5fb 100644 --- a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs @@ -199,7 +199,7 @@ internal static class GameSettingMenuPatches { SaveScrollPositions(__instance); SelectedModIdx += 1; - if (SelectedModIdx > MiraPluginManager.Instance.RegisteredPlugins.Length) + if (SelectedModIdx > MiraPluginManager.Instance.RegisteredOptionablePlugins.Length) { SelectedModIdx = 0; } @@ -220,7 +220,7 @@ internal static class GameSettingMenuPatches SelectedModIdx -= 1; if (SelectedModIdx < 0) { - SelectedModIdx = MiraPluginManager.Instance.RegisteredPlugins.Length; + SelectedModIdx = MiraPluginManager.Instance.RegisteredOptionablePlugins.Length; } UpdateText(__instance, __instance.GameSettingsTab, __instance.RoleSettingsTab); @@ -399,17 +399,17 @@ internal static class GameSettingMenuPatches { if (_text is not null && SelectedModIdx == 0) { - _text.text = $"(Page 0/{MiraPluginManager.Instance.RegisteredPlugins.Length})\nDefault"; + _text.text = $"(Page 0/{MiraPluginManager.Instance.RegisteredOptionablePlugins.Length})\nMain"; _text.fontSizeMax = 3.2f; SelectedMod = null; } else if (_text is not null) { _text.fontSizeMax = 2.3f; - SelectedMod = MiraPluginManager.Instance.RegisteredPlugins[SelectedModIdx - 1]; + SelectedMod = MiraPluginManager.Instance.RegisteredOptionablePlugins[SelectedModIdx - 1]; var name = SelectedMod.MiraPlugin.OptionsTitleText; - _text.text = $"(Page {SelectedModIdx}/{MiraPluginManager.Instance.RegisteredPlugins.Length})\n" + name[..Math.Min(name.Length, 25)]; + _text.text = $"(Page {SelectedModIdx}/{MiraPluginManager.Instance.RegisteredOptionablePlugins.Length})\n" + name[..Math.Min(name.Length, 25)]; } bool replaceWithModifiers = true; diff --git a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs index c543447..5a4460d 100644 --- a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs +++ b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs @@ -25,7 +25,7 @@ public static class LobbyViewPanePatches private static MiraPluginInfo? SelectedMod => SelectedModIdx == 0 ? null - : MiraPluginManager.Instance.RegisteredPlugins[SelectedModIdx - 1]; + : MiraPluginManager.Instance.RegisteredOptionablePlugins[SelectedModIdx - 1]; private static PassiveButton? ModifiersTabButton { get; set; } @@ -75,7 +75,7 @@ public static class LobbyViewPanePatches (UnityAction)(() => { SelectedModIdx += 1; - if (SelectedModIdx > MiraPluginManager.Instance.RegisteredPlugins.Length) + if (SelectedModIdx > MiraPluginManager.Instance.RegisteredOptionablePlugins.Length) { SelectedModIdx = 0; } @@ -99,7 +99,7 @@ public static class LobbyViewPanePatches SelectedModIdx -= 1; if (SelectedModIdx < 0) { - SelectedModIdx = MiraPluginManager.Instance.RegisteredPlugins.Length; + SelectedModIdx = MiraPluginManager.Instance.RegisteredOptionablePlugins.Length; } Refresh(__instance); diff --git a/MiraAPI/PluginLoading/IMiraPlugin.cs b/MiraAPI/PluginLoading/IMiraPlugin.cs index 05470cc..a29dd4c 100644 --- a/MiraAPI/PluginLoading/IMiraPlugin.cs +++ b/MiraAPI/PluginLoading/IMiraPlugin.cs @@ -8,6 +8,11 @@ namespace MiraAPI.PluginLoading; /// public interface IMiraPlugin { + /// + /// Gets or sets a value indicating whether to display the plugin in the options menu. + /// + public virtual bool DisplayOnOptionsMenu => true; + /// /// Gets the name to display on the options menu. /// diff --git a/MiraAPI/PluginLoading/MiraPluginManager.cs b/MiraAPI/PluginLoading/MiraPluginManager.cs index 4639b4f..171ab90 100644 --- a/MiraAPI/PluginLoading/MiraPluginManager.cs +++ b/MiraAPI/PluginLoading/MiraPluginManager.cs @@ -34,6 +34,10 @@ public sealed class MiraPluginManager internal MiraPluginInfo[] RegisteredPlugins { get; private set; } = null!; + private readonly Dictionary _registeredOptionablePlugins = []; + + internal MiraPluginInfo[] RegisteredOptionablePlugins { get; private set; } = null!; + internal Dictionary> QueuedRoleRegistrations { get; } = []; internal static MiraPluginManager Instance { get; private set; } = new(); @@ -127,6 +131,10 @@ public sealed class MiraPluginManager QueuedRoleRegistrations.Add(info, roles); _registeredPlugins.Add(assembly, info); + if (miraPlugin.DisplayOnOptionsMenu) + { + _registeredOptionablePlugins.Add(assembly, info); + } info.SavePublicCollections(); PresetManager.CreateDefaultPreset(info); @@ -141,6 +149,7 @@ public sealed class MiraPluginManager // Cache all the registered plugins into an array for easy access RegisteredPlugins = [.. _registeredPlugins.Values]; + RegisteredOptionablePlugins = [.. _registeredOptionablePlugins.Values]; ModifierManager.Modifiers = new ReadOnlyCollection(ModifierManager.InternalModifiers); }; From 8c5aee4bebaa197b7d235c56898ef9ae2bccf9de Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sun, 26 Jul 2026 11:56:21 -0500 Subject: [PATCH 42/42] Fix vanilla roles tab being broken --- MiraAPI/Patches/Options/LobbyViewPanePatches.cs | 2 +- MiraAPI/Patches/Options/RoleSettingMenuPatches.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs index 5a4460d..dd80dc4 100644 --- a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs +++ b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs @@ -109,7 +109,7 @@ public static class LobbyViewPanePatches private static void Refresh(LobbyViewSettingsPane menu) { ModifiersTabButton?.gameObject.SetActive(SelectedModIdx != 0); - menu.gameModeText.text = SelectedMod?.PluginInfo.Metadata.Name ?? "Default"; + menu.gameModeText.text = SelectedMod?.PluginInfo.Metadata.Name ?? "Main"; menu.RefreshTab(); menu.scrollBar.ScrollToTop(); } diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index b6f61c4..cb1283b 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -152,7 +152,7 @@ public static class RoleSettingMenuPatches } Info($"Created {num3} role options for the default game."); - yield return null; + yield break; } ScrollerNum = 0.522f;