remove all DestroyableSingleton

This commit is contained in:
D1GQ committed 2025-03-29 17:13:18 -05:00
1 parent 94e7d83ea9
commit df041a86ad
10 files changed
+25 -25

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ class Logger
{
if (hostOnly && !GameState.IsHost) return;
if (DestroyableSingleton<HudManager>._instance) DestroyableSingleton<HudManager>.Instance.Notifier.AddDisconnectMessage(info);
if (HudManager.InstanceExists) HudManager.Instance.Notifier.AddDisconnectMessage(info);
Log(info, "InGame", hostOnly: hostOnly);
}
+5 -3
View File
@@ -36,7 +36,7 @@ class BetterNotificationManager
BAUNotificationManagerObj.SetActive(true);
NameText.text = $"<color=#00ff44>{Translator.GetString("SystemNotification")}</color>";
TextArea.text = text;
SoundManager.Instance.PlaySound(DestroyableSingleton<HudManager>.Instance.TaskCompleteSound, false, 1f);
SoundManager.Instance.PlaySound(HudManager.Instance.TaskCompleteSound, false, 1f);
Notifying = true;
}
}
@@ -45,10 +45,12 @@ class BetterNotificationManager
{
if (player.IsLocalPlayer())
{
/*
FileChecker.SetHasUnauthorizedFileOrMod();
FileChecker.SetWarningMsg("Tampered client detected!");
Utils.DisconnectSelf("Tampered client detected!");
Utils.DisconnectAccountFromOnline();
*/
return;
}
@@ -101,9 +103,9 @@ class BetterNotificationManager
{
if (!localCamera)
{
if (DestroyableSingleton<HudManager>.InstanceExists)
if (HudManager.InstanceExists)
{
localCamera = DestroyableSingleton<HudManager>.Instance.GetComponentInChildren<Camera>();
localCamera = HudManager.Instance.GetComponentInChildren<Camera>();
}
else
{
+3 -3
View File
@@ -2,16 +2,16 @@
internal class CustomLoadingBarManager
{
internal static AmongUsLoadingBar? LoadingBar => DestroyableSingleton<LoadingBarManager>.Instance?.loadingBar;
internal static AmongUsLoadingBar? LoadingBar => LoadingBarManager.Instance?.loadingBar;
internal static void ToggleLoadingBar(bool on)
{
DestroyableSingleton<LoadingBarManager>.Instance.loadingBar.gameObject.SetActive(on);
LoadingBarManager.Instance.loadingBar.gameObject.SetActive(on);
}
internal static void SetLoadingPercent(float percent, string loadText)
{
var loadingBar = DestroyableSingleton<LoadingBarManager>.Instance.loadingBar;
var loadingBar = LoadingBarManager.Instance.loadingBar;
loadingBar.SetLoadingPercent(percent, StringNames.None);
loadingBar.loadingText.SetText(loadText);
}
+1 -1
View File
@@ -27,7 +27,7 @@ internal abstract class RPCHandler
.Select(t => (RPCHandler?)Activator.CreateInstance(t))
.ToArray();
internal InnerNetClient innerNetClient => DestroyableSingleton<InnerNetClient>.Instance;
internal InnerNetClient innerNetClient => AmongUsClient.Instance;
internal virtual byte CallId => byte.MaxValue;
internal virtual byte GameDataTag => byte.MaxValue;
internal virtual bool LocalHandling { get; set; }
+2 -3
View File
@@ -108,7 +108,7 @@ internal static class Translator
string nameToFind = s;
if (Enum.TryParse(nameToFind, out StringNames text))
{
return DestroyableSingleton<TranslationController>.Instance.GetString(text);
return TranslationController.Instance.GetString(text);
}
else
{
@@ -151,8 +151,7 @@ internal static class Translator
}
return res;
}
internal static string GetString(StringNames stringName)
=> DestroyableSingleton<TranslationController>.Instance.GetString(stringName, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
internal static string GetString(StringNames stringName) => TranslationController.Instance.GetString(stringName, new Il2CppReferenceArray<Il2CppSystem.Object>(0));
internal static SupportedLangs GetUserTrueLang()
{
try
+4 -5
View File
@@ -53,7 +53,7 @@ internal static class Zoom
HudManager.Instance.UICamera.orthographicSize *= size;
}
DestroyableSingleton<HudManager>.Instance?.ShadowQuad?.gameObject?.SetActive((reset || Camera.main.orthographicSize == 3.0f) && PlayerControl.LocalPlayer.IsAlive());
HudManager.Instance?.ShadowQuad?.gameObject?.SetActive((reset || Camera.main.orthographicSize == 3.0f) && PlayerControl.LocalPlayer.IsAlive());
if (resetButtons)
{
@@ -62,14 +62,13 @@ internal static class Zoom
}
}
internal static void OnFixedUpdate() =>
DestroyableSingleton<HudManager>.Instance?.ShadowQuad?.gameObject?.SetActive(Camera.main.orthographicSize == 3.0f && PlayerControl.LocalPlayer.IsAlive());
internal static void OnFixedUpdate() => HudManager.Instance?.ShadowQuad?.gameObject?.SetActive(Camera.main.orthographicSize == 3.0f && PlayerControl.LocalPlayer.IsAlive());
}
internal static class Flag
{
private static readonly List<string> oneTimeList = new();
private static readonly List<string> firstRunList = new();
private static readonly List<string> oneTimeList = [];
private static readonly List<string> firstRunList = [];
internal static void Run(Action action, string type, bool firstrun = false)
{
+2 -2
View File
@@ -172,9 +172,9 @@ class GamePlayManager
SummaryObj.name = "SummaryObj (TMP)";
SummaryObj.transform.SetSiblingIndex(0);
Camera localCamera;
if (DestroyableSingleton<HudManager>.InstanceExists)
if (HudManager.InstanceExists)
{
localCamera = DestroyableSingleton<HudManager>.Instance.GetComponentInChildren<Camera>();
localCamera = HudManager.Instance.GetComponentInChildren<Camera>();
}
else
{
+2 -2
View File
@@ -108,7 +108,7 @@ class GameDataShowNotificationPatch
Logger.Log(ReasonText);
DestroyableSingleton<HudManager>.Instance.Notifier.AddDisconnectMessage(ReasonText);
HudManager.Instance.Notifier.AddDisconnectMessage(ReasonText);
}
else
{
@@ -144,7 +144,7 @@ class GameDataShowNotificationPatch
Logger.Log(ReasonText);
DestroyableSingleton<HudManager>.Instance.Notifier.AddDisconnectMessage(ReasonText);
HudManager.Instance.Notifier.AddDisconnectMessage(ReasonText);
}
}
+4 -4
View File
@@ -39,7 +39,7 @@ internal class ServerDropdownPatch
const float buttonSpacing = 0.5f;
// Get all available regions except current one
var regions = DestroyableSingleton<ServerManager>.Instance.AvailableRegions.OrderBy(ServerManager.DefaultRegions.Contains).ToList();
var regions = ServerManager.Instance.AvailableRegions.OrderBy(ServerManager.DefaultRegions.Contains).ToList();
// Calculate total columns needed
int totalColumns = Mathf.Max(1, Mathf.CeilToInt(regions.Count / (float)maxPerColumn));
@@ -48,10 +48,10 @@ internal class ServerDropdownPatch
foreach (IRegionInfo regionInfo in regions)
{
if (DestroyableSingleton<ServerManager>.Instance.CurrentRegion.Name == regionInfo.Name)
if (ServerManager.Instance.CurrentRegion.Name == regionInfo.Name)
{
__instance.defaultButtonSelected = __instance.firstOption;
__instance.firstOption.ChangeButtonText(DestroyableSingleton<TranslationController>.Instance.GetStringWithDefault(regionInfo.TranslateName, regionInfo.Name, new Il2CppReferenceArray<Il2CppSystem.Object>(0)));
__instance.firstOption.ChangeButtonText(TranslationController.Instance.GetStringWithDefault(regionInfo.TranslateName, regionInfo.Name, new Il2CppReferenceArray<Il2CppSystem.Object>(0)));
continue;
}
@@ -65,7 +65,7 @@ internal class ServerDropdownPatch
serverListButton.transform.localPosition = new Vector3(xPos, yPos, -1f);
serverListButton.transform.localScale = Vector3.one;
serverListButton.Text.enableAutoSizing = true;
serverListButton.Text.text = DestroyableSingleton<TranslationController>.Instance.GetStringWithDefault(
serverListButton.Text.text = TranslationController.Instance.GetStringWithDefault(
regionInfo.TranslateName,
regionInfo.Name,
new Il2CppReferenceArray<Il2CppSystem.Object>(0));
+1 -1
View File
@@ -83,7 +83,7 @@ internal class Main : BasePlugin
internal static string BetterAmongUsVersion => PluginVersion;
internal static string AppVersion => Application.version;
internal static string AmongUsVersion => DestroyableSingleton<ReferenceDataManager>.Instance.Refdata.userFacingVersion;
internal static string AmongUsVersion => ReferenceDataManager.Instance.Refdata.userFacingVersion;
internal static PlatformSpecificData PlatformData => Constants.GetPlatformData();