Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Empress Among Us v1.0.2
BepInEx/plugins/Omniscye-Empress_Among_Us/EmpressAmongUs.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using REPOLib.Objects.Sdk; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressAmongUs")] [assembly: AssemblyTitle("EmpressAmongUs")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.REPO.AmongUs { internal static class AmongUsAccess { private delegate void ModuleSetAllChecklistDelegate(Module module); private delegate void LevelGeneratorGenerateDoneDelegate(LevelGenerator instance, PhotonMessageInfo info); private static readonly FieldInfo EnvironmentSetupDoneField = AccessTools.Field(typeof(EnvironmentDirector), "SetupDone"); private static readonly FieldInfo EnvironmentMainCameraField = AccessTools.Field(typeof(EnvironmentDirector), "MainCamera"); private static readonly FieldInfo EnvironmentAmbientColorField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColor"); private static readonly FieldInfo EnvironmentAmbientColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorNew"); private static readonly FieldInfo EnvironmentAmbientColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorPrevious"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptation"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationNewField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationNew"); private static readonly FieldInfo EnvironmentAmbientColorAdaptationPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "AmbientColorAdaptationPrevious"); private static readonly FieldInfo EnvironmentDarkAdaptationLerpField = AccessTools.Field(typeof(EnvironmentDirector), "DarkAdaptationLerp"); private static readonly FieldInfo EnvironmentFogColorField = AccessTools.Field(typeof(EnvironmentDirector), "FogColor"); private static readonly FieldInfo EnvironmentFogColorNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorNew"); private static readonly FieldInfo EnvironmentFogColorPreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogColorPrevious"); private static readonly FieldInfo EnvironmentFogStartDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistance"); private static readonly FieldInfo EnvironmentFogStartDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistanceNew"); private static readonly FieldInfo EnvironmentFogStartDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogStartDistancePrevious"); private static readonly FieldInfo EnvironmentFogEndDistanceField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistance"); private static readonly FieldInfo EnvironmentFogEndDistanceNewField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistanceNew"); private static readonly FieldInfo EnvironmentFogEndDistancePreviousField = AccessTools.Field(typeof(EnvironmentDirector), "FogEndDistancePrevious"); private static readonly FieldInfo LevelGeneratorAllPlayersReadyField = AccessTools.Field(typeof(LevelGenerator), "AllPlayersReady"); private static readonly FieldInfo LevelGeneratorEnemyReadyField = AccessTools.Field(typeof(LevelGenerator), "EnemyReady"); private static readonly FieldInfo LevelGeneratorModulesSpawnedField = AccessTools.Field(typeof(LevelGenerator), "ModulesSpawned"); private static readonly FieldInfo LevelGeneratorPlayerSpawnedField = AccessTools.Field(typeof(LevelGenerator), "playerSpawned"); private static readonly FieldInfo RunManagerLevelPreviousField = AccessTools.Field(typeof(RunManager), "levelPrevious"); private static readonly FieldInfo PlayerAvatarIsDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled"); private static readonly FieldInfo PlayerAvatarDeadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet"); private static readonly FieldInfo PlayerAvatarPlayerNameField = AccessTools.Field(typeof(PlayerAvatar), "playerName"); private static readonly FieldInfo PlayerAvatarPhotonViewField = AccessTools.Field(typeof(PlayerAvatar), "photonView"); private static readonly FieldInfo PlayerAvatarIsLocalField = AccessTools.Field(typeof(PlayerAvatar), "isLocal"); private static readonly FieldInfo PlayerAvatarSteamShortField = AccessTools.Field(typeof(PlayerAvatar), "steamIDshort"); private static readonly FieldInfo ValuableDirectorSetupCompleteField = AccessTools.Field(typeof(ValuableDirector), "setupComplete"); private static readonly FieldInfo PlayerAvatarTumbleField = AccessTools.Field(typeof(PlayerAvatar), "tumble"); private static readonly FieldInfo PlayerTumblePhysGrabObjectField = AccessTools.Field(typeof(PlayerTumble), "physGrabObject"); private static readonly FieldInfo PlayerAvatarRbField = AccessTools.Field(typeof(PlayerAvatar), "rb"); private static readonly FieldInfo PlayerAvatarVisualPositionField = AccessTools.Field(typeof(PlayerAvatarVisuals), "visualPosition"); private static readonly FieldInfo PlayerControllerRbField = AccessTools.Field(typeof(PlayerController), "rb"); private static readonly FieldInfo PlayerControllerVelocityField = AccessTools.Field(typeof(PlayerController), "Velocity"); private static readonly FieldInfo PlayerControllerVelocityRelativeField = AccessTools.Field(typeof(PlayerController), "VelocityRelative"); private static readonly FieldInfo PlayerControllerVelocityRelativeNewField = AccessTools.Field(typeof(PlayerController), "VelocityRelativeNew"); private static readonly FieldInfo PlayerControllerMoveForceTimerField = AccessTools.Field(typeof(PlayerController), "MoveForceTimer"); private static readonly MethodInfo PlayerControllerInputDisableMethod = AccessTools.Method(typeof(PlayerController), "InputDisable", new Type[1] { typeof(float) }, (Type[])null); private static readonly FieldInfo RoundDirectorExtractionPointsField = AccessTools.Field(typeof(RoundDirector), "extractionPoints"); private static readonly FieldInfo RoundDirectorExtractionPointsCompletedField = AccessTools.Field(typeof(RoundDirector), "extractionPointsCompleted"); private static readonly FieldInfo RoundDirectorExtractionPointListField = AccessTools.Field(typeof(RoundDirector), "extractionPointList"); private static readonly FieldInfo ModuleSetupDoneField = AccessTools.Field(typeof(Module), "SetupDone"); private static readonly FieldInfo ModuleStartRoomField = AccessTools.Field(typeof(Module), "StartRoom"); private static readonly FieldInfo ModuleGridXField = AccessTools.Field(typeof(Module), "GridX"); private static readonly FieldInfo ModuleGridYField = AccessTools.Field(typeof(Module), "GridY"); private static readonly FieldInfo ModuleFirstField = AccessTools.Field(typeof(Module), "First"); private static readonly FieldInfo LevelPointInStartRoomField = AccessTools.Field(typeof(LevelPoint), "inStartRoom"); private static readonly FieldInfo RunManagerSingleplayerPoolField = AccessTools.Field(typeof(RunManager), "singleplayerPool"); private static readonly FieldInfo RunManagerMultiplayerPoolField = AccessTools.Field(typeof(RunManager), "multiplayerPool"); private static readonly FieldInfo MultiplayerPoolResourceCacheField = AccessTools.Field(typeof(MultiplayerPool), "ResourceCache"); private static readonly MethodInfo ModuleSetAllChecklistMethod = AccessTools.Method(typeof(Module), "SetAllChecklist", (Type[])null, (Type[])null); private static readonly MethodInfo LevelGeneratorGenerateDoneMethod = AccessTools.Method(typeof(LevelGenerator), "GenerateDone", new Type[1] { typeof(PhotonMessageInfo) }, (Type[])null); private static readonly MethodInfo LevelGeneratorEnemySetupMethod = AccessTools.Method(typeof(LevelGenerator), "EnemySetup", (Type[])null, (Type[])null); private static readonly ModuleSetAllChecklistDelegate ModuleSetAllChecklistCall = CreateDelegate<ModuleSetAllChecklistDelegate>(ModuleSetAllChecklistMethod); private static readonly LevelGeneratorGenerateDoneDelegate LevelGeneratorGenerateDoneCall = CreateDelegate<LevelGeneratorGenerateDoneDelegate>(LevelGeneratorGenerateDoneMethod); public static void SetEnvironmentFog(EnvironmentDirector director, Color color, float startDistance, float endDistance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentFogColorField, director, color); SetField(EnvironmentFogColorNewField, director, color); SetField(EnvironmentFogColorPreviousField, director, color); SetField(EnvironmentFogStartDistanceField, director, startDistance); SetField(EnvironmentFogStartDistanceNewField, director, startDistance); SetField(EnvironmentFogStartDistancePreviousField, director, startDistance); SetField(EnvironmentFogEndDistanceField, director, endDistance); SetField(EnvironmentFogEndDistanceNewField, director, endDistance); SetField(EnvironmentFogEndDistancePreviousField, director, endDistance); } public static void SetEnvironmentAmbient(EnvironmentDirector director, Color ambient, Color adaptation) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) SetField(EnvironmentAmbientColorField, director, ambient); SetField(EnvironmentAmbientColorNewField, director, ambient); SetField(EnvironmentAmbientColorPreviousField, director, ambient); SetField(EnvironmentAmbientColorAdaptationField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationNewField, director, adaptation); SetField(EnvironmentAmbientColorAdaptationPreviousField, director, adaptation); } public static void SetEnvironmentDarkAdaptation(EnvironmentDirector director, float value) { SetField(EnvironmentDarkAdaptationLerpField, director, value); } public static Camera GetEnvironmentMainCamera(EnvironmentDirector director) { return Get<Camera>(EnvironmentMainCameraField, director); } public static void SetEnvironmentMainCamera(EnvironmentDirector director, Camera camera) { SetField(EnvironmentMainCameraField, director, camera); } public static void SetEnvironmentSetupDone(EnvironmentDirector director, bool value) { SetField(EnvironmentSetupDoneField, director, value); } public static void SetAllPlayersReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorAllPlayersReadyField, generator, value); } public static bool GetAllPlayersReady(LevelGenerator generator) { return GetBool(LevelGeneratorAllPlayersReadyField, generator); } public static void SetLevelPrevious(RunManager manager, Level level) { SetField(RunManagerLevelPreviousField, manager, level); } public static void SetEnemyReady(LevelGenerator generator, bool value) { SetField(LevelGeneratorEnemyReadyField, generator, value); } public static void SetModulesSpawned(LevelGenerator generator, int value) { SetField(LevelGeneratorModulesSpawnedField, generator, value); } public static void SetPlayerSpawnedCount(LevelGenerator generator, int value) { SetField(LevelGeneratorPlayerSpawnedField, generator, value); } public static int GetPlayerSpawnedCount(LevelGenerator generator) { return GetInt(LevelGeneratorPlayerSpawnedField, generator); } public static bool GetIsDisabled(PlayerAvatar avatar) { return GetBool(PlayerAvatarIsDisabledField, avatar); } public static bool GetDeadSet(PlayerAvatar avatar) { return GetBool(PlayerAvatarDeadSetField, avatar); } public static bool GetValuableSetupComplete(ValuableDirector director) { return GetBool(ValuableDirectorSetupCompleteField, director); } public static string GetPlayerName(PlayerAvatar avatar) { return Get<string>(PlayerAvatarPlayerNameField, avatar); } public static int GetActorNumber(PlayerAvatar avatar) { if ((Object)(object)avatar == (Object)null) { return -1; } PhotonView val = Get<PhotonView>(PlayerAvatarPhotonViewField, avatar); if ((Object)(object)val != (Object)null && val.Owner != null) { return val.Owner.ActorNumber; } if (GetBool(PlayerAvatarIsLocalField, avatar)) { return 1; } return GetInt(PlayerAvatarSteamShortField, avatar); } public static PlayerTumble GetPlayerTumble(PlayerAvatar avatar) { return Get<PlayerTumble>(PlayerAvatarTumbleField, avatar); } public static void ResetRoundExtraction(RoundDirector director) { SetField(RoundDirectorExtractionPointsField, director, 0); SetField(RoundDirectorExtractionPointsCompletedField, director, 0); Get<List<GameObject>>(RoundDirectorExtractionPointListField, director)?.Clear(); } public static void ConfigureStartRoomModule(Module module, int gridX, int gridY) { ModuleSetAllChecklistCall?.Invoke(module); SetField(ModuleSetupDoneField, module, true); SetField(ModuleStartRoomField, module, true); SetField(ModuleFirstField, module, true); SetField(ModuleGridXField, module, gridX); SetField(ModuleGridYField, module, gridY); } public static void MarkLevelPointInStartRoom(LevelPoint point, bool value) { SetField(LevelPointInStartRoomField, point, value); } public static void GenerateDone(LevelGenerator generator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) LevelGeneratorGenerateDoneCall?.Invoke(generator, default(PhotonMessageInfo)); } public static IEnumerator EnemySetup(LevelGenerator generator) { if (LevelGeneratorEnemySetupMethod == null) { return null; } return LevelGeneratorEnemySetupMethod.Invoke(generator, null) as IEnumerator; } public static void RegisterResourcePrefab(string resourcePath, GameObject prefab) { RunManager instance = RunManager.instance; if (!((Object)(object)instance == (Object)null) && !string.IsNullOrEmpty(resourcePath) && !((Object)(object)prefab == (Object)null)) { AddToPool(RunManagerSingleplayerPoolField?.GetValue(instance), resourcePath, prefab); object obj = RunManagerMultiplayerPoolField?.GetValue(instance); if (obj != null) { AddToPool(MultiplayerPoolResourceCacheField?.GetValue(obj), resourcePath, prefab); } } } private static void AddToPool(object poolObject, string resourcePath, GameObject prefab) { if (poolObject is IDictionary dictionary && !dictionary.Contains(resourcePath)) { dictionary.Add(resourcePath, prefab); } } public static void TeleportLocalPlayer(Vector3 position, Quaternion rotation) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerController.instance.playerAvatarScript : null); if ((Object)(object)val == (Object)null) { return; } if ((Object)(object)val.physGrabber != (Object)null) { val.physGrabber.ReleaseObject(-1, 0.1f); } PlayerTumble playerTumble = GetPlayerTumble(val); PhysGrabObject val2 = Get<PhysGrabObject>(PlayerTumblePhysGrabObjectField, playerTumble); if ((Object)(object)val2 != (Object)null) { val2.Teleport(position, rotation); } Rigidbody val3 = Get<Rigidbody>(PlayerAvatarRbField, val); if ((Object)(object)val3 != (Object)null) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; val3.position = position; val3.rotation = rotation; } ((Component)val).transform.SetPositionAndRotation(position, rotation); if ((Object)(object)val.playerTransform != (Object)null) { val.playerTransform.SetPositionAndRotation(position, rotation); } if ((Object)(object)val.playerAvatarVisuals != (Object)null) { ((Component)val.playerAvatarVisuals).transform.position = position; SetField(PlayerAvatarVisualPositionField, val.playerAvatarVisuals, position); } PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null) { ((Component)instance).transform.SetPositionAndRotation(position, rotation); Rigidbody val4 = Get<Rigidbody>(PlayerControllerRbField, instance); if ((Object)(object)val4 != (Object)null) { val4.velocity = Vector3.zero; val4.angularVelocity = Vector3.zero; val4.position = position; val4.rotation = rotation; } SetField(PlayerControllerVelocityField, instance, Vector3.zero); SetField(PlayerControllerVelocityRelativeField, instance, Vector3.zero); SetField(PlayerControllerVelocityRelativeNewField, instance, Vector3.zero); SetField(PlayerControllerMoveForceTimerField, instance, 0f); PlayerControllerInputDisableMethod?.Invoke(instance, new object[1] { 0.25f }); } } private static T Get<T>(FieldInfo field, object instance) where T : class { if (field == null || instance == null) { return null; } return field.GetValue(instance) as T; } private static bool GetBool(FieldInfo field, object instance) { if (field == null || instance == null) { return false; } object value = field.GetValue(instance); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private static int GetInt(FieldInfo field, object instance) { if (field == null || instance == null) { return 0; } object value = field.GetValue(instance); if (value is int) { return (int)value; } return 0; } private static void SetField(FieldInfo field, object instance, object value) { if (!(field == null) && instance != null) { field.SetValue(instance, value); } } private static TDelegate CreateDelegate<TDelegate>(MethodInfo method) where TDelegate : Delegate { if (method == null) { return null; } return AccessTools.MethodDelegate<TDelegate>(method, (object)null, true); } } internal static class AmongUsAssets { private const string BundleFileName = "empress_among_us_level.empress"; private const string LevelPrefabName = "EmpressAmongUsLevel"; public static GameObject LevelPrefab { get; private set; } public static void Load() { if ((Object)(object)LevelPrefab != (Object)null) { return; } string text = Path.Combine(EmpressAmongUsPlugin.PluginDirectory, "bundles", "empress_among_us_level.empress"); if (!File.Exists(text)) { EmpressAmongUsPlugin.Log.LogError((object)("Missing Empress Among Us bundle: " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { EmpressAmongUsPlugin.Log.LogError((object)("Could not load Empress Among Us bundle: " + text)); return; } LevelPrefab = val.LoadAsset<GameObject>("EmpressAmongUsLevel"); if ((Object)(object)LevelPrefab == (Object)null) { EmpressAmongUsPlugin.Log.LogError((object)"Could not find prefab EmpressAmongUsLevel in empress_among_us_level.empress."); } } } internal static class AmongUsAudio { public static AudioClip DoorOpen { get; private set; } public static AudioClip VentMove { get; private set; } public static AudioClip Emergency { get; private set; } public static AudioClip Report { get; private set; } public static AudioClip TaskComplete { get; private set; } public static AudioClip TaskBeep { get; private set; } public static IEnumerator LoadAll(string pluginDirectory) { string audioDirectory = Path.Combine(pluginDirectory, "audio"); if (Directory.Exists(audioDirectory)) { yield return Load(Path.Combine(audioDirectory, "door_open.ogg"), delegate(AudioClip clip) { DoorOpen = clip; }); yield return Load(Path.Combine(audioDirectory, "vent_move.ogg"), delegate(AudioClip clip) { VentMove = clip; }); yield return Load(Path.Combine(audioDirectory, "emergency.ogg"), delegate(AudioClip clip) { Emergency = clip; }); yield return Load(Path.Combine(audioDirectory, "report.ogg"), delegate(AudioClip clip) { Report = clip; }); yield return Load(Path.Combine(audioDirectory, "task_complete.ogg"), delegate(AudioClip clip) { TaskComplete = clip; }); yield return Load(Path.Combine(audioDirectory, "task_beep.ogg"), delegate(AudioClip clip) { TaskBeep = clip; }); } } private static IEnumerator Load(string filePath, Action<AudioClip> assign) { if (!File.Exists(filePath)) { yield break; } UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file://" + filePath, (AudioType)14); DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)request.downloadHandler; val.streamAudio = false; val.compressed = false; yield return request.SendWebRequest(); if ((int)request.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)content != (Object)null) { ((Object)content).name = Path.GetFileNameWithoutExtension(filePath); assign(content); } } } } public sealed class AmongUsDoor : MonoBehaviour { private const float OpenRange = 3.8f; private const float CloseRange = 5.6f; private const float SlideSpeed = 6f; private const float DoorVolume = 0.09f; internal static readonly List<Collider> AllColliders = new List<Collider>(); private Vector3 _closedLocal; private Vector3 _openLocal; private float _openAmount; private Collider[] _colliders; private AudioSource _audio; private bool _wasOpen; private bool _isOpen; private float _enemyCheckTimer; private float _enemyNearestCached = 999f; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) _closedLocal = ((Component)this).transform.localPosition; float num = 2.6f; Renderer component = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { Bounds bounds = component.bounds; num = Mathf.Max(1.8f, ((Bounds)(ref bounds)).size.y * 0.95f); } _openLocal = _closedLocal + Vector3.up * num; _colliders = ((Component)this).GetComponentsInChildren<Collider>(true); for (int i = 0; i < _colliders.Length; i++) { if ((Object)(object)_colliders[i] != (Object)null && !AllColliders.Contains(_colliders[i])) { AllColliders.Add(_colliders[i]); } } _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); _audio.spatialBlend = 1f; _audio.minDistance = 2f; _audio.maxDistance = 22f; _audio.volume = 0.09f; _audio.playOnAwake = false; } private void Update() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(NearestPlayer(), NearestEnemy()); if (!_isOpen && num < 3.8f) { _isOpen = true; } else if (_isOpen && num > 5.6f) { _isOpen = false; } if (_isOpen && !_wasOpen && (Object)(object)_audio != (Object)null && (Object)(object)AmongUsAudio.DoorOpen != (Object)null) { _audio.PlayOneShot(AmongUsAudio.DoorOpen); } _wasOpen = _isOpen; float num2 = (_isOpen ? 1f : 0f); _openAmount = Mathf.MoveTowards(_openAmount, num2, 6f * Time.deltaTime); ((Component)this).transform.localPosition = Vector3.Lerp(_closedLocal, _openLocal, _openAmount); bool flag = _openAmount > 0.55f; for (int i = 0; i < _colliders.Length; i++) { if ((Object)(object)_colliders[i] != (Object)null && _colliders[i].enabled == flag) { _colliders[i].enabled = !flag; } } } private float NearestPlayer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; float num = 999f; List<PlayerAvatar> list = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.PlayerList : null); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (!((Object)(object)list[i] == (Object)null)) { float num2 = Vector3.Distance(((Component)list[i]).transform.position, position); if (num2 < num) { num = num2; } } } return num; } if (!((Object)(object)PlayerAvatar.instance != (Object)null)) { return 999f; } return Vector3.Distance(((Component)PlayerAvatar.instance).transform.position, position); } private float NearestEnemy() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) _enemyCheckTimer -= Time.deltaTime; if (_enemyCheckTimer > 0f) { return _enemyNearestCached; } _enemyCheckTimer = 0.25f; _enemyNearestCached = 999f; Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 5.6f, -1, (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && (Object)(object)((Component)array[i]).GetComponentInParent<EnemyParent>() != (Object)null) { float num = Vector3.Distance(((Component)array[i]).transform.position, ((Component)this).transform.position); if (num < _enemyNearestCached) { _enemyNearestCached = num; } } } return _enemyNearestCached; } private void OnDestroy() { if (_colliders != null) { for (int i = 0; i < _colliders.Length; i++) { AllColliders.Remove(_colliders[i]); } } } } public sealed class AmongUsEmergencyButton : MonoBehaviour { private const float InteractionDistance = 3f; private bool _armed; private Text _prompt; private void Start() { BuildPrompt(); } private void Update() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) AmongUsGame instance = AmongUsGame.Instance; if ((Object)(object)_prompt == (Object)null || (Object)(object)instance == (Object)null || !Object.op_Implicit((Object)(object)PlayerAvatar.instance)) { return; } if (instance.Phase != GamePhase.Roaming) { _prompt.text = ""; return; } if (!AmongUsGame.IsAlive(AmongUsGame.LocalAvatar())) { _prompt.text = ""; return; } if (Vector3.Distance(((Component)this).transform.position, ((Component)PlayerAvatar.instance).transform.position) > 3f) { _armed = false; _prompt.text = ""; return; } float num = instance.MeetingCooldownUntil - Time.time; if (num > 0f) { _prompt.text = "Button charging " + Mathf.CeilToInt(num) + "s"; ((Graphic)_prompt).color = new Color(0.8f, 0.6f, 0.4f, 0.9f); _armed = false; return; } _prompt.text = "[E] Emergency Meeting"; ((Graphic)_prompt).color = new Color(0.95f, 0.3f, 0.3f, 0.95f); bool flag = Input.GetKeyDown((KeyCode)101) || ((Object)(object)InputManager.instance != (Object)null && InputManager.instance.KeyDown((InputKey)2)); if (!_armed) { if (!flag) { _armed = true; } } else if (flag) { _prompt.text = ""; instance.RequestMeeting(AmongUsGame.LocalActor(), report: false); } } private void BuildPrompt() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) Transform val = (Object.op_Implicit((Object)(object)HUDCanvas.instance) ? ((Component)HUDCanvas.instance).transform : null); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject("AmongUsEmergencyPrompt"); val2.transform.SetParent(val, false); _prompt = val2.AddComponent<Text>(); Font font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == "Arial")) ?? Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault() ?? Font.CreateDynamicFontFromOSFont("Arial", 16); _prompt.font = font; ((Graphic)_prompt).color = new Color(0.95f, 0.3f, 0.3f, 0.95f); _prompt.alignment = (TextAnchor)4; _prompt.fontSize = 24; RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.2f, 0.24f); component.anchorMax = new Vector2(0.8f, 0.3f); Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; _prompt.text = ""; } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_prompt)) { Object.Destroy((Object)(object)((Component)_prompt).gameObject); } } } internal enum GamePhase { Idle, Roaming, Meeting, Over } internal sealed class AmongUsGame : MonoBehaviour { private readonly HashSet<int> _imposterActors = new HashSet<int>(); private readonly Dictionary<int, List<int>> _crewTasks = new Dictionary<int, List<int>>(); private readonly Dictionary<int, object[]> _roleData = new Dictionary<int, object[]>(); private readonly HashSet<string> _completed = new HashSet<string>(); private readonly HashSet<int> _localTeammates = new HashSet<int>(); private readonly HashSet<int> _localTasksDone = new HashSet<int>(); private readonly List<Vector3> _bodies = new List<Vector3>(); private readonly Dictionary<int, bool> _wasAlive = new Dictionary<int, bool>(); private float _bodyScanTimer; private AmongUsHud _hud; private AmongUsMeeting _meeting; private bool _roundActive; private bool _roleReceived; private bool _rolesAssigned; private float _voteEndTime; private bool _tallying; private readonly Dictionary<int, int> _votesByActor = new Dictionary<int, int>(); public static AmongUsGame Instance { get; private set; } internal GamePhase Phase { get; private set; } internal bool LocalIsImposter { get; private set; } internal int TasksCompleted { get; private set; } internal int TasksTotal { get; private set; } internal float MeetingCooldownUntil { get; private set; } internal List<int> LocalTasks { get; } = new List<int>(); public static AmongUsGame EnsureHost() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("Empress Among Us Game"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<AmongUsGame>(); return Instance; } private void Awake() { Instance = this; _hud = ((Component)this).gameObject.AddComponent<AmongUsHud>(); ((Component)this).gameObject.AddComponent<AmongUsKill>(); ((Component)this).gameObject.AddComponent<AmongUsReport>(); } internal void StartRound() { EmpressAmongUsPlugin.EnsurePhotonHooked(); Phase = GamePhase.Roaming; _roundActive = true; _roleReceived = false; _rolesAssigned = false; LocalIsImposter = false; _imposterActors.Clear(); _crewTasks.Clear(); _roleData.Clear(); _completed.Clear(); _localTeammates.Clear(); _localTasksDone.Clear(); LocalTasks.Clear(); _bodies.Clear(); _wasAlive.Clear(); TasksCompleted = 0; TasksTotal = 1; MeetingCooldownUntil = Time.time + 15f; if (SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviour)this).StartCoroutine(AssignRolesRoutine()); } else { ((MonoBehaviour)this).StartCoroutine(RoleWatchdogRoutine()); } } private IEnumerator AssignRolesRoutine() { yield return (object)new WaitForSeconds(2.5f); List<PlayerAvatar> list = AllPlayers(); int num = Mathf.Max(1, AmongUsTasks.StationCount); int count = Mathf.Clamp(EmpressAmongUsPlugin.Settings.TasksPerCrew.Value, 1, num); int num2 = Mathf.Clamp(EmpressAmongUsPlugin.Settings.ImposterCount.Value, 1, 2); if (list.Count < 2) { num2 = 0; } else if (list.Count < 4) { num2 = Mathf.Min(num2, 1); } List<int> list2 = list.Select(ActorOf).ToList(); List<int> list3 = new List<int>(); List<int> list4 = new List<int>(list2); for (int i = 0; i < num2; i++) { if (list4.Count <= 0) { break; } int index = Random.Range(0, list4.Count); list3.Add(list4[index]); _imposterActors.Add(list4[index]); list4.RemoveAt(index); } TasksTotal = 0; _roleData.Clear(); foreach (int actor in list2) { bool flag = _imposterActors.Contains(actor); List<int> list5 = PickStations(num, count); if (!flag) { _crewTasks[actor] = list5; TasksTotal += list5.Count; } int[] array = (flag ? list3.Where((int a) => a != actor).ToArray() : new int[0]); object[] value = new object[4] { flag, array, list5.ToArray(), 0 }; _roleData[actor] = value; } if (TasksTotal < 1) { TasksTotal = 1; } _rolesAssigned = true; for (int repeat = 0; repeat < 2; repeat++) { foreach (KeyValuePair<int, object[]> roleDatum in _roleData) { EmpressAmongUsPlugin.RaiseToActor(181, roleDatum.Value, roleDatum.Key); } EmpressAmongUsPlugin.RaiseToAll(187, new object[2] { TasksCompleted, TasksTotal }); yield return (object)new WaitForSeconds(2.5f); } } private IEnumerator RoleWatchdogRoutine() { for (int attempt = 0; attempt < 8; attempt++) { yield return (object)new WaitForSeconds(3f); if (_roleReceived || Phase != GamePhase.Roaming) { break; } EmpressAmongUsPlugin.RaiseToMaster(189, new object[1] { LocalActor() }); } } private static List<int> PickStations(int stationCount, int count) { List<int> list = Enumerable.Range(0, stationCount).ToList(); List<int> list2 = new List<int>(); for (int i = 0; i < count; i++) { if (list.Count <= 0) { break; } int index = Random.Range(0, list.Count); list2.Add(list[index]); list.RemoveAt(index); } return list2; } internal void EndRound() { Phase = GamePhase.Idle; _roundActive = false; _imposterActors.Clear(); _crewTasks.Clear(); if ((Object)(object)_meeting != (Object)null) { Object.Destroy((Object)(object)((Component)_meeting).gameObject); _meeting = null; } } private void Update() { if (Phase == GamePhase.Roaming) { ScanDeaths(); } if (Phase == GamePhase.Meeting && _tallying && SemiFunc.IsMasterClientOrSingleplayer() && Time.time >= _voteEndTime) { FinishMeeting(); } } private void ScanDeaths() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) _bodyScanTimer -= Time.deltaTime; if (_bodyScanTimer > 0f) { return; } _bodyScanTimer = 0.25f; List<PlayerAvatar> list = AllPlayers(); for (int i = 0; i < list.Count; i++) { int key = ActorOf(list[i]); bool flag = IsAlive(list[i]); bool value; bool num = !_wasAlive.TryGetValue(key, out value) || value; _wasAlive[key] = flag; if (num && !flag) { Vector3 position = ((Component)list[i]).transform.position; if (!NearestBody(position, 2f).HasValue) { _bodies.Add(position); } } } } internal Vector3? NearestBody(Vector3 position, float range) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Vector3? result = null; float num = range; for (int i = 0; i < _bodies.Count; i++) { float num2 = Vector3.Distance(_bodies[i], position); if (num2 < num) { num = num2; result = _bodies[i]; } } return result; } internal void ReceiveRole(object[] data) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) bool roleReceived = _roleReceived; _roleReceived = true; LocalIsImposter = (bool)data[0]; int[] obj = (data[1] as int[]) ?? new int[0]; int[] collection = (data[2] as int[]) ?? new int[0]; _localTeammates.Clear(); int[] array = obj; foreach (int item in array) { _localTeammates.Add(item); } LocalTasks.Clear(); LocalTasks.AddRange(collection); _localTasksDone.Clear(); AmongUsKill.SetLocalImposter(LocalIsImposter, !roleReceived); if ((Object)(object)_hud != (Object)null) { _hud.SetRole(LocalIsImposter); } if (!roleReceived) { string text = (LocalIsImposter ? "IMPOSTER" : "CREWMATE"); Color val = (LocalIsImposter ? new Color(0.95f, 0.2f, 0.2f) : new Color(0.5f, 0.8f, 1f)); string obj2 = (LocalIsImposter ? "Kill the crew. Fake tasks. Hold TAB to see the sabotage list." : "Finish your tasks. Hold TAB to see them."); SemiFunc.UIBigMessage("YOU ARE " + text, LocalIsImposter ? "{!}" : "{-}", 50f, val, Color.white); SemiFunc.UIFocusText(obj2, val, Color.white, 6f); } } internal void ReceiveGameBegin(object[] data) { if (SemiFunc.IsMasterClientOrSingleplayer() && _rolesAssigned) { int num = (int)data[0]; if (_roleData.TryGetValue(num, out var value)) { EmpressAmongUsPlugin.RaiseToActor(181, value, num); } } } internal bool IsTeammate(int actor) { return _localTeammates.Contains(actor); } internal bool IsLocalTaskDone(int stationId) { return _localTasksDone.Contains(stationId); } internal bool CanDoTask(int stationId) { if (LocalTasks.Contains(stationId)) { return !_localTasksDone.Contains(stationId); } return false; } internal void CompleteLocalTask(int stationId) { if (_localTasksDone.Add(stationId)) { EmpressAmongUsPlugin.RaiseToMaster(186, new object[2] { LocalActor(), stationId }); } } internal void ReceiveTaskDone(object[] data) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } int key = (int)data[0]; int item = (int)data[1]; if (_crewTasks.TryGetValue(key, out var value) && value.Contains(item)) { string item2 = key + ":" + item; if (_completed.Add(item2)) { TasksCompleted = _completed.Count; EmpressAmongUsPlugin.RaiseToAll(187, new object[2] { TasksCompleted, TasksTotal }); WinCheckTasks(); } } } internal void ReceiveProgress(object[] data) { TasksCompleted = (int)data[0]; TasksTotal = (int)data[1]; if ((Object)(object)_hud != (Object)null) { _hud.SetProgress(TasksCompleted, TasksTotal); } } internal void RequestKill(int victimActor) { EmpressAmongUsPlugin.RaiseToMaster(182, new object[2] { LocalActor(), victimActor }); } internal void ReceiveKill(object[] data) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } int num = (int)data[0]; int num2 = (int)data[1]; EmpressAmongUsPlugin.Log.LogInfo((object)("Among Us kill request killer=" + num + " victim=" + num2 + " imposters=[" + string.Join(",", _imposterActors) + "]")); if (!_imposterActors.Contains(num) || _imposterActors.Contains(num2)) { SemiFunc.UIFocusText("Kill blocked: role mismatch (killer " + num + ")", new Color(1f, 0.6f, 0.3f), Color.white, 3f); return; } PlayerAvatar val = AvatarByActor(num); PlayerAvatar val2 = AvatarByActor(num2); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || !IsAlive(val) || !IsAlive(val2)) { SemiFunc.UIFocusText("Kill blocked: target not found or already dead", new Color(1f, 0.6f, 0.3f), Color.white, 3f); return; } float num3 = Vector3.Distance(((Component)val).transform.position, ((Component)val2).transform.position); if (num3 > 8f) { SemiFunc.UIFocusText("Kill blocked: too far (" + num3.ToString("F1") + "m)", new Color(1f, 0.6f, 0.3f), Color.white, 3f); return; } val2.PlayerDeath(-1); ((MonoBehaviour)this).StartCoroutine(WinCheckDeathsDelayed()); } internal void RequestMeeting(int callerActor, bool report) { EmpressAmongUsPlugin.RaiseToMaster(183, new object[3] { callerActor, 0, report ? 1 : 0 }); } internal void ReceiveMeetingStart(object[] data) { int num = (int)data[0]; int num2 = (int)data[1]; int num3 = ((data.Length > 2) ? ((int)data[2]) : 0); if (num2 == 0) { if (SemiFunc.IsMasterClientOrSingleplayer() && Phase == GamePhase.Roaming && (num3 != 0 || !(Time.time < MeetingCooldownUntil))) { EmpressAmongUsPlugin.RaiseToAll(183, new object[3] { num, 1, num3 }); } } else { OpenMeeting(num, num3 == 1); } } private void OpenMeeting(int callerActor, bool report) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (Phase != GamePhase.Meeting) { Phase = GamePhase.Meeting; _tallying = false; _bodies.Clear(); AudioClip val = (report ? AmongUsAudio.Report : AmongUsAudio.Emergency); if ((Object)(object)val != (Object)null) { Vector3 val2 = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : AmongUsRuntime.CafeteriaTable); AudioSource.PlayClipAtPoint(val, val2, 0.2f); } Vector3 cafeteriaTable = AmongUsRuntime.CafeteriaTable; PlayerAvatar val3 = LocalAvatar(); if ((Object)(object)val3 != (Object)null && IsAlive(val3)) { float num = (float)LocalActor() * 0.9f; Vector3 val4 = cafeteriaTable + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 3.4f; Vector3 val5 = cafeteriaTable - val4; val5.y = 0f; Quaternion rotation = ((((Vector3)(ref val5)).sqrMagnitude > 0.01f) ? Quaternion.LookRotation(((Vector3)(ref val5)).normalized) : Quaternion.identity); AmongUsAccess.TeleportLocalPlayer(val4 + Vector3.up * 0.6f, rotation); } if ((Object)(object)_meeting == (Object)null) { GameObject val6 = new GameObject("Empress Among Us Meeting"); val6.transform.SetParent(((Component)this).transform, false); _meeting = val6.AddComponent<AmongUsMeeting>(); } _meeting.Open(callerActor, report); if (SemiFunc.IsMasterClientOrSingleplayer()) { _voteEndTime = Time.time + 20f + 30f; _tallying = true; } } } internal void CastVote(int targetActor) { EmpressAmongUsPlugin.RaiseToMaster(184, new object[2] { LocalActor(), targetActor }); } internal void ReceiveVote(object[] data) { if (SemiFunc.IsMasterClientOrSingleplayer() && Phase == GamePhase.Meeting) { int num = (int)data[0]; int value = (int)data[1]; PlayerAvatar val = AvatarByActor(num); if (!((Object)(object)val == (Object)null) && IsAlive(val)) { _votesByActor[num] = value; } } } private void FinishMeeting() { _tallying = false; Dictionary<int, int> dictionary = new Dictionary<int, int>(); foreach (KeyValuePair<int, int> item in _votesByActor) { if (item.Value >= 0) { dictionary.TryGetValue(item.Value, out var value); dictionary[item.Value] = value + 1; } } int num = -1; int num2 = 0; bool flag = false; foreach (KeyValuePair<int, int> item2 in dictionary) { if (item2.Value > num2) { num2 = item2.Value; num = item2.Key; flag = false; } else if (item2.Value == num2) { flag = true; } } if (flag || num2 == 0) { num = -1; } _votesByActor.Clear(); bool flag2 = num >= 0 && _imposterActors.Contains(num); EmpressAmongUsPlugin.RaiseToAll(185, new object[2] { num, flag2 }); } internal void ReceiveMeetingEnd(object[] data) { int num = (int)data[0]; bool wasImposter = (bool)data[1]; if ((Object)(object)_meeting != (Object)null) { _meeting.ShowResult(num, wasImposter); } if (SemiFunc.IsMasterClientOrSingleplayer() && num >= 0) { PlayerAvatar val = AvatarByActor(num); if ((Object)(object)val != (Object)null && IsAlive(val)) { val.PlayerDeath(-1); } } ((MonoBehaviour)this).StartCoroutine(CloseMeetingRoutine()); } private IEnumerator CloseMeetingRoutine() { yield return (object)new WaitForSeconds(5f); if ((Object)(object)_meeting != (Object)null) { Object.Destroy((Object)(object)((Component)_meeting).gameObject); _meeting = null; } if (Phase != GamePhase.Over) { Phase = GamePhase.Roaming; MeetingCooldownUntil = Time.time + 30f; yield return null; WinCheckDeaths(); } } private IEnumerator WinCheckDeathsDelayed() { yield return (object)new WaitForSeconds(0.4f); WinCheckDeaths(); } private void WinCheckTasks() { if (SemiFunc.IsMasterClientOrSingleplayer() && Phase != GamePhase.Over && _roundActive && TasksTotal > 0 && TasksCompleted >= TasksTotal) { DeclareOver(crewWon: true, 1); } } private void WinCheckDeaths() { if (!SemiFunc.IsMasterClientOrSingleplayer() || Phase == GamePhase.Over || !_roundActive) { return; } int num = 0; int num2 = 0; List<PlayerAvatar> list = AllPlayers(); for (int i = 0; i < list.Count; i++) { if (IsAlive(list[i])) { if (_imposterActors.Contains(ActorOf(list[i]))) { num++; } else { num2++; } } } if (num == 0) { DeclareOver(crewWon: true, 0); } else if (num >= num2) { DeclareOver(crewWon: false, 2); } } private void DeclareOver(bool crewWon, int reason) { Phase = GamePhase.Over; EmpressAmongUsPlugin.RaiseToAll(188, new object[2] { crewWon, reason }); } internal void ReceiveGameOver(object[] data) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) bool num = (bool)data[0]; int num2 = (int)data[1]; Phase = GamePhase.Over; _roundActive = false; string text = ((!num) ? "IMPOSTER WINS" : ((num2 == 1) ? "CREW WINS - ALL TASKS DONE" : "CREW WINS - IMPOSTER EJECTED")); Color val = (num ? new Color(0.4f, 0.9f, 1f) : new Color(0.95f, 0.2f, 0.2f)); SemiFunc.UIBigMessage(text, "{!}", 60f, val, Color.white); SemiFunc.UIFocusText(text, val, Color.white, 8f); ((MonoBehaviour)this).StartCoroutine(EndRoundRoutine()); } private IEnumerator EndRoundRoutine() { yield return (object)new WaitForSeconds(8f); EndRound(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)RunManager.instance != (Object)null && EmpressAmongUsPlugin.IsAmongUsLevel(RunManager.instance.levelCurrent)) { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } } internal static List<PlayerAvatar> AllPlayers() { if ((Object)(object)GameDirector.instance != (Object)null && GameDirector.instance.PlayerList != null) { return new List<PlayerAvatar>(GameDirector.instance.PlayerList); } return new List<PlayerAvatar>(); } internal static bool IsAlive(PlayerAvatar avatar) { if ((Object)(object)avatar != (Object)null && !AmongUsAccess.GetDeadSet(avatar)) { return !AmongUsAccess.GetIsDisabled(avatar); } return false; } internal static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } internal static int LocalActor() { if (PhotonNetwork.InRoom && PhotonNetwork.LocalPlayer != null) { return PhotonNetwork.LocalPlayer.ActorNumber; } return ActorOf(LocalAvatar()); } internal static int ActorOf(PlayerAvatar avatar) { return AmongUsAccess.GetActorNumber(avatar); } internal static PlayerAvatar AvatarByActor(int actor) { List<PlayerAvatar> list = AllPlayers(); for (int i = 0; i < list.Count; i++) { if (ActorOf(list[i]) == actor) { return list[i]; } } return null; } internal bool ActorIsImposter(int actor) { return _imposterActors.Contains(actor); } } internal sealed class AmongUsHud : MonoBehaviour { private Canvas _canvas; private Image _barBackground; private Image _barFill; private Text _barText; private Text _roleText; private Image _taskListPanel; private Text _taskListText; private int _completed; private int _total = 1; private bool _isImposter; private bool _built; private void Update() { if (!_built) { Build(); } if (!((Object)(object)_canvas == (Object)null)) { AmongUsGame instance = AmongUsGame.Instance; bool flag = (Object)(object)instance != (Object)null && (instance.Phase == GamePhase.Roaming || instance.Phase == GamePhase.Meeting); if (((Behaviour)_canvas).enabled != flag) { ((Behaviour)_canvas).enabled = flag; } bool flag2 = flag && instance.Phase == GamePhase.Roaming && SemiFunc.InputHold((InputKey)8); if ((Object)(object)_taskListPanel != (Object)null && ((Component)_taskListPanel).gameObject.activeSelf != flag2) { ((Component)_taskListPanel).gameObject.SetActive(flag2); } if (flag2) { RefreshTaskList(instance); } } } private void RefreshTaskList(AmongUsGame game) { if ((Object)(object)_taskListText == (Object)null) { return; } if (game.LocalIsImposter) { _taskListText.text = "SABOTAGE LIST\n\nFake these to blend in:\n"; for (int i = 0; i < game.LocalTasks.Count; i++) { Text taskListText = _taskListText; taskListText.text = taskListText.text + "- " + AmongUsTasks.StationName(game.LocalTasks[i]) + "\n"; } return; } _taskListText.text = "YOUR TASKS\n\n"; for (int j = 0; j < game.LocalTasks.Count; j++) { int num = game.LocalTasks[j]; bool flag = game.IsLocalTaskDone(num); Text taskListText2 = _taskListText; taskListText2.text = taskListText2.text + (flag ? "[x] " : "[ ] ") + AmongUsTasks.StationName(num) + "\n"; } } private void Build() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) Font font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == "Arial")) ?? Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault() ?? Font.CreateDynamicFontFromOSFont("Arial", 16); GameObject val = new GameObject("Empress Among Us HUD"); val.transform.SetParent(((Component)this).transform, false); _canvas = val.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 800; val.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1; val.GetComponent<CanvasScaler>().referenceResolution = new Vector2(1920f, 1080f); GameObject val2 = new GameObject("TaskBarBg"); val2.transform.SetParent(val.transform, false); _barBackground = val2.AddComponent<Image>(); ((Graphic)_barBackground).color = new Color(0f, 0f, 0f, 0.55f); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.3f, 0.94f); component.anchorMax = new Vector2(0.7f, 0.975f); Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; GameObject val3 = new GameObject("TaskBarFill"); val3.transform.SetParent(val2.transform, false); _barFill = val3.AddComponent<Image>(); ((Graphic)_barFill).color = new Color(0.35f, 0.85f, 1f, 0.9f); RectTransform component2 = val3.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(0f, 1f); offsetMin = (component2.offsetMax = Vector2.zero); component2.offsetMin = offsetMin; GameObject val4 = new GameObject("TaskBarText"); val4.transform.SetParent(val2.transform, false); _barText = val4.AddComponent<Text>(); _barText.font = font; _barText.alignment = (TextAnchor)4; ((Graphic)_barText).color = Color.white; _barText.fontSize = 20; RectTransform component3 = val4.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; offsetMin = (component3.offsetMax = Vector2.zero); component3.offsetMin = offsetMin; GameObject val5 = new GameObject("RoleText"); val5.transform.SetParent(val.transform, false); _roleText = val5.AddComponent<Text>(); _roleText.font = font; _roleText.alignment = (TextAnchor)4; _roleText.fontSize = 22; ((Graphic)_roleText).color = new Color(0.5f, 0.8f, 1f); RectTransform component4 = val5.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0.3f, 0.905f); component4.anchorMax = new Vector2(0.7f, 0.94f); offsetMin = (component4.offsetMax = Vector2.zero); component4.offsetMin = offsetMin; GameObject val6 = new GameObject("TaskListPanel"); val6.transform.SetParent(val.transform, false); _taskListPanel = val6.AddComponent<Image>(); ((Graphic)_taskListPanel).color = new Color(0.02f, 0.05f, 0.1f, 0.85f); RectTransform component5 = val6.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0.02f, 0.35f); component5.anchorMax = new Vector2(0.28f, 0.85f); offsetMin = (component5.offsetMax = Vector2.zero); component5.offsetMin = offsetMin; GameObject val7 = new GameObject("TaskListText"); val7.transform.SetParent(val6.transform, false); _taskListText = val7.AddComponent<Text>(); _taskListText.font = font; _taskListText.fontSize = 22; _taskListText.alignment = (TextAnchor)0; ((Graphic)_taskListText).color = new Color(0.85f, 0.95f, 1f); RectTransform component6 = val7.GetComponent<RectTransform>(); component6.anchorMin = new Vector2(0.06f, 0.04f); component6.anchorMax = new Vector2(0.96f, 0.96f); offsetMin = (component6.offsetMax = Vector2.zero); component6.offsetMin = offsetMin; val6.SetActive(false); _built = true; SetProgress(_completed, _total); SetRole(_isImposter); } internal void SetProgress(int completed, int total) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) _completed = completed; _total = Mathf.Max(1, total); if (_built) { float num = Mathf.Clamp01((float)_completed / (float)_total); ((Graphic)_barFill).rectTransform.anchorMax = new Vector2(num, 1f); _barText.text = "TASKS " + _completed + " / " + _total; } } internal void SetRole(bool isImposter) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) _isImposter = isImposter; if (_built) { _roleText.text = (isImposter ? "IMPOSTER" : "CREWMATE"); ((Graphic)_roleText).color = (isImposter ? new Color(0.95f, 0.3f, 0.3f) : new Color(0.5f, 0.8f, 1f)); ((Graphic)_barFill).color = (isImposter ? new Color(0.95f, 0.4f, 0.4f, 0.9f) : new Color(0.35f, 0.85f, 1f, 0.9f)); } } } internal sealed class AmongUsKill : MonoBehaviour { private const float KillRange = 2.8f; private const float KillCooldown = 25f; private static bool _localImposter; private float _cooldownUntil; private Text _prompt; internal static AmongUsKill Instance { get; private set; } public static void SetLocalImposter(bool imposter, bool resetCooldown) { _localImposter = imposter; if ((Object)(object)Instance != (Object)null && resetCooldown) { Instance._cooldownUntil = Time.time + 10f; } } private void Awake() { Instance = this; } private void Update() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_prompt == (Object)null) { BuildPrompt(); if ((Object)(object)_prompt == (Object)null) { return; } } AmongUsGame instance = AmongUsGame.Instance; if (!_localImposter || (Object)(object)instance == (Object)null || instance.Phase != GamePhase.Roaming) { _prompt.text = ""; return; } PlayerAvatar val = AmongUsGame.LocalAvatar(); if (!AmongUsGame.IsAlive(val)) { _prompt.text = ""; return; } float num = _cooldownUntil - Time.time; PlayerAvatar val2 = FindTarget(val); if (num > 0f) { _prompt.text = "Kill ready in " + Mathf.CeilToInt(num) + "s"; ((Graphic)_prompt).color = new Color(0.8f, 0.5f, 0.5f, 0.85f); return; } if ((Object)(object)val2 != (Object)null) { ((Graphic)_prompt).color = new Color(0.95f, 0.3f, 0.3f, 0.95f); _prompt.text = "[" + ((object)EmpressAmongUsPlugin.Settings.KillKey.Value/*cast due to .constrained prefix*/).ToString() + "] Kill " + AmongUsAccess.GetPlayerName(val2); } else { _prompt.text = ""; } if (Input.GetKeyDown(EmpressAmongUsPlugin.Settings.KillKey.Value)) { if ((Object)(object)val2 != (Object)null) { DoKill(val, val2); } else { SemiFunc.UIFocusText("No crewmate in kill range.", new Color(0.9f, 0.6f, 0.4f), Color.white, 2f); } } } private void DoKill(PlayerAvatar killer, PlayerAvatar target) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) _cooldownUntil = Time.time + 25f; SemiFunc.UIFocusText("You attacked " + AmongUsAccess.GetPlayerName(target), new Color(0.95f, 0.3f, 0.3f), Color.white, 2f); EmpressAmongUsPlugin.Log.LogInfo((object)("Among Us kill sent: me=" + AmongUsGame.LocalActor() + " target=" + AmongUsGame.ActorOf(target))); ((MonoBehaviour)this).StartCoroutine(LungeRoutine(killer, target)); AmongUsGame.Instance.RequestKill(AmongUsGame.ActorOf(target)); } private IEnumerator LungeRoutine(PlayerAvatar killer, PlayerAvatar target) { Vector3 start = ((Component)killer).transform.position; Vector3 position = ((Component)target).transform.position; Vector3 val = ((Component)target).transform.position - start; Vector3 destination = position - ((Vector3)(ref val)).normalized * 0.9f; destination.y = start.y; float timer = 0f; while (timer < 0.18f) { timer += Time.deltaTime; Vector3 val2 = Vector3.Lerp(start, destination, timer / 0.18f); val = ((Component)target).transform.position - val2; AmongUsAccess.TeleportLocalPlayer(val2, Quaternion.LookRotation(((Vector3)(ref val)).normalized + Vector3.forward * 0.001f)); yield return null; } } private PlayerAvatar FindTarget(PlayerAvatar local) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar result = null; float num = 2.8f; List<PlayerAvatar> list = AmongUsGame.AllPlayers(); int num2 = AmongUsGame.ActorOf(local); for (int i = 0; i < list.Count; i++) { PlayerAvatar val = list[i]; if ((Object)(object)val == (Object)(object)local || !AmongUsGame.IsAlive(val)) { continue; } int num3 = AmongUsGame.ActorOf(val); if (num3 != num2 && !AmongUsGame.Instance.ActorIsImposter(num3) && !AmongUsGame.Instance.IsTeammate(num3)) { float num4 = Vector3.Distance(((Component)local).transform.position, ((Component)val).transform.position); if (num4 < num) { num = num4; result = val; } } } return result; } private void BuildPrompt() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) Transform val = (Object.op_Implicit((Object)(object)HUDCanvas.instance) ? ((Component)HUDCanvas.instance).transform : null); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject("AmongUsKillPrompt"); val2.transform.SetParent(val, false); _prompt = val2.AddComponent<Text>(); Font font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == "Arial")) ?? Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault() ?? Font.CreateDynamicFontFromOSFont("Arial", 16); _prompt.font = font; _prompt.alignment = (TextAnchor)4; _prompt.fontSize = 26; ((Graphic)_prompt).color = new Color(0.95f, 0.3f, 0.3f, 0.95f); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.3f, 0.34f); component.anchorMax = new Vector2(0.7f, 0.4f); Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; _prompt.text = ""; } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_prompt)) { Object.Destroy((Object)(object)((Component)_prompt).gameObject); } } } internal static class AmongUsLevelRegistry { private static readonly FieldRef<LevelContent, Level> LevelContentLevelRef = AccessTools.FieldRefAccess<LevelContent, Level>("_level"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentStartRoomsRef = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_startRooms"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesNormal3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesNormal3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesPassage3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesPassage3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesDeadEnd3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesDeadEnd3"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction1Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction1"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction2Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction2"); private static readonly FieldRef<LevelContent, List<GameObject>> LevelContentModulesExtraction3Ref = AccessTools.FieldRefAccess<LevelContent, List<GameObject>>("_modulesExtraction3"); private static readonly FieldRef<LevelContent, GameObject> LevelContentConnectObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_connectObject"); private static readonly FieldRef<LevelContent, GameObject> LevelContentBlockObjectRef = AccessTools.FieldRefAccess<LevelContent, GameObject>("_blockObject"); public static Level RegisterLevel() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Level val = ScriptableObject.CreateInstance<Level>(); ((Object)val).name = "Level - Empress Among Us"; val.NarrativeName = "Empress - The Skeld"; LevelValuables val2 = ScriptableObject.CreateInstance<LevelValuables>(); ((Object)val2).name = "Valuables - Empress Among Us"; val2.tiny = new List<PrefabRef>(); val2.small = new List<PrefabRef>(); val2.medium = new List<PrefabRef>(); val2.big = new List<PrefabRef>(); val2.wide = new List<PrefabRef>(); val2.tall = new List<PrefabRef>(); val2.veryTall = new List<PrefabRef>(); SetLevelField(val, "ModuleAmount", 0); SetLevelField(val, "PassageMaxAmount", 0); SetLevelField(val, "HasEnemies", false); SetLevelField(val, "ValuablePresets", new List<LevelValuables> { val2 }); SetLevelField(val, "AmbiencePresets", new List<LevelAmbience>()); SetLevelField(val, "FogColor", (object)new Color(0.008f, 0.012f, 0.028f)); SetLevelField(val, "FogStartDistance", 45f); SetLevelField(val, "FogEndDistance", 320f); SetLevelField(val, "AmbientColor", (object)new Color(0.44f, 0.46f, 0.52f)); SetLevelField(val, "AmbientColorAdaptation", (object)new Color(0.2f, 0.22f, 0.3f)); SetLevelField(val, "ColorTemperature", 0f); SetLevelField(val, "ColorFilter", (object)new Color(0.94f, 0.96f, 1f, 1f)); SetLevelField(val, "BloomIntensity", 0.5f); SetLevelField(val, "BloomThreshold", 1.1f); SetLevelField(val, "VignetteColor", (object)new Color(0.02f, 0.03f, 0.08f, 1f)); SetLevelField(val, "VignetteIntensity", 0.24f); SetLevelField(val, "VignetteSmoothness", 0.72f); SetLevelField(val, "DiscordIcon", "level"); EnsureLevelFieldInstance(val, "LoadingGraphic01"); EnsureLevelFieldInstance(val, "LoadingGraphic02"); EnsureLevelFieldInstance(val, "LoadingGraphic03"); EnsureLevelFieldInstance(val, "ConnectObject"); EnsureLevelFieldInstance(val, "BlockObject"); LevelContent val3 = ScriptableObject.CreateInstance<LevelContent>(); ((Object)val3).name = "Empress Among Us Content"; LevelContentLevelRef.Invoke(val3) = val; LevelContentStartRoomsRef.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesNormal3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesPassage3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesDeadEnd3Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction1Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction2Ref.Invoke(val3) = new List<GameObject>(); LevelContentModulesExtraction3Ref.Invoke(val3) = new List<GameObject>(); LevelContentConnectObjectRef.Invoke(val3) = null; LevelContentBlockObjectRef.Invoke(val3) = null; Levels.RegisterLevel(val3); return val; } private static void SetLevelField(Level level, string fieldName, object value) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && value != null && fieldInfo.FieldType.IsInstanceOfType(value)) { fieldInfo.SetValue(level, value); } } private static void EnsureLevelFieldInstance(Level level, string fieldName) { FieldInfo fieldInfo = AccessTools.Field(typeof(Level), fieldName); if (!(fieldInfo == null) && fieldInfo.FieldType.IsClass && !(fieldInfo.FieldType == typeof(string)) && fieldInfo.GetValue(level) == null) { object uninitializedObject = FormatterServices.GetUninitializedObject(fieldInfo.FieldType); fieldInfo.SetValue(level, uninitializedObject); } } } internal sealed class AmongUsMeeting : MonoBehaviour { internal const float DiscussionSeconds = 20f; internal const float VoteSeconds = 30f; private Canvas _canvas; private Text _header; private Text _timerText; private Text _footer; private readonly List<Image> _boxes = new List<Image>(); private readonly List<Text> _rows = new List<Text>(); private readonly List<int> _rowActors = new List<int>(); private float _openTime; private bool _votePhase; private bool _voted; private int _myVote = -2; private bool _resultShown; private CursorLockMode _prevLock; private bool _prevCursorVisible; private bool _report; internal void Open(int callerActor, bool report) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) _openTime = Time.time; _votePhase = false; _voted = false; _myVote = -2; _resultShown = false; _report = report; _prevLock = Cursor.lockState; _prevCursorVisible = Cursor.visible; Build(callerActor); } private void Update() { if ((Object)(object)_canvas == (Object)null) { return; } if ((Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.InputDisable(0.1f); } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; if (!_resultShown) { float num = Time.time - _openTime; if (!_votePhase && num >= 20f) { _votePhase = true; } if (!_votePhase) { _timerText.text = "DISCUSS " + Mathf.CeilToInt(20f - num); _footer.text = "Talk it out. Voting opens soon."; } else { float num2 = 50f - num; _timerText.text = "VOTE " + Mathf.CeilToInt(Mathf.Max(0f, num2)); HandleVoteInput(); } RefreshRows(); } } private void HandleVoteInput() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) bool flag = AmongUsGame.IsAlive(AmongUsGame.LocalAvatar()) && !_voted; _footer.text = (_voted ? "Vote locked in." : (flag ? "Click a crewmate to vote - click SKIP to pass" : "Dead players cannot vote.")); if (!flag) { return; } Vector2 val = Vector2.op_Implicit(Input.mousePosition); int num = -3; for (int i = 0; i < _boxes.Count; i++) { if (RectTransformUtility.RectangleContainsScreenPoint(((Graphic)_boxes[i]).rectTransform, val, (Camera)null)) { num = i; } } if (Input.GetMouseButtonDown(0) && num != -3) { if (num == _boxes.Count - 1) { CastAndLock(-1); } else if (AmongUsGame.IsAlive(AmongUsGame.AvatarByActor(_rowActors[num]))) { CastAndLock(_rowActors[num]); } } } private void CastAndLock(int targetActor) { _voted = true; _myVote = targetActor; AmongUsGame.Instance.CastVote(targetActor); } internal void ShowResult(int ejectedActor, bool wasImposter) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) _resultShown = true; if (!((Object)(object)_header == (Object)null)) { if (ejectedActor < 0) { _header.text = "NO ONE WAS EJECTED"; ((Graphic)_header).color = new Color(0.8f, 0.8f, 0.8f); _footer.text = "The vote was tied or skipped."; } else { PlayerAvatar val = AmongUsGame.AvatarByActor(ejectedActor); string text = (((Object)(object)val != (Object)null) ? AmongUsAccess.GetPlayerName(val) : "A player"); _header.text = text + " WAS EJECTED"; ((Graphic)_header).color = (wasImposter ? new Color(0.4f, 0.9f, 1f) : new Color(0.95f, 0.4f, 0.4f)); _footer.text = (wasImposter ? (text + " was an Imposter.") : (text + " was not an Imposter.")); } _timerText.text = ""; } } private void Build(int callerActor) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) Font font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == "Arial")) ?? Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault() ?? Font.CreateDynamicFontFromOSFont("Arial", 16); GameObject val = new GameObject("Empress Among Us Meeting Canvas"); val.transform.SetParent(((Component)this).transform, false); _canvas = val.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 1200; CanvasScaler obj = val.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); ((Object)MakeImage(val.transform, new Color(0f, 0f, 0f, 0.82f), Vector2.zero, Vector2.one)).name = "Dim"; _header = MakeText(val.transform, font, 40, new Vector2(0.2f, 0.87f), new Vector2(0.8f, 0.96f)); _header.text = (_report ? "DEAD BODY REPORTED" : "EMERGENCY MEETING"); ((Graphic)_header).color = (_report ? new Color(0.95f, 0.3f, 0.3f) : new Color(0.95f, 0.85f, 0.2f)); _timerText = MakeText(val.transform, font, 30, new Vector2(0.2f, 0.81f), new Vector2(0.8f, 0.87f)); ((Graphic)_timerText).color = Color.white; _footer = MakeText(val.transform, font, 22, new Vector2(0.2f, 0.06f), new Vector2(0.8f, 0.12f)); ((Graphic)_footer).color = new Color(0.85f, 0.9f, 1f); List<PlayerAvatar> list = (from p in AmongUsGame.AllPlayers() where (Object)(object)p != (Object)null select p).OrderBy(AmongUsGame.ActorOf).ToList(); int num = 2; int num2 = Mathf.CeilToInt((float)(list.Count + 1) / (float)num); float boxHeight = 0.66f / (float)Mathf.Max(1, num2); for (int num3 = 0; num3 < list.Count; num3++) { _rowActors.Add(AmongUsGame.ActorOf(list[num3])); AddBox(val.transform, font, num3, num3, num, num2, boxHeight); } AddBox(val.transform, font, list.Count, -1, num, num2, boxHeight); RefreshRows(); } private void AddBox(Transform parent, Font font, int slot, int rowIndex, int columns, int rowsPerColumn, float boxHeight) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) int num = slot / rowsPerColumn; int num2 = slot % rowsPerColumn; float num3 = 0.16f + (float)num * 0.36f; float num4 = num3 + 0.32f; float num5 = 0.78f - (float)num2 * boxHeight; float num6 = num5 - boxHeight * 0.82f; Image val = MakeImage(parent, new Color(0.1f, 0.12f, 0.18f, 0.9f), new Vector2(num3, num6), new Vector2(num4, num5)); _boxes.Add(val); Text val2 = MakeText(((Component)val).transform, font, 24, new Vector2(0.04f, 0f), new Vector2(0.96f, 1f)); val2.alignment = (TextAnchor)3; if (rowIndex >= 0) { _rows.Add(val2); } else { val2.text = "SKIP VOTE"; } } private void RefreshRows() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.op_Implicit(Input.mousePosition); for (int i = 0; i < _rows.Count; i++) { PlayerAvatar val2 = AmongUsGame.AvatarByActor(_rowActors[i]); string text = (((Object)(object)val2 != (Object)null) ? AmongUsAccess.GetPlayerName(val2) : "Unknown"); if (!AmongUsGame.IsAlive(val2)) { _rows[i].text = text + " (DEAD)"; ((Graphic)_rows[i]).color = new Color(0.5f, 0.5f, 0.5f); ((Graphic)_boxes[i]).color = new Color(0.06f, 0.06f, 0.08f, 0.85f); } else { _rows[i].text = text; ((Graphic)_rows[i]).color = Color.white; bool flag = _votePhase && !_voted && RectTransformUtility.RectangleContainsScreenPoint(((Graphic)_boxes[i]).rectTransform, val, (Camera)null); bool flag2 = _myVote == _rowActors[i]; ((Graphic)_boxes[i]).color = (flag2 ? new Color(0.4f, 0.6f, 0.3f, 0.95f) : (flag ? new Color(0.25f, 0.35f, 0.5f, 0.95f) : new Color(0.1f, 0.12f, 0.18f, 0.9f))); } } int num = _boxes.Count - 1; if (num >= 0) { bool flag3 = _votePhase && !_voted && RectTransformUtility.RectangleContainsScreenPoint(((Graphic)_boxes[num]).rectTransform, val, (Camera)null); ((Graphic)_boxes[num]).color = ((_myVote == -1) ? new Color(0.4f, 0.6f, 0.3f, 0.95f) : (flag3 ? new Color(0.25f, 0.35f, 0.5f, 0.95f) : new Color(0.12f, 0.12f, 0.14f, 0.9f))); } } private void OnDestroy() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Cursor.lockState = _prevLock; Cursor.visible = _prevCursorVisible; } private static Image MakeImage(Transform parent, Color color, Vector2 anchorMin, Vector2 anchorMax) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Box"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = color; RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; return val2; } private static Text MakeText(Transform parent, Font font, int size, Vector2 anchorMin, Vector2 anchorMax) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text"); val.transform.SetParent(parent, false); Text val2 = val.AddComponent<Text>(); val2.font = font; val2.fontSize = size; val2.alignment = (TextAnchor)4; ((Graphic)val2).color = Color.white; RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; return val2; } } internal sealed class AmongUsMiniGame : MonoBehaviour { internal const int TypeCount = 4; private static readonly KeyCode[] NumberKeys; private int _type; private bool _imposter; private Action<bool, bool> _onFinished; private Canvas _canvas; private Text _header; private Text _body; private Image _barBackground; private Image _barFill; private Image _marker; private Image _target; private float _holdProgress; private string _code = ""; private string _entered = ""; private float _markerPos; private int _timingHits; private float _mashValue; private bool _finished; private AudioSource _audio; internal void Begin(int type, bool imposter, Action<bool, bool> onFinished) { _type = Mathf.Clamp(type, 0, 3); _imposter = imposter; _onFinished = onFinished; if (_type == 1) { _code = string.Concat(from _ in Enumerable.Range(0, 4) select Random.Range(1, 7).ToString()); } Build(); _audio = ((Component)this).gameObject.AddComponent<AudioSource>(); _audio.spatialBlend = 0f; _audio.volume = 0.4f; _audio.playOnAwake = false; if ((Object)(object)AmongUsAudio.TaskBeep != (Object)null) { _audio.PlayOneShot(AmongUsAudio.TaskBeep); } } private void Update() { if (_finished) { return; } if ((Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.InputDisable(0.1f); } if (Input.GetKeyDown((KeyCode)27)) { Finish(success: false); return; } switch (_type) { case 0: UpdateHold(); break; case 1: UpdateSequence(); break; case 2: UpdateTiming(); break; default: UpdateMash(); break; } } private void UpdateHold() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) _header.text = Title("DOWNLOAD DATA"); _body.text = "Hold [SPACE] to transfer - [Esc] Leave"; _holdProgress += (Input.GetKey((KeyCode)32) ? (Time.deltaTime / 3.5f) : ((0f - Time.deltaTime) * 0.4f)); _holdProgress = Mathf.Clamp01(_holdProgress); ((Graphic)_barFill).rectTransform.anchorMax = new Vector2(_holdProgress, 1f); if (_holdProgress >= 1f) { Finish(success: true); } } private void UpdateSequence() { _header.text = Title("ENTER CODE"); _body.text = "Code: " + _code + "\nYou: " + _entered + "\n[Esc] Leave"; for (int i = 0; i < NumberKeys.Length; i++) { if (Input.GetKeyDown(NumberKeys[i])) { _entered += i; if (!_code.StartsWith(_entered)) { _entered = ""; } else if (_entered.Length >= _code.Length) { Finish(success: true); } break; } } } private void UpdateTiming() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) _header.text = Title("ALIGN ENGINE"); _body.text = "Press [SPACE] in the green zone (" + _timingHits + "/3) - [Esc] Leave"; _markerPos = Mathf.PingPong(Time.time * 0.6f, 1f); ((Graphic)_marker).rectTransform.anchorMin = new Vector2(_markerPos - 0.01f, 0f); ((Graphic)_marker).rectTransform.anchorMax = new Vector2(_markerPos + 0.01f, 1f); if (!Input.GetKeyDown((KeyCode)32)) { return; } if (_markerPos > 0.42f && _markerPos < 0.58f) { _timingHits++; if (_timingHits >= 3) { Finish(success: true); } } else { _timingHits = 0; } } private void UpdateMash() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) _header.text = Title("PRIME SHIELDS"); _body.text = "Mash [SPACE] to charge - [Esc] Leave"; _mashValue -= Time.deltaTime * 0.35f; if (Input.GetKeyDown((KeyCode)32)) { _mashValue += 0.08f; } _mashValue = Mathf.Clamp01(_mashValue);