mirror of
https://github.com/ApeMV/AmongUsRevamped.git
synced 2026-10-20 01:46:28 +00:00
Pray this works simulator (v1.9.4)
This commit is contained in:
1 parent
69c13b2fba
commit
037c3ce902
23 files changed
+804
-361
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using AmongUs.GameOptions;
|
||||
using Hazel;
|
||||
using Il2CppInterop.Runtime.InteropTypes.Arrays;
|
||||
using System;
|
||||
|
||||
namespace AmongUsRevamped;
|
||||
|
||||
public static class OptionManager
|
||||
{
|
||||
private static OptionBackupData CachedOptions;
|
||||
public static void SyncGameOptions()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
var options = GameOptionsManager.Instance.CurrentGameOptions;
|
||||
|
||||
foreach (var component in GameManager.Instance.LogicComponents)
|
||||
{
|
||||
var logicOptions = component.TryCast<LogicOptions>();
|
||||
|
||||
if (logicOptions != null)
|
||||
{
|
||||
logicOptions.SetGameOptions(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CacheOptions()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
CachedOptions = new OptionBackupData(GameOptionsManager.Instance.CurrentGameOptions);
|
||||
}
|
||||
|
||||
public static void RestoreOptions()
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || CachedOptions == null) return;
|
||||
|
||||
var restored = CachedOptions.Restore(GameOptionsManager.Instance.CurrentGameOptions);
|
||||
|
||||
GameOptionsManager.Instance.CurrentGameOptions = restored;
|
||||
|
||||
SyncGameOptions();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user