diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 486abb2b7..f791d8655 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -417,7 +417,7 @@ static class ExtendedPlayerControl _ = new LateTask(() => { pc.RpcDesyncRepairSystem(systemtypes, 16); - if (Main.NormalOptions.MapId == 4) //Airship用 + if (Main.NormalOptions.MapId == 4) // Airship only pc.RpcDesyncRepairSystem(systemtypes, 17); }, 0.4f + delay, "Fix Desync Reactor"); } diff --git a/Modules/HashAuth.cs b/Modules/HashAuth.cs index a2bbf0e4a..e19c38041 100644 --- a/Modules/HashAuth.cs +++ b/Modules/HashAuth.cs @@ -8,7 +8,7 @@ public class HashAuth public readonly string HashValue; private readonly string salt; - private HashAlgorithm algorithm; + private readonly HashAlgorithm algorithm; public HashAuth(string hashValue, string salt = null, HashAlgorithm algorithm = null) { HashValue = hashValue; diff --git a/Modules/LocateArrow.cs b/Modules/LocateArrow.cs index 1126474cb..33ff2092a 100644 --- a/Modules/LocateArrow.cs +++ b/Modules/LocateArrow.cs @@ -25,7 +25,7 @@ static class LocateArrow } } - static Dictionary LocateArrows = new(); + static readonly Dictionary LocateArrows = new(); static readonly string[] Arrows = { "↑", "↗", diff --git a/Modules/ModUpdater.cs b/Modules/ModUpdater.cs index f482e8e84..af70f92b2 100644 --- a/Modules/ModUpdater.cs +++ b/Modules/ModUpdater.cs @@ -306,7 +306,7 @@ public class ModUpdater byte[] buffer = new byte[1024]; long readLength = 0; int length; - while ((length = await stream.ReadAsync(buffer, 0, buffer.Length)) != 0) + while ((length = await stream.ReadAsync(buffer)) != 0) { // 写入到文件 fileStream.Write(buffer, 0, length); diff --git a/Modules/TargetArrow.cs b/Modules/TargetArrow.cs index 92ed27929..327be1ecd 100644 --- a/Modules/TargetArrow.cs +++ b/Modules/TargetArrow.cs @@ -26,7 +26,7 @@ static class TargetArrow } } - static Dictionary TargetArrows = new(); + static readonly Dictionary TargetArrows = new(); static readonly string[] Arrows = { "↑", "↗", diff --git a/Modules/TemplateManager.cs b/Modules/TemplateManager.cs index 0dc5bb004..6e90e4fe7 100644 --- a/Modules/TemplateManager.cs +++ b/Modules/TemplateManager.cs @@ -15,7 +15,7 @@ namespace TOHE; public static class TemplateManager { private static readonly string TEMPLATE_FILE_PATH = "./TOHE_DATA/template.txt"; - private static Dictionary> _replaceDictionary = new() + private static readonly Dictionary> _replaceDictionary = new() { ["RoomCode"] = () => InnerNet.GameCode.IntToGameName(AmongUsClient.Instance.GameId), ["PlayerName"] = () => DataManager.Player.Customization.Name, diff --git a/Patches/GameOptionsMenuPatch.cs b/Patches/GameOptionsMenuPatch.cs index f4f492265..89bf17246 100644 --- a/Patches/GameOptionsMenuPatch.cs +++ b/Patches/GameOptionsMenuPatch.cs @@ -160,8 +160,7 @@ public class GameOptionsMenuUpdatePatch for (int i = 0; i < list.Count; i++) { object tab = list[i]; - string tabcolor = string.Empty; - tabcolor = tab switch + string tabcolor = tab switch { TabGroup.SystemSettings => Main.ModColor, TabGroup.GameSettings => "#59ef83", diff --git a/Patches/onGameStartedPatch.cs b/Patches/onGameStartedPatch.cs index 698006939..b34ced7f8 100644 --- a/Patches/onGameStartedPatch.cs +++ b/Patches/onGameStartedPatch.cs @@ -1000,7 +1000,7 @@ internal class SelectRolesPatch GameOptionsSender.AllSenders.Add(new PlayerGameOptionsSender(pc)); } - // ResetCamが必要なプレイヤーのリストにクラス化が済んでいない役職のプレイヤーを追加 + // Added players with unclassified roles to the list of players who require ResetCam. Main.ResetCamPlayerList.AddRange(Main.AllPlayerControls.Where(p => p.GetCustomRole() is CustomRoles.Arsonist or CustomRoles.Revolutionist or CustomRoles.Sidekick or CustomRoles.KB_Normal).Select(p => p.PlayerId)); Utils.CountAlivePlayers(true); Utils.SyncAllSettings();