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) {