From 1f3e21ce19618059dfd751c1bd2d4b53bde9fb4d Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Sun, 18 May 2025 10:01:48 -0400 Subject: [PATCH] cleanup more warnings --- MiraAPI/GameOptions/IModdedOption.cs | 58 +++++++++++++++++++++ MiraAPI/GameOptions/ModdedOptionsManager.cs | 2 + MiraAPI/Patches/.editorconfig | 5 ++ MiraAPI/Roles/ModdedRoleTeams.cs | 14 +++++ MiraAPI/Roles/RoleId.cs | 17 +++++- MiraAPI/Utilities/MiraNumberSuffixes.cs | 19 +++++++ 6 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 MiraAPI/Patches/.editorconfig diff --git a/MiraAPI/GameOptions/IModdedOption.cs b/MiraAPI/GameOptions/IModdedOption.cs index f40f3cf..86baf9d 100644 --- a/MiraAPI/GameOptions/IModdedOption.cs +++ b/MiraAPI/GameOptions/IModdedOption.cs @@ -6,18 +6,76 @@ using UnityEngine; namespace MiraAPI.GameOptions; +/// +/// Interface for modded options. +/// public interface IModdedOption { + /// + /// Gets the unique identifier for the option. + /// uint Id { get; } + + /// + /// Gets the title of the option. + /// string Title { get; } + + /// + /// Gets the StringName for the option, used for localization. + /// StringNames StringName { get; } + + /// + /// Gets or sets the MiraPlugin that created this option. + /// IMiraPlugin? ParentMod { get; set; } + + /// + /// Gets the game setting data for the option. + /// BaseGameSetting Data { get; } + + /// + /// Gets the OptionBehaviour object of the option. + /// OptionBehaviour? OptionBehaviour { get; } + + /// + /// Gets or sets the visibility function for the option. + /// Func Visible { get; set; } + + /// + /// Gets or sets the ConfigDefinition 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 Transform container for the option. + /// >The created OptionBehaviour object. OptionBehaviour CreateOption(ToggleOption toggleOpt, NumberOption numberOpt, StringOption stringOpt, Transform container); + + /// + /// Gets the value as a float. + /// + /// >The value of the option as a float. float GetFloatData(); + + /// + /// Gets the NetData for the option, used for network synchronization. + /// + /// >Returns the NetData object for the option. NetData GetNetData(); + + /// + /// Handles incoming network data for the option. + /// + /// >The byte array representing the network data. void HandleNetData(byte[] data); } diff --git a/MiraAPI/GameOptions/ModdedOptionsManager.cs b/MiraAPI/GameOptions/ModdedOptionsManager.cs index c3e7e22..4d28884 100644 --- a/MiraAPI/GameOptions/ModdedOptionsManager.cs +++ b/MiraAPI/GameOptions/ModdedOptionsManager.cs @@ -175,6 +175,7 @@ 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; @@ -188,6 +189,7 @@ 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/.editorconfig b/MiraAPI/Patches/.editorconfig new file mode 100644 index 0000000..1afcd96 --- /dev/null +++ b/MiraAPI/Patches/.editorconfig @@ -0,0 +1,5 @@ +[*.{cs,vb}] +dotnet_diagnostic.CA1707.severity = none +dotnet_diagnostic.CS1591.severity = none +dotnet_diagnostic.SA1611.severity = none +dotnet_diagnostic.SA1615.severity = none \ No newline at end of file diff --git a/MiraAPI/Roles/ModdedRoleTeams.cs b/MiraAPI/Roles/ModdedRoleTeams.cs index 0d8c6a1..8661060 100644 --- a/MiraAPI/Roles/ModdedRoleTeams.cs +++ b/MiraAPI/Roles/ModdedRoleTeams.cs @@ -1,8 +1,22 @@ namespace MiraAPI.Roles; +/// +/// Enum for modded role teams. +/// public enum ModdedRoleTeams { + /// + /// The crewmate team. + /// Crewmate, + + /// + /// The impostor team. + /// Impostor, + + /// + /// Custom team, catchall for any other teams. + /// Custom, } diff --git a/MiraAPI/Roles/RoleId.cs b/MiraAPI/Roles/RoleId.cs index 05f9cd0..91044fb 100644 --- a/MiraAPI/Roles/RoleId.cs +++ b/MiraAPI/Roles/RoleId.cs @@ -2,9 +2,18 @@ namespace MiraAPI.Roles; +/// +/// Utility class to get the ID of a role. +/// public static class RoleId { - public static ushort Get() where T : RoleBehaviour + /// + /// Gets the ID of a role. + /// + /// The type of the role. + /// The role ID as a ushort. + /// Thrown when the role is not registered. + public static ushort Get() where T : ICustomRole { if (!CustomRoleManager.RoleIds.TryGetValue(typeof(T), out var roleId)) { @@ -14,6 +23,12 @@ public static class RoleId return roleId; } + /// + /// Gets the ID of a role. + /// + /// The type of the role. + /// The ID as a ushort. + /// Thrown when the role is not registered. public static ushort Get(Type type) { if (!CustomRoleManager.RoleIds.TryGetValue(type, out var roleId)) diff --git a/MiraAPI/Utilities/MiraNumberSuffixes.cs b/MiraAPI/Utilities/MiraNumberSuffixes.cs index 20ed21c..2f55226 100644 --- a/MiraAPI/Utilities/MiraNumberSuffixes.cs +++ b/MiraAPI/Utilities/MiraNumberSuffixes.cs @@ -1,8 +1,27 @@ namespace MiraAPI.Utilities; + +/// +/// Suffixes used for options numbers. +/// public enum MiraNumberSuffixes { + /// + /// No suffix. + /// None, + + /// + /// Multiplier suffix (x). + /// Multiplier, + + /// + /// Seconds suffix (s). + /// Seconds, + + /// + /// Percentage suffix (%). + /// Percent, }