From 8b55463fa02fa8ea1aab0da1d2f321f34b919e91 Mon Sep 17 00:00:00 2001 From: XtraCube <72575280+XtraCube@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:27:45 -0400 Subject: [PATCH] getting rid of IDE warnings --- MiraAPI.Example/CustomRole.cs | 2 +- MiraAPI.Example/CustomRole2.cs | 2 +- MiraAPI.Example/CustomRoleSettings.cs | 6 +++--- MiraAPI.Example/ExampleOptions.cs | 10 +++++----- MiraAPI.Example/SomeRandomNonGroupClass.cs | 4 ++-- MiraAPI/GameModes/CustomGameModeManager.cs | 2 +- MiraAPI/Patches/GameModes/ConsolePatches.cs | 6 +----- MiraAPI/Patches/GameModes/DeadBodyPatch.cs | 5 +---- MiraAPI/Patches/GameModes/GameLogicPatches.cs | 5 +---- MiraAPI/Patches/GameModes/ImpostorTargetPatch.cs | 5 +---- MiraAPI/Patches/GameModes/MapBehaviourPatch.cs | 5 +---- MiraAPI/Patches/GameModes/OnDeathPatch.cs | 5 +---- MiraAPI/Patches/GameModes/VentPatches.cs | 8 +------- MiraAPI/Patches/HudManagerPatches.cs | 1 - MiraAPI/Patches/IntroCutscenePatches.cs | 1 - MiraAPI/Patches/PlayerControlPatches.cs | 2 +- MiraAPI/Patches/Roles/TaskAdderPatch.cs | 8 ++++---- 17 files changed, 25 insertions(+), 52 deletions(-) diff --git a/MiraAPI.Example/CustomRole.cs b/MiraAPI.Example/CustomRole.cs index 47b361b..84c9274 100644 --- a/MiraAPI.Example/CustomRole.cs +++ b/MiraAPI.Example/CustomRole.cs @@ -15,6 +15,6 @@ public class CustomRole : ImpostorRole, ICustomRole public ModdedRoleTeams Team => ModdedRoleTeams.Impostor; public LoadableAsset OptionsScreenshot => MiraAssets.Banner; - [ModdedNumberOption("Testing level", min: 3, max: 9, roleType: typeof(CustomRole))] public float testingLevel { get; set; } = 4; + [ModdedNumberOption("Testing level", min: 3, max: 9, roleType: typeof(CustomRole))] public float TestingLevel { get; set; } = 4; } \ No newline at end of file diff --git a/MiraAPI.Example/CustomRole2.cs b/MiraAPI.Example/CustomRole2.cs index 3033a12..e03e057 100644 --- a/MiraAPI.Example/CustomRole2.cs +++ b/MiraAPI.Example/CustomRole2.cs @@ -15,6 +15,6 @@ public class CustomRole2 : CrewmateRole, ICustomRole public ModdedRoleTeams Team => ModdedRoleTeams.Crewmate; public LoadableAsset OptionsScreenshot => MiraAssets.Banner; - [ModdedToggleOption("Teleportation ability", roleType: typeof(CustomRole2))] public bool teleport { get; set; } = true; + [ModdedToggleOption("Teleportation ability", roleType: typeof(CustomRole2))] public bool Teleport { get; set; } = true; } \ No newline at end of file diff --git a/MiraAPI.Example/CustomRoleSettings.cs b/MiraAPI.Example/CustomRoleSettings.cs index 34cb47a..d8f6d7c 100644 --- a/MiraAPI.Example/CustomRoleSettings.cs +++ b/MiraAPI.Example/CustomRoleSettings.cs @@ -11,9 +11,9 @@ public class CustomRoleSettings : IModdedOptionGroup public Type AdvancedRole => typeof(CustomRole); - [ModdedNumberOption("amogus", min: 3, max: 9)] public float amogus { get; set; } = 1; + [ModdedNumberOption("amogus", min: 3, max: 9)] public float Amogus { get; set; } = 1; - [ModdedEnumOption("dwayne the rock johnson", typeof(TestEnum))] public TestEnum dwayneTheRockJohnson { get; set; } = TestEnum.Hello; + [ModdedEnumOption("dwayne the rock johnson", typeof(TestEnum))] public TestEnum DwayneTheRockJohnson { get; set; } = TestEnum.Hello; - public ModdedToggleOption testToggle { get; } = new ("test toggle", false); + public ModdedToggleOption TestToggle { get; } = new ("test toggle", false); } \ No newline at end of file diff --git a/MiraAPI.Example/ExampleOptions.cs b/MiraAPI.Example/ExampleOptions.cs index 4160189..0cbb0e3 100644 --- a/MiraAPI.Example/ExampleOptions.cs +++ b/MiraAPI.Example/ExampleOptions.cs @@ -10,19 +10,19 @@ public class ExampleOptions : IModdedOptionGroup public Color GroupColor => Color.red; [ModdedToggleOption("Use Thing")] - public bool useThing { get; set; } = false; + public bool UseThing { get; set; } = false; [ModdedToggleOption("Use another thing")] - public bool useAnotherThing { get; set; } = true; + public bool UseAnotherThing { get; set; } = true; [ModdedNumberOption("Sussy level", min: 0, max: 10)] - public float sussyLevel { get; set; } = 4f; + public float SussyLevel { get; set; } = 4f; [ModdedStringOption("Sus choices", ["hello", "hello 2", "hello 3"])] - public int susChoices { get; set; } = 2; + public int SusChoices { get; set; } = 2; [ModdedEnumOption("Enum test", typeof(TestEnum))] - public TestEnum enumTest { get; set; } = TestEnum.Bye; + public TestEnum EnumTest { get; set; } = TestEnum.Bye; } public enum TestEnum diff --git a/MiraAPI.Example/SomeRandomNonGroupClass.cs b/MiraAPI.Example/SomeRandomNonGroupClass.cs index 7e57075..b931ef6 100644 --- a/MiraAPI.Example/SomeRandomNonGroupClass.cs +++ b/MiraAPI.Example/SomeRandomNonGroupClass.cs @@ -4,6 +4,6 @@ namespace MiraAPI.Example; public class SomeRandomNonGroupClass { - [ModdedStringOption("Yeah, idk", ["Idk 1", "idk 2", "idk 3", "idk 4"])] public static int yeaIdk { get; set; } = 3; - [ModdedNumberOption("Aw man", min: 45, max: 95)] public float sussyLevel { get; set; } = 63; + [ModdedStringOption("Yeah, idk", ["Idk 1", "idk 2", "idk 3", "idk 4"])] public static int YeaIdk { get; set; } = 3; + [ModdedNumberOption("Aw man", min: 45, max: 95)] public float SussyLevel { get; set; } = 63; } \ No newline at end of file diff --git a/MiraAPI/GameModes/CustomGameModeManager.cs b/MiraAPI/GameModes/CustomGameModeManager.cs index 9426a2b..9fe2ce2 100644 --- a/MiraAPI/GameModes/CustomGameModeManager.cs +++ b/MiraAPI/GameModes/CustomGameModeManager.cs @@ -49,7 +49,7 @@ public static class CustomGameModeManager { if (!typeof(CustomGameMode).IsAssignableFrom(gameModeType)) { - Logger.Warning($"{gameModeType?.Name} does not inherit CustomGameMode!"); + Logger.Warning($"{gameModeType.Name} does not inherit CustomGameMode!"); return; } diff --git a/MiraAPI/Patches/GameModes/ConsolePatches.cs b/MiraAPI/Patches/GameModes/ConsolePatches.cs index c19a554..50248e7 100644 --- a/MiraAPI/Patches/GameModes/ConsolePatches.cs +++ b/MiraAPI/Patches/GameModes/ConsolePatches.cs @@ -1,8 +1,4 @@ -using HarmonyLib; -using InnerNet; -using MiraAPI.GameModes; - -namespace MiraAPI.Patches.GameModes; + /* [HarmonyPatch] public static class ConsolePatches diff --git a/MiraAPI/Patches/GameModes/DeadBodyPatch.cs b/MiraAPI/Patches/GameModes/DeadBodyPatch.cs index e61a52c..edd4e58 100644 --- a/MiraAPI/Patches/GameModes/DeadBodyPatch.cs +++ b/MiraAPI/Patches/GameModes/DeadBodyPatch.cs @@ -1,7 +1,4 @@ -using HarmonyLib; -using MiraAPI.GameModes; - -namespace MiraAPI.Patches.GameModes; + /* [HarmonyPatch(typeof(DeadBody))] diff --git a/MiraAPI/Patches/GameModes/GameLogicPatches.cs b/MiraAPI/Patches/GameModes/GameLogicPatches.cs index fee4cc4..77eca63 100644 --- a/MiraAPI/Patches/GameModes/GameLogicPatches.cs +++ b/MiraAPI/Patches/GameModes/GameLogicPatches.cs @@ -1,7 +1,4 @@ -using HarmonyLib; -using MiraAPI.GameModes; - -namespace MiraAPI.Patches.GameModes; + /* [HarmonyPatch] diff --git a/MiraAPI/Patches/GameModes/ImpostorTargetPatch.cs b/MiraAPI/Patches/GameModes/ImpostorTargetPatch.cs index 7657fde..58f1187 100644 --- a/MiraAPI/Patches/GameModes/ImpostorTargetPatch.cs +++ b/MiraAPI/Patches/GameModes/ImpostorTargetPatch.cs @@ -1,7 +1,4 @@ -using HarmonyLib; -using MiraAPI.GameModes; - -namespace MiraAPI.Patches.GameModes; + /* /// diff --git a/MiraAPI/Patches/GameModes/MapBehaviourPatch.cs b/MiraAPI/Patches/GameModes/MapBehaviourPatch.cs index 07512ec..8f17b99 100644 --- a/MiraAPI/Patches/GameModes/MapBehaviourPatch.cs +++ b/MiraAPI/Patches/GameModes/MapBehaviourPatch.cs @@ -1,7 +1,4 @@ -using HarmonyLib; -using MiraAPI.GameModes; - -namespace MiraAPI.Patches.GameModes; + /* [HarmonyPatch(typeof(MapBehaviour))] diff --git a/MiraAPI/Patches/GameModes/OnDeathPatch.cs b/MiraAPI/Patches/GameModes/OnDeathPatch.cs index e7589dd..275321d 100644 --- a/MiraAPI/Patches/GameModes/OnDeathPatch.cs +++ b/MiraAPI/Patches/GameModes/OnDeathPatch.cs @@ -1,7 +1,4 @@ -using HarmonyLib; -using MiraAPI.GameModes; - -namespace MiraAPI.Patches.GameModes; + /* [HarmonyPatch(typeof(KillAnimation))] diff --git a/MiraAPI/Patches/GameModes/VentPatches.cs b/MiraAPI/Patches/GameModes/VentPatches.cs index 7e53b98..a86aa46 100644 --- a/MiraAPI/Patches/GameModes/VentPatches.cs +++ b/MiraAPI/Patches/GameModes/VentPatches.cs @@ -1,10 +1,4 @@ -using HarmonyLib; -using MiraAPI.GameModes; -using MiraAPI.Roles; -using MiraAPI.Utilities; -using UnityEngine; - -namespace MiraAPI.Patches.GameModes; + /* [HarmonyPatch(typeof(Vent))] diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs index 9a1c56d..45cd890 100644 --- a/MiraAPI/Patches/HudManagerPatches.cs +++ b/MiraAPI/Patches/HudManagerPatches.cs @@ -1,6 +1,5 @@ using HarmonyLib; using InnerNet; -using MiraAPI.GameModes; using MiraAPI.Hud; using MiraAPI.Roles; using Reactor.Utilities.Extensions; diff --git a/MiraAPI/Patches/IntroCutscenePatches.cs b/MiraAPI/Patches/IntroCutscenePatches.cs index 7b395a5..9d95896 100644 --- a/MiraAPI/Patches/IntroCutscenePatches.cs +++ b/MiraAPI/Patches/IntroCutscenePatches.cs @@ -1,5 +1,4 @@ using HarmonyLib; -using MiraAPI.GameModes; using MiraAPI.Roles; using MiraAPI.Utilities; using UnityEngine; diff --git a/MiraAPI/Patches/PlayerControlPatches.cs b/MiraAPI/Patches/PlayerControlPatches.cs index 41ae0a9..cf67604 100644 --- a/MiraAPI/Patches/PlayerControlPatches.cs +++ b/MiraAPI/Patches/PlayerControlPatches.cs @@ -21,7 +21,7 @@ public static class PlayerControlPatches foreach (var button in CustomButtonManager.CustomButtons) { - if (!button.Enabled(__instance.Data.Role)) + if (!button.Enabled(__instance.Data?.Role)) { continue; } diff --git a/MiraAPI/Patches/Roles/TaskAdderPatch.cs b/MiraAPI/Patches/Roles/TaskAdderPatch.cs index cba0b73..fc32e14 100644 --- a/MiraAPI/Patches/Roles/TaskAdderPatch.cs +++ b/MiraAPI/Patches/Roles/TaskAdderPatch.cs @@ -160,23 +160,23 @@ public static class TaskAdderPatch RoleBehaviour roleBehaviour = DestroyableSingleton.Instance.AllRoles[m]; if (roleBehaviour.Role != RoleTypes.ImpostorGhost && roleBehaviour.Role != RoleTypes.CrewmateGhost && !CustomRoleManager.CustomRoles.ContainsKey((ushort)roleBehaviour.Role)) { - TaskAddButton taskAddButton2 = Object.Instantiate(__instance.RoleButton); + TaskAddButton taskAddButton2 = Object.Instantiate(__instance.RoleButton); taskAddButton2.SafePositionWorld = __instance.SafePositionWorld; taskAddButton2.Text.text = "Be_" + roleBehaviour.NiceName + ".exe"; __instance.AddFileAsChild(RolesFolder, taskAddButton2, ref num, ref num2, ref num3); taskAddButton2.Role = roleBehaviour; if (taskAddButton2 != null && taskAddButton2.Button != null) { - ControllerManager.Instance.AddSelectableUiElement(taskAddButton2.Button, false); + ControllerManager.Instance.AddSelectableUiElement(taskAddButton2.Button); if (m == 0 && __instance.restorePreviousSelectionFound != null) { - ControllerManager.Instance.SetDefaultSelection(__instance.restorePreviousSelectionFound, null); + ControllerManager.Instance.SetDefaultSelection(__instance.restorePreviousSelectionFound); __instance.restorePreviousSelectionByFolderName = string.Empty; __instance.restorePreviousSelectionFound = null; } else if (m == 0) { - ControllerManager.Instance.SetDefaultSelection(taskAddButton2.Button, null); + ControllerManager.Instance.SetDefaultSelection(taskAddButton2.Button); } } }