mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-19 15:51:58 +00:00
Replace DestroyableSingleton with direct access
This commit is contained in:
1 parent
1c0f8f93d9
commit
026bd1e05b
30 files changed
+123
-144
No files matched your search
+14
-6
@@ -316,7 +316,10 @@ public static class Mingle
|
||||
|
||||
public static void HandleDisconnect()
|
||||
{
|
||||
RequiredPlayerCount[AllRooms.First(x => RequiredPlayerCount.TryGetValue(x, out var required) && GetNumPlayersInRoom(x) < required)]--;
|
||||
SystemTypes decreaseRoom = AllRooms.First(x => RequiredPlayerCount.TryGetValue(x, out var required) && GetNumPlayersInRoom(x) < required);
|
||||
|
||||
if (RequiredPlayerCount[decreaseRoom] <= 1) RequiredPlayerCount.Remove(decreaseRoom);
|
||||
else RequiredPlayerCount[decreaseRoom]--;
|
||||
}
|
||||
|
||||
public static class FixedUpdatePatch
|
||||
@@ -339,12 +342,17 @@ public static class Mingle
|
||||
KillPlayers();
|
||||
StartNewRound();
|
||||
}
|
||||
else if (RequiredPlayerCount.All(x => GetNumPlayersInRoom(x.Key) == x.Value))
|
||||
else
|
||||
{
|
||||
Main.AllAlivePlayerControls.NotifyPlayers(Utils.ColorString(Color.green, "✓"), 3f);
|
||||
Time = Math.Max(Time - TimeDecreaseOnNoDeath, MinTime);
|
||||
StartNewRound();
|
||||
return;
|
||||
Dictionary<SystemTypes, int> numPlayersInRoom = Main.AllAlivePlayerControls.Select(x => (pc: x, room: x.GetPlainShipRoom())).GroupBy(x => x.room == null ? SystemTypes.Outside : x.room.RoomId).ToDictionary(x => x.Key, x => x.Count());
|
||||
|
||||
if (RequiredPlayerCount.All(x => numPlayersInRoom.GetValueOrDefault(x.Key, 0) == x.Value))
|
||||
{
|
||||
Main.AllAlivePlayerControls.NotifyPlayers(Utils.ColorString(Color.green, "✓"), 3f);
|
||||
Time = Math.Max(Time - TimeDecreaseOnNoDeath, MinTime);
|
||||
StartNewRound();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Utils.NotifyRoles();
|
||||
|
||||
@@ -50,7 +50,7 @@ public static class AutoHaunt
|
||||
HauntMenuMinigameSetHauntTargetPatch.Prefix(HauntMenuMinigameStartPatch.Instance, preferredTarget);
|
||||
}
|
||||
else
|
||||
FastDestroyableSingleton<HudManager>.Instance.AbilityButton.DoClick();
|
||||
HudManager.Instance.AbilityButton.DoClick();
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(5f);
|
||||
|
||||
@@ -27,7 +27,7 @@ public static class ChatBubbleShower
|
||||
(string message, string title) = Queue.First();
|
||||
Queue.Remove((message, title));
|
||||
|
||||
ChatController chat = FastDestroyableSingleton<HudManager>.Instance.Chat;
|
||||
ChatController chat = HudManager.Instance.Chat;
|
||||
|
||||
if (GameStates.IsMeeting || chat.IsOpenOrOpening) ShowBubbleWithoutPlayer();
|
||||
else if (GameStates.IsLobby) Utils.SendMessage(message, PlayerControl.LocalPlayer.PlayerId, title);
|
||||
|
||||
@@ -2039,7 +2039,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
ReportDeadBodyPatch.AfterReportTasks(reporter, target);
|
||||
MeetingRoomManager.Instance.AssignSelf(reporter, target);
|
||||
FastDestroyableSingleton<HudManager>.Instance.OpenMeetingRoom(reporter);
|
||||
HudManager.Instance.OpenMeetingRoom(reporter);
|
||||
reporter.RpcStartMeeting(target);
|
||||
}
|
||||
|
||||
@@ -2282,7 +2282,7 @@ internal static class ExtendedPlayerControl
|
||||
if (Main.UserData.TryGetValue(pc.FriendCode, out Options.UserData userData) && !string.IsNullOrWhiteSpace(userData.Tag) && userData.Tag.Length > 0) return true;
|
||||
|
||||
ClientData client = pc.GetClient();
|
||||
return client != null && FriendsListManager.InstanceExists && FastDestroyableSingleton<FriendsListManager>.Instance.IsPlayerFriend(client.ProductUserId);
|
||||
return client != null && FriendsListManager.InstanceExists && FriendsListManager.Instance.IsPlayerFriend(client.ProductUserId);
|
||||
}
|
||||
|
||||
public static bool IsBeginner(this PlayerControl pc)
|
||||
|
||||
@@ -46,37 +46,6 @@ public static class ObjectHelper
|
||||
}
|
||||
}
|
||||
|
||||
// From: https://github.com/TheOtherRolesAU/TheOtherRoles/blob/a5126c5d1eae15e8a9def2dc27dc1e3f63681f2c/TheOtherRoles/Utilities/FastDestroyableSingleton.cs
|
||||
public static unsafe class FastDestroyableSingleton<T> where T : MonoBehaviour
|
||||
{
|
||||
private static readonly IntPtr FieldPtr;
|
||||
private static readonly Func<IntPtr, T> CreateObject;
|
||||
|
||||
static FastDestroyableSingleton()
|
||||
{
|
||||
FieldPtr = IL2CPP.GetIl2CppField(Il2CppClassPointerStore<DestroyableSingleton<T>>.NativeClassPtr, nameof(DestroyableSingleton<T>._instance));
|
||||
ConstructorInfo constructor = typeof(T).GetConstructor([typeof(IntPtr)]);
|
||||
ParameterExpression ptr = Expression.Parameter(typeof(IntPtr));
|
||||
NewExpression create = Expression.New(constructor!, ptr);
|
||||
Expression<Func<IntPtr, T>> lambda = Expression.Lambda<Func<IntPtr, T>>(create, ptr);
|
||||
CreateObject = lambda.Compile();
|
||||
}
|
||||
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ANDROID
|
||||
return DestroyableSingleton<T>.Instance;
|
||||
#else
|
||||
IntPtr objectPointer;
|
||||
IL2CPP.il2cpp_field_static_get_value(FieldPtr, &objectPointer);
|
||||
return objectPointer == IntPtr.Zero ? DestroyableSingleton<T>.Instance : CreateObject(objectPointer);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The codes below I stole from TommyXL
|
||||
public static class Il2CppCastHelper
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ public static class FixedUpdateCaller
|
||||
|
||||
if (HudManager.InstanceExists)
|
||||
{
|
||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hudManager = HudManager.Instance;
|
||||
|
||||
if (hudManager)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public static class FixedUpdateCaller
|
||||
List<PlayerControl> players = PlayerControl.LocalPlayer.GetPlayersInAbilityRangeSorted(predicate);
|
||||
PlayerControl closest = players.Count == 0 ? null : players[0];
|
||||
|
||||
KillButton killButton = FastDestroyableSingleton<HudManager>.Instance.KillButton;
|
||||
KillButton killButton = HudManager.Instance.KillButton;
|
||||
|
||||
if (killButton.currentTarget && killButton.currentTarget != closest)
|
||||
killButton.currentTarget.ToggleHighlight(false, RoleTeamTypes.Impostor);
|
||||
|
||||
@@ -612,7 +612,7 @@ public static class GuessManager
|
||||
private static void ProcessGuess(PlayerControl pc, MeetingHud meetingHud)
|
||||
{
|
||||
if (!HudManager.InstanceExists) return;
|
||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hudManager = HudManager.Instance;
|
||||
SoundManager.Instance.PlaySound(pc.KillSfx, false, 0.8f);
|
||||
if (!Options.DisableKillAnimationOnGuess.GetBool()) hudManager.KillOverlay.ShowKillAnimation(pc.Data, pc.Data);
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public static class Prompt
|
||||
try
|
||||
{
|
||||
if (!HudManager.InstanceExists) return;
|
||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hud = HudManager.Instance;
|
||||
|
||||
if (CurrentQuestion != string.Empty || !hud)
|
||||
{
|
||||
|
||||
+3
-3
@@ -1521,13 +1521,13 @@ internal static class RPC
|
||||
SoundManager.Instance.PlaySound(PlayerControl.LocalPlayer.KillSfx, false);
|
||||
break;
|
||||
case Sounds.TaskComplete when HudManager.InstanceExists:
|
||||
SoundManager.Instance.PlaySound(FastDestroyableSingleton<HudManager>.Instance.TaskCompleteSound, false);
|
||||
SoundManager.Instance.PlaySound(HudManager.Instance.TaskCompleteSound, false);
|
||||
break;
|
||||
case Sounds.TaskUpdateSound when HudManager.InstanceExists:
|
||||
SoundManager.Instance.PlaySound(FastDestroyableSingleton<HudManager>.Instance.TaskUpdateSound, false);
|
||||
SoundManager.Instance.PlaySound(HudManager.Instance.TaskUpdateSound, false);
|
||||
break;
|
||||
case Sounds.ImpTransform:
|
||||
SoundManager.Instance.PlaySound(FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx, false, 0.8f);
|
||||
SoundManager.Instance.PlaySound(DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx, false, 0.8f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public static class Translator
|
||||
#if ANDROID
|
||||
return TranslationController.Instance.GetString(stringName);
|
||||
#else
|
||||
return FastDestroyableSingleton<TranslationController>.Instance.GetString(stringName, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
|
||||
return TranslationController.Instance.GetString(stringName, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -142,7 +142,7 @@ public static class Utils
|
||||
}
|
||||
}
|
||||
|
||||
try { FastDestroyableSingleton<LoadingBarManager>.Instance.ToggleLoadingBar(false); }
|
||||
try { LoadingBarManager.Instance.ToggleLoadingBar(false); }
|
||||
catch (Exception e) { ThrowException(e); }
|
||||
}
|
||||
|
||||
@@ -1858,7 +1858,7 @@ public static class Utils
|
||||
{
|
||||
string name = sender.Data.PlayerName;
|
||||
sender.SetName(title);
|
||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(sender, text);
|
||||
HudManager.Instance.Chat.AddChat(sender, text);
|
||||
sender.SetName(name);
|
||||
}
|
||||
|
||||
@@ -2068,7 +2068,7 @@ public static class Utils
|
||||
{
|
||||
string name = sender.Data.PlayerName;
|
||||
sender.SetName(title);
|
||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(sender, text);
|
||||
HudManager.Instance.Chat.AddChat(sender, text);
|
||||
sender.SetName(name);
|
||||
}
|
||||
|
||||
@@ -3765,7 +3765,7 @@ public static class Utils
|
||||
if (!open) return;
|
||||
|
||||
if (PlayerControl.LocalPlayer != null && HudManager.InstanceExists)
|
||||
FastDestroyableSingleton<HudManager>.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, string.Format(GetString("Message.DumpfileSaved"), "EHR" + filename.Split("EHR")[1]));
|
||||
HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, string.Format(GetString("Message.DumpfileSaved"), "EHR" + filename.Split("EHR")[1]));
|
||||
|
||||
#if !ANDROID
|
||||
Process.Start("explorer.exe", f.Replace("/", "\\"));
|
||||
@@ -4007,7 +4007,7 @@ public static class Utils
|
||||
public static void FlashColor(Color color, float duration = 1f)
|
||||
{
|
||||
if (!HudManager.InstanceExists) return;
|
||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hud = HudManager.Instance;
|
||||
if (hud.FullScreen == null) return;
|
||||
|
||||
GameObject obj = hud.transform.FindChild("FlashColor_FullScreen")?.gameObject;
|
||||
|
||||
+2
-2
@@ -70,7 +70,7 @@ public static class Zoom
|
||||
HudManager.Instance.UICamera.orthographicSize *= size;
|
||||
}
|
||||
|
||||
FastDestroyableSingleton<HudManager>.Instance?.ShadowQuad?.gameObject.SetActive((reset || Mathf.Approximately(Camera.main.orthographicSize, 3.0f)) && PlayerControl.LocalPlayer.IsAlive());
|
||||
HudManager.Instance?.ShadowQuad?.gameObject.SetActive((reset || Mathf.Approximately(Camera.main.orthographicSize, 3.0f)) && PlayerControl.LocalPlayer.IsAlive());
|
||||
|
||||
if (ResetButtons)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public static class Zoom
|
||||
{
|
||||
if (Camera.main == null || !HudManager.InstanceExists) return;
|
||||
|
||||
FastDestroyableSingleton<HudManager>.Instance?.ShadowQuad?.gameObject.SetActive(Mathf.Approximately(Camera.main.orthographicSize, 3.0f) && PlayerControl.LocalPlayer.IsAlive());
|
||||
HudManager.Instance?.ShadowQuad?.gameObject.SetActive(Mathf.Approximately(Camera.main.orthographicSize, 3.0f) && PlayerControl.LocalPlayer.IsAlive());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2834,7 +2834,7 @@ internal static class ChatCommands
|
||||
|
||||
default:
|
||||
if (!HudManager.InstanceExists) break;
|
||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, "crew | imp");
|
||||
HudManager.Instance.Chat.AddChat(player, "crew | imp");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3359,7 +3359,7 @@ internal static class ChatCommands
|
||||
private static void VersionCommand(PlayerControl player, string text, string[] args)
|
||||
{
|
||||
string versionText = Main.PlayerVersion.OrderBy(pair => pair.Key).Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}: ({Main.AllPlayerNames[kvp.Key]}) {kvp.Value.forkId}/{kvp.Value.version}({kvp.Value.tag})\n");
|
||||
if (versionText != string.Empty && HudManager.InstanceExists) FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, (player.FriendCode.GetDevUser().HasTag() ? "\n" : string.Empty) + versionText);
|
||||
if (versionText != string.Empty && HudManager.InstanceExists) HudManager.Instance.Chat.AddChat(player, (player.FriendCode.GetDevUser().HasTag() ? "\n" : string.Empty) + versionText);
|
||||
}
|
||||
|
||||
private static void LTCommand(PlayerControl player, string text, string[] args)
|
||||
@@ -3685,7 +3685,7 @@ internal static class ChatUpdatePatch
|
||||
if (clientId == -1 && HudManager.InstanceExists)
|
||||
{
|
||||
player.SetName(title);
|
||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, msg);
|
||||
HudManager.Instance.Chat.AddChat(player, msg);
|
||||
player.SetName(name);
|
||||
}
|
||||
|
||||
@@ -3754,9 +3754,9 @@ internal static class RpcSendChatPatch
|
||||
|
||||
int return_count = PlayerControl.LocalPlayer.name.Count(x => x == '\n');
|
||||
chatText = new StringBuilder(chatText).Insert(0, "\n", return_count).ToString();
|
||||
if (AmongUsClient.Instance.AmClient && HudManager.InstanceExists) FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(__instance, chatText);
|
||||
if (AmongUsClient.Instance.AmClient && HudManager.InstanceExists) HudManager.Instance.Chat.AddChat(__instance, chatText);
|
||||
|
||||
if (chatText.Contains("who", StringComparison.OrdinalIgnoreCase)) FastDestroyableSingleton<UnityTelemetry>.Instance.SendWho();
|
||||
if (chatText.Contains("who", StringComparison.OrdinalIgnoreCase)) UnityTelemetry.Instance.SendWho();
|
||||
|
||||
MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(__instance.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable);
|
||||
messageWriter.Write(chatText);
|
||||
|
||||
@@ -227,7 +227,7 @@ public static class ChatManager
|
||||
if (aapc.Length == 0) return;
|
||||
|
||||
string[] filtered = ChatHistory.Where(a => Utils.GetPlayerById(Convert.ToByte(a.Split(':')[0].Trim())).IsAlive()).ToArray();
|
||||
ChatController chat = FastDestroyableSingleton<HudManager>.Instance.Chat;
|
||||
ChatController chat = HudManager.Instance.Chat;
|
||||
var writer = CustomRpcSender.Create("SendPreviousMessagesToAll", SendOption.Reliable);
|
||||
var hasValue = false;
|
||||
|
||||
@@ -284,7 +284,7 @@ public static class ChatManager
|
||||
{
|
||||
bool toEveryone = receiver == null;
|
||||
bool toLocalPlayer = !toEveryone && receiver.IsLocalPlayer();
|
||||
if (HudManager.InstanceExists && (toLocalPlayer || toEveryone)) FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, "<size=32767>.");
|
||||
if (HudManager.InstanceExists && (toLocalPlayer || toEveryone)) HudManager.Instance.Chat.AddChat(player, "<size=32767>.");
|
||||
if (toLocalPlayer) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable, toEveryone ? -1 : receiver.OwnerId);
|
||||
writer.Write("<size=32767>.");
|
||||
|
||||
@@ -149,7 +149,7 @@ internal static class ControllerManagerUpdatePatch
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
string format = GetString("ResettingOptions");
|
||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hudManager = HudManager.Instance;
|
||||
hudManager.ShowPopUp(string.Format(format, 0, OptionItem.AllOptions.Count));
|
||||
hudManager.Dialogue.BackButton.gameObject.SetActive(false);
|
||||
|
||||
@@ -205,7 +205,7 @@ internal static class ControllerManagerUpdatePatch
|
||||
if (KeysDown(KeyCode.Return, KeyCode.G, KeyCode.LeftShift) && GameStates.IsInGame && HudManager.InstanceExists)
|
||||
{
|
||||
HudManager.Instance.StartCoroutine(HudManager.Instance.CoFadeFullScreen(Color.clear, Color.black));
|
||||
HudManager.Instance.StartCoroutine(FastDestroyableSingleton<HudManager>.Instance.CoShowIntro());
|
||||
HudManager.Instance.StartCoroutine(HudManager.Instance.CoShowIntro());
|
||||
}
|
||||
|
||||
if (KeysDown(KeyCode.Return, KeyCode.V, KeyCode.LeftShift) && GameStates.IsMeeting)
|
||||
@@ -238,7 +238,7 @@ internal static class ControllerManagerUpdatePatch
|
||||
if (Input.GetKeyDown(KeyCode.Equals) && !GameStates.IsMeeting && HudManager.InstanceExists && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
Main.VisibleTasksCount = !Main.VisibleTasksCount;
|
||||
FastDestroyableSingleton<HudManager>.Instance.Notifier.AddDisconnectMessage($"VisibleTaskCount changed to {Main.VisibleTasksCount}.");
|
||||
HudManager.Instance.Notifier.AddDisconnectMessage($"VisibleTaskCount changed to {Main.VisibleTasksCount}.");
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.I) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
@@ -327,13 +327,13 @@ internal static class HandleHUDPatch
|
||||
HudManager.InstanceExists &&
|
||||
PlayerControl.LocalPlayer.Data?.Role?.IsImpostor == false &&
|
||||
PlayerControl.LocalPlayer.CanUseKillButton())
|
||||
FastDestroyableSingleton<HudManager>.Instance.KillButton.DoClick();
|
||||
HudManager.Instance.KillButton.DoClick();
|
||||
|
||||
if (player.GetButtonDown(50) && // 50: Impostor vent button actionId
|
||||
HudManager.InstanceExists &&
|
||||
PlayerControl.LocalPlayer.Data?.Role?.IsImpostor == false &&
|
||||
PlayerControl.LocalPlayer.CanUseImpostorVentButton())
|
||||
FastDestroyableSingleton<HudManager>.Instance.ImpostorVentButton.DoClick();
|
||||
HudManager.Instance.ImpostorVentButton.DoClick();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ internal static class FriendsListUIOpenPatch
|
||||
__instance.currentSceneName = activeScene.name;
|
||||
__instance.UpdateFriendCodeUI();
|
||||
|
||||
if ((HudManager.InstanceExists && FastDestroyableSingleton<HudManager>.Instance != null && FastDestroyableSingleton<HudManager>.Instance.Chat != null && FastDestroyableSingleton<HudManager>.Instance.Chat.IsOpenOrOpening) || ShipStatus.Instance != null)
|
||||
if ((HudManager.InstanceExists && HudManager.Instance != null && HudManager.Instance.Chat != null && HudManager.Instance.Chat.IsOpenOrOpening) || ShipStatus.Instance != null)
|
||||
return false;
|
||||
|
||||
__instance.friendBars = new();
|
||||
@@ -210,13 +210,13 @@ internal static class FriendsListUIOpenPatch
|
||||
__instance.gameObject.SetActive(true);
|
||||
__instance.guestAccountWarnings.ForEach((Action<FriendsListGuestWarning>)(t => t.gameObject.SetActive(false)));
|
||||
__instance.ViewRequestsButton.color = __instance.NoRequestsColor;
|
||||
__instance.ViewRequestsText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.NoNewRequests);
|
||||
__instance.ViewRequestsText.text = TranslationController.Instance.GetString(StringNames.NoNewRequests);
|
||||
|
||||
__instance.StartCoroutine(FastDestroyableSingleton<FriendsListManager>.Instance.RefreshFriendsList((Action)(() =>
|
||||
__instance.StartCoroutine(FriendsListManager.Instance.RefreshFriendsList((Action)(() =>
|
||||
{
|
||||
__instance.ClearNotifs();
|
||||
|
||||
if (FastDestroyableSingleton<EOSManager>.Instance.IsFriendsListAllowed())
|
||||
if (EOSManager.Instance.IsFriendsListAllowed())
|
||||
{
|
||||
__instance.AddFriendObjects.SetActive(true);
|
||||
__instance.RefreshBlockedPlayers();
|
||||
@@ -418,7 +418,7 @@ internal static class ModManagerLateUpdatePatch
|
||||
{
|
||||
__instance.localCamera = !HudManager.InstanceExists
|
||||
? Camera.main
|
||||
: FastDestroyableSingleton<HudManager>.Instance.GetComponentInChildren<Camera>();
|
||||
: HudManager.Instance.GetComponentInChildren<Camera>();
|
||||
|
||||
if (__instance.localCamera != null)
|
||||
{
|
||||
@@ -438,7 +438,7 @@ internal static class OptionsMenuBehaviourOpenPatch
|
||||
{
|
||||
try
|
||||
{
|
||||
if (HudManager.InstanceExists && !FastDestroyableSingleton<HudManager>.Instance.SettingsButton.activeSelf) return false;
|
||||
if (HudManager.InstanceExists && !HudManager.Instance.SettingsButton.activeSelf) return false;
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
||||
+2
-2
@@ -240,7 +240,7 @@ internal static class Crowded
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
public static bool Prefix(CreateOptionsPicker __instance, int maxPlayers)
|
||||
{
|
||||
if (DestroyableSingleton<FindAGameManager>.InstanceExists || __instance.mode != SettingsMode.Host)
|
||||
if (FindAGameManager.InstanceExists || __instance.mode != SettingsMode.Host)
|
||||
return true;
|
||||
|
||||
IGameOptions targetOptions = __instance.GetTargetOptions();
|
||||
@@ -261,7 +261,7 @@ internal static class Crowded
|
||||
__instance.UpdateMaxPlayersButtons(targetOptions);
|
||||
__instance.UpdateLanguageButton((uint)targetOptions.Keywords);
|
||||
__instance.MapMenu.UpdateMapButtons(targetOptions.MapId);
|
||||
__instance.GameModeText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(GameModesHelpers.ModeToName[GameOptionsManager.Instance.CurrentGameOptions.GameMode]);
|
||||
__instance.GameModeText.text = TranslationController.Instance.GetString(GameModesHelpers.ModeToName[GameOptionsManager.Instance.CurrentGameOptions.GameMode]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1074,7 +1074,7 @@ public static class GameSettingMenuPatch
|
||||
presetTmp.DestroyTranslator();
|
||||
presetTmp.text = Translator.GetString($"Preset_{OptionItem.CurrentPreset + 1}");
|
||||
|
||||
bool russian = FastDestroyableSingleton<TranslationController>.Instance.currentLanguage.languageID == SupportedLangs.Russian;
|
||||
bool russian = TranslationController.Instance.currentLanguage.languageID == SupportedLangs.Russian;
|
||||
float size = !russian ? 2.45f : 1.45f;
|
||||
presetTmp.fontSizeMax = presetTmp.fontSizeMin = size;
|
||||
|
||||
@@ -1196,7 +1196,9 @@ public static class GameSettingMenuPatch
|
||||
}
|
||||
|
||||
|
||||
FreeChatInputField freeChatField = FastDestroyableSingleton<HudManager>.Instance.Chat.freeChatField; // FastDestroyableSingleton DOES NOT WORK HERE!!!! IF YOU USE THAT, IT BREAKS THE ENTIRE SETTINGS MENU
|
||||
if (!HudManager.InstanceExists) return;
|
||||
|
||||
FreeChatInputField freeChatField = HudManager.Instance.Chat.freeChatField;
|
||||
FreeChatInputField field = Object.Instantiate(freeChatField, parentLeftPanel.parent);
|
||||
field.transform.localScale = new(0.3f, 0.59f, 1);
|
||||
field.transform.localPosition = new(-0.7f, -2.5f, -5f);
|
||||
@@ -1394,7 +1396,7 @@ public static class GameSettingMenuPatch
|
||||
ModGameOptionsMenu.CategoryHeaderList = new();
|
||||
|
||||
ControllerManager.Instance.OpenOverlayMenu(__instance.name, __instance.BackButton, __instance.DefaultButtonSelected, __instance.ControllerSelectable);
|
||||
if (HudManager.InstanceExists) FastDestroyableSingleton<HudManager>.Instance.menuNavigationPrompts.SetActive(false);
|
||||
if (HudManager.InstanceExists) HudManager.Instance.menuNavigationPrompts.SetActive(false);
|
||||
if (Controller.currentTouchType != Controller.TouchType.Joystick) __instance.ChangeTab(1, false);
|
||||
|
||||
__instance.StartCoroutine(__instance.CoSelectDefault());
|
||||
|
||||
@@ -53,7 +53,7 @@ public static class GameStartManagerPatch
|
||||
|
||||
if (GameData.Instance && HudManager.InstanceExists && AmongUsClient.Instance.NetworkMode != NetworkModes.LocalGame && GameStates.CurrentServerType == GameStates.ServerType.Vanilla)
|
||||
{
|
||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hudManager = HudManager.Instance;
|
||||
hudManager.ShowLobbyTimer(597);
|
||||
hudManager.LobbyTimerExtensionUI.timerText.transform.parent.transform.Find("Icon").gameObject.SetActive(false);
|
||||
GameStartManagerUpdatePatch.Warned = false;
|
||||
@@ -62,7 +62,7 @@ public static class GameStartManagerPatch
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
__instance.GameStartTextParent.GetComponent<SpriteRenderer>().sprite = null;
|
||||
__instance.StartButton.ChangeButtonText(FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.StartLabel));
|
||||
__instance.StartButton.ChangeButtonText(TranslationController.Instance.GetString(StringNames.StartLabel));
|
||||
__instance.GameStartText.transform.localPosition = new(__instance.GameStartText.transform.localPosition.x, 2f, __instance.GameStartText.transform.localPosition.z);
|
||||
__instance.StartButton.activeTextColor = __instance.StartButton.inactiveTextColor = Color.white;
|
||||
|
||||
@@ -258,11 +258,11 @@ public static class GameStartManagerPatch
|
||||
|
||||
instance.CheckSettingsDiffs();
|
||||
instance.StartButton.gameObject.SetActive(true);
|
||||
instance.RulesPresetText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(GameOptionsManager.Instance.CurrentGameOptions.GetRulesPresetTitle());
|
||||
instance.RulesPresetText.text = TranslationController.Instance.GetString(GameOptionsManager.Instance.CurrentGameOptions.GetRulesPresetTitle());
|
||||
|
||||
if (GameCode.IntToGameName(AmongUsClient.Instance.GameId) == null) instance.privatePublicPanelText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.LocalButton);
|
||||
else if (AmongUsClient.Instance.IsGamePublic) instance.privatePublicPanelText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.PublicHeader);
|
||||
else instance.privatePublicPanelText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.PrivateHeader);
|
||||
if (GameCode.IntToGameName(AmongUsClient.Instance.GameId) == null) instance.privatePublicPanelText.text = TranslationController.Instance.GetString(StringNames.LocalButton);
|
||||
else if (AmongUsClient.Instance.IsGamePublic) instance.privatePublicPanelText.text = TranslationController.Instance.GetString(StringNames.PublicHeader);
|
||||
else instance.privatePublicPanelText.text = TranslationController.Instance.GetString(StringNames.PrivateHeader);
|
||||
|
||||
instance.HostPrivateButton.gameObject.SetActive(!AmongUsClient.Instance.IsGamePublic);
|
||||
instance.HostPublicButton.gameObject.SetActive(AmongUsClient.Instance.IsGamePublic);
|
||||
@@ -282,12 +282,12 @@ public static class GameStartManagerPatch
|
||||
ActionMapGlyphDisplay startButtonGlyph = instance.StartButtonGlyph;
|
||||
startButtonGlyph?.SetColor(instance.LastPlayerCount >= instance.MinPlayers ? Palette.EnabledColor : Palette.DisabledClear);
|
||||
|
||||
if (DestroyableSingleton<DiscordManager>.InstanceExists)
|
||||
if (DiscordManager.InstanceExists)
|
||||
{
|
||||
if (AmongUsClient.Instance.AmHost && AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame)
|
||||
FastDestroyableSingleton<DiscordManager>.Instance.SetInLobbyHost(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
DiscordManager.Instance.SetInLobbyHost(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
else
|
||||
FastDestroyableSingleton<DiscordManager>.Instance.SetInLobbyClient(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
DiscordManager.Instance.SetInLobbyClient(instance.LastPlayerCount, GameManager.Instance.LogicOptions.MaxPlayers, AmongUsClient.Instance.GameId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,14 +307,14 @@ public static class GameStartManagerPatch
|
||||
if (!instance.GameStartTextParent.activeSelf) SoundManager.Instance.PlaySound(instance.gameStartSound, false);
|
||||
|
||||
instance.GameStartTextParent.SetActive(true);
|
||||
instance.GameStartText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.GameStarting, num2);
|
||||
instance.GameStartText.text = TranslationController.Instance.GetString(StringNames.GameStarting, num2);
|
||||
if (num != num2) PlayerControl.LocalPlayer.RpcSetStartCounter(num2);
|
||||
|
||||
if (num2 <= 0) instance.FinallyBegin();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.StartButton.ChangeButtonText(FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.StartLabel));
|
||||
instance.StartButton.ChangeButtonText(TranslationController.Instance.GetString(StringNames.StartLabel));
|
||||
instance.StartButton.inactiveSprites.GetComponent<SpriteRenderer>().color = new(0.1f, 0.1f, 0.1f, 1f);
|
||||
instance.StartButton.activeSprites.GetComponent<SpriteRenderer>().color = new(0.2f, 0.2f, 0.2f, 1f);
|
||||
instance.StartButton.inactiveSprites.transform.Find("Shine").GetComponent<SpriteRenderer>().color = new(0.3f, 0.3f, 0.3f, 0.5f);
|
||||
@@ -326,10 +326,10 @@ public static class GameStartManagerPatch
|
||||
|
||||
if (!HudManager.InstanceExists) return;
|
||||
|
||||
if (instance.LobbyInfoPane.gameObject.activeSelf && FastDestroyableSingleton<HudManager>.Instance.Chat.IsOpenOrOpening)
|
||||
if (instance.LobbyInfoPane.gameObject.activeSelf && HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
instance.LobbyInfoPane.DeactivatePane();
|
||||
|
||||
instance.LobbyInfoPane.gameObject.SetActive(!FastDestroyableSingleton<HudManager>.Instance.Chat.IsOpenOrOpening);
|
||||
instance.LobbyInfoPane.gameObject.SetActive(!HudManager.Instance.Chat.IsOpenOrOpening);
|
||||
}
|
||||
|
||||
#if !ANDROID
|
||||
@@ -461,14 +461,14 @@ public static class GameStartManagerPatch
|
||||
{
|
||||
float timer = Timer;
|
||||
|
||||
if (LobbyTimerBg == null) LobbyTimerBg = FastDestroyableSingleton<HudManager>.Instance.LobbyTimerExtensionUI.timerText.transform.parent.transform.Find("LabelBackground").GetComponent<SpriteRenderer>();
|
||||
if (LobbyTimerBg == null) LobbyTimerBg = HudManager.Instance.LobbyTimerExtensionUI.timerText.transform.parent.transform.Find("LabelBackground").GetComponent<SpriteRenderer>();
|
||||
LobbyTimerBg.sprite = Utils.LoadSprite("EHR.Resources.Images.LobbyTimerBG.png", 100f);
|
||||
LobbyTimerBg.color = GetTimerColor(timer);
|
||||
|
||||
if (timer <= 60 && !Warned && AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
Warned = true;
|
||||
LobbyTimerExtensionUI lobbyTimerExtensionUI = FastDestroyableSingleton<HudManager>.Instance.LobbyTimerExtensionUI;
|
||||
LobbyTimerExtensionUI lobbyTimerExtensionUI = HudManager.Instance.LobbyTimerExtensionUI;
|
||||
lobbyTimerExtensionUI.timerText.transform.parent.transform.Find("Icon").gameObject.SetActive(true);
|
||||
SoundManager.Instance.PlaySound(lobbyTimerExtensionUI.lobbyTimerPopUpSound, false);
|
||||
Utils.FlashColor(new(1f, 1f, 0f, 0.4f), 2f);
|
||||
|
||||
+1
-1
@@ -1237,7 +1237,7 @@ internal static class TaskPanelBehaviourPatch
|
||||
if (taskList == "None" || GameStates.IsLobby || player == null) return;
|
||||
|
||||
NetworkedPlayerInfo data = PlayerControl.LocalPlayer.Data;
|
||||
if (data && data.Role) taskList = taskList.Replace($"\n{data.Role.NiceName} {FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.RoleHint)}\n{data.Role.BlurbMed}", string.Empty);
|
||||
if (data && data.Role) taskList = taskList.Replace($"\n{data.Role.NiceName} {TranslationController.Instance.GetString(StringNames.RoleHint)}\n{data.Role.BlurbMed}", string.Empty);
|
||||
|
||||
if (Options.CurrentGameMode is not (CustomGameMode.Standard or CustomGameMode.MoveAndStop or CustomGameMode.HideAndSeek or CustomGameMode.Speedrun))
|
||||
taskList = GetString("None");
|
||||
|
||||
@@ -131,7 +131,7 @@ static class CoShowIntroPatch
|
||||
else
|
||||
{
|
||||
int adjustedNumImpostors = GameManager.Instance.LogicOptions.GetAdjustedNumImpostors(GameData.Instance.PlayerCount);
|
||||
introCutscene.ImpostorText.text = adjustedNumImpostors == 1 ? FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.NumImpostorsS) : FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.NumImpostorsP, adjustedNumImpostors);
|
||||
introCutscene.ImpostorText.text = adjustedNumImpostors == 1 ? TranslationController.Instance.GetString(StringNames.NumImpostorsS) : TranslationController.Instance.GetString(StringNames.NumImpostorsP, adjustedNumImpostors);
|
||||
introCutscene.ImpostorText.text = introCutscene.ImpostorText.text.Replace("[FF1919FF]", "<color=#FF1919FF>");
|
||||
introCutscene.ImpostorText.text = introCutscene.ImpostorText.text.Replace("[]", "</color>");
|
||||
}
|
||||
@@ -632,21 +632,21 @@ internal static class BeginCrewmatePatch
|
||||
CustomRoles.Dictator or
|
||||
CustomRoles.Mayor or
|
||||
CustomRoles.NiceSwapper
|
||||
=> FastDestroyableSingleton<HudManager>.Instance.Chat.messageSound,
|
||||
=> HudManager.Instance.Chat.messageSound,
|
||||
|
||||
CustomRoles.AntiAdminer or
|
||||
CustomRoles.Monitor
|
||||
=> FastDestroyableSingleton<HudManager>.Instance.Chat.warningSound,
|
||||
=> HudManager.Instance.Chat.warningSound,
|
||||
|
||||
CustomRoles.GM or
|
||||
CustomRoles.Snitch or
|
||||
CustomRoles.Speedrunner or
|
||||
CustomRoles.Workaholic
|
||||
=> FastDestroyableSingleton<HudManager>.Instance.TaskCompleteSound,
|
||||
=> HudManager.Instance.TaskCompleteSound,
|
||||
|
||||
CustomRoles.Helper or
|
||||
CustomRoles.TaskManager
|
||||
=> FastDestroyableSingleton<HudManager>.Instance.TaskUpdateSound,
|
||||
=> HudManager.Instance.TaskUpdateSound,
|
||||
|
||||
CustomRoles.Inhibitor or
|
||||
CustomRoles.Mechanic or
|
||||
@@ -687,11 +687,11 @@ internal static class BeginCrewmatePatch
|
||||
|
||||
CustomRoles.Chronomancer or
|
||||
CustomRoles.Tremor
|
||||
=> FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx,
|
||||
=> DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx,
|
||||
|
||||
CustomRoles.Deputy or
|
||||
CustomRoles.Sheriff
|
||||
=> FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherYeehawSfx,
|
||||
=> DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherYeehawSfx,
|
||||
|
||||
CustomRoles.Hater or
|
||||
CustomRoles.Lawyer or
|
||||
@@ -850,7 +850,7 @@ internal static class BeginCrewmatePatch
|
||||
__instance.ImpostorText.gameObject.SetActive(true);
|
||||
__instance.ImpostorText.text = GetString("ModeSoloKombat");
|
||||
__instance.BackgroundBar.material.color = color;
|
||||
PlayerControl.LocalPlayer.Data.Role.IntroSound = FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx;
|
||||
PlayerControl.LocalPlayer.Data.Role.IntroSound = DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx;
|
||||
break;
|
||||
}
|
||||
case CustomGameMode.FFA:
|
||||
@@ -1329,7 +1329,7 @@ internal static class IntroCutsceneDestroyPatch
|
||||
|
||||
if (!HudManager.InstanceExists) return;
|
||||
|
||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hud = HudManager.Instance;
|
||||
|
||||
HudSpritePatch.DefaultIcons =
|
||||
[
|
||||
|
||||
@@ -34,8 +34,8 @@ internal static class NotificationPopperPatch
|
||||
if (parentName == "Accept") return;
|
||||
|
||||
string str = key.Parent != null
|
||||
? FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.LobbyChangeSettingNotification, "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + parentName + "</font>: <font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>")
|
||||
: FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.LobbyChangeSettingNotification, "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>");
|
||||
? TranslationController.Instance.GetString(StringNames.LobbyChangeSettingNotification, "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + parentName + "</font>: <font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>")
|
||||
: TranslationController.Instance.GetString(StringNames.LobbyChangeSettingNotification, "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>");
|
||||
|
||||
SettingsChangeMessageLogic(key, str, playSound);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ internal static class NotificationPopperPatch
|
||||
if (name == "Accept") return;
|
||||
|
||||
SendRpc(1, index, customRole, playSound);
|
||||
string str = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.LobbyChangeSettingNotification, "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>");
|
||||
string str = TranslationController.Instance.GetString(StringNames.LobbyChangeSettingNotification, "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>");
|
||||
SettingsChangeMessageLogic(key, str, playSound);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,14 +43,14 @@ internal static class ChangeRoleSettings
|
||||
{
|
||||
AmongUsClient amongUsClient = __instance;
|
||||
|
||||
if (FastDestroyableSingleton<HudManager>.Instance.GameMenu.IsOpen)
|
||||
FastDestroyableSingleton<HudManager>.Instance.GameMenu.Close();
|
||||
if (HudManager.Instance.GameMenu.IsOpen)
|
||||
HudManager.Instance.GameMenu.Close();
|
||||
|
||||
FastDestroyableSingleton<UnityTelemetry>.Instance.Init();
|
||||
UnityTelemetry.Instance.Init();
|
||||
amongUsClient.logger.Info("Received game start: " + amongUsClient.AmHost);
|
||||
yield return null;
|
||||
|
||||
while (!DestroyableSingleton<HudManager>.InstanceExists)
|
||||
while (!HudManager.InstanceExists)
|
||||
yield return null;
|
||||
|
||||
while (!PlayerControl.LocalPlayer)
|
||||
@@ -68,34 +68,34 @@ internal static class ChangeRoleSettings
|
||||
if (objectOfType2)
|
||||
objectOfType2.Close();
|
||||
|
||||
if (DestroyableSingleton<GameStartManager>.InstanceExists)
|
||||
if (GameStartManager.InstanceExists)
|
||||
{
|
||||
amongUsClient.DisconnectHandlers.Remove(FastDestroyableSingleton<GameStartManager>.Instance.CastFast<IDisconnectHandler>());
|
||||
Object.Destroy(FastDestroyableSingleton<GameStartManager>.Instance.gameObject);
|
||||
amongUsClient.DisconnectHandlers.Remove(GameStartManager.Instance.CastFast<IDisconnectHandler>());
|
||||
Object.Destroy(GameStartManager.Instance.gameObject);
|
||||
}
|
||||
|
||||
if (DestroyableSingleton<LobbyInfoPane>.InstanceExists)
|
||||
Object.Destroy(FastDestroyableSingleton<LobbyInfoPane>.Instance.gameObject);
|
||||
if (LobbyInfoPane.InstanceExists)
|
||||
Object.Destroy(LobbyInfoPane.Instance.gameObject);
|
||||
|
||||
if (DestroyableSingleton<DiscordManager>.InstanceExists)
|
||||
FastDestroyableSingleton<DiscordManager>.Instance.SetPlayingGame();
|
||||
if (DiscordManager.InstanceExists)
|
||||
DiscordManager.Instance.SetPlayingGame();
|
||||
|
||||
if (!string.IsNullOrEmpty(DataManager.Player.Store.ActiveCosmicube))
|
||||
AmongUsClient.Instance.SetActivePodType(FastDestroyableSingleton<CosmicubeManager>.Instance.GetCubeDataByID(DataManager.Player.Store.ActiveCosmicube).podId);
|
||||
AmongUsClient.Instance.SetActivePodType(CosmicubeManager.Instance.GetCubeDataByID(DataManager.Player.Store.ActiveCosmicube).podId);
|
||||
else
|
||||
{
|
||||
PlayerStorageManager.CloudPlayerPrefs playerPrefs = FastDestroyableSingleton<PlayerStorageManager>.Instance.PlayerPrefs;
|
||||
PlayerStorageManager.CloudPlayerPrefs playerPrefs = PlayerStorageManager.Instance.PlayerPrefs;
|
||||
AmongUsClient.Instance.SetActivePodType(playerPrefs.ActivePodType);
|
||||
}
|
||||
|
||||
FastDestroyableSingleton<FriendsListManager>.Instance.ConfirmationScreen.Cancel();
|
||||
FastDestroyableSingleton<FriendsListManager>.Instance.Ui.Close(true);
|
||||
FastDestroyableSingleton<FriendsListManager>.Instance.ReparentUI();
|
||||
FriendsListManager.Instance.ConfirmationScreen.Cancel();
|
||||
FriendsListManager.Instance.Ui.Close(true);
|
||||
FriendsListManager.Instance.ReparentUI();
|
||||
|
||||
try { CosmeticsCache.ClearUnusedCosmetics(); }
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
|
||||
yield return FastDestroyableSingleton<HudManager>.Instance.CoFadeFullScreen(Color.clear, Color.black);
|
||||
yield return HudManager.Instance.CoFadeFullScreen(Color.clear, Color.black);
|
||||
++DataManager.Player.Ban.BanPoints;
|
||||
DataManager.Player.Ban.PreviousGameStartDate = DateTime.UtcNow;
|
||||
DataManager.Player.Save();
|
||||
@@ -126,17 +126,17 @@ internal static class ChangeRoleSettings
|
||||
}
|
||||
}
|
||||
|
||||
FastDestroyableSingleton<FriendsListManager>.Instance.SetRecentlyPlayed(GameData.Instance.AllPlayers);
|
||||
FriendsListManager.Instance.SetRecentlyPlayed(GameData.Instance.AllPlayers);
|
||||
GameData.TimeGameStarted = Time.realtimeSinceStartup;
|
||||
int map = Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1);
|
||||
string gameName = GameCode.IntToGameName(AmongUsClient.Instance.GameId);
|
||||
FastDestroyableSingleton<DebugAnalytics>.Instance.Analytics.StartGame(PlayerControl.LocalPlayer.Data, GameData.Instance.PlayerCount, GameOptionsManager.Instance.CurrentGameOptions.NumImpostors, AmongUsClient.Instance.NetworkMode, (MapNames)map, GameOptionsManager.Instance.CurrentGameOptions.GameMode, gameName, FastDestroyableSingleton<ServerManager>.Instance.CurrentRegion.Name, GameOptionsManager.Instance.CurrentGameOptions, GameData.Instance.AllPlayers);
|
||||
DebugAnalytics.Instance.Analytics.StartGame(PlayerControl.LocalPlayer.Data, GameData.Instance.PlayerCount, GameOptionsManager.Instance.CurrentGameOptions.NumImpostors, AmongUsClient.Instance.NetworkMode, (MapNames)map, GameOptionsManager.Instance.CurrentGameOptions.GameMode, gameName, ServerManager.Instance.CurrentRegion.Name, GameOptionsManager.Instance.CurrentGameOptions, GameData.Instance.AllPlayers);
|
||||
|
||||
try
|
||||
{
|
||||
FastDestroyableSingleton<UnityTelemetry>.Instance.StartGame(AmongUsClient.Instance.AmHost, GameData.Instance.PlayerCount, GameOptionsManager.Instance.CurrentGameOptions.NumImpostors, AmongUsClient.Instance.NetworkMode, DataManager.Player.Stats.GetStat(StatID.GamesAsImpostor), DataManager.Player.Stats.GetStat(StatID.GamesStarted), DataManager.Player.Stats.GetStat(StatID.CrewmateStreak));
|
||||
UnityTelemetry.Instance.StartGame(AmongUsClient.Instance.AmHost, GameData.Instance.PlayerCount, GameOptionsManager.Instance.CurrentGameOptions.NumImpostors, AmongUsClient.Instance.NetworkMode, DataManager.Player.Stats.GetStat(StatID.GamesAsImpostor), DataManager.Player.Stats.GetStat(StatID.GamesStarted), DataManager.Player.Stats.GetStat(StatID.CrewmateStreak));
|
||||
NetworkedPlayerInfo.PlayerOutfit defaultOutfit = PlayerControl.LocalPlayer.Data.DefaultOutfit;
|
||||
FastDestroyableSingleton<UnityTelemetry>.Instance.StartGameCosmetics(defaultOutfit.ColorId, defaultOutfit.HatId, defaultOutfit.SkinId, defaultOutfit.PetId, defaultOutfit.VisorId, defaultOutfit.NamePlateId);
|
||||
UnityTelemetry.Instance.StartGameCosmetics(defaultOutfit.ColorId, defaultOutfit.HatId, defaultOutfit.SkinId, defaultOutfit.PetId, defaultOutfit.VisorId, defaultOutfit.NamePlateId);
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -540,7 +540,7 @@ internal static class StartGameHostPatch
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
|
||||
string loadingTextText1 = GetString("LoadingBarText.1");
|
||||
LoadingBarManager loadingBarManager = FastDestroyableSingleton<LoadingBarManager>.Instance;
|
||||
LoadingBarManager loadingBarManager = LoadingBarManager.Instance;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1136,7 +1136,7 @@ internal static class StartGameHostPatch
|
||||
}
|
||||
|
||||
|
||||
LoadingBarManager loadingBarManager = FastDestroyableSingleton<LoadingBarManager>.Instance;
|
||||
LoadingBarManager loadingBarManager = LoadingBarManager.Instance;
|
||||
yield return loadingBarManager.WaitAndSmoothlyUpdate(90f, 95f, 1f, GetString("LoadingBarText.1"));
|
||||
|
||||
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
||||
|
||||
@@ -160,7 +160,7 @@ public static class PhantomRolePatch
|
||||
{
|
||||
if (phantom.AmOwner)
|
||||
{
|
||||
FastDestroyableSingleton<HudManager>.Instance.AbilityButton.SetFromSettings(phantom.Data.Role.Ability);
|
||||
HudManager.Instance.AbilityButton.SetFromSettings(phantom.Data.Role.Ability);
|
||||
if (Utils.ShouldNotApplyAbilityCooldown(roleBase)) return false;
|
||||
phantom.Data.Role.SetCooldown();
|
||||
return false;
|
||||
@@ -353,8 +353,8 @@ public static class PhantomRoleUseAbilityPatch
|
||||
return false;
|
||||
}
|
||||
|
||||
FastDestroyableSingleton<HudManager>.Instance.AbilityButton.SetSecondImage(__instance.Ability);
|
||||
FastDestroyableSingleton<HudManager>.Instance.AbilityButton.OverrideText(FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.PhantomAbilityUndo, new Il2CppReferenceArray<Il2CppSystem.Object>(0)));
|
||||
HudManager.Instance.AbilityButton.SetSecondImage(__instance.Ability);
|
||||
HudManager.Instance.AbilityButton.OverrideText(TranslationController.Instance.GetString(StringNames.PhantomAbilityUndo, new Il2CppReferenceArray<Il2CppSystem.Object>(0)));
|
||||
__instance.Player.CmdCheckVanish(GameManager.Instance.LogicOptions.GetRoleFloat(FloatOptionNames.PhantomDuration));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1189,7 +1189,7 @@ internal static class ReportDeadBodyPatch
|
||||
|
||||
CustomNetObject.OnMeeting();
|
||||
|
||||
if (HudManager.InstanceExists) FastDestroyableSingleton<HudManager>.Instance.SetRolePanelOpen(false);
|
||||
if (HudManager.InstanceExists) HudManager.Instance.SetRolePanelOpen(false);
|
||||
|
||||
Asthmatic.RunChecks = false;
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ internal static class OnPlayerJoinedPatch
|
||||
Logger.Info(msg, "Android Kick");
|
||||
}
|
||||
|
||||
if (FriendsListManager.InstanceExists && FastDestroyableSingleton<FriendsListManager>.Instance.IsPlayerBlockedUsername(client.FriendCode) && AmongUsClient.Instance.AmHost && GameStates.CurrentServerType is not GameStates.ServerType.Modded and not GameStates.ServerType.Niko and not GameStates.ServerType.Local)
|
||||
if (FriendsListManager.InstanceExists && FriendsListManager.Instance.IsPlayerBlockedUsername(client.FriendCode) && AmongUsClient.Instance.AmHost && GameStates.CurrentServerType is not GameStates.ServerType.Modded and not GameStates.ServerType.Niko and not GameStates.ServerType.Local)
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(client.Id, true);
|
||||
Logger.Info($"Blocked Player {client.PlayerName}({client.FriendCode}) has been banned.", "BAN");
|
||||
@@ -503,7 +503,7 @@ internal static class OnPlayerLeftPatch
|
||||
case CustomGameMode.HideAndSeek:
|
||||
CustomHnS.PlayerRoles.Remove(data.Character.PlayerId);
|
||||
break;
|
||||
case CustomGameMode.Mingle:
|
||||
case CustomGameMode.Mingle when data.Character.IsAlive():
|
||||
Mingle.HandleDisconnect();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public static class SabotageButtonDoClickPatch
|
||||
{
|
||||
if (!PlayerControl.LocalPlayer.inVent && GameManager.Instance.SabotagesEnabled() && HudManager.InstanceExists)
|
||||
{
|
||||
FastDestroyableSingleton<HudManager>.Instance.ToggleMapVisible(new()
|
||||
HudManager.Instance.ToggleMapVisible(new()
|
||||
{
|
||||
Mode = MapOptions.Modes.Sabotage
|
||||
});
|
||||
|
||||
@@ -17,8 +17,8 @@ public static class ServerDropdownPatch
|
||||
if (SceneManager.GetActiveScene().name == "FindAGame") return true;
|
||||
SpriteRenderer bg = __instance.background;
|
||||
bg.size = new Vector2(4, 1);
|
||||
ServerManager sm = FastDestroyableSingleton<ServerManager>.Instance;
|
||||
TranslationController tc = FastDestroyableSingleton<TranslationController>.Instance;
|
||||
ServerManager sm = ServerManager.Instance;
|
||||
TranslationController tc = TranslationController.Instance;
|
||||
int totalCols = Mathf.Max(1, Mathf.CeilToInt(sm.AvailableRegions.Length / (float)5));
|
||||
int rowLimit = Mathf.Min(sm.AvailableRegions.Length, 5);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public static class TextBoxPatch
|
||||
}
|
||||
}
|
||||
|
||||
if (!__instance.tempTxt.ToString().Equals(FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.EnterName), StringComparison.OrdinalIgnoreCase) && __instance.characterLimit > 0)
|
||||
if (!__instance.tempTxt.ToString().Equals(TranslationController.Instance.GetString(StringNames.EnterName), StringComparison.OrdinalIgnoreCase) && __instance.characterLimit > 0)
|
||||
{
|
||||
int length = __instance.tempTxt.Length;
|
||||
__instance.tempTxt.Length = Math.Min(__instance.tempTxt.Length, __instance.characterLimit);
|
||||
@@ -185,7 +185,7 @@ public static class TextBoxPatch
|
||||
}
|
||||
|
||||
IsInvalidCommand = false;
|
||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
||||
HudManager hud = HudManager.Instance;
|
||||
|
||||
if (PlaceHolderText == null)
|
||||
{
|
||||
@@ -341,7 +341,7 @@ public static class TextBoxPatch
|
||||
|
||||
if (AdditionalInfoText != null)
|
||||
{
|
||||
bool showLobbyCode = FastDestroyableSingleton<HudManager>.Instance?.Chat?.IsOpenOrOpening == true && GameStates.IsLobby && Options.GetSuffixMode() == SuffixModes.Streaming && !Options.HideGameSettings.GetBool() && !DataManager.Settings.Gameplay.StreamerMode;
|
||||
bool showLobbyCode = HudManager.Instance?.Chat?.IsOpenOrOpening == true && GameStates.IsLobby && Options.GetSuffixMode() == SuffixModes.Streaming && !Options.HideGameSettings.GetBool() && !DataManager.Settings.Gameplay.StreamerMode;
|
||||
AdditionalInfoText.enabled = showLobbyCode;
|
||||
if (showLobbyCode) AdditionalInfoText.text = $"\n\n{Translator.GetString("LobbyCode")}:\n<size=250%><b>{GameCode.IntToGameName(AmongUsClient.Instance.GameId)}</b></size>";
|
||||
}
|
||||
@@ -363,7 +363,7 @@ public static class TextBoxPatch
|
||||
{
|
||||
try
|
||||
{
|
||||
bool open = HudManager.InstanceExists && (FastDestroyableSingleton<HudManager>.Instance?.Chat?.IsOpenOrOpening ?? false);
|
||||
bool open = HudManager.InstanceExists && (HudManager.Instance?.Chat?.IsOpenOrOpening ?? false);
|
||||
PlaceHolderText?.gameObject.SetActive(open);
|
||||
CommandInfoText?.gameObject.SetActive(open);
|
||||
AdditionalInfoText?.gameObject.SetActive(open);
|
||||
|
||||
@@ -227,6 +227,6 @@ public sealed class Stealth : RoleBase
|
||||
seen ??= seer;
|
||||
if (isForMeeting || seer != StealthPC || seen != StealthPC || !darkenedRoom.HasValue) return base.GetSuffix(seer, seen, isForMeeting, isForHud);
|
||||
|
||||
return string.Format(Translator.GetString("StealthDarkened"), FastDestroyableSingleton<TranslationController>.Instance.GetString(darkenedRoom.Value));
|
||||
return string.Format(Translator.GetString("StealthDarkened"), TranslationController.Instance.GetString(darkenedRoom.Value));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user