mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +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()
|
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
|
public static class FixedUpdatePatch
|
||||||
@@ -339,12 +342,17 @@ public static class Mingle
|
|||||||
KillPlayers();
|
KillPlayers();
|
||||||
StartNewRound();
|
StartNewRound();
|
||||||
}
|
}
|
||||||
else if (RequiredPlayerCount.All(x => GetNumPlayersInRoom(x.Key) == x.Value))
|
else
|
||||||
{
|
{
|
||||||
Main.AllAlivePlayerControls.NotifyPlayers(Utils.ColorString(Color.green, "✓"), 3f);
|
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());
|
||||||
Time = Math.Max(Time - TimeDecreaseOnNoDeath, MinTime);
|
|
||||||
StartNewRound();
|
if (RequiredPlayerCount.All(x => numPlayersInRoom.GetValueOrDefault(x.Key, 0) == x.Value))
|
||||||
return;
|
{
|
||||||
|
Main.AllAlivePlayerControls.NotifyPlayers(Utils.ColorString(Color.green, "✓"), 3f);
|
||||||
|
Time = Math.Max(Time - TimeDecreaseOnNoDeath, MinTime);
|
||||||
|
StartNewRound();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.NotifyRoles();
|
Utils.NotifyRoles();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public static class AutoHaunt
|
|||||||
HauntMenuMinigameSetHauntTargetPatch.Prefix(HauntMenuMinigameStartPatch.Instance, preferredTarget);
|
HauntMenuMinigameSetHauntTargetPatch.Prefix(HauntMenuMinigameStartPatch.Instance, preferredTarget);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
FastDestroyableSingleton<HudManager>.Instance.AbilityButton.DoClick();
|
HudManager.Instance.AbilityButton.DoClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return new WaitForSeconds(5f);
|
yield return new WaitForSeconds(5f);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public static class ChatBubbleShower
|
|||||||
(string message, string title) = Queue.First();
|
(string message, string title) = Queue.First();
|
||||||
Queue.Remove((message, title));
|
Queue.Remove((message, title));
|
||||||
|
|
||||||
ChatController chat = FastDestroyableSingleton<HudManager>.Instance.Chat;
|
ChatController chat = HudManager.Instance.Chat;
|
||||||
|
|
||||||
if (GameStates.IsMeeting || chat.IsOpenOrOpening) ShowBubbleWithoutPlayer();
|
if (GameStates.IsMeeting || chat.IsOpenOrOpening) ShowBubbleWithoutPlayer();
|
||||||
else if (GameStates.IsLobby) Utils.SendMessage(message, PlayerControl.LocalPlayer.PlayerId, title);
|
else if (GameStates.IsLobby) Utils.SendMessage(message, PlayerControl.LocalPlayer.PlayerId, title);
|
||||||
|
|||||||
@@ -2039,7 +2039,7 @@ internal static class ExtendedPlayerControl
|
|||||||
|
|
||||||
ReportDeadBodyPatch.AfterReportTasks(reporter, target);
|
ReportDeadBodyPatch.AfterReportTasks(reporter, target);
|
||||||
MeetingRoomManager.Instance.AssignSelf(reporter, target);
|
MeetingRoomManager.Instance.AssignSelf(reporter, target);
|
||||||
FastDestroyableSingleton<HudManager>.Instance.OpenMeetingRoom(reporter);
|
HudManager.Instance.OpenMeetingRoom(reporter);
|
||||||
reporter.RpcStartMeeting(target);
|
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;
|
if (Main.UserData.TryGetValue(pc.FriendCode, out Options.UserData userData) && !string.IsNullOrWhiteSpace(userData.Tag) && userData.Tag.Length > 0) return true;
|
||||||
|
|
||||||
ClientData client = pc.GetClient();
|
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)
|
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
|
// The codes below I stole from TommyXL
|
||||||
public static class Il2CppCastHelper
|
public static class Il2CppCastHelper
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public static class FixedUpdateCaller
|
|||||||
|
|
||||||
if (HudManager.InstanceExists)
|
if (HudManager.InstanceExists)
|
||||||
{
|
{
|
||||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hudManager = HudManager.Instance;
|
||||||
|
|
||||||
if (hudManager)
|
if (hudManager)
|
||||||
{
|
{
|
||||||
@@ -102,7 +102,7 @@ public static class FixedUpdateCaller
|
|||||||
List<PlayerControl> players = PlayerControl.LocalPlayer.GetPlayersInAbilityRangeSorted(predicate);
|
List<PlayerControl> players = PlayerControl.LocalPlayer.GetPlayersInAbilityRangeSorted(predicate);
|
||||||
PlayerControl closest = players.Count == 0 ? null : players[0];
|
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)
|
if (killButton.currentTarget && killButton.currentTarget != closest)
|
||||||
killButton.currentTarget.ToggleHighlight(false, RoleTeamTypes.Impostor);
|
killButton.currentTarget.ToggleHighlight(false, RoleTeamTypes.Impostor);
|
||||||
|
|||||||
@@ -612,7 +612,7 @@ public static class GuessManager
|
|||||||
private static void ProcessGuess(PlayerControl pc, MeetingHud meetingHud)
|
private static void ProcessGuess(PlayerControl pc, MeetingHud meetingHud)
|
||||||
{
|
{
|
||||||
if (!HudManager.InstanceExists) return;
|
if (!HudManager.InstanceExists) return;
|
||||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hudManager = HudManager.Instance;
|
||||||
SoundManager.Instance.PlaySound(pc.KillSfx, false, 0.8f);
|
SoundManager.Instance.PlaySound(pc.KillSfx, false, 0.8f);
|
||||||
if (!Options.DisableKillAnimationOnGuess.GetBool()) hudManager.KillOverlay.ShowKillAnimation(pc.Data, pc.Data);
|
if (!Options.DisableKillAnimationOnGuess.GetBool()) hudManager.KillOverlay.ShowKillAnimation(pc.Data, pc.Data);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ public static class Prompt
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!HudManager.InstanceExists) return;
|
if (!HudManager.InstanceExists) return;
|
||||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hud = HudManager.Instance;
|
||||||
|
|
||||||
if (CurrentQuestion != string.Empty || !hud)
|
if (CurrentQuestion != string.Empty || !hud)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -1521,13 +1521,13 @@ internal static class RPC
|
|||||||
SoundManager.Instance.PlaySound(PlayerControl.LocalPlayer.KillSfx, false);
|
SoundManager.Instance.PlaySound(PlayerControl.LocalPlayer.KillSfx, false);
|
||||||
break;
|
break;
|
||||||
case Sounds.TaskComplete when HudManager.InstanceExists:
|
case Sounds.TaskComplete when HudManager.InstanceExists:
|
||||||
SoundManager.Instance.PlaySound(FastDestroyableSingleton<HudManager>.Instance.TaskCompleteSound, false);
|
SoundManager.Instance.PlaySound(HudManager.Instance.TaskCompleteSound, false);
|
||||||
break;
|
break;
|
||||||
case Sounds.TaskUpdateSound when HudManager.InstanceExists:
|
case Sounds.TaskUpdateSound when HudManager.InstanceExists:
|
||||||
SoundManager.Instance.PlaySound(FastDestroyableSingleton<HudManager>.Instance.TaskUpdateSound, false);
|
SoundManager.Instance.PlaySound(HudManager.Instance.TaskUpdateSound, false);
|
||||||
break;
|
break;
|
||||||
case Sounds.ImpTransform:
|
case Sounds.ImpTransform:
|
||||||
SoundManager.Instance.PlaySound(FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx, false, 0.8f);
|
SoundManager.Instance.PlaySound(DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx, false, 0.8f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public static class Translator
|
|||||||
#if ANDROID
|
#if ANDROID
|
||||||
return TranslationController.Instance.GetString(stringName);
|
return TranslationController.Instance.GetString(stringName);
|
||||||
#else
|
#else
|
||||||
return FastDestroyableSingleton<TranslationController>.Instance.GetString(stringName, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
|
return TranslationController.Instance.GetString(stringName, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
|
||||||
#endif
|
#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); }
|
catch (Exception e) { ThrowException(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1858,7 +1858,7 @@ public static class Utils
|
|||||||
{
|
{
|
||||||
string name = sender.Data.PlayerName;
|
string name = sender.Data.PlayerName;
|
||||||
sender.SetName(title);
|
sender.SetName(title);
|
||||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(sender, text);
|
HudManager.Instance.Chat.AddChat(sender, text);
|
||||||
sender.SetName(name);
|
sender.SetName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2068,7 +2068,7 @@ public static class Utils
|
|||||||
{
|
{
|
||||||
string name = sender.Data.PlayerName;
|
string name = sender.Data.PlayerName;
|
||||||
sender.SetName(title);
|
sender.SetName(title);
|
||||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(sender, text);
|
HudManager.Instance.Chat.AddChat(sender, text);
|
||||||
sender.SetName(name);
|
sender.SetName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3765,7 +3765,7 @@ public static class Utils
|
|||||||
if (!open) return;
|
if (!open) return;
|
||||||
|
|
||||||
if (PlayerControl.LocalPlayer != null && HudManager.InstanceExists)
|
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
|
#if !ANDROID
|
||||||
Process.Start("explorer.exe", f.Replace("/", "\\"));
|
Process.Start("explorer.exe", f.Replace("/", "\\"));
|
||||||
@@ -4007,7 +4007,7 @@ public static class Utils
|
|||||||
public static void FlashColor(Color color, float duration = 1f)
|
public static void FlashColor(Color color, float duration = 1f)
|
||||||
{
|
{
|
||||||
if (!HudManager.InstanceExists) return;
|
if (!HudManager.InstanceExists) return;
|
||||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hud = HudManager.Instance;
|
||||||
if (hud.FullScreen == null) return;
|
if (hud.FullScreen == null) return;
|
||||||
|
|
||||||
GameObject obj = hud.transform.FindChild("FlashColor_FullScreen")?.gameObject;
|
GameObject obj = hud.transform.FindChild("FlashColor_FullScreen")?.gameObject;
|
||||||
|
|||||||
+2
-2
@@ -70,7 +70,7 @@ public static class Zoom
|
|||||||
HudManager.Instance.UICamera.orthographicSize *= size;
|
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)
|
if (ResetButtons)
|
||||||
{
|
{
|
||||||
@@ -83,7 +83,7 @@ public static class Zoom
|
|||||||
{
|
{
|
||||||
if (Camera.main == null || !HudManager.InstanceExists) return;
|
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:
|
default:
|
||||||
if (!HudManager.InstanceExists) break;
|
if (!HudManager.InstanceExists) break;
|
||||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, "crew | imp");
|
HudManager.Instance.Chat.AddChat(player, "crew | imp");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3359,7 +3359,7 @@ internal static class ChatCommands
|
|||||||
private static void VersionCommand(PlayerControl player, string text, string[] args)
|
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");
|
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)
|
private static void LTCommand(PlayerControl player, string text, string[] args)
|
||||||
@@ -3685,7 +3685,7 @@ internal static class ChatUpdatePatch
|
|||||||
if (clientId == -1 && HudManager.InstanceExists)
|
if (clientId == -1 && HudManager.InstanceExists)
|
||||||
{
|
{
|
||||||
player.SetName(title);
|
player.SetName(title);
|
||||||
FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, msg);
|
HudManager.Instance.Chat.AddChat(player, msg);
|
||||||
player.SetName(name);
|
player.SetName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3754,9 +3754,9 @@ internal static class RpcSendChatPatch
|
|||||||
|
|
||||||
int return_count = PlayerControl.LocalPlayer.name.Count(x => x == '\n');
|
int return_count = PlayerControl.LocalPlayer.name.Count(x => x == '\n');
|
||||||
chatText = new StringBuilder(chatText).Insert(0, "\n", return_count).ToString();
|
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 messageWriter = AmongUsClient.Instance.StartRpcImmediately(__instance.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable);
|
||||||
messageWriter.Write(chatText);
|
messageWriter.Write(chatText);
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ public static class ChatManager
|
|||||||
if (aapc.Length == 0) return;
|
if (aapc.Length == 0) return;
|
||||||
|
|
||||||
string[] filtered = ChatHistory.Where(a => Utils.GetPlayerById(Convert.ToByte(a.Split(':')[0].Trim())).IsAlive()).ToArray();
|
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 writer = CustomRpcSender.Create("SendPreviousMessagesToAll", SendOption.Reliable);
|
||||||
var hasValue = false;
|
var hasValue = false;
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ public static class ChatManager
|
|||||||
{
|
{
|
||||||
bool toEveryone = receiver == null;
|
bool toEveryone = receiver == null;
|
||||||
bool toLocalPlayer = !toEveryone && receiver.IsLocalPlayer();
|
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;
|
if (toLocalPlayer) return;
|
||||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable, toEveryone ? -1 : receiver.OwnerId);
|
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.SendChat, SendOption.Reliable, toEveryone ? -1 : receiver.OwnerId);
|
||||||
writer.Write("<size=32767>.");
|
writer.Write("<size=32767>.");
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ internal static class ControllerManagerUpdatePatch
|
|||||||
yield return new WaitForSeconds(0.1f);
|
yield return new WaitForSeconds(0.1f);
|
||||||
|
|
||||||
string format = GetString("ResettingOptions");
|
string format = GetString("ResettingOptions");
|
||||||
HudManager hudManager = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hudManager = HudManager.Instance;
|
||||||
hudManager.ShowPopUp(string.Format(format, 0, OptionItem.AllOptions.Count));
|
hudManager.ShowPopUp(string.Format(format, 0, OptionItem.AllOptions.Count));
|
||||||
hudManager.Dialogue.BackButton.gameObject.SetActive(false);
|
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)
|
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(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)
|
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)
|
if (Input.GetKeyDown(KeyCode.Equals) && !GameStates.IsMeeting && HudManager.InstanceExists && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||||
{
|
{
|
||||||
Main.VisibleTasksCount = !Main.VisibleTasksCount;
|
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)
|
if (Input.GetKeyDown(KeyCode.I) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||||
@@ -327,13 +327,13 @@ internal static class HandleHUDPatch
|
|||||||
HudManager.InstanceExists &&
|
HudManager.InstanceExists &&
|
||||||
PlayerControl.LocalPlayer.Data?.Role?.IsImpostor == false &&
|
PlayerControl.LocalPlayer.Data?.Role?.IsImpostor == false &&
|
||||||
PlayerControl.LocalPlayer.CanUseKillButton())
|
PlayerControl.LocalPlayer.CanUseKillButton())
|
||||||
FastDestroyableSingleton<HudManager>.Instance.KillButton.DoClick();
|
HudManager.Instance.KillButton.DoClick();
|
||||||
|
|
||||||
if (player.GetButtonDown(50) && // 50: Impostor vent button actionId
|
if (player.GetButtonDown(50) && // 50: Impostor vent button actionId
|
||||||
HudManager.InstanceExists &&
|
HudManager.InstanceExists &&
|
||||||
PlayerControl.LocalPlayer.Data?.Role?.IsImpostor == false &&
|
PlayerControl.LocalPlayer.Data?.Role?.IsImpostor == false &&
|
||||||
PlayerControl.LocalPlayer.CanUseImpostorVentButton())
|
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.currentSceneName = activeScene.name;
|
||||||
__instance.UpdateFriendCodeUI();
|
__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;
|
return false;
|
||||||
|
|
||||||
__instance.friendBars = new();
|
__instance.friendBars = new();
|
||||||
@@ -210,13 +210,13 @@ internal static class FriendsListUIOpenPatch
|
|||||||
__instance.gameObject.SetActive(true);
|
__instance.gameObject.SetActive(true);
|
||||||
__instance.guestAccountWarnings.ForEach((Action<FriendsListGuestWarning>)(t => t.gameObject.SetActive(false)));
|
__instance.guestAccountWarnings.ForEach((Action<FriendsListGuestWarning>)(t => t.gameObject.SetActive(false)));
|
||||||
__instance.ViewRequestsButton.color = __instance.NoRequestsColor;
|
__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();
|
__instance.ClearNotifs();
|
||||||
|
|
||||||
if (FastDestroyableSingleton<EOSManager>.Instance.IsFriendsListAllowed())
|
if (EOSManager.Instance.IsFriendsListAllowed())
|
||||||
{
|
{
|
||||||
__instance.AddFriendObjects.SetActive(true);
|
__instance.AddFriendObjects.SetActive(true);
|
||||||
__instance.RefreshBlockedPlayers();
|
__instance.RefreshBlockedPlayers();
|
||||||
@@ -418,7 +418,7 @@ internal static class ModManagerLateUpdatePatch
|
|||||||
{
|
{
|
||||||
__instance.localCamera = !HudManager.InstanceExists
|
__instance.localCamera = !HudManager.InstanceExists
|
||||||
? Camera.main
|
? Camera.main
|
||||||
: FastDestroyableSingleton<HudManager>.Instance.GetComponentInChildren<Camera>();
|
: HudManager.Instance.GetComponentInChildren<Camera>();
|
||||||
|
|
||||||
if (__instance.localCamera != null)
|
if (__instance.localCamera != null)
|
||||||
{
|
{
|
||||||
@@ -438,7 +438,7 @@ internal static class OptionsMenuBehaviourOpenPatch
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (HudManager.InstanceExists && !FastDestroyableSingleton<HudManager>.Instance.SettingsButton.activeSelf) return false;
|
if (HudManager.InstanceExists && !HudManager.Instance.SettingsButton.activeSelf) return false;
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -240,7 +240,7 @@ internal static class Crowded
|
|||||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||||
public static bool Prefix(CreateOptionsPicker __instance, int maxPlayers)
|
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;
|
return true;
|
||||||
|
|
||||||
IGameOptions targetOptions = __instance.GetTargetOptions();
|
IGameOptions targetOptions = __instance.GetTargetOptions();
|
||||||
@@ -261,7 +261,7 @@ internal static class Crowded
|
|||||||
__instance.UpdateMaxPlayersButtons(targetOptions);
|
__instance.UpdateMaxPlayersButtons(targetOptions);
|
||||||
__instance.UpdateLanguageButton((uint)targetOptions.Keywords);
|
__instance.UpdateLanguageButton((uint)targetOptions.Keywords);
|
||||||
__instance.MapMenu.UpdateMapButtons(targetOptions.MapId);
|
__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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1074,7 +1074,7 @@ public static class GameSettingMenuPatch
|
|||||||
presetTmp.DestroyTranslator();
|
presetTmp.DestroyTranslator();
|
||||||
presetTmp.text = Translator.GetString($"Preset_{OptionItem.CurrentPreset + 1}");
|
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;
|
float size = !russian ? 2.45f : 1.45f;
|
||||||
presetTmp.fontSizeMax = presetTmp.fontSizeMin = size;
|
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);
|
FreeChatInputField field = Object.Instantiate(freeChatField, parentLeftPanel.parent);
|
||||||
field.transform.localScale = new(0.3f, 0.59f, 1);
|
field.transform.localScale = new(0.3f, 0.59f, 1);
|
||||||
field.transform.localPosition = new(-0.7f, -2.5f, -5f);
|
field.transform.localPosition = new(-0.7f, -2.5f, -5f);
|
||||||
@@ -1394,7 +1396,7 @@ public static class GameSettingMenuPatch
|
|||||||
ModGameOptionsMenu.CategoryHeaderList = new();
|
ModGameOptionsMenu.CategoryHeaderList = new();
|
||||||
|
|
||||||
ControllerManager.Instance.OpenOverlayMenu(__instance.name, __instance.BackButton, __instance.DefaultButtonSelected, __instance.ControllerSelectable);
|
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);
|
if (Controller.currentTouchType != Controller.TouchType.Joystick) __instance.ChangeTab(1, false);
|
||||||
|
|
||||||
__instance.StartCoroutine(__instance.CoSelectDefault());
|
__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)
|
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.ShowLobbyTimer(597);
|
||||||
hudManager.LobbyTimerExtensionUI.timerText.transform.parent.transform.Find("Icon").gameObject.SetActive(false);
|
hudManager.LobbyTimerExtensionUI.timerText.transform.parent.transform.Find("Icon").gameObject.SetActive(false);
|
||||||
GameStartManagerUpdatePatch.Warned = false;
|
GameStartManagerUpdatePatch.Warned = false;
|
||||||
@@ -62,7 +62,7 @@ public static class GameStartManagerPatch
|
|||||||
if (AmongUsClient.Instance.AmHost)
|
if (AmongUsClient.Instance.AmHost)
|
||||||
{
|
{
|
||||||
__instance.GameStartTextParent.GetComponent<SpriteRenderer>().sprite = null;
|
__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.GameStartText.transform.localPosition = new(__instance.GameStartText.transform.localPosition.x, 2f, __instance.GameStartText.transform.localPosition.z);
|
||||||
__instance.StartButton.activeTextColor = __instance.StartButton.inactiveTextColor = Color.white;
|
__instance.StartButton.activeTextColor = __instance.StartButton.inactiveTextColor = Color.white;
|
||||||
|
|
||||||
@@ -258,11 +258,11 @@ public static class GameStartManagerPatch
|
|||||||
|
|
||||||
instance.CheckSettingsDiffs();
|
instance.CheckSettingsDiffs();
|
||||||
instance.StartButton.gameObject.SetActive(true);
|
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);
|
if (GameCode.IntToGameName(AmongUsClient.Instance.GameId) == null) instance.privatePublicPanelText.text = TranslationController.Instance.GetString(StringNames.LocalButton);
|
||||||
else if (AmongUsClient.Instance.IsGamePublic) instance.privatePublicPanelText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.PublicHeader);
|
else if (AmongUsClient.Instance.IsGamePublic) instance.privatePublicPanelText.text = TranslationController.Instance.GetString(StringNames.PublicHeader);
|
||||||
else instance.privatePublicPanelText.text = FastDestroyableSingleton<TranslationController>.Instance.GetString(StringNames.PrivateHeader);
|
else instance.privatePublicPanelText.text = TranslationController.Instance.GetString(StringNames.PrivateHeader);
|
||||||
|
|
||||||
instance.HostPrivateButton.gameObject.SetActive(!AmongUsClient.Instance.IsGamePublic);
|
instance.HostPrivateButton.gameObject.SetActive(!AmongUsClient.Instance.IsGamePublic);
|
||||||
instance.HostPublicButton.gameObject.SetActive(AmongUsClient.Instance.IsGamePublic);
|
instance.HostPublicButton.gameObject.SetActive(AmongUsClient.Instance.IsGamePublic);
|
||||||
@@ -282,12 +282,12 @@ public static class GameStartManagerPatch
|
|||||||
ActionMapGlyphDisplay startButtonGlyph = instance.StartButtonGlyph;
|
ActionMapGlyphDisplay startButtonGlyph = instance.StartButtonGlyph;
|
||||||
startButtonGlyph?.SetColor(instance.LastPlayerCount >= instance.MinPlayers ? Palette.EnabledColor : Palette.DisabledClear);
|
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)
|
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
|
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);
|
if (!instance.GameStartTextParent.activeSelf) SoundManager.Instance.PlaySound(instance.gameStartSound, false);
|
||||||
|
|
||||||
instance.GameStartTextParent.SetActive(true);
|
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 (num != num2) PlayerControl.LocalPlayer.RpcSetStartCounter(num2);
|
||||||
|
|
||||||
if (num2 <= 0) instance.FinallyBegin();
|
if (num2 <= 0) instance.FinallyBegin();
|
||||||
}
|
}
|
||||||
else
|
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.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.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);
|
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 (!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.DeactivatePane();
|
||||||
|
|
||||||
instance.LobbyInfoPane.gameObject.SetActive(!FastDestroyableSingleton<HudManager>.Instance.Chat.IsOpenOrOpening);
|
instance.LobbyInfoPane.gameObject.SetActive(!HudManager.Instance.Chat.IsOpenOrOpening);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ANDROID
|
#if !ANDROID
|
||||||
@@ -461,14 +461,14 @@ public static class GameStartManagerPatch
|
|||||||
{
|
{
|
||||||
float timer = Timer;
|
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.sprite = Utils.LoadSprite("EHR.Resources.Images.LobbyTimerBG.png", 100f);
|
||||||
LobbyTimerBg.color = GetTimerColor(timer);
|
LobbyTimerBg.color = GetTimerColor(timer);
|
||||||
|
|
||||||
if (timer <= 60 && !Warned && AmongUsClient.Instance.AmHost)
|
if (timer <= 60 && !Warned && AmongUsClient.Instance.AmHost)
|
||||||
{
|
{
|
||||||
Warned = true;
|
Warned = true;
|
||||||
LobbyTimerExtensionUI lobbyTimerExtensionUI = FastDestroyableSingleton<HudManager>.Instance.LobbyTimerExtensionUI;
|
LobbyTimerExtensionUI lobbyTimerExtensionUI = HudManager.Instance.LobbyTimerExtensionUI;
|
||||||
lobbyTimerExtensionUI.timerText.transform.parent.transform.Find("Icon").gameObject.SetActive(true);
|
lobbyTimerExtensionUI.timerText.transform.parent.transform.Find("Icon").gameObject.SetActive(true);
|
||||||
SoundManager.Instance.PlaySound(lobbyTimerExtensionUI.lobbyTimerPopUpSound, false);
|
SoundManager.Instance.PlaySound(lobbyTimerExtensionUI.lobbyTimerPopUpSound, false);
|
||||||
Utils.FlashColor(new(1f, 1f, 0f, 0.4f), 2f);
|
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;
|
if (taskList == "None" || GameStates.IsLobby || player == null) return;
|
||||||
|
|
||||||
NetworkedPlayerInfo data = PlayerControl.LocalPlayer.Data;
|
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))
|
if (Options.CurrentGameMode is not (CustomGameMode.Standard or CustomGameMode.MoveAndStop or CustomGameMode.HideAndSeek or CustomGameMode.Speedrun))
|
||||||
taskList = GetString("None");
|
taskList = GetString("None");
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ static class CoShowIntroPatch
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int adjustedNumImpostors = GameManager.Instance.LogicOptions.GetAdjustedNumImpostors(GameData.Instance.PlayerCount);
|
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("[FF1919FF]", "<color=#FF1919FF>");
|
||||||
introCutscene.ImpostorText.text = introCutscene.ImpostorText.text.Replace("[]", "</color>");
|
introCutscene.ImpostorText.text = introCutscene.ImpostorText.text.Replace("[]", "</color>");
|
||||||
}
|
}
|
||||||
@@ -632,21 +632,21 @@ internal static class BeginCrewmatePatch
|
|||||||
CustomRoles.Dictator or
|
CustomRoles.Dictator or
|
||||||
CustomRoles.Mayor or
|
CustomRoles.Mayor or
|
||||||
CustomRoles.NiceSwapper
|
CustomRoles.NiceSwapper
|
||||||
=> FastDestroyableSingleton<HudManager>.Instance.Chat.messageSound,
|
=> HudManager.Instance.Chat.messageSound,
|
||||||
|
|
||||||
CustomRoles.AntiAdminer or
|
CustomRoles.AntiAdminer or
|
||||||
CustomRoles.Monitor
|
CustomRoles.Monitor
|
||||||
=> FastDestroyableSingleton<HudManager>.Instance.Chat.warningSound,
|
=> HudManager.Instance.Chat.warningSound,
|
||||||
|
|
||||||
CustomRoles.GM or
|
CustomRoles.GM or
|
||||||
CustomRoles.Snitch or
|
CustomRoles.Snitch or
|
||||||
CustomRoles.Speedrunner or
|
CustomRoles.Speedrunner or
|
||||||
CustomRoles.Workaholic
|
CustomRoles.Workaholic
|
||||||
=> FastDestroyableSingleton<HudManager>.Instance.TaskCompleteSound,
|
=> HudManager.Instance.TaskCompleteSound,
|
||||||
|
|
||||||
CustomRoles.Helper or
|
CustomRoles.Helper or
|
||||||
CustomRoles.TaskManager
|
CustomRoles.TaskManager
|
||||||
=> FastDestroyableSingleton<HudManager>.Instance.TaskUpdateSound,
|
=> HudManager.Instance.TaskUpdateSound,
|
||||||
|
|
||||||
CustomRoles.Inhibitor or
|
CustomRoles.Inhibitor or
|
||||||
CustomRoles.Mechanic or
|
CustomRoles.Mechanic or
|
||||||
@@ -687,11 +687,11 @@ internal static class BeginCrewmatePatch
|
|||||||
|
|
||||||
CustomRoles.Chronomancer or
|
CustomRoles.Chronomancer or
|
||||||
CustomRoles.Tremor
|
CustomRoles.Tremor
|
||||||
=> FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx,
|
=> DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx,
|
||||||
|
|
||||||
CustomRoles.Deputy or
|
CustomRoles.Deputy or
|
||||||
CustomRoles.Sheriff
|
CustomRoles.Sheriff
|
||||||
=> FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherYeehawSfx,
|
=> DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherYeehawSfx,
|
||||||
|
|
||||||
CustomRoles.Hater or
|
CustomRoles.Hater or
|
||||||
CustomRoles.Lawyer or
|
CustomRoles.Lawyer or
|
||||||
@@ -850,7 +850,7 @@ internal static class BeginCrewmatePatch
|
|||||||
__instance.ImpostorText.gameObject.SetActive(true);
|
__instance.ImpostorText.gameObject.SetActive(true);
|
||||||
__instance.ImpostorText.text = GetString("ModeSoloKombat");
|
__instance.ImpostorText.text = GetString("ModeSoloKombat");
|
||||||
__instance.BackgroundBar.material.color = color;
|
__instance.BackgroundBar.material.color = color;
|
||||||
PlayerControl.LocalPlayer.Data.Role.IntroSound = FastDestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx;
|
PlayerControl.LocalPlayer.Data.Role.IntroSound = DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CustomGameMode.FFA:
|
case CustomGameMode.FFA:
|
||||||
@@ -1329,7 +1329,7 @@ internal static class IntroCutsceneDestroyPatch
|
|||||||
|
|
||||||
if (!HudManager.InstanceExists) return;
|
if (!HudManager.InstanceExists) return;
|
||||||
|
|
||||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hud = HudManager.Instance;
|
||||||
|
|
||||||
HudSpritePatch.DefaultIcons =
|
HudSpritePatch.DefaultIcons =
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ internal static class NotificationPopperPatch
|
|||||||
if (parentName == "Accept") return;
|
if (parentName == "Accept") return;
|
||||||
|
|
||||||
string str = key.Parent != null
|
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>")
|
? 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\">" + name + "</font>", "<font=\"Barlow-Black SDF\" material=\"Barlow-Black Outline\">" + optValue + "</font>");
|
||||||
|
|
||||||
SettingsChangeMessageLogic(key, str, playSound);
|
SettingsChangeMessageLogic(key, str, playSound);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ internal static class NotificationPopperPatch
|
|||||||
if (name == "Accept") return;
|
if (name == "Accept") return;
|
||||||
|
|
||||||
SendRpc(1, index, customRole, playSound);
|
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);
|
SettingsChangeMessageLogic(key, str, playSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ internal static class ChangeRoleSettings
|
|||||||
{
|
{
|
||||||
AmongUsClient amongUsClient = __instance;
|
AmongUsClient amongUsClient = __instance;
|
||||||
|
|
||||||
if (FastDestroyableSingleton<HudManager>.Instance.GameMenu.IsOpen)
|
if (HudManager.Instance.GameMenu.IsOpen)
|
||||||
FastDestroyableSingleton<HudManager>.Instance.GameMenu.Close();
|
HudManager.Instance.GameMenu.Close();
|
||||||
|
|
||||||
FastDestroyableSingleton<UnityTelemetry>.Instance.Init();
|
UnityTelemetry.Instance.Init();
|
||||||
amongUsClient.logger.Info("Received game start: " + amongUsClient.AmHost);
|
amongUsClient.logger.Info("Received game start: " + amongUsClient.AmHost);
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
while (!DestroyableSingleton<HudManager>.InstanceExists)
|
while (!HudManager.InstanceExists)
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
while (!PlayerControl.LocalPlayer)
|
while (!PlayerControl.LocalPlayer)
|
||||||
@@ -68,34 +68,34 @@ internal static class ChangeRoleSettings
|
|||||||
if (objectOfType2)
|
if (objectOfType2)
|
||||||
objectOfType2.Close();
|
objectOfType2.Close();
|
||||||
|
|
||||||
if (DestroyableSingleton<GameStartManager>.InstanceExists)
|
if (GameStartManager.InstanceExists)
|
||||||
{
|
{
|
||||||
amongUsClient.DisconnectHandlers.Remove(FastDestroyableSingleton<GameStartManager>.Instance.CastFast<IDisconnectHandler>());
|
amongUsClient.DisconnectHandlers.Remove(GameStartManager.Instance.CastFast<IDisconnectHandler>());
|
||||||
Object.Destroy(FastDestroyableSingleton<GameStartManager>.Instance.gameObject);
|
Object.Destroy(GameStartManager.Instance.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DestroyableSingleton<LobbyInfoPane>.InstanceExists)
|
if (LobbyInfoPane.InstanceExists)
|
||||||
Object.Destroy(FastDestroyableSingleton<LobbyInfoPane>.Instance.gameObject);
|
Object.Destroy(LobbyInfoPane.Instance.gameObject);
|
||||||
|
|
||||||
if (DestroyableSingleton<DiscordManager>.InstanceExists)
|
if (DiscordManager.InstanceExists)
|
||||||
FastDestroyableSingleton<DiscordManager>.Instance.SetPlayingGame();
|
DiscordManager.Instance.SetPlayingGame();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(DataManager.Player.Store.ActiveCosmicube))
|
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
|
else
|
||||||
{
|
{
|
||||||
PlayerStorageManager.CloudPlayerPrefs playerPrefs = FastDestroyableSingleton<PlayerStorageManager>.Instance.PlayerPrefs;
|
PlayerStorageManager.CloudPlayerPrefs playerPrefs = PlayerStorageManager.Instance.PlayerPrefs;
|
||||||
AmongUsClient.Instance.SetActivePodType(playerPrefs.ActivePodType);
|
AmongUsClient.Instance.SetActivePodType(playerPrefs.ActivePodType);
|
||||||
}
|
}
|
||||||
|
|
||||||
FastDestroyableSingleton<FriendsListManager>.Instance.ConfirmationScreen.Cancel();
|
FriendsListManager.Instance.ConfirmationScreen.Cancel();
|
||||||
FastDestroyableSingleton<FriendsListManager>.Instance.Ui.Close(true);
|
FriendsListManager.Instance.Ui.Close(true);
|
||||||
FastDestroyableSingleton<FriendsListManager>.Instance.ReparentUI();
|
FriendsListManager.Instance.ReparentUI();
|
||||||
|
|
||||||
try { CosmeticsCache.ClearUnusedCosmetics(); }
|
try { CosmeticsCache.ClearUnusedCosmetics(); }
|
||||||
catch (Exception e) { Utils.ThrowException(e); }
|
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.BanPoints;
|
||||||
DataManager.Player.Ban.PreviousGameStartDate = DateTime.UtcNow;
|
DataManager.Player.Ban.PreviousGameStartDate = DateTime.UtcNow;
|
||||||
DataManager.Player.Save();
|
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;
|
GameData.TimeGameStarted = Time.realtimeSinceStartup;
|
||||||
int map = Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1);
|
int map = Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1);
|
||||||
string gameName = GameCode.IntToGameName(AmongUsClient.Instance.GameId);
|
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
|
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;
|
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 { }
|
catch { }
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ internal static class StartGameHostPatch
|
|||||||
catch (Exception e) { Utils.ThrowException(e); }
|
catch (Exception e) { Utils.ThrowException(e); }
|
||||||
|
|
||||||
string loadingTextText1 = GetString("LoadingBarText.1");
|
string loadingTextText1 = GetString("LoadingBarText.1");
|
||||||
LoadingBarManager loadingBarManager = FastDestroyableSingleton<LoadingBarManager>.Instance;
|
LoadingBarManager loadingBarManager = LoadingBarManager.Instance;
|
||||||
|
|
||||||
try
|
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"));
|
yield return loadingBarManager.WaitAndSmoothlyUpdate(90f, 95f, 1f, GetString("LoadingBarText.1"));
|
||||||
|
|
||||||
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public static class PhantomRolePatch
|
|||||||
{
|
{
|
||||||
if (phantom.AmOwner)
|
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;
|
if (Utils.ShouldNotApplyAbilityCooldown(roleBase)) return false;
|
||||||
phantom.Data.Role.SetCooldown();
|
phantom.Data.Role.SetCooldown();
|
||||||
return false;
|
return false;
|
||||||
@@ -353,8 +353,8 @@ public static class PhantomRoleUseAbilityPatch
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FastDestroyableSingleton<HudManager>.Instance.AbilityButton.SetSecondImage(__instance.Ability);
|
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.OverrideText(TranslationController.Instance.GetString(StringNames.PhantomAbilityUndo, new Il2CppReferenceArray<Il2CppSystem.Object>(0)));
|
||||||
__instance.Player.CmdCheckVanish(GameManager.Instance.LogicOptions.GetRoleFloat(FloatOptionNames.PhantomDuration));
|
__instance.Player.CmdCheckVanish(GameManager.Instance.LogicOptions.GetRoleFloat(FloatOptionNames.PhantomDuration));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1189,7 +1189,7 @@ internal static class ReportDeadBodyPatch
|
|||||||
|
|
||||||
CustomNetObject.OnMeeting();
|
CustomNetObject.OnMeeting();
|
||||||
|
|
||||||
if (HudManager.InstanceExists) FastDestroyableSingleton<HudManager>.Instance.SetRolePanelOpen(false);
|
if (HudManager.InstanceExists) HudManager.Instance.SetRolePanelOpen(false);
|
||||||
|
|
||||||
Asthmatic.RunChecks = false;
|
Asthmatic.RunChecks = false;
|
||||||
|
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ internal static class OnPlayerJoinedPatch
|
|||||||
Logger.Info(msg, "Android Kick");
|
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);
|
AmongUsClient.Instance.KickPlayer(client.Id, true);
|
||||||
Logger.Info($"Blocked Player {client.PlayerName}({client.FriendCode}) has been banned.", "BAN");
|
Logger.Info($"Blocked Player {client.PlayerName}({client.FriendCode}) has been banned.", "BAN");
|
||||||
@@ -503,7 +503,7 @@ internal static class OnPlayerLeftPatch
|
|||||||
case CustomGameMode.HideAndSeek:
|
case CustomGameMode.HideAndSeek:
|
||||||
CustomHnS.PlayerRoles.Remove(data.Character.PlayerId);
|
CustomHnS.PlayerRoles.Remove(data.Character.PlayerId);
|
||||||
break;
|
break;
|
||||||
case CustomGameMode.Mingle:
|
case CustomGameMode.Mingle when data.Character.IsAlive():
|
||||||
Mingle.HandleDisconnect();
|
Mingle.HandleDisconnect();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public static class SabotageButtonDoClickPatch
|
|||||||
{
|
{
|
||||||
if (!PlayerControl.LocalPlayer.inVent && GameManager.Instance.SabotagesEnabled() && HudManager.InstanceExists)
|
if (!PlayerControl.LocalPlayer.inVent && GameManager.Instance.SabotagesEnabled() && HudManager.InstanceExists)
|
||||||
{
|
{
|
||||||
FastDestroyableSingleton<HudManager>.Instance.ToggleMapVisible(new()
|
HudManager.Instance.ToggleMapVisible(new()
|
||||||
{
|
{
|
||||||
Mode = MapOptions.Modes.Sabotage
|
Mode = MapOptions.Modes.Sabotage
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ public static class ServerDropdownPatch
|
|||||||
if (SceneManager.GetActiveScene().name == "FindAGame") return true;
|
if (SceneManager.GetActiveScene().name == "FindAGame") return true;
|
||||||
SpriteRenderer bg = __instance.background;
|
SpriteRenderer bg = __instance.background;
|
||||||
bg.size = new Vector2(4, 1);
|
bg.size = new Vector2(4, 1);
|
||||||
ServerManager sm = FastDestroyableSingleton<ServerManager>.Instance;
|
ServerManager sm = ServerManager.Instance;
|
||||||
TranslationController tc = FastDestroyableSingleton<TranslationController>.Instance;
|
TranslationController tc = TranslationController.Instance;
|
||||||
int totalCols = Mathf.Max(1, Mathf.CeilToInt(sm.AvailableRegions.Length / (float)5));
|
int totalCols = Mathf.Max(1, Mathf.CeilToInt(sm.AvailableRegions.Length / (float)5));
|
||||||
int rowLimit = Mathf.Min(sm.AvailableRegions.Length, 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;
|
int length = __instance.tempTxt.Length;
|
||||||
__instance.tempTxt.Length = Math.Min(__instance.tempTxt.Length, __instance.characterLimit);
|
__instance.tempTxt.Length = Math.Min(__instance.tempTxt.Length, __instance.characterLimit);
|
||||||
@@ -185,7 +185,7 @@ public static class TextBoxPatch
|
|||||||
}
|
}
|
||||||
|
|
||||||
IsInvalidCommand = false;
|
IsInvalidCommand = false;
|
||||||
HudManager hud = FastDestroyableSingleton<HudManager>.Instance;
|
HudManager hud = HudManager.Instance;
|
||||||
|
|
||||||
if (PlaceHolderText == null)
|
if (PlaceHolderText == null)
|
||||||
{
|
{
|
||||||
@@ -341,7 +341,7 @@ public static class TextBoxPatch
|
|||||||
|
|
||||||
if (AdditionalInfoText != null)
|
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;
|
AdditionalInfoText.enabled = showLobbyCode;
|
||||||
if (showLobbyCode) AdditionalInfoText.text = $"\n\n{Translator.GetString("LobbyCode")}:\n<size=250%><b>{GameCode.IntToGameName(AmongUsClient.Instance.GameId)}</b></size>";
|
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
|
try
|
||||||
{
|
{
|
||||||
bool open = HudManager.InstanceExists && (FastDestroyableSingleton<HudManager>.Instance?.Chat?.IsOpenOrOpening ?? false);
|
bool open = HudManager.InstanceExists && (HudManager.Instance?.Chat?.IsOpenOrOpening ?? false);
|
||||||
PlaceHolderText?.gameObject.SetActive(open);
|
PlaceHolderText?.gameObject.SetActive(open);
|
||||||
CommandInfoText?.gameObject.SetActive(open);
|
CommandInfoText?.gameObject.SetActive(open);
|
||||||
AdditionalInfoText?.gameObject.SetActive(open);
|
AdditionalInfoText?.gameObject.SetActive(open);
|
||||||
|
|||||||
@@ -227,6 +227,6 @@ public sealed class Stealth : RoleBase
|
|||||||
seen ??= seer;
|
seen ??= seer;
|
||||||
if (isForMeeting || seer != StealthPC || seen != StealthPC || !darkenedRoom.HasValue) return base.GetSuffix(seer, seen, isForMeeting, isForHud);
|
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