From 98dd5ca05675dc0f8c0aa8a480a617e55af23e80 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Sun, 18 May 2025 12:40:40 -0400 Subject: [PATCH 1/3] fix more warnings --- MiraAPI/GameModes/.editorconfig | 2 ++ MiraAPI/GameOptions/ModdedOptionsManager.cs | 2 -- MiraAPI/Patches/GameModes/.editorconfig | 2 ++ MiraAPI/PluginLoading/IMiraPlugin.cs | 11 +++++++++++ MiraAPI/PluginLoading/MiraPluginManager.cs | 4 ++-- 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 MiraAPI/GameModes/.editorconfig create mode 100644 MiraAPI/Patches/GameModes/.editorconfig diff --git a/MiraAPI/GameModes/.editorconfig b/MiraAPI/GameModes/.editorconfig new file mode 100644 index 0000000..948715b --- /dev/null +++ b/MiraAPI/GameModes/.editorconfig @@ -0,0 +1,2 @@ +[*.cs] +dotnet_diagnostic.CS1591.severity = none \ No newline at end of file diff --git a/MiraAPI/GameOptions/ModdedOptionsManager.cs b/MiraAPI/GameOptions/ModdedOptionsManager.cs index 4d28884..c3e7e22 100644 --- a/MiraAPI/GameOptions/ModdedOptionsManager.cs +++ b/MiraAPI/GameOptions/ModdedOptionsManager.cs @@ -175,7 +175,6 @@ public static class ModdedOptionsManager /// /// The original setter method. /// The new object value. - // ReSharper disable InconsistentNaming public static void PropertySetterPatch(MethodBase __originalMethod, object value) { var attribute = OptionAttributes.First(pair => pair.Key.GetSetMethod() == __originalMethod).Value; @@ -189,7 +188,6 @@ public static class ModdedOptionsManager /// The result of the property getter. /// False so the original getter gets skipped. public static bool PropertyGetterPatch(MethodBase __originalMethod, ref object __result) - // ReSharper restore InconsistentNaming { var attribute = OptionAttributes.First(pair => pair.Key.GetGetMethod() == __originalMethod).Value; __result = attribute.GetValue(); diff --git a/MiraAPI/Patches/GameModes/.editorconfig b/MiraAPI/Patches/GameModes/.editorconfig new file mode 100644 index 0000000..d825cc9 --- /dev/null +++ b/MiraAPI/Patches/GameModes/.editorconfig @@ -0,0 +1,2 @@ +[*.cs] +dotnet_diagnostic.S125.severity = none \ No newline at end of file diff --git a/MiraAPI/PluginLoading/IMiraPlugin.cs b/MiraAPI/PluginLoading/IMiraPlugin.cs index 07928da..af3d3d5 100644 --- a/MiraAPI/PluginLoading/IMiraPlugin.cs +++ b/MiraAPI/PluginLoading/IMiraPlugin.cs @@ -2,8 +2,19 @@ namespace MiraAPI.PluginLoading; +/// +/// The interface that all Mira plugins must implement. +/// public interface IMiraPlugin { + /// + /// Gets the name to display on the options menu. + /// string OptionsTitleText { get; } + + /// + /// Gets the BepInEx configuration file for the plugin. + /// + /// The BepInEx configuration file for the plugin. public ConfigFile GetConfigFile(); } diff --git a/MiraAPI/PluginLoading/MiraPluginManager.cs b/MiraAPI/PluginLoading/MiraPluginManager.cs index c68c8ce..7ae2e12 100644 --- a/MiraAPI/PluginLoading/MiraPluginManager.cs +++ b/MiraAPI/PluginLoading/MiraPluginManager.cs @@ -183,7 +183,7 @@ public sealed class MiraPluginManager ModdedOptionsManager.RegisterAttributeOption(type, attribute, property, pluginInfo); } - foreach (var field in type.GetFields().Where(f=>f.FieldType.IsAssignableTo(typeof(IModdedOption)))) + foreach (var field in type.GetFields().Where(f => f.FieldType.IsAssignableTo(typeof(IModdedOption)))) { Logger.Error($"{field.Name} is a field, not a property. Use properties for options."); } @@ -254,7 +254,7 @@ public sealed class MiraPluginManager PaletteManager.CustomColors.Add(color); } - foreach (var field in type.GetFields().Where(f=>f.FieldType.IsAssignableTo(typeof(CustomColor)))) + foreach (var field in type.GetFields().Where(f => f.FieldType.IsAssignableTo(typeof(CustomColor)))) { Logger.Error($"{field.Name} is a field, not a property. Use properties for colors."); } From 023cdaa4708cc47ec7a9ec43b43892a8b6b7fb4e Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Sun, 18 May 2025 14:46:24 -0400 Subject: [PATCH 2/3] fix role setting menu bug --- .../Patches/Options/GameSettingMenuPatches.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs index d18407d..647ad5d 100644 --- a/MiraAPI/Patches/Options/GameSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/GameSettingMenuPatches.cs @@ -397,6 +397,21 @@ internal static class GameSettingMenuPatches private static void CleanupTab(GameOptionsMenu settings, RolesSettingsMenu roles) { + if (roles.roleChances != null) + { + CleanupRoleSettings(roles); + } + + if (settings.Children != null) + { + CleanupSettings(settings); + } + + if (_modifiersTab?.Children?.Count > 0) + { + CleanupSettings(_modifiersTab); + } + void CleanupRoleSettings(RolesSettingsMenu rolesMenu) { if (rolesMenu.advancedSettingChildren != null) @@ -452,20 +467,5 @@ internal static class GameSettingMenuPatches gameOptMenu.scrollBar.ScrollToTop(); } } - - if (roles.roleChances != null && SelectedMod?.CustomRoles.Count > 0) - { - CleanupRoleSettings(roles); - } - - if (settings.Children != null && SelectedMod?.OptionGroups.Count > 0) - { - CleanupSettings(settings); - } - - if (_modifiersTab?.Children?.Count > 0) - { - CleanupSettings(_modifiersTab); - } } } From 1a6aed539abe6638f862e4d894df99078bd2a5a9 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Sun, 18 May 2025 14:49:40 -0400 Subject: [PATCH 3/3] fix lobbyview modifier options showing in game options --- MiraAPI/Patches/Options/LobbyViewPanePatches.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs index b98585d..d9ac09b 100644 --- a/MiraAPI/Patches/Options/LobbyViewPanePatches.cs +++ b/MiraAPI/Patches/Options/LobbyViewPanePatches.cs @@ -128,7 +128,7 @@ public static class LobbyViewPanePatches ModifiersTabButton?.SelectButton(true); var filteredGroups = SelectedMod.OptionGroups - .Where(x => x.GroupVisible() && (x.ShowInModifiersMenu || x.OptionableType?.IsAssignableTo(typeof(BaseModifier))==true)); + .Where(x => x.GroupVisible() && (x.ShowInModifiersMenu || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true)); DrawOptions(__instance, filteredGroups); return false; } @@ -143,7 +143,7 @@ public static class LobbyViewPanePatches } var filteredGroups = SelectedMod.OptionGroups - .Where(x => x.OptionableType == null && x.GroupVisible.Invoke()); + .Where(x => x is { ShowInModifiersMenu: false, OptionableType: null } && x.GroupVisible.Invoke()); DrawOptions(__instance, filteredGroups); return false; }