diff --git a/TheOtherRoles/Buttons/CustomButton.cs b/TheOtherRoles/Buttons/CustomButton.cs index 49f5a56c..82ccc441 100644 --- a/TheOtherRoles/Buttons/CustomButton.cs +++ b/TheOtherRoles/Buttons/CustomButton.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; -using System.Linq; using TheOtherRoles.Utilities; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; -using Object = UnityEngine.Object; using static TheOtherRoles.Buttons.HudManagerStartPatch; +using Object = UnityEngine.Object; namespace TheOtherRoles.Buttons; diff --git a/TheOtherRoles/Modules/LateTask.cs b/TheOtherRoles/Modules/LateTask.cs index 30cfb1e1..1853335d 100644 --- a/TheOtherRoles/Modules/LateTask.cs +++ b/TheOtherRoles/Modules/LateTask.cs @@ -54,7 +54,7 @@ public static void Update(float deltaTime) } [HarmonyPatch(typeof(ModManager), nameof(ModManager.LateUpdate))] -class ModManagerLateUpdatePatch +internal class ModManagerLateUpdatePatch { public static void Prefix(ModManager __instance) { diff --git a/TheOtherRoles/Modules/ModTranslation.cs b/TheOtherRoles/Modules/ModTranslation.cs index 549f15c2..f251aad0 100644 --- a/TheOtherRoles/Modules/ModTranslation.cs +++ b/TheOtherRoles/Modules/ModTranslation.cs @@ -82,13 +82,4 @@ internal static string Translate(this string key) { return getString(key); } -} - -[HarmonyPatch(typeof(LanguageSetter), nameof(LanguageSetter.SetLanguage))] -class SetLanguagePatch -{ - static void Postfix() - { - //ClientOptionsPatch.updateTranslations(); - } } \ No newline at end of file diff --git a/TheOtherRoles/Modules/ModUpdater.cs b/TheOtherRoles/Modules/ModUpdater.cs index 2a16ddfc..95f88281 100644 --- a/TheOtherRoles/Modules/ModUpdater.cs +++ b/TheOtherRoles/Modules/ModUpdater.cs @@ -198,13 +198,13 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode) public IEnumerator CoShowAnnouncement(string announcement, bool show = true, string shortTitle = "TOUE Update", string title = "", string date = "") { var mgr = FindObjectOfType(true); - var popUpTemplate = UnityEngine.Object.FindObjectOfType(true); + var popUpTemplate = FindObjectOfType(true); if (popUpTemplate == null) { Error("couldnt show credits, popUp is null"); yield return null; } - var popUp = UnityEngine.Object.Instantiate(popUpTemplate); + var popUp = Instantiate(popUpTemplate); popUp.gameObject.SetActive(true); diff --git a/TheOtherRoles/Patches/ExileControllerPatch.cs b/TheOtherRoles/Patches/ExileControllerPatch.cs index 15877632..5dd19935 100644 --- a/TheOtherRoles/Patches/ExileControllerPatch.cs +++ b/TheOtherRoles/Patches/ExileControllerPatch.cs @@ -20,7 +20,7 @@ internal class ExileControllerBeginPatch { public static GameData.PlayerInfo lastExiled; public static TextMeshPro confirmImpostorSecondText; - static bool IsSec; + private static bool IsSec; public static bool Prefix(ExileController __instance, [HarmonyArgument(0)] ref GameData.PlayerInfo exiled, [HarmonyArgument(1)] bool tie) { lastExiled = exiled; diff --git a/TheOtherRoles/Patches/LobbyRoleList.cs b/TheOtherRoles/Patches/LobbyRoleList.cs index cec6c90a..9a288615 100644 --- a/TheOtherRoles/Patches/LobbyRoleList.cs +++ b/TheOtherRoles/Patches/LobbyRoleList.cs @@ -181,7 +181,8 @@ public static void roleInfosOnclick(string team, RoleTeam teamId) count++; } } - static void AddInfoCard(RoleInfo roleInfo) + + private static void AddInfoCard(RoleInfo roleInfo) { string roleSettingDescription = roleInfo.FullDescription != "" ? roleInfo.FullDescription : roleInfo.ShortDescription; string coloredHelp = cs(Color.white, roleSettingDescription); @@ -216,7 +217,7 @@ static void AddInfoCard(RoleInfo roleInfo) } [HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.Start))] -class GameStartPatch +internal class GameStartPatch { public static void Prefix(ShipStatus __instance) { diff --git a/TheOtherRoles/Patches/MeetingHudPatch.cs b/TheOtherRoles/Patches/MeetingHudPatch.cs index 9dfe1557..69d4722e 100644 --- a/TheOtherRoles/Patches/MeetingHudPatch.cs +++ b/TheOtherRoles/Patches/MeetingHudPatch.cs @@ -482,7 +482,7 @@ private static bool Prefix(MeetingHud __instance) { if (playerVoteArea.VotedFor != Balancer.targetplayerright.PlayerId && playerVoteArea.VotedFor != Balancer.targetplayerleft.PlayerId) { - playerVoteArea.VotedFor = Helpers.GetRandom([Balancer.targetplayerright.PlayerId, Balancer.targetplayerleft.PlayerId]); + playerVoteArea.VotedFor = Helpers.GetRandom((byte[])([Balancer.targetplayerright.PlayerId, Balancer.targetplayerleft.PlayerId])); } } diff --git a/TheOtherRoles/Patches/TaskCountPatch.cs b/TheOtherRoles/Patches/TaskCountPatch.cs index 46602251..2f144a9b 100644 --- a/TheOtherRoles/Patches/TaskCountPatch.cs +++ b/TheOtherRoles/Patches/TaskCountPatch.cs @@ -8,15 +8,15 @@ namespace TheOtherRoles.Patches; -class TaskCount +internal class TaskCount { public static bool WireTaskIsRandom => CustomOptionHolder.WireTaskIsRandomOption.getBool(); public static int WireTaskNum => CustomOptionHolder.WireTaskNumOption.GetInt(); [HarmonyPatch(typeof(NormalPlayerTask), nameof(NormalPlayerTask.Initialize))] - class NormalPlayerTaskInitializePatch + private class NormalPlayerTaskInitializePatch { - static void Postfix(NormalPlayerTask __instance) + private static void Postfix(NormalPlayerTask __instance) { if (__instance.TaskType != TaskTypes.FixWiring || !WireTaskIsRandom) return; List orgList = MapUtilities.CachedShipStatus.AllConsoles.Where((Console t) => t.TaskTypes.Contains(__instance.TaskType)).ToList(); @@ -28,7 +28,7 @@ static void Postfix(NormalPlayerTask __instance) { if (list.Count == 0) list = new List(orgList); - int index = GetRandomIndex(list); + int index = GetRandom(list); __instance.Data[i] = (byte)list[index].ConsoleId; list.RemoveAt(index); } diff --git a/TheOtherRoles/Roles/Crewmate/Balancer.cs b/TheOtherRoles/Roles/Crewmate/Balancer.cs index cd3a8298..9f8b0ef4 100644 --- a/TheOtherRoles/Roles/Crewmate/Balancer.cs +++ b/TheOtherRoles/Roles/Crewmate/Balancer.cs @@ -393,9 +393,14 @@ private static void BalancerOnClick(int Index, MeetingHud __instance) if (currentTarget == null) { currentTarget = Target; - __instance.playerStates.ForEach(x => { if (x.TargetPlayerId == currentTarget.PlayerId && x.transform.FindChild("BalancerButton") != null) x.transform.FindChild("BalancerButton").gameObject.SetActive(false); }); + __instance.playerStates.ForEach(x => + { + if (x.TargetPlayerId == currentTarget.PlayerId && x.transform.FindChild("BalancerButton") != null) + x.transform.FindChild("BalancerButton").gameObject.SetActive(false); + }); return; } + IsAbilityUsed--; if (balancer.IsDead()) return; var writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.BalancerBalance, SendOption.Reliable); @@ -404,8 +409,10 @@ private static void BalancerOnClick(int Index, MeetingHud __instance) writer.Write(Target.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.balancerBalance(PlayerControl.LocalPlayer.PlayerId, currentTarget.PlayerId, Target.PlayerId); - IsAbilityUsed--; - __instance.playerStates.ForEach(x => { if (x.transform.FindChild("BalancerButton") != null) Object.Destroy(x.transform.FindChild("BalancerButton").gameObject); }); + __instance.playerStates.ForEach(x => + { + if (x.transform.FindChild("BalancerButton") != null) Object.Destroy(x.transform.FindChild("BalancerButton").gameObject); + }); } private static void Event(MeetingHud __instance) diff --git a/TheOtherRoles/Roles/Crewmate/Prosecutor.cs b/TheOtherRoles/Roles/Crewmate/Prosecutor.cs index f70026a7..341b0076 100644 --- a/TheOtherRoles/Roles/Crewmate/Prosecutor.cs +++ b/TheOtherRoles/Roles/Crewmate/Prosecutor.cs @@ -229,7 +229,7 @@ public static void Prefix(GameObject obj) [HarmonyPatch(typeof(ExileController), nameof(ExileController.Begin))] [HarmonyPriority(Priority.First)] -class ExileControllerPatch +internal class ExileControllerPatch { public static ExileController lastExiled; public static void Prefix(ExileController __instance) diff --git a/TheOtherRoles/Roles/Guesser.cs b/TheOtherRoles/Roles/Guesser.cs index c808c2c5..d426ca39 100644 --- a/TheOtherRoles/Roles/Guesser.cs +++ b/TheOtherRoles/Roles/Guesser.cs @@ -50,7 +50,7 @@ public static int remainingShots(byte playerId, bool shoot = false) public static int Page; public static byte guesserCurrentTarget; - static void guesserSelectRole(RoleTeam Role, bool SetPage = true) + private static void guesserSelectRole(RoleTeam Role, bool SetPage = true) { currentTeamType = Role; if (SetPage) Page = 1;