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.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; using UnityEngine.Video; [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("LGUMonitorTakeover")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Y4NGZ monitor takeover sequence for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8c5521e37f37e3d76518a16d04e5d1051842f105")] [assembly: AssemblyProduct("LGUMonitorTakeover")] [assembly: AssemblyTitle("LGUMonitorTakeover")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 LGUMonitorTakeover { internal static class ConstellationBridgeReflection { private static bool _initialized; private static bool _bridgeAvailable; private static MethodInfo _checkAndNotifyMethod; private static void Init() { if (_initialized) { return; } _initialized = true; try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "LGUConstellationsBridge"); if (assembly == null) { Plugin.Log.LogInfo((object)"[TakeoverBridge] LGUConstellationsBridge not loaded — skipping notification."); return; } Type type = assembly.GetType("LGUConstellationsBridge.ConstellationNotification"); if (type == null) { Plugin.Log.LogWarning((object)"[TakeoverBridge] ConstellationNotification type not found in bridge."); return; } _checkAndNotifyMethod = type.GetMethod("CheckAndNotify", BindingFlags.Static | BindingFlags.Public); if (_checkAndNotifyMethod == null) { Plugin.Log.LogWarning((object)"[TakeoverBridge] CheckAndNotify method not found."); return; } _bridgeAvailable = true; Plugin.Log.LogInfo((object)"[TakeoverBridge] Constellation notification bridge ready."); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverBridge] Init failed: " + ex.Message)); } } public static void TryShowConstellationNotification() { Init(); if (!_bridgeAvailable) { return; } try { _checkAndNotifyMethod.Invoke(null, null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverBridge] Notification call failed: " + ex.Message)); } } } internal class MonitorDebugger : MonoBehaviour { internal static void DumpAll() { //IL_0065: 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_011b: Invalid comparison between Unknown and I4 //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Unknown result type (might be due to invalid IL or missing references) //IL_0711: Expected O, but got Unknown StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("========== Y4NGZ MONITOR DEBUGGER =========="); StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { Plugin.Log.LogWarning((object)"StartOfRound.Instance is null — are you in-game?"); return; } stringBuilder.AppendLine("\n--- screenLevelVideoReel (VideoPlayer) ---"); VideoPlayer screenLevelVideoReel = instance.screenLevelVideoReel; if ((Object)(object)screenLevelVideoReel == (Object)null) { stringBuilder.AppendLine(" NULL"); } else { stringBuilder.AppendLine($" renderMode : {screenLevelVideoReel.renderMode}"); stringBuilder.AppendLine(" targetTexture : " + (((Object)(object)screenLevelVideoReel.targetTexture != (Object)null) ? ((Object)screenLevelVideoReel.targetTexture).name : "null")); stringBuilder.AppendLine(" clip : " + (((Object)(object)screenLevelVideoReel.clip != (Object)null) ? ((Object)screenLevelVideoReel.clip).name : "null")); stringBuilder.AppendLine($" isPlaying : {screenLevelVideoReel.isPlaying}"); stringBuilder.AppendLine(" gameObject path : " + GetPath(((Component)screenLevelVideoReel).gameObject)); if ((int)screenLevelVideoReel.renderMode == 3) { Renderer val = ((Component)screenLevelVideoReel).GetComponent() ?? ((Component)screenLevelVideoReel).GetComponentInChildren(); stringBuilder.AppendLine(" MaterialOverride renderer: " + (((Object)(object)val != (Object)null) ? GetPath(((Component)val).gameObject) : "none on same GO")); } } stringBuilder.AppendLine("\n--- mapScreen (ManualCameraRenderer) ---"); ManualCameraRenderer mapScreen = instance.mapScreen; if ((Object)(object)mapScreen == (Object)null) { stringBuilder.AppendLine(" NULL"); } else { stringBuilder.AppendLine(" gameObject path : " + GetPath(((Component)mapScreen).gameObject)); stringBuilder.AppendLine(" cam : " + (((Object)(object)mapScreen.cam != (Object)null) ? ((Object)mapScreen.cam).name : "null")); if ((Object)(object)mapScreen.cam != (Object)null) { stringBuilder.AppendLine(" cam.targetTexture: " + (((Object)(object)mapScreen.cam.targetTexture != (Object)null) ? ((Object)mapScreen.cam.targetTexture).name : "null")); } stringBuilder.AppendLine(" mapCamera : " + (((Object)(object)mapScreen.mapCamera != (Object)null) ? ((Object)mapScreen.mapCamera).name : "null")); if ((Object)(object)mapScreen.mapCamera != (Object)null) { stringBuilder.AppendLine(" mapCamera.targetTexture: " + (((Object)(object)mapScreen.mapCamera.targetTexture != (Object)null) ? ((Object)mapScreen.mapCamera.targetTexture).name : "null")); } } stringBuilder.AppendLine("\n--- upperMonitorsCanvas ---"); GameObject upperMonitorsCanvas = instance.upperMonitorsCanvas; if ((Object)(object)upperMonitorsCanvas == (Object)null) { stringBuilder.AppendLine(" NULL"); } else { stringBuilder.AppendLine(" path : " + GetPath(upperMonitorsCanvas)); stringBuilder.AppendLine(" parent : " + (((Object)(object)upperMonitorsCanvas.transform.parent != (Object)null) ? GetPath(((Component)upperMonitorsCanvas.transform.parent).gameObject) : "none")); Canvas[] componentsInChildren = upperMonitorsCanvas.GetComponentsInChildren(true); stringBuilder.AppendLine($" child Canvas count: {componentsInChildren.Length}"); Canvas[] array = componentsInChildren; foreach (Canvas val2 in array) { stringBuilder.AppendLine($" Canvas: {GetPath(((Component)val2).gameObject)} renderMode={val2.renderMode}"); } if ((Object)(object)upperMonitorsCanvas.transform.parent != (Object)null) { MeshRenderer[] componentsInChildren2 = ((Component)upperMonitorsCanvas.transform.parent).GetComponentsInChildren(true); stringBuilder.AppendLine($" MeshRenderers in parent ({((Object)upperMonitorsCanvas.transform.parent).name}): {componentsInChildren2.Length}"); MeshRenderer[] array2 = componentsInChildren2; foreach (MeshRenderer val3 in array2) { Material sharedMaterial = ((Renderer)val3).sharedMaterial; string text = (((Object)(object)((sharedMaterial != null) ? sharedMaterial.mainTexture : null) != (Object)null) ? (((object)sharedMaterial.mainTexture).GetType().Name + ":" + ((Object)sharedMaterial.mainTexture).name) : "no mainTexture"); stringBuilder.AppendLine(" " + GetPath(((Component)val3).gameObject) + " mat=" + ((sharedMaterial != null) ? ((Object)sharedMaterial).name : null) + " tex=" + text); } } } stringBuilder.AppendLine("\n--- Ship MeshRenderers with RenderTexture mainTexture ---"); GameObject val4 = GameObject.Find("Environment/HangarShip") ?? GameObject.Find("HangarShip"); if ((Object)(object)val4 == (Object)null) { stringBuilder.AppendLine(" HangarShip not found in scene"); } else { int num = 0; MeshRenderer[] array2 = val4.GetComponentsInChildren(true); foreach (MeshRenderer val5 in array2) { Material sharedMaterial2 = ((Renderer)val5).sharedMaterial; Texture obj = ((sharedMaterial2 != null) ? sharedMaterial2.mainTexture : null); RenderTexture val6 = (RenderTexture)(object)((obj is RenderTexture) ? obj : null); if (val6 != null) { stringBuilder.AppendLine(" " + GetPath(((Component)val5).gameObject)); stringBuilder.AppendLine($" material={((Object)((Renderer)val5).sharedMaterial).name} RT={((Object)val6).name} ({((Texture)val6).width}x{((Texture)val6).height})"); num++; } } if (num == 0) { stringBuilder.AppendLine(" (none found)"); } } stringBuilder.AppendLine("\n--- Top monitor UI components ---"); LogUIComponent(stringBuilder, "profitQuotaMonitorBGImage", (Component)(object)instance.profitQuotaMonitorBGImage); LogUIComponent(stringBuilder, "profitQuotaMonitorText", (Component)(object)instance.profitQuotaMonitorText); LogUIComponent(stringBuilder, "deadlineMonitorBGImage", (Component)(object)instance.deadlineMonitorBGImage); LogUIComponent(stringBuilder, "deadlineMonitorText", (Component)(object)instance.deadlineMonitorText); stringBuilder.AppendLine("\n--- HUDContainer ---"); HUDManager instance2 = HUDManager.Instance; if ((Object)(object)instance2?.HUDContainer != (Object)null) { stringBuilder.AppendLine($" path: {GetPath(instance2.HUDContainer)} active={instance2.HUDContainer.activeSelf}"); } else { stringBuilder.AppendLine(" HUDManager or HUDContainer is null"); } stringBuilder.AppendLine("\n--- MonitorWall ALL MeshRenderers ---"); GameObject val7 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall"); if ((Object)(object)val7 == (Object)null) { stringBuilder.AppendLine(" MonitorWall not found!"); } else { MeshRenderer[] array2 = val7.GetComponentsInChildren(true); foreach (MeshRenderer val8 in array2) { Material sharedMaterial3 = ((Renderer)val8).sharedMaterial; string text2 = (((Object)(object)((sharedMaterial3 != null) ? sharedMaterial3.mainTexture : null) != (Object)null) ? (((object)sharedMaterial3.mainTexture).GetType().Name + ":" + ((Object)sharedMaterial3.mainTexture).name) : "null"); string text3 = "n/a"; try { MaterialPropertyBlock val9 = new MaterialPropertyBlock(); ((Renderer)val8).GetPropertyBlock(val9); Texture texture = val9.GetTexture("_MainTex"); text3 = (((Object)(object)texture != (Object)null) ? ("MPB:" + ((Object)texture).name) : "no MPB"); } catch { } stringBuilder.AppendLine(" " + GetPath(((Component)val8).gameObject)); stringBuilder.AppendLine(" sharedMat=" + ((sharedMaterial3 != null) ? ((Object)sharedMaterial3).name : null) + " sharedTex=" + text2 + " instCheck=" + text3); } } stringBuilder.AppendLine("\n========== END DEBUGGER =========="); Plugin.Log.LogInfo((object)stringBuilder.ToString()); } private static void LogUIComponent(StringBuilder sb, string label, Component c) { //IL_0060: 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) if ((Object)(object)c == (Object)null) { sb.AppendLine(" " + label + ": NULL"); return; } sb.AppendLine(" " + label + ":"); sb.AppendLine(" path : " + GetPath(c.gameObject)); sb.AppendLine($" world position: {c.transform.position}"); sb.AppendLine($" enabled : {((Behaviour)c).enabled}"); } private static string GetPath(GameObject go) { if ((Object)(object)go == (Object)null) { return "(null)"; } string text = ((Object)go).name; Transform parent = go.transform.parent; int num = 0; while ((Object)(object)parent != (Object)null && num < 8) { text = ((Object)parent).name + "/" + text; parent = parent.parent; num++; } return text; } } internal static class OpenBodyCamsCompat { private const string PluginGuid = "Zaggy1024.OpenBodyCams"; private static bool _resolved; private static bool _present; private static Behaviour _bodyCamBehaviour; private static bool _wasEnabled; private static GameObject _overlayMeshGO; private static bool _overlayWasActive; private static void Resolve() { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown _resolved = true; try { if (!Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams")) { return; } GameObject val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogInfo((object)"[OBCCompat] OpenBodyCams loaded but Cube.001 not found at resolve time."); return; } Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (!(assembly.GetName().Name != "OpenBodyCams")) { type = assembly.GetType("OpenBodyCams.Components.BodyCamComponent", throwOnError: false) ?? assembly.GetType("OpenBodyCams.BodyCamComponent", throwOnError: false); if (type != null) { break; } } } if (type == null) { Plugin.Log.LogWarning((object)"[OBCCompat] BodyCamComponent type not found in OpenBodyCams assembly."); return; } Component component = val.GetComponent(type); Behaviour val2 = (Behaviour)(object)((component is Behaviour) ? component : null); if (val2 == null) { Plugin.Log.LogInfo((object)"[OBCCompat] BodyCamComponent not attached to Cube.001 — nothing to suppress."); return; } _bodyCamBehaviour = val2; _present = true; Plugin.Log.LogInfo((object)"[OBCCompat] Detected OpenBodyCams BodyCamComponent on Cube.001."); GameObject val3 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall"); if (!((Object)(object)val3 != (Object)null)) { return; } foreach (Transform item in val3.transform) { Transform val4 = item; if ((Object)(object)val4 != (Object)null && ((Object)val4).name != null && ((Object)val4).name.StartsWith("BodyCamOverlayMesh")) { _overlayMeshGO = ((Component)val4).gameObject; Plugin.Log.LogInfo((object)("[OBCCompat] Detected OBC overlay mesh: " + ((Object)val4).name)); break; } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[OBCCompat] Resolve failed: " + ex.Message)); } } internal static void Suppress() { if (!_resolved) { Resolve(); } if (!_present || (Object)(object)_bodyCamBehaviour == (Object)null) { return; } try { _wasEnabled = _bodyCamBehaviour.enabled; if (_wasEnabled) { _bodyCamBehaviour.enabled = false; Plugin.Log.LogInfo((object)"[OBCCompat] Suppressed OpenBodyCams BodyCamComponent on Cube.001."); } if ((Object)(object)_overlayMeshGO != (Object)null) { _overlayWasActive = _overlayMeshGO.activeSelf; if (_overlayWasActive) { _overlayMeshGO.SetActive(false); Plugin.Log.LogInfo((object)"[OBCCompat] Hid OBC overlay mesh under MonitorWall."); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[OBCCompat] Suppress failed: " + ex.Message)); } } internal static void Restore() { if (!_present || (Object)(object)_bodyCamBehaviour == (Object)null) { return; } try { if ((Object)(object)_overlayMeshGO != (Object)null && _overlayWasActive && !_overlayMeshGO.activeSelf) { _overlayMeshGO.SetActive(true); Plugin.Log.LogInfo((object)"[OBCCompat] Restored OBC overlay mesh under MonitorWall."); } if (_wasEnabled && !_bodyCamBehaviour.enabled) { _bodyCamBehaviour.enabled = true; Plugin.Log.LogInfo((object)"[OBCCompat] Restored OpenBodyCams BodyCamComponent on Cube.001."); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[OBCCompat] Restore failed: " + ex.Message)); } } } internal static class Patches { [HarmonyPatch(typeof(TimeOfDay), "SetNewProfitQuota")] [HarmonyPostfix] private static void OnSetNewProfitQuota() { Plugin.QuotaJustCompleted = true; Plugin.Log.LogInfo((object)"[LGUMonitorTakeover] Quota fulfilled (server) — takeover queued."); CheckMaskManTrigger("server"); } [HarmonyPatch(typeof(TimeOfDay), "SyncNewProfitQuotaClientRpc")] [HarmonyPostfix] private static void OnSyncNewProfitQuotaClientRpc() { Plugin.QuotaJustCompleted = true; Plugin.Log.LogInfo((object)"[LGUMonitorTakeover] Quota sync received (client) — takeover queued."); CheckMaskManTrigger("client"); } private static void CheckMaskManTrigger(string source) { try { TimeOfDay instance = TimeOfDay.Instance; int num = (((Object)(object)instance != (Object)null) ? instance.timesFulfilledQuota : (-1)); bool flag = false; try { string text = GameNetworkManager.Instance?.currentSaveFileName; if (!string.IsNullOrEmpty(text)) { flag = ES3.Load("Y4NGZ_MaskManFired", text, false); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[LGUMonitorTakeover] Failed to read Y4NGZ_MaskManFired from save: " + ex.Message)); } Plugin.Log.LogInfo((object)($"[LGUMonitorTakeover] MaskMan check ({source}): timesFulfilledQuota={num} " + $"alreadyFiredThisSave={flag}")); if ((Object)(object)instance != (Object)null && num == 3 && !flag) { Plugin.MaskManPending = true; Plugin.QuotaJustCompleted = false; Plugin.Log.LogInfo((object)"[LGUMonitorTakeover] Quota 3 completed — Mask Man takeover queued (one-shot per save). Y4NGZ takeover suppressed for this orbit."); } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("[LGUMonitorTakeover] CheckMaskManTrigger (" + source + ") failed: " + ex2.Message)); } } [HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")] [HarmonyPostfix] private static void OnSetShipReadyToLand(StartOfRound __instance) { MonitorDebugger.DumpAll(); if (Plugin.MaskManPending) { Plugin.MaskManPending = false; TakeoverManager.EnsureInstance(); if ((Object)(object)TakeoverManager.Instance != (Object)null) { Plugin.Log.LogInfo((object)"[LGUMonitorTakeover] Ship reached orbit. Starting MASK MAN takeover."); TakeoverManager.Instance.BeginMaskManTakeover(); } } else if (Plugin.QuotaJustCompleted) { Plugin.QuotaJustCompleted = false; TakeoverManager.EnsureInstance(); if ((Object)(object)TakeoverManager.Instance != (Object)null) { Plugin.Log.LogInfo((object)"[LGUMonitorTakeover] Ship reached orbit. Starting takeover coroutine."); TakeoverManager.Instance.BeginTakeover(); } } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] private static void OnDisconnect() { TakeoverManager.Instance?.ForceRestore("disconnect"); } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] private static void OnShipLeave() { TakeoverManager.Instance?.ForceRestore("ShipLeave"); } [HarmonyPatch(typeof(StartOfRound), "ShipLeaveAutomatically")] [HarmonyPostfix] private static void OnShipLeaveAutomatically() { TakeoverManager.Instance?.ForceRestore("ShipLeaveAutomatically"); } } [BepInPlugin("com.y4ngz.lgumonitortakeover", "LGUMonitorTakeover", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "com.y4ngz.lgumonitortakeover"; public const string PLUGIN_NAME = "LGUMonitorTakeover"; public const string PLUGIN_VERSION = "1.0.0"; internal static ManualLogSource Log; internal static bool QuotaJustCompleted = false; internal static bool MaskManPending = false; internal static VideoClip TakeoverVideoClip; internal static AudioClip[] MumbleClips = Array.Empty(); internal static AudioClip AlarmClip; internal static VideoClip MaskManVideoClip; internal static AudioClip MaskManAudioClip; internal static ConfigEntry CfgEnabled; internal static ConfigEntry CfgTakeoverDuration; internal static ConfigEntry CfgOrbitDelay; internal static ConfigEntry CfgMumbleVolume; internal static ConfigEntry CfgTypewriterSpeed; internal static ConfigEntry CfgHideHUD; internal static ConfigEntry CfgDimLights; internal static ConfigEntry CfgLightDimIntensity; internal static ConfigEntry CfgOverrideFifthMonitor; internal static ConfigEntry CfgMaskManTailBuffer; private Harmony _harmony; internal static Plugin Instance { get; private set; } private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; BindConfig(); if (!CfgEnabled.Value) { Log.LogInfo((object)"LGUMonitorTakeover v1.0.0 — disabled via config."); return; } if (!LoadBundle()) { Log.LogError((object)"Asset bundle failed to load — mod is disabled."); ((Behaviour)this).enabled = false; return; } _harmony = new Harmony("com.y4ngz.lgumonitortakeover"); _harmony.PatchAll(typeof(Patches)); Log.LogInfo((object)("LGUMonitorTakeover v1.0.0 loaded. Video: " + (((Object)(object)TakeoverVideoClip != (Object)null) ? "OK" : "MISSING") + ", " + $"Mumble clips: {MumbleClips.Length}/5, " + "MaskManVideo: " + (((Object)(object)MaskManVideoClip != (Object)null) ? "OK" : "MISSING") + ", MaskManAudio: " + (((Object)(object)MaskManAudioClip != (Object)null) ? "OK" : "MISSING"))); } private void BindConfig() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown CfgEnabled = ((BaseUnityPlugin)this).Config.Bind("Settings", "Enabled", true, "Master toggle. Set to false to completely disable the mod."); CfgTakeoverDuration = ((BaseUnityPlugin)this).Config.Bind("Settings", "Takeover Duration", 11f, "Total seconds the monitor takeover lasts before reverting to normal."); CfgOrbitDelay = ((BaseUnityPlugin)this).Config.Bind("Settings", "Orbit Delay", 4f, "Seconds to wait after the ship enters orbit before starting the takeover."); CfgMumbleVolume = ((BaseUnityPlugin)this).Config.Bind("Settings", "Mumble Volume", 0.6f, new ConfigDescription("Volume of Y4NGZ mumble audio (0 = silent, 1 = full).", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); CfgTypewriterSpeed = ((BaseUnityPlugin)this).Config.Bind("Settings", "Typewriter Speed", 0.026f, "Seconds between characters in the typewriter dialogue effect. Lower = faster. Default 0.026 reveals the longest dialogue ~2s before sequence ends."); CfgHideHUD = ((BaseUnityPlugin)this).Config.Bind("Settings", "Hide HUD", true, "Hide all player HUD elements during the takeover."); CfgDimLights = ((BaseUnityPlugin)this).Config.Bind("Settings", "Dim Lights", true, "Dim ship interior lights during the takeover."); CfgLightDimIntensity = ((BaseUnityPlugin)this).Config.Bind("Settings", "Light Dim Intensity", 0.12f, new ConfigDescription("How dim the ship lights go (fraction of original intensity). Lower = darker.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); CfgOverrideFifthMonitor = ((BaseUnityPlugin)this).Config.Bind("Settings", "Override Fifth Monitor", true, "If true, any additional MeshRenderer under MonitorWall beyond the four known monitor meshes is also overridden during takeover (catches small side screens)."); CfgMaskManTailBuffer = ((BaseUnityPlugin)this).Config.Bind("Settings", "Mask Man Tail Buffer", 1.5f, new ConfigDescription("Seconds of held-on-monitor time after the Mask Man audio clip finishes before restoring.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); } private bool LoadBundle() { try { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "monitortakeover.lethalbundle"); if (!File.Exists(text)) { Log.LogError((object)("Bundle not found: " + text)); Log.LogError((object)"Deploy monitortakeover.lethalbundle alongside LGUMonitorTakeover.dll."); return false; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Log.LogError((object)"AssetBundle.LoadFromFile returned null (corrupt bundle?)."); return false; } try { string[] allAssetNames = val.GetAllAssetNames(); Log.LogInfo((object)$"[LGUMonitorTakeover] Bundle asset dump: {allAssetNames.Length} entries."); string[] array = allAssetNames; foreach (string text2 in array) { Log.LogInfo((object)("[LGUMonitorTakeover] asset: " + text2)); } } catch (Exception ex) { Log.LogWarning((object)("[LGUMonitorTakeover] Bundle asset dump failed: " + ex.Message)); } TakeoverVideoClip = val.LoadAsset("y4ngz_monitor_takeover"); if ((Object)(object)TakeoverVideoClip == (Object)null) { Log.LogWarning((object)"Could not load 'y4ngz_monitor_takeover' from bundle. Monitors will go dark instead of showing video."); } List list = new List(); for (int j = 1; j <= 5; j++) { AudioClip val2 = val.LoadAsset($"mumble_0{j}"); if ((Object)(object)val2 != (Object)null) { list.Add(val2); } else { Log.LogWarning((object)$"Could not load 'mumble_0{j}' from bundle."); } } MumbleClips = list.ToArray(); AlarmClip = val.LoadAsset("alarm_takeover"); if ((Object)(object)AlarmClip == (Object)null) { Log.LogInfo((object)"Bundle has no 'alarm_takeover' clip — TakeoverManager will fall back to an in-game alarm. (TODO: ship a dedicated takeover alarm asset.)"); } MaskManVideoClip = val.LoadAsset("mask_man_video"); if ((Object)(object)MaskManVideoClip == (Object)null) { Log.LogWarning((object)"Could not load 'mask_man_video' from bundle — Mask Man takeover will be skipped. Verify the exact asset name from the bundle dump above."); } MaskManAudioClip = val.LoadAsset("mask_man_audio"); if ((Object)(object)MaskManAudioClip == (Object)null) { Log.LogWarning((object)"Could not load 'mask_man_audio' from bundle — Mask Man takeover will be skipped. Verify the exact asset name from the bundle dump above."); } val.Unload(false); Log.LogInfo((object)"Bundle loaded successfully."); return true; } catch (Exception arg) { Log.LogError((object)$"Exception loading bundle: {arg}"); return false; } } } internal class TakeoverManager : MonoBehaviour { [CompilerGenerated] private sealed class d__71 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private WaitForEndOfFrame 5__2; private bool 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__71(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = new WaitForEndOfFrame(); 5__3 = false; break; case 1: <>1__state = -1; if (!5__3) { Plugin.Log.LogInfo((object)($"[Diag/Blit] first blit: src=_renderTexture(id={((Object)takeoverManager._renderTexture).GetInstanceID()} {((Texture)takeoverManager._renderTexture).width}x{((Texture)takeoverManager._renderTexture).height}) " + $"dst=_mapScreenRT(id={((Object)takeoverManager._mapScreenRT).GetInstanceID()} {((Texture)takeoverManager._mapScreenRT).width}x{((Texture)takeoverManager._mapScreenRT).height})")); 5__3 = true; } try { Graphics.Blit((Texture)(object)takeoverManager._renderTexture, takeoverManager._mapScreenRT); } catch { } break; } if (takeoverManager._takeoverActive && (Object)(object)takeoverManager._mapScreenRT != (Object)null && (Object)(object)takeoverManager._renderTexture != (Object)null) { <>2__current = 5__2; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__75 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private Texture2D 5__2; private Texture2D 5__3; private Texture2D 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__75(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)takeoverManager._dialogueCanvasGO != (Object)null) { Object.Destroy((Object)(object)takeoverManager._dialogueCanvasGO); takeoverManager._dialogueCanvasGO = null; } if ((Object)(object)takeoverManager._mumbleSource != (Object)null) { takeoverManager._mumbleSource.Stop(); } if ((Object)(object)takeoverManager._alarmSource != (Object)null) { takeoverManager._alarmSource.Stop(); } if ((Object)(object)takeoverManager._droneSource != (Object)null) { takeoverManager._droneSource.Stop(); } 5__2 = CreateSolidTexture(Color.white); 5__3 = CreateSolidTexture(Color.black); 5__4 = CreateNoiseTexture(256, 256); takeoverManager.PlayStaticBurst(); takeoverManager.SetAllMonitorTexture((Texture)(object)5__2); <>2__current = (object)new WaitForSeconds(0.06f); <>1__state = 1; return true; case 1: <>1__state = -1; takeoverManager.SetAllMonitorTexture((Texture)(object)5__4); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; case 2: <>1__state = -1; takeoverManager.SetAllMonitorTexture((Texture)(object)5__3); <>2__current = (object)new WaitForSeconds(0.15f); <>1__state = 3; return true; case 3: <>1__state = -1; Object.Destroy((Object)(object)5__2, 5f); Object.Destroy((Object)(object)5__3, 5f); Object.Destroy((Object)(object)5__4, 5f); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__62 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public TakeoverManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__62(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_012a: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_0162: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)takeoverManager._renderTexture == (Object)null) { Plugin.Log.LogInfo((object)"[Diag/RT] readback: _renderTexture is null"); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; try { RenderTexture active = RenderTexture.active; RenderTexture.active = takeoverManager._renderTexture; Texture2D val = new Texture2D(4, 4, (TextureFormat)3, false); val.ReadPixels(new Rect(0f, 0f, 4f, 4f), 0, 0); val.Apply(); RenderTexture.active = active; Color val2 = Color.black; Color[] pixels = val.GetPixels(); Color[] array = pixels; foreach (Color val3 in array) { val2 += val3; } val2 /= (float)pixels.Length; Object.Destroy((Object)(object)val); string text = ((val2.r > 0.9f && val2.g > 0.9f && val2.b > 0.9f) ? "WHITE (RT empty — video not decoding)" : ((val2.r < 0.05f && val2.g < 0.05f && val2.b < 0.05f) ? "BLACK (RT cleared/uninitialized)" : "HAS COLOR (video decoding into RT)")); Plugin.Log.LogInfo((object)$"[Diag/RT] readback at t={delay}s: avg=({val2.r:F3},{val2.g:F3},{val2.b:F3}) — {text}"); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Diag/RT] readback failed: " + ex.Message)); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__61 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)takeoverManager._videoPlayer == (Object)null) { return false; } break; case 1: <>1__state = -1; break; } if (takeoverManager._takeoverActive && (Object)(object)takeoverManager._videoPlayer != (Object)null) { Plugin.Log.LogInfo((object)($"[Diag/Video] isPrepared={takeoverManager._videoPlayer.isPrepared} isPlaying={takeoverManager._videoPlayer.isPlaying} " + $"isPaused={takeoverManager._videoPlayer.isPaused} frame={takeoverManager._videoPlayer.frame}/{takeoverManager._videoPlayer.frameCount} " + string.Format("time={0:F2} clip='{1}' ", takeoverManager._videoPlayer.time, ((Object)(object)takeoverManager._videoPlayer.clip != (Object)null) ? ((Object)takeoverManager._videoPlayer.clip).name : "null") + "url='" + takeoverManager._videoPlayer.url + "' targetTex-id=" + (((Object)(object)takeoverManager._videoPlayer.targetTexture != (Object)null) ? ((Object)takeoverManager._videoPlayer.targetTexture).GetInstanceID().ToString() : "NULL") + " rt-id=" + (((Object)(object)takeoverManager._renderTexture != (Object)null) ? ((Object)takeoverManager._renderTexture).GetInstanceID().ToString() : "NULL"))); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__44 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private float 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__44(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; takeoverManager._savedLights.Clear(); GameObject val = GameObject.Find("Environment/HangarShip") ?? GameObject.Find("HangarShip"); Light[] array = (((Object)(object)val != (Object)null) ? val.GetComponentsInChildren(true) : Object.FindObjectsOfType()); foreach (Light val2 in array) { if (!((Object)(object)val2 == (Object)null) && ((Component)val2).gameObject.activeInHierarchy) { takeoverManager._savedLights.Add((val2, val2.intensity, val2.color)); } } takeoverManager.PlayAlarm(); 5__2 = 1.5f; 5__3 = 0f; 5__4 = Plugin.CfgLightDimIntensity.Value; break; } case 1: <>1__state = -1; break; } if (5__3 < 5__2) { 5__3 += Time.deltaTime; float num2 = Mathf.SmoothStep(0f, 1f, 5__3 / 5__2); foreach (var (val3, num3, val4) in takeoverManager._savedLights) { if (!((Object)(object)val3 == (Object)null)) { val3.intensity = Mathf.Lerp(num3, num3 * 5__4, num2); val3.color = Color.Lerp(val4, new Color(Mathf.Min(val4.r + 0.15f, 1f), val4.g * 0.7f, val4.b * 0.7f, val4.a), num2); } } <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__45 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private float 5__2; private bool 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__45(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006e: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 1f / 6f; 5__3 = false; break; case 1: <>1__state = -1; break; } if (takeoverManager._takeoverActive) { 5__3 = !5__3; foreach (var (val, num2, val2) in takeoverManager._savedLights) { if (!((Object)(object)val == (Object)null)) { if (5__3) { val.intensity = num2 * 0.6f; val.color = new Color(0.1f, 1f, 0.1f, val2.a); } else { val.intensity = num2 * 0.03f; val.color = new Color(0f, 0.4f, 0f, val2.a); } } } <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__43 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private StartOfRound 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__43(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; takeoverManager._takeoverActive = true; <>2__current = (object)new WaitForSeconds(Plugin.CfgOrbitDelay.Value); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.inShipPhase) { takeoverManager._takeoverActive = false; takeoverManager._takeoverCoroutine = null; return false; } if ((Object)(object)Plugin.MaskManVideoClip == (Object)null || (Object)(object)Plugin.MaskManAudioClip == (Object)null) { Plugin.Log.LogError((object)"[TakeoverManager] MaskManSequence: assets null at runtime — aborting."); takeoverManager.RestoreAll(immediate: true); takeoverManager._takeoverActive = false; takeoverManager._takeoverCoroutine = null; return false; } 5__2 = StartOfRound.Instance; if ((Object)(object)5__2.speakerAudioSource != (Object)null) { takeoverManager._savedSpeakerVolume = 5__2.speakerAudioSource.volume; 5__2.speakerAudioSource.volume = 0f; takeoverManager._speakerVolumeSaved = true; } 5__3 = Plugin.MaskManAudioClip.length + Plugin.CfgMaskManTailBuffer.Value; 5__4 = 0f; Plugin.Log.LogInfo((object)($"[TakeoverManager] MaskMan: duration={5__3:F2}s " + $"(audio={Plugin.MaskManAudioClip.length:F2}s + buffer={Plugin.CfgMaskManTailBuffer.Value:F2}s).")); takeoverManager.PlayPowerDownWhine(); if (Plugin.CfgDimLights.Value) { <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.DimLights()); <>1__state = 2; return true; } takeoverManager.PlayAlarm(); goto IL_01e2; case 2: <>1__state = -1; takeoverManager._flashCoroutine = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.FlashLightsLoop()); goto IL_01e2; case 3: { <>1__state = -1; takeoverManager.OverrideMonitors(); GameObject val = new GameObject("MaskMan_Audio"); Object.DontDestroyOnLoad((Object)(object)val); takeoverManager._mumbleSource = val.AddComponent(); if ((Object)(object)5__2?.speakerAudioSource != (Object)null) { val.transform.position = ((Component)5__2.speakerAudioSource).transform.position; } else if ((Object)(object)5__2 != (Object)null) { val.transform.position = ((Component)5__2).transform.position; } takeoverManager._mumbleSource.spatialBlend = 0f; takeoverManager._mumbleSource.volume = 1f; takeoverManager._mumbleSource.loop = false; takeoverManager._mumbleSource.playOnAwake = false; takeoverManager._mumbleSource.PlayOneShot(Plugin.MaskManAudioClip); Plugin.Log.LogInfo((object)("[TakeoverManager] MaskMan: PlayOneShot '" + ((Object)Plugin.MaskManAudioClip).name + "' " + $"({Plugin.MaskManAudioClip.length:F2}s) isPlaying={takeoverManager._mumbleSource.isPlaying}.")); try { string text = GameNetworkManager.Instance?.currentSaveFileName; if (!string.IsNullOrEmpty(text)) { ES3.Save("Y4NGZ_MaskManFired", true, text); Plugin.Log.LogInfo((object)("[TakeoverManager] Persisted Y4NGZ_MaskManFired=true to save '" + text + "'.")); } else { Plugin.Log.LogWarning((object)"[TakeoverManager] Could not persist Y4NGZ_MaskManFired — currentSaveFileName is null."); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverManager] Failed to persist Y4NGZ_MaskManFired: " + ex.Message)); } goto IL_03e4; } case 4: <>1__state = -1; goto IL_03e4; case 5: <>1__state = -1; <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.RestoreCoroutine()); <>1__state = 6; return true; case 6: <>1__state = -1; takeoverManager._takeoverActive = false; takeoverManager._takeoverCoroutine = null; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 7; return true; case 7: { <>1__state = -1; ConstellationBridgeReflection.TryShowConstellationNotification(); return false; } IL_03e4: if (5__4 < 5__3) { 5__4 += Time.deltaTime; <>2__current = null; <>1__state = 4; return true; } if (takeoverManager._flashCoroutine != null) { ((MonoBehaviour)takeoverManager).StopCoroutine(takeoverManager._flashCoroutine); takeoverManager._flashCoroutine = null; } <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.CRTTransition()); <>1__state = 5; return true; IL_01e2: takeoverManager.StartDrone(); if (Plugin.CfgHideHUD.Value) { takeoverManager.HideHUD(); } OpenBodyCamsCompat.Suppress(); takeoverManager.SetupVideoFor(Plugin.MaskManVideoClip, looping: true); <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.WaitForVideoPrepared()); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__72 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private AudioClip 5__2; private float 5__3; private float 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__72(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; Plugin.Log.LogInfo((object)$"[TakeoverManager] PlayMumbleSequence: entered. MumbleClips.Length={Plugin.MumbleClips.Length}"); if (Plugin.MumbleClips.Length == 0) { Plugin.Log.LogWarning((object)"[TakeoverManager] PlayMumbleSequence: no mumble clips loaded — yielding break."); return false; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { Plugin.Log.LogWarning((object)"[TakeoverManager] PlayMumbleSequence: StartOfRound.Instance is null — position will default."); } GameObject val = new GameObject("Y4NGZ_MumbleAudio"); Object.DontDestroyOnLoad((Object)(object)val); takeoverManager._mumbleSource = val.AddComponent(); if ((Object)(object)takeoverManager._mumbleSource == (Object)null) { Plugin.Log.LogWarning((object)"[TakeoverManager] PlayMumbleSequence: AddComponent returned null — abort."); return false; } if ((Object)(object)instance?.speakerAudioSource != (Object)null) { val.transform.position = ((Component)instance.speakerAudioSource).transform.position; } else if ((Object)(object)instance != (Object)null) { val.transform.position = ((Component)instance).transform.position; } takeoverManager._mumbleSource.spatialBlend = 0f; takeoverManager._mumbleSource.volume = Mathf.Min(Plugin.CfgMumbleVolume.Value * 1.6f, 1f); takeoverManager._mumbleSource.loop = false; takeoverManager._mumbleSource.playOnAwake = false; AudioHighPassFilter obj = val.AddComponent(); obj.cutoffFrequency = 300f; obj.highpassResonanceQ = 1f; AudioLowPassFilter obj2 = val.AddComponent(); obj2.cutoffFrequency = 2200f; obj2.lowpassResonanceQ = 1.5f; val.AddComponent().distortionLevel = 0.3f; Plugin.Log.LogInfo((object)($"[TakeoverManager] PlayMumbleSequence: source ready. spatial={takeoverManager._mumbleSource.spatialBlend:F2} " + $"vol={takeoverManager._mumbleSource.volume:F2} clips={Plugin.MumbleClips.Length}. Entering loop.")); goto IL_0379; } case 1: <>1__state = -1; goto IL_0379; case 2: <>1__state = -1; goto IL_02da; case 3: { <>1__state = -1; goto IL_035c; } IL_035c: if (5__5 < 5__4 && takeoverManager._takeoverActive) { 5__5 += Time.deltaTime; <>2__current = null; <>1__state = 3; return true; } 5__2 = null; goto IL_0379; IL_0379: if (!takeoverManager._takeoverActive || !((Object)(object)takeoverManager._mumbleSource != (Object)null) || Plugin.MumbleClips.Length == 0) { break; } 5__2 = Plugin.MumbleClips[Random.Range(0, Plugin.MumbleClips.Length)]; if ((Object)(object)5__2 == (Object)null) { Plugin.Log.LogWarning((object)"[TakeoverManager] PlayMumbleSequence: picked null clip — skipping frame."); <>2__current = null; <>1__state = 1; return true; } takeoverManager._mumbleSource.clip = 5__2; takeoverManager._mumbleSource.Play(); Plugin.Log.LogInfo((object)$"[TakeoverManager] PlayMumbleSequence: playing '{((Object)5__2).name}' ({5__2.length:F2}s) isPlaying={takeoverManager._mumbleSource.isPlaying}"); 5__3 = 0f; goto IL_02da; IL_02da: if (5__3 < 5__2.length && takeoverManager._takeoverActive) { 5__3 += Time.deltaTime; <>2__current = null; <>1__state = 2; return true; } if (!takeoverManager._takeoverActive || (Object)(object)takeoverManager._mumbleSource == (Object)null) { break; } 5__4 = Random.Range(0.4f, 1.2f); 5__5 = 0f; goto IL_035c; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__80 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__80(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (Plugin.CfgDimLights.Value && takeoverManager._savedLights.Count > 0) { <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.RestoreLights()); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } takeoverManager.RestoreAll(immediate: false); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__81 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private List<(Light l, float curI, Color curC, float targI, Color targC)> 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__81(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_01d3: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = new List<(Light, float, Color, float, Color)>(); foreach (var (val, item, item2) in takeoverManager._savedLights) { if ((Object)(object)val != (Object)null) { 5__2.Add((val, val.intensity, val.color, item, item2)); } } 5__3 = 1.5f; 5__4 = 0f; break; case 1: <>1__state = -1; break; } if (5__4 < 5__3) { 5__4 += Time.deltaTime; float num2 = Mathf.SmoothStep(0f, 1f, 5__4 / 5__3); foreach (var (val2, num3, val3, num4, val4) in 5__2) { if (!((Object)(object)val2 == (Object)null)) { val2.intensity = Mathf.Lerp(num3, num4, num2); val2.color = Color.Lerp(val3, val4, num2); } } <>2__current = null; <>1__state = 1; return true; } foreach (var (val5, _, _, intensity, color) in 5__2) { if ((Object)(object)val5 != (Object)null) { val5.intensity = intensity; val5.color = color; } } takeoverManager._savedLights.Clear(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__73 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; public string passage; private TextMeshProUGUI 5__2; private float 5__3; private AudioClip 5__4; private AudioSource 5__5; private string 5__6; private string <>7__wrap6; private int <>7__wrap7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__73(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>7__wrap6 = null; <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_01b2: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; takeoverManager._dialogueCanvasGO = new GameObject("Y4NGZ_DialogueCanvas"); Object.DontDestroyOnLoad((Object)(object)takeoverManager._dialogueCanvasGO); Canvas obj = takeoverManager._dialogueCanvasGO.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 500; CanvasScaler obj2 = takeoverManager._dialogueCanvasGO.AddComponent(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 1f; takeoverManager._dialogueCanvasGO.AddComponent(); GameObject val = new GameObject("Y4NGZ_DialogueText"); val.transform.SetParent(takeoverManager._dialogueCanvasGO.transform, false); 5__2 = val.AddComponent(); ((TMP_Text)5__2).fontSize = 28f; ((Graphic)5__2).color = new Color(0f, 1f, 0.255f, 1f); ((TMP_Text)5__2).alignment = (TextAlignmentOptions)1026; ((TMP_Text)5__2).enableWordWrapping = true; ((TMP_Text)5__2).overflowMode = (TextOverflowModes)0; ((TMP_Text)5__2).text = ""; AssignVanillaFont(5__2); RectTransform rectTransform = ((TMP_Text)5__2).rectTransform; rectTransform.anchorMin = new Vector2(0.1f, 0.02f); rectTransform.anchorMax = new Vector2(0.9f, 0.3f); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; 5__3 = Plugin.CfgTypewriterSpeed.Value; 5__4 = CreateTypewriterTick(); GameObject val2 = new GameObject("Y4NGZ_TypewriterTick"); val2.transform.SetParent(takeoverManager._dialogueCanvasGO.transform); 5__5 = val2.AddComponent(); 5__5.spatialBlend = 0f; 5__5.volume = 0.8f; 5__5.playOnAwake = false; 5__6 = ""; <>7__wrap6 = passage; <>7__wrap7 = 0; goto IL_02c6; } case 1: <>1__state = -1; goto IL_02b8; case 2: { <>1__state = -1; break; } IL_02c6: if (<>7__wrap7 < <>7__wrap6.Length) { char c = <>7__wrap6[<>7__wrap7]; if ((Object)(object)5__2 == (Object)null) { return false; } 5__6 += c; ((TMP_Text)5__2).text = 5__6; if (!char.IsWhiteSpace(c)) { if ((Object)(object)5__5 != (Object)null) { 5__5.PlayOneShot(5__4); } <>2__current = (object)new WaitForSeconds(5__3); <>1__state = 1; return true; } goto IL_02b8; } <>7__wrap6 = null; break; IL_02b8: <>7__wrap7++; goto IL_02c6; } if ((Object)(object)takeoverManager._dialogueCanvasGO != (Object)null) { <>2__current = null; <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__42 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__42(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; takeoverManager._takeoverActive = true; <>2__current = (object)new WaitForSeconds(Plugin.CfgOrbitDelay.Value); <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.inShipPhase) { takeoverManager._takeoverActive = false; return false; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance.speakerAudioSource != (Object)null) { takeoverManager._savedSpeakerVolume = instance.speakerAudioSource.volume; instance.speakerAudioSource.volume = 0f; takeoverManager._speakerVolumeSaved = true; } 5__2 = Plugin.CfgTakeoverDuration.Value; 5__3 = 0f; Plugin.Log.LogInfo((object)"[TakeoverManager] Seq: calling PlayPowerDownWhine."); takeoverManager.PlayPowerDownWhine(); if (Plugin.CfgDimLights.Value) { <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.DimLights()); <>1__state = 2; return true; } takeoverManager.PlayAlarm(); goto IL_013f; } case 2: <>1__state = -1; takeoverManager._flashCoroutine = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.FlashLightsLoop()); goto IL_013f; case 3: { <>1__state = -1; ManualLogSource log = Plugin.Log; string[] obj = new string[6] { "[Diag/RT] at OverrideMonitors: _renderTexture id=", ((Object)(object)takeoverManager._renderTexture != (Object)null) ? ((Object)takeoverManager._renderTexture).GetInstanceID().ToString() : "NULL", " VP.targetTexture id=", null, null, null }; VideoPlayer videoPlayer = takeoverManager._videoPlayer; obj[3] = (((Object)(object)((videoPlayer != null) ? videoPlayer.targetTexture : null) != (Object)null) ? ((Object)takeoverManager._videoPlayer.targetTexture).GetInstanceID().ToString() : "NULL"); obj[4] = " "; VideoPlayer videoPlayer2 = takeoverManager._videoPlayer; obj[5] = $"match={(Object)(object)((videoPlayer2 != null) ? videoPlayer2.targetTexture : null) == (Object)(object)takeoverManager._renderTexture}"; log.LogInfo((object)string.Concat(obj)); takeoverManager.OverrideMonitors(); ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.DiagVideoStateLoop()); ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.DiagRTReadbackAfterDelay(3f)); Plugin.Log.LogInfo((object)"[TakeoverManager] Seq: starting PlayMumbleSequence coroutine."); ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.PlayMumbleSequence()); string passage = DialoguePool[Random.Range(0, DialoguePool.Length)]; ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.ShowDialogue(passage)); goto IL_0399; } case 4: <>1__state = -1; goto IL_0399; case 5: <>1__state = -1; <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.RestoreCoroutine()); <>1__state = 6; return true; case 6: <>1__state = -1; takeoverManager._takeoverActive = false; takeoverManager._takeoverCoroutine = null; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 7; return true; case 7: { <>1__state = -1; ConstellationBridgeReflection.TryShowConstellationNotification(); return false; } IL_0399: if (5__3 < 5__2) { 5__3 += Time.deltaTime; <>2__current = null; <>1__state = 4; return true; } if (takeoverManager._flashCoroutine != null) { ((MonoBehaviour)takeoverManager).StopCoroutine(takeoverManager._flashCoroutine); takeoverManager._flashCoroutine = null; } <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.CRTTransition()); <>1__state = 5; return true; IL_013f: Plugin.Log.LogInfo((object)"[TakeoverManager] Seq: calling StartDrone."); takeoverManager.StartDrone(); Plugin.Log.LogInfo((object)("[TakeoverManager] Seq: StartDrone returned. _droneSource=" + (((Object)(object)takeoverManager._droneSource != (Object)null) ? "OK" : "NULL") + " clip=" + (((Object)(object)takeoverManager._droneSource != (Object)null && (Object)(object)takeoverManager._droneSource.clip != (Object)null) ? ((Object)takeoverManager._droneSource.clip).name : "") + " " + $"isPlaying={(Object)(object)takeoverManager._droneSource != (Object)null && takeoverManager._droneSource.isPlaying}")); if (Plugin.CfgHideHUD.Value) { takeoverManager.HideHUD(); } OpenBodyCamsCompat.Suppress(); takeoverManager.SetupVideo(); <>2__current = ((MonoBehaviour)takeoverManager).StartCoroutine(takeoverManager.WaitForVideoPrepared()); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__63 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__63(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; foreach (var overriddenRenderer in takeoverManager._overriddenRenderers) { MeshRenderer item = overriddenRenderer.renderer; if (!((Object)(object)item == (Object)null)) { Material material; try { material = ((Renderer)item).material; } catch { continue; } if (!((Object)(object)material == (Object)null)) { Texture val = (material.HasProperty("_BaseColorMap") ? material.GetTexture("_BaseColorMap") : null); Texture val2 = (material.HasProperty("_EmissiveColorMap") ? material.GetTexture("_EmissiveColorMap") : null); Texture mainTexture = material.mainTexture; bool flag = (Object)(object)val == (Object)(object)takeoverManager._renderTexture; bool flag2 = (Object)(object)val2 == (Object)(object)takeoverManager._renderTexture; Plugin.Log.LogInfo((object)("[Diag/Post] '" + ((Object)((Component)item).gameObject).name + "' shader='" + ((Object)material.shader).name + "' " + string.Format("_BaseColorMap={0} (ours={1}) ", ((Object)(object)val != (Object)null) ? ((Object)val).name : "null", flag) + string.Format("_EmissiveColorMap={0} (ours={1}) ", ((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "null", flag2) + "mainTex=" + (((Object)(object)mainTexture != (Object)null) ? ((Object)mainTexture).name : "null"))); } } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__59 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeoverManager <>4__this; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown int num = <>1__state; TakeoverManager takeoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)takeoverManager._videoPlayer == (Object)null) { return false; } 5__2 = 4f; 5__3 = 0f; goto IL_007e; case 1: <>1__state = -1; goto IL_007e; case 2: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 3; return true; case 3: { <>1__state = -1; return false; } IL_007e: if (!takeoverManager._videoPlayer.isPrepared && 5__3 < 5__2) { 5__3 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } takeoverManager._videoPlayer.Play(); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Coroutine _takeoverCoroutine; private Coroutine _flashCoroutine; private bool _takeoverActive; private bool _profitTextWasEnabled; private bool _profitBGWasEnabled; private bool _deadlineTextWasEnabled; private bool _deadlineBGWasEnabled; private bool _levelDescWasEnabled; private VideoClip _savedVideoClip; private bool _savedVideoLooping; private bool _savedVideoPlaying; private readonly List<(MeshRenderer renderer, Texture originalTexture)> _overriddenRenderers = new List<(MeshRenderer, Texture)>(); private readonly Dictionary _savedHDRPState = new Dictionary(); private readonly List _topMonitorOverlayImages = new List(); private RawImage _videoReelRawImage; private Texture _savedVideoReelTexture; private readonly List<(CanvasGroup cg, float alpha, bool interact, bool raycast)> _savedHUDGroups = new List<(CanvasGroup, float, bool, bool)>(); private readonly List _addedHUDGroups = new List(); private readonly List<(GameObject go, bool wasActive)> _hiddenHotbarObjects = new List<(GameObject, bool)>(); private RenderTexture _mapScreenRT; private Coroutine _mapBlitCoroutine; private readonly List<(Light light, float origIntensity, Color origColor)> _savedLights = new List<(Light, float, Color)>(); private float _savedSpeakerVolume = 1f; private bool _speakerVolumeSaved; private readonly List<(Behaviour component, bool wasEnabled)> _disabledComponents = new List<(Behaviour, bool)>(); private VideoPlayer _videoPlayer; private RenderTexture _renderTexture; private AudioSource _mumbleSource; private AudioSource _alarmSource; private AudioSource _droneSource; private GameObject _dialogueCanvasGO; private static readonly string[] DialoguePool = new string[21] { "First satisfactory output from this crew.\nClean execution. I had the over on you\nfinishing this one alive, paid out nicely.\nReinvesting immediately. I want you to know\nI don't celebrate. Celebration implies surprise.\nI'm not surprised. I'm confirmed.", "Consistent output. I respect the margins\non this run. Reminds me of when I wrote\nTech Talk — calculated, efficient, no wasted\nbars. Every word in that track had a function.\nEvery syllable was load-bearing. That's what\nI need from you. Load-bearing performance.\nNo filler. No ad-libs. Just execution.", "You're demonstrating real value. I moved\nsome numbers around on the back end,\nnothing you need to worry about. Just keep\nperforming. I restructured some of the internal\nmetrics to better reflect what I'm seeing out\nthere. Again, not your concern. Your concern\nis scrap. My concern is everything else.", "I was in New York closing something.\nCan't say what. Point is, I had action on\nfour different outcomes this week and every\nsingle one hit. You were one of them.\nCongratulations. I sat in a steakhouse in\nMurray Hill afterward and ate alone. Not\nbecause I had to. Because the booth across\nfrom me was occupied by a version of me\nwho didn't need to eat. We didn't speak.", "I want you to understand something.\nJuice WRLD recorded hundreds of songs that\nnever came out. Hundreds. That's not waste.\nThat's pipeline. You are pipeline. Keep moving.\nPeople called him prolific. I call him\noperationally sound. He understood throughput.\nMost artists don't. Most crews don't either.", "I've been running the numbers on crew\nsurvivability and I'll be honest, you're\noutperforming the model. I don't like when\nthings outperform the model. It means the\nmodel is wrong. I'll adjust. I've already\nstarted recalibrating. By tomorrow morning\nthe model will expect exactly what you\ndelivered today. You'll have to do better.\nThat's not a threat. That's forecasting.", "Wrote Bruises about a very specific feeling.\nNot pain exactly. More like the moment you\nrealize pain is just overhead. You account\nfor it. You build it into the forecast.\nQuota's done. People thought that song was\nabout a relationship. It was about depreciation.\nPhysical, emotional, structural. Everything\nbruises. The question is whether you write\nit off or capitalize it.", "I placed a parlay — crew survival, scrap\ntotal, and whether anyone would cry on the\nship. Two out of three hit. I won't say which\none missed. The book I use doesn't ask\nquestions. I like that about them. They\nunderstand that a bet is just a belief with\ncollateral. I believe in very specific things.\nYou should find that comforting.", "Took a red-eye to New York. Sat in a booth\nat a restaurant in Midtown for four hours.\nDidn't order anything. Waitress asked if I was\nokay. I said 'Yeah what.' She didn't ask again.\nGood trip overall. Flew back the same night.\nDidn't sleep. Wrote half a verse on the plane\nabout lunar rotation cycles. Scrapped it.\nToo honest.", "I'm going to be transparent with you\nbecause I think you've earned it. Magic Trik\nisn't about magic. It's about making people\nlook where you want them to look. That's all\nmanagement is. Misdirection with benefits.\nI learned that in New York. I learned it again\non Titan. Some lessons you have to learn in\ntwo places before they stick.", "I have a spreadsheet. You're on it.\nEveryone's on it. The columns are labeled\nbut I won't share what the labels mean.\nYour column is trending upward. Be grateful\nfor that. I update it manually. Not because\nI have to. The automation works fine. I just\nlike the feeling of typing the numbers myself.\nIt keeps me connected to the data. The data\nkeeps me connected to you.", "Juice never made it this far. Different\ncontext. But I think about it. I think about\nwhat it means to keep going past the point\nwhere someone else stopped. Not better.\nJust still here. Still filing. Still submitting.\nThere's a version of Rockstar Status I never\nreleased where the second verse is just me\nreading quarterly projections over an 808.\nIt goes harder than you'd think.", "I shorted three crews this cycle. Not yours.\nYours I'm long on. That's not loyalty.\nThat's positioning. Rockstar Status was about\npositioning. Nobody understood that. They\nheard the hook and thought it was about fame.\nIt was about leverage. Every bar in that song\nis a hedge against irrelevance. I don't write\nmusic. I write instruments. Financial ones.", "I stood in the ship hallway for forty-five\nminutes this morning. Not thinking. Not\nwaiting. Just auditing. Internally. Everything\nchecks out. Everything always checks out.\nThat's what concerns me. When the numbers\nare too clean it means something isn't being\nmeasured. I've started measuring things that\ndon't have units yet. I'll name the units later.\nOne of them might be named after you.", "Someone asked me what Y4NGZ stands for.\nI told them it doesn't stand for anything.\nThey said everything has to mean something.\nI fired them. Not from a job. Just in general.\nFrom everything. They still exist but in a\nreduced capacity. I think about that interaction\nwhen I'm trying to fall asleep. Not because\nit bothers me. Because it's the only thing\nthat's quiet enough.", "The line on the next quota is steep but\nI've seen your work and frankly the house\nis wrong. The house is always wrong.\nI am the house. I am wrong. This is fine.\nI built the odds myself. Used a model I wrote\non a napkin in JFK. The napkin is framed in\nmy studio now. It's the most important thing\nI've ever written and it's just numbers.", "New York again. Times Square. I looked up\nat one of those billboards and for a second\nit said something meant only for me. Then it\nwent back to normal. I placed a bet on whether\nit would happen again. It did. I'm up on the\nyear. I'm up on the lifetime. The problem is\nI don't know what I'm winning. The money goes\nsomewhere. I go somewhere. We never end up\nin the same place.", "I don't have anything to say right now.\nBut I'm choosing to be here. That's worse\nand I need you to understand that. Silence\nfrom me isn't empty. It's full. It's a room\nwith no furniture that still feels crowded.\nThat's what the next album sounds like.\nYou'll never hear it.", "The next song is called Margin Call.\nIt's three minutes of silence over an 808.\nThe silence is the point. The 808 is for the\nshareholders. I played it for someone once\nand they left the room. Not because it was\nbad. Because they understood it. Understanding\nis the most violent thing you can do to\na person.", "I ran the numbers on your life expectancy.\nBet the under. Nothing personal. Everything\npersonal. Quota's done. I have a policy of\nnever apologizing for a position I've taken.\nThe position is the apology. The odds are the\nexplanation. If you survive long enough I'll\nclose the bet at a loss and I will feel nothing\nabout it. That's not cold. That's solvent.", "Every moon is New York if you think about\nit long enough. I have thought about it long\nenough. The same grid. The same strangers.\nThe same feeling that you're being watched\nby something that doesn't care about you\nspecifically but cares about what you represent\nstatistically. I wrote a hook about it.\nIt goes hard. You'll never hear it." }; private const float MinAlarmLength = 1f; internal static TakeoverManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { ForceRestore("OnDestroy"); Instance = null; } } internal static void EnsureInstance() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance != (Object)null)) { new GameObject("Y4NGZ_TakeoverManager").AddComponent(); } } internal void BeginTakeover() { if (!_takeoverActive) { if (_takeoverCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_takeoverCoroutine); } _takeoverCoroutine = ((MonoBehaviour)this).StartCoroutine(TakeoverSequence()); } } internal void BeginMaskManTakeover() { if (_takeoverActive) { return; } if ((Object)(object)Plugin.MaskManVideoClip == (Object)null || (Object)(object)Plugin.MaskManAudioClip == (Object)null) { Plugin.Log.LogError((object)("[TakeoverManager] BeginMaskManTakeover: missing assets " + $"(video={(Object)(object)Plugin.MaskManVideoClip != (Object)null}, audio={(Object)(object)Plugin.MaskManAudioClip != (Object)null}). Aborting.")); return; } if (_takeoverCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_takeoverCoroutine); } _takeoverCoroutine = ((MonoBehaviour)this).StartCoroutine(MaskManSequence()); } internal void ForceRestore(string reason) { if (_takeoverActive) { Plugin.Log.LogInfo((object)("[TakeoverManager] ForceRestore: " + reason)); if (_takeoverCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_takeoverCoroutine); _takeoverCoroutine = null; } if (_flashCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_flashCoroutine); _flashCoroutine = null; } RestoreAll(immediate: true); } } [IteratorStateMachine(typeof(d__42))] private IEnumerator TakeoverSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__42(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__43))] private IEnumerator MaskManSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__43(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__44))] private IEnumerator DimLights() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__44(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__45))] private IEnumerator FlashLightsLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__45(0) { <>4__this = this }; } private void PlayAlarm() { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_019a: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) AudioClip val = null; string text = null; if ((Object)(object)Plugin.AlarmClip != (Object)null) { val = Plugin.AlarmClip; text = "bundle:Y4NGZ_Klaxon"; Plugin.Log.LogInfo((object)$"[TakeoverManager] PlayAlarm: using bundle clip '{((Object)val).name}' ({val.length:F2}s)."); } else { AudioClip val2 = FindGameAlarmClip(); if ((Object)(object)val2 != (Object)null && val2.length < 1f) { Plugin.Log.LogWarning((object)$"[TakeoverManager] PlayAlarm: rejecting scene clip '{((Object)val2).name}' ({val2.length:F2}s) — shorter than 1s threshold."); val2 = null; } if ((Object)(object)val2 != (Object)null) { val = val2; text = "scene:" + ((Object)val2).name; Plugin.Log.LogInfo((object)$"[TakeoverManager] PlayAlarm: using scene clip '{((Object)val2).name}' ({val2.length:F2}s)."); } else { val = CreateKlaxonClip(); text = "procedural"; Plugin.Log.LogInfo((object)"[TakeoverManager] PlayAlarm: falling back to procedural klaxon."); } } if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[TakeoverManager] PlayAlarm: alarmClip null after fallback — aborting."); return; } Plugin.Log.LogInfo((object)("[TakeoverManager] Alarm source: " + ((Object)val).name + " (from " + text + ")")); StartOfRound instance = StartOfRound.Instance; Vector3 position = (((Object)(object)instance?.speakerAudioSource != (Object)null) ? ((Component)instance.speakerAudioSource).transform.position : (((Object)(object)instance != (Object)null) ? ((Component)instance).transform.position : Vector3.zero)); GameObject val3 = new GameObject("Y4NGZ_Alarm"); Object.DontDestroyOnLoad((Object)(object)val3); _alarmSource = val3.AddComponent(); ((Component)_alarmSource).transform.position = position; _alarmSource.spatialBlend = 0f; _alarmSource.volume = 0.9f; _alarmSource.clip = val; _alarmSource.loop = true; _alarmSource.Play(); } private static AudioClip FindGameAlarmClip() { Plugin.Log.LogInfo((object)"[TakeoverManager] FindGameAlarmClip: beginning scan."); try { AudioSource[] array = Resources.FindObjectsOfTypeAll(); Plugin.Log.LogInfo((object)$"[TakeoverManager] scene AudioSources found: {array.Length}"); int num = 0; AudioSource[] array2 = array; foreach (AudioSource val in array2) { if (!((Object)(object)val == (Object)null)) { string text = (((Object)(object)val.clip != (Object)null) ? ((Object)val.clip).name : ""); float num2 = (((Object)(object)val.clip != (Object)null) ? val.clip.length : 0f); string text2 = (((Object)(object)((Component)val).gameObject != (Object)null) ? ((Object)((Component)val).gameObject).name : ""); Plugin.Log.LogInfo((object)$"[TakeoverManager] AudioSource on '{text2}' clip='{text}' len={num2:F2}s spatial={val.spatialBlend:F2}"); if (++num > 200) { Plugin.Log.LogInfo((object)"[TakeoverManager] (truncated AudioSource list at 200)"); break; } } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverManager] AudioSource dump failed: " + ex.Message)); } AudioClip[] array3 = Resources.FindObjectsOfTypeAll(); Plugin.Log.LogInfo((object)$"[TakeoverManager] loaded AudioClips found: {array3.Length}"); string[] array4 = new string[9] { "ShipAlarmHornConstant", "0DaysLeftAlert", "DeadlineAlarm", "FireAlarm", "ShipAlarm", "RedAlarmSFX", "ShipAlarmSFX", "EjectAlarm", "ShipAlarmCord" }; AudioClip[] array5; foreach (string text3 in array4) { array5 = array3; foreach (AudioClip val2 in array5) { if (!((Object)(object)val2 == (Object)null) && ((Object)val2).name.Equals(text3, StringComparison.OrdinalIgnoreCase)) { if (!(val2.length < 1f)) { Plugin.Log.LogInfo((object)$"[TakeoverManager] exact MATCH '{((Object)val2).name}' ({val2.length:F2}s) via keyword '{text3}'."); return val2; } Plugin.Log.LogInfo((object)$"[TakeoverManager] exact '{((Object)val2).name}' matched but rejected ({val2.length:F2}s < {1f:F2}s)."); } } } Plugin.Log.LogInfo((object)"[TakeoverManager] no exact match — falling to keyword search."); AudioClip val3 = null; string arg = null; array5 = array3; foreach (AudioClip val4 in array5) { if ((Object)(object)val4 == (Object)null || val4.length < 1f) { continue; } string text4 = ((Object)val4).name.ToLower(); if (text4.Contains("chatter") || text4.Contains("foot") || text4.Contains("spot") || text4.Contains("siren") || text4.Contains("tentacle") || text4.Contains("insanity") || text4.Contains("bomb") || text4.Contains("lrad") || text4.Contains("extension") || text4.Contains("controller")) { continue; } string text5 = null; if (text4.Contains("alarm")) { text5 = "alarm"; } else if (text4.Contains("klaxon")) { text5 = "klaxon"; } else if (text4.Contains("eject")) { text5 = "eject"; } else if (text4.Contains("alert")) { text5 = "alert"; } else if (text4.Contains("emergency")) { text5 = "emergency"; } if (text5 != null) { Plugin.Log.LogInfo((object)$"[TakeoverManager] keyword candidate '{((Object)val4).name}' ({val4.length:F2}s) matched='{text5}'."); if ((Object)(object)val3 == (Object)null || val4.length > val3.length) { val3 = val4; arg = text5; } } } if ((Object)(object)val3 != (Object)null) { Plugin.Log.LogInfo((object)$"[TakeoverManager] keyword WINNER '{((Object)val3).name}' ({val3.length:F2}s) via '{arg}'."); return val3; } Plugin.Log.LogWarning((object)"[TakeoverManager] FindGameAlarmClip: no suitable clip — caller will fall back."); return null; } private static AudioClip CreateKlaxonClip() { int num = 44100; float num2 = 0.5f; int num3 = (int)((float)num * num2); int num4 = 5; int num5 = num3 * num4; float[] array = new float[num5]; float num6 = 0f; float num7 = 0f; for (int i = 0; i < num5; i++) { float num8 = (float)(i % num3) / (float)num3; float num9 = ((num8 < 0.5f) ? Mathf.Lerp(400f, 800f, num8 * 2f) : Mathf.Lerp(800f, 400f, (num8 - 0.5f) * 2f)); num6 += num9 / (float)num; num7 += num9 * 2f / (float)num; float num10 = ((Mathf.Sin(num6 * 2f * MathF.PI) > 0f) ? 1f : (-1f)); float num11 = Mathf.Sin(num7 * 2f * MathF.PI); float num12 = num10 * 0.6f + num11 * 0.25f; float num13 = (((float)i < (float)num * 0.01f) ? ((float)i / ((float)num * 0.01f)) : 1f); array[i] = num12 * num13 * 0.8f; } AudioClip obj = AudioClip.Create("Y4NGZ_Klaxon", num5, 1, num, false); obj.SetData(array, 0); return obj; } private void PlayPowerDownWhine() { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown int num = 44100; float num2 = 1.4f; int num3 = (int)((float)num * num2); float[] array = new float[num3]; float num4 = 0f; float num5 = 0f; for (int i = 0; i < num3; i++) { float num6 = (float)i / (float)num3; float num7 = Random.value * 2f - 1f; num4 += 0.057f * (num7 - num4); float num8 = num4 * 1.8f; num5 += 45f / (float)num; float num9 = Mathf.Exp((0f - num6) * 6f); float num10 = Mathf.Sin(num5 * 2f * MathF.PI) * num9 * 0.6f; float num11 = Mathf.Clamp01(1f - num6 * num6); array[i] = (num8 * 0.4f + num10) * num11 * 0.45f; } AudioClip val = AudioClip.Create("Y4NGZ_PowerDown", num3, 1, num, false); val.SetData(array, 0); GameObject val2 = new GameObject("Y4NGZ_PowerDown"); AudioSource obj = val2.AddComponent(); obj.spatialBlend = 0f; obj.volume = 0.55f; obj.PlayOneShot(val); Object.Destroy((Object)val2, num2 + 0.5f); } private void StartDrone() { //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown int num = 44100; float num2 = Plugin.CfgTakeoverDuration.Value + 4f; int num3 = (int)((float)num * num2); float[] array = new float[num3]; float num4 = 0f; float num5 = 0f; float num6 = 0f; for (int i = 0; i < num3; i++) { float num7 = (float)i / (float)num3; num4 += 55f / (float)num; num5 += 82.5f / (float)num; float num8 = Mathf.Sin(num4 * 2f * MathF.PI) * 0.5f + Mathf.Sin(num5 * 2f * MathF.PI) * 0.3f; float num9 = Random.value * 2f - 1f; num6 += 0.0712f * (num9 - num6); float num10 = 0.35f + 0.25f * Mathf.Sin(num7 * num2 * 2f * MathF.PI * 0.4f); float num11 = num6 * num10; float num12 = num8 + num11; float num13 = 0.7f + 0.3f * Mathf.Sin(num7 * num2 * 2f * MathF.PI * 1.5f); float num14 = 1f; if ((float)i < (float)num * 0.5f) { num14 = (float)i / ((float)num * 0.5f); } if (i > num3 - (int)((float)num * 1.5f)) { num14 = (float)(num3 - i) / ((float)num * 1.5f); } array[i] = num12 * num13 * num14 * 0.5f; } AudioClip val = AudioClip.Create("Y4NGZ_Drone", num3, 1, num, false); val.SetData(array, 0); GameObject val2 = new GameObject("Y4NGZ_Drone"); Object.DontDestroyOnLoad((Object)(object)val2); _droneSource = val2.AddComponent(); if ((Object)(object)_droneSource == (Object)null) { Plugin.Log.LogWarning((object)"[TakeoverManager] StartDrone: AddComponent returned null."); return; } _droneSource.spatialBlend = 0f; _droneSource.volume = 0.7f; _droneSource.clip = val; _droneSource.loop = false; if ((Object)(object)_droneSource.clip == (Object)null) { Plugin.Log.LogWarning((object)"[TakeoverManager] StartDrone: clip not assigned to source."); } _droneSource.Play(); Plugin.Log.LogInfo((object)($"[TakeoverManager] StartDrone: playing '{((Object)val).name}' len={val.length:F2}s " + $"spatial={_droneSource.spatialBlend:F2} vol={_droneSource.volume:F2} isPlaying={_droneSource.isPlaying}")); } private void HideHUD() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown if ((Object)(object)HUDManager.Instance == (Object)null) { return; } try { _savedHUDGroups.Clear(); _addedHUDGroups.Clear(); object obj; if (!((Object)(object)HUDManager.Instance.HUDContainer != (Object)null)) { if (!((Object)(object)HUDManager.Instance.playerScreenTexture != (Object)null)) { obj = null; } else { Canvas canvas = ((Graphic)HUDManager.Instance.playerScreenTexture).canvas; obj = ((canvas != null) ? ((Component)canvas).transform : null); } } else { obj = HUDManager.Instance.HUDContainer.transform.parent; } Transform val = (Transform)obj; if ((Object)(object)val == (Object)null) { GameObject hUDContainer = HUDManager.Instance.HUDContainer; val = ((hUDContainer != null) ? hUDContainer.transform : null); } if ((Object)(object)val == (Object)null) { return; } CanvasGroup[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (CanvasGroup val2 in componentsInChildren) { _savedHUDGroups.Add((val2, val2.alpha, val2.interactable, val2.blocksRaycasts)); val2.alpha = 0f; val2.interactable = false; val2.blocksRaycasts = false; } Transform val3 = (((Object)(object)HUDManager.Instance.playerScreenTexture != (Object)null) ? ((Component)HUDManager.Instance.playerScreenTexture).transform : null); foreach (Transform item in val) { Transform val4 = item; if (!((Object)(object)val4 == (Object)null) && !((Object)(object)((Component)val4).GetComponent() != (Object)null)) { if ((Object)(object)val3 != (Object)null && IsAncestorOrSelf(val4, val3)) { Plugin.Log.LogInfo((object)("[TakeoverManager] HideHUD: skipping '" + ((Object)val4).name + "' (ancestor of playerScreenTexture).")); continue; } CanvasGroup val5 = ((Component)val4).gameObject.AddComponent(); val5.alpha = 0f; val5.interactable = false; val5.blocksRaycasts = false; _addedHUDGroups.Add(val5); } } try { Image[] itemSlotIconFrames = HUDManager.Instance.itemSlotIconFrames; if (itemSlotIconFrames != null && itemSlotIconFrames.Length != 0) { Image[] array = itemSlotIconFrames; foreach (Image val6 in array) { if ((Object)(object)val6 == (Object)null) { continue; } Transform val7 = ((Component)val6).transform; while ((Object)(object)val7 != (Object)null && (Object)(object)((Component)val7).GetComponent() == (Object)null) { val7 = val7.parent; } if (!((Object)(object)val7 == (Object)null)) { if ((Object)(object)val7 == (Object)(object)val) { Plugin.Log.LogInfo((object)"[TakeoverManager] HideHUD: hotbar canvas is the shared root — skipping to preserve player view."); } else { HideHUDAncestor(val7); } break; } } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverManager] HideHUD hotbar: " + ex.Message)); } try { _hiddenHotbarObjects.Clear(); HUDManager instance = HUDManager.Instance; if (!((Object)(object)instance != (Object)null)) { return; } if (instance.itemSlotIcons != null) { Image[] array = instance.itemSlotIcons; foreach (Image val8 in array) { if (!((Object)(object)val8 == (Object)null)) { GameObject gameObject = ((Component)val8).gameObject; _hiddenHotbarObjects.Add((gameObject, gameObject.activeSelf)); gameObject.SetActive(false); } } } if (instance.itemSlotIconFrames != null) { Image[] array = instance.itemSlotIconFrames; foreach (Image val9 in array) { if (!((Object)(object)val9 == (Object)null)) { GameObject gameObject2 = ((Component)val9).gameObject; _hiddenHotbarObjects.Add((gameObject2, gameObject2.activeSelf)); gameObject2.SetActive(false); } } } Plugin.Log.LogInfo((object)$"[TakeoverManager] HideHUD: hid {_hiddenHotbarObjects.Count} hotbar icon GameObjects."); } catch (Exception ex2) { Plugin.Log.LogWarning((object)("[TakeoverManager] HideHUD hotbar icons: " + ex2.Message)); } } catch (Exception ex3) { Plugin.Log.LogWarning((object)("[TakeoverManager] HideHUD: " + ex3.Message)); } } private static bool IsAncestorOrSelf(Transform potentialAncestor, Transform t) { Transform val = t; while ((Object)(object)val != (Object)null) { if ((Object)(object)val == (Object)(object)potentialAncestor) { return true; } val = val.parent; } return false; } private static string GetTransformPath(Transform t) { if ((Object)(object)t == (Object)null) { return ""; } StringBuilder stringBuilder = new StringBuilder(((Object)t).name); Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } private void HideHUDAncestor(Transform t) { if ((Object)(object)t == (Object)null) { return; } CanvasGroup component = ((Component)t).GetComponent(); if ((Object)(object)component != (Object)null) { foreach (var savedHUDGroup in _savedHUDGroups) { if ((Object)(object)savedHUDGroup.cg == (Object)(object)component) { return; } } _savedHUDGroups.Add((component, component.alpha, component.interactable, component.blocksRaycasts)); component.alpha = 0f; component.interactable = false; component.blocksRaycasts = false; Plugin.Log.LogInfo((object)("[TakeoverManager] HideHUD: zeroed existing CanvasGroup on '" + ((Object)t).name + "'.")); } else { CanvasGroup val = ((Component)t).gameObject.AddComponent(); val.alpha = 0f; val.interactable = false; val.blocksRaycasts = false; _addedHUDGroups.Add(val); Plugin.Log.LogInfo((object)("[TakeoverManager] HideHUD: added CanvasGroup to '" + ((Object)t).name + "'.")); } } private void RestoreHUD() { if ((Object)(object)HUDManager.Instance == (Object)null) { return; } try { foreach (var (val, alpha, interactable, blocksRaycasts) in _savedHUDGroups) { if (!((Object)(object)val == (Object)null)) { val.alpha = alpha; val.interactable = interactable; val.blocksRaycasts = blocksRaycasts; } } _savedHUDGroups.Clear(); foreach (CanvasGroup addedHUDGroup in _addedHUDGroups) { if ((Object)(object)addedHUDGroup != (Object)null) { Object.Destroy((Object)(object)addedHUDGroup); } } _addedHUDGroups.Clear(); foreach (var (val2, active) in _hiddenHotbarObjects) { if ((Object)(object)val2 != (Object)null) { val2.SetActive(active); } } _hiddenHotbarObjects.Clear(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverManager] RestoreHUD: " + ex.Message)); } } private void SetupVideo() { SetupVideoFor(Plugin.TakeoverVideoClip, looping: true); } private void SetupVideoFor(VideoClip clip, bool looping) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)clip == (Object)null)) { _renderTexture = new RenderTexture(1920, 1080, 0, (RenderTextureFormat)0); _renderTexture.Create(); Plugin.Log.LogInfo((object)($"[Diag/RT] constructed: id={((Object)_renderTexture).GetInstanceID()} " + $"size={((Texture)_renderTexture).width}x{((Texture)_renderTexture).height} fmt={_renderTexture.format} name='{((Object)_renderTexture).name}'")); _videoPlayer = ((Component)this).gameObject.AddComponent(); _videoPlayer.clip = clip; _videoPlayer.renderMode = (VideoRenderMode)2; _videoPlayer.targetTexture = _renderTexture; _videoPlayer.isLooping = looping; _videoPlayer.audioOutputMode = (VideoAudioOutputMode)0; _videoPlayer.playOnAwake = false; Plugin.Log.LogInfo((object)("[Diag/RT] VP.targetTexture id=" + (((Object)(object)_videoPlayer.targetTexture != (Object)null) ? ((Object)_videoPlayer.targetTexture).GetInstanceID().ToString() : "NULL") + " " + string.Format("match={0} clip='{1}'", (Object)(object)_videoPlayer.targetTexture == (Object)(object)_renderTexture, ((Object)(object)_videoPlayer.clip != (Object)null) ? ((Object)_videoPlayer.clip).name : "null"))); _videoPlayer.Prepare(); } } [IteratorStateMachine(typeof(d__59))] private IEnumerator WaitForVideoPrepared() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__59(0) { <>4__this = this }; } private void OverrideMonitors() { _overriddenRenderers.Clear(); _savedHDRPState.Clear(); _topMonitorOverlayImages.Clear(); _disabledComponents.Clear(); _videoReelRawImage = null; StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)_renderTexture == (Object)null) { return; } try { _profitTextWasEnabled = SetEnabled((Behaviour)(object)instance.profitQuotaMonitorText, enabled: false); _profitBGWasEnabled = SetEnabled((Behaviour)(object)instance.profitQuotaMonitorBGImage, enabled: false); _deadlineTextWasEnabled = SetEnabled((Behaviour)(object)instance.deadlineMonitorText, enabled: false); _deadlineBGWasEnabled = SetEnabled((Behaviour)(object)instance.deadlineMonitorBGImage, enabled: false); _topMonitorOverlayImages.Clear(); AddOverlayMatchingBG(instance.profitQuotaMonitorBGImage); AddOverlayMatchingBG(instance.deadlineMonitorBGImage); Plugin.Log.LogInfo((object)$"[TakeoverManager] Top monitor overlays added: {_topMonitorOverlayImages.Count}"); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[TakeoverManager] Top monitor override: " + ex.Message)); } try { _levelDescWasEnabled = SetEnabled((Behaviour)(object)instance.screenLevelDescription, enabled: false); if ((Object)(object)instance.screenLevelVideoReel != (Object)null) { VideoPlayer screenLevelVideoReel = instance.screenLevelVideoReel; _savedVideoClip = screenLevelVideoReel.clip; _savedVideoLooping = screenLevelVideoReel.isLooping; _savedVideoPlaying = screenLevelVideoReel.isPlaying; _mapScreenRT = screenLevelVideoReel.targetTexture; screenLevelVideoReel.Stop(); } if ((Object)(object)_mapScreenRT != (Object)null && (Object)(object)_renderTexture != (Object)null) { _mapBlitCoroutine = ((MonoBehaviour)this).StartCoroutine(BlitMapScreenLoop()); Plugin.Log.LogInfo((object)$"[TakeoverManager] Pinning MapScreenVideo RT ({((Texture)_mapScreenRT).width}x{((Texture)_mapScreenRT).height}) to Y4NGZ via per-frame Blit."); } GameObject val = GameObject.Find("Systems/GameSystems/ItemSystems/MapScreenUI"); if ((Object)(object)val != (Object)null) { RawImage[] componentsInChildren = val.GetComponentsInChildren(true); foreach (RawImage val2 in componentsInChildren) { if ((Object)(object)val2.texture != (Object)null && ((Object)val2.texture).name == "MapScreenVideo") { _videoReelRawImage = val2; _savedVideoReelTexture = val2.texture; val2.texture = (Texture)(object)_renderTexture; break; } } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("[TakeoverManager] Bottom-left override: " + ex2.Message)); } try { GameObject val3 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall"); if ((Object)(object)val3 != (Object)null) { Plugin.Log.LogInfo((object)"[TakeoverManager] --- MonitorWall hierarchy dump ---"); DumpHierarchy(val3.transform, 0); Plugin.Log.LogInfo((object)"[TakeoverManager] --- end MonitorWall dump ---"); } else { Plugin.Log.LogWarning((object)"[TakeoverManager] MonitorWall not found for hierarchy dump."); } } catch (Exception ex3) { Plugin.Log.LogWarning((object)("[TakeoverManager] MonitorWall dump: " + ex3.Message)); } try { GameObject val4 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001"); if ((Object)(object)val4 != (Object)null) { MeshRenderer component = val4.GetComponent(); if ((Object)(object)component != (Object)null && !AlreadyOverridden(component)) { if ((Object)(object)instance != (Object)null && (Object)(object)instance.mapScreen != (Object)null) { _disabledComponents.Add(((Behaviour)(object)instance.mapScreen, ((Behaviour)instance.mapScreen).enabled)); ((Behaviour)instance.mapScreen).enabled = false; Plugin.Log.LogInfo((object)("[TakeoverManager] Cube.001: disabled sor.mapScreen MCR on '" + ((Object)((Component)instance.mapScreen).gameObject).name + "'.")); } else { Plugin.Log.LogInfo((object)"[TakeoverManager] Cube.001: sor.mapScreen null — relying on global MCR disable."); } Texture item = (((Object)(object)((Renderer)component).sharedMaterial != (Object)null) ? ((Renderer)component).sharedMaterial.mainTexture : null); _overriddenRenderers.Add((component, item)); ApplyMonitorOverride(component); Plugin.Log.LogInfo((object)"[TakeoverManager] Cube.001 overridden via HDRP write."); } } else { Plugin.Log.LogWarning((object)"[TakeoverManager] Cube.001 not found."); } } catch (Exception ex4) { Plugin.Log.LogWarning((object)("[TakeoverManager] Bottom-left override: " + ex4.Message)); } try { GameObject val5 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/SingleScreen"); if ((Object)(object)val5 != (Object)null) { MeshRenderer component2 = val5.GetComponent(); if ((Object)(object)component2 != (Object)null && !AlreadyOverridden(component2)) { Texture item2 = (((Object)(object)((Renderer)component2).sharedMaterial != (Object)null) ? ((Renderer)component2).sharedMaterial.mainTexture : null); _overriddenRenderers.Add((component2, item2)); ApplyMonitorOverride(component2); Plugin.Log.LogInfo((object)"[TakeoverManager] SingleScreen overridden."); } } else { Plugin.Log.LogWarning((object)"[TakeoverManager] SingleScreen not found."); } } catch (Exception ex5) { Plugin.Log.LogWarning((object)("[TakeoverManager] SingleScreen override: " + ex5.Message)); } try { GameObject val6 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall"); if ((Object)(object)val6 != (Object)null && Plugin.CfgOverrideFifthMonitor.Value) { MeshRenderer[] componentsInChildren2 = val6.GetComponentsInChildren(true); foreach (MeshRenderer val7 in componentsInChildren2) { if (!((Object)(object)val7 == (Object)null) && !AlreadyOverridden(val7) && IsMonitorScreen(val7)) { try { Texture item3 = (((Object)(object)((Renderer)val7).sharedMaterial != (Object)null) ? ((Renderer)val7).sharedMaterial.mainTexture : null); _overriddenRenderers.Add((val7, item3)); ApplyMonitorOverride(val7); Plugin.Log.LogInfo((object)("[TakeoverManager] Fifth monitor override: " + GetHierarchyPath(((Component)val7).transform))); } catch { } } } } else if ((Object)(object)val6 != (Object)null) { Plugin.Log.LogInfo((object)"[TakeoverManager] Fifth-monitor pass skipped (CfgOverrideFifthMonitor=false)."); } } catch (Exception ex6) { Plugin.Log.LogWarning((object)("[TakeoverManager] MonitorWall/RT scan: " + ex6.Message)); } try { int num = 0; ManualCameraRenderer[] array = Object.FindObjectsOfType(); foreach (ManualCameraRenderer val8 in array) { if (!((Object)(object)val8 == (Object)null)) { if (AlreadyDisabled((Behaviour)(object)val8)) { ((Behaviour)val8).enabled = false; continue; } _disabledComponents.Add(((Behaviour)(object)val8, ((Behaviour)val8).enabled)); ((Behaviour)val8).enabled = false; num++; } } Plugin.Log.LogInfo((object)$"[TakeoverManager] Disabled {_disabledComponents.Count} ManualCameraRenderer components (+{num} this pass)."); } catch (Exception ex7) { Plugin.Log.LogWarning((object)("[TakeoverManager] MCR disable: " + ex7.Message)); } try { List list = new List(); foreach (var overriddenRenderer in _overriddenRenderers) { MeshRenderer item4 = overriddenRenderer.renderer; if ((Object)(object)item4 != (Object)null) { list.Add(((Object)((Component)item4).gameObject).name); } } Plugin.Log.LogInfo((object)("[TakeoverManager] Override summary: " + string.Join(", ", list))); } catch { } Plugin.Log.LogInfo((object)($"[TakeoverManager] Override complete. MeshRenderers: {_overriddenRenderers.Count}, " + $"Canvas overlays: {_topMonitorOverlayImages.Count}, " + "VideoReel RawImage: " + (((Object)(object)_videoReelRawImage != (Object)null) ? "found" : "missing"))); ((MonoBehaviour)this).StartCoroutine(VerifyOverridesAfterDelay()); } [IteratorStateMachine(typeof(d__61))] private IEnumerator DiagVideoStateLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__61(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__62))] private IEnumerator DiagRTReadbackAfterDelay(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__62(0) { <>4__this = this, delay = delay }; } [IteratorStateMachine(typeof(d__63))] private IEnumerator VerifyOverridesAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__63(0) { <>4__this = this }; } private void AddOverlayMatchingBG(Image bgImage) { //IL_0024: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) //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) //IL_007d: 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) if (!((Object)(object)bgImage == (Object)null) && !((Object)(object)_renderTexture == (Object)null)) { RectTransform rectTransform = ((Graphic)bgImage).rectTransform; GameObject val = new GameObject("Y4NGZ_MonitorOverlay"); val.transform.SetParent(((Transform)rectTransform).parent, false); RectTransform obj = val.AddComponent(); obj.anchorMin = rectTransform.anchorMin; obj.anchorMax = rectTransform.anchorMax; obj.pivot = rectTransform.pivot; obj.anchoredPosition = rectTransform.anchoredPosition; obj.sizeDelta = rectTransform.sizeDelta; ((Transform)obj).localScale = Vector3.one; RawImage val2 = val.AddComponent(); val2.texture = (Texture)(object)_renderTexture; ((Graphic)val2).color = Color.white; _topMonitorOverlayImages.Add(val2); } } private void ApplyMonitorOverride(MeshRenderer mr) { //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mr == (Object)null || (Object)(object)_renderTexture == (Object)null) { return; } Material[] materials; try { materials = ((Renderer)mr).materials; } catch { return; } if (materials == null || materials.Length == 0) { return; } try { Material[] sharedMaterials = ((Renderer)mr).sharedMaterials; Plugin.Log.LogInfo((object)$"[Diag/Slots] '{((Object)mr).name}' slotCount={materials.Length}"); for (int i = 0; i < materials.Length; i++) { string text = ((sharedMaterials != null && i < sharedMaterials.Length && (Object)(object)sharedMaterials[i] != (Object)null) ? ((Object)sharedMaterials[i]).name : ""); Material val = materials[i]; string text2 = (((Object)(object)val != (Object)null) ? ((Object)val).name : ""); string text3 = (((Object)(object)val != (Object)null && (Object)(object)val.shader != (Object)null) ? ((Object)val.shader).name : ""); Texture val2 = null; try { if (sharedMaterials != null && i < sharedMaterials.Length && (Object)(object)sharedMaterials[i] != (Object)null) { val2 = sharedMaterials[i].mainTexture; } } catch { } Texture val3 = null; try { if (sharedMaterials != null && i < sharedMaterials.Length && (Object)(object)sharedMaterials[i] != (Object)null && sharedMaterials[i].HasProperty("_BaseColorMap")) { val3 = sharedMaterials[i].GetTexture("_BaseColorMap"); } } catch { } string text4 = (((Object)(object)val2 != (Object)null) ? (((object)val2).GetType().Name + ":" + ((Object)val2).name) : ""); string text5 = (((Object)(object)val3 != (Object)null) ? (((object)val3).GetType().Name + ":" + ((Object)val3).name) : ""); Plugin.Log.LogInfo((object)$"[Diag/Slots] slot[{i}] sharedMat='{text}' instMat='{text2}' shader='{text3}' mainTex={text4} _BaseColorMap={text5}"); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Diag/Slots] dump failed for '" + ((Object)mr).name + "': " + ex.Message)); } if (!_savedHDRPState.ContainsKey(mr)) { (bool, Texture, Texture, Texture, Color, bool, bool)[] array = new(bool, Texture, Texture, Texture, Color, bool, bool)[materials.Length]; for (int j = 0; j < materials.Length; j++) { Material val4 = materials[j]; if (!((Object)(object)val4 == (Object)null)) { Texture item = null; try { item = val4.mainTexture; } catch { } Texture item2 = (val4.HasProperty("_BaseColorMap") ? val4.GetTexture("_BaseColorMap") : null); Texture item3 = (val4.HasProperty("_EmissiveColorMap") ? val4.GetTexture("_EmissiveColorMap") : null); Color item4 = (val4.HasProperty("_EmissiveColor") ? val4.GetColor("_EmissiveColor") : Color.black); bool item5 = val4.IsKeywordEnabled("_EMISSION"); bool item6 = val4.IsKeywordEnabled("_EMISSIVE_COLOR_MAP"); array[j] = (true, item, item2, item3, item4, item5, item6); } } _savedHDRPState[mr] = array; } for (int k = 0; k < materials.Length; k++) { Material val5 = materials[k]; if ((Object)(object)val5 == (Object)null) { continue; } if ((((Object)(object)val5.shader != (Object)null) ? ((Object)val5.shader).name : string.Empty).IndexOf("HDRP/Lit", StringComparison.Ordinal) >= 0) { if (_savedHDRPState.TryGetValue(mr, out (bool, Texture, Texture, Texture, Color, bool, bool)[] value) && value != null && k < value.Length) { (bool, Texture, Texture, Texture, Color, bool, bool) tuple = value[k]; tuple.Item1 = false; value[k] = tuple; } continue; } try { val5.mainTexture = (Texture)(object)_renderTexture; } catch { } if (val5.HasProperty("_BaseColorMap")) { val5.SetTexture("_BaseColorMap", (Texture)(object)_renderTexture); } if (val5.HasProperty("_EmissiveColorMap")) { val5.SetTexture("_EmissiveColorMap", (Texture)(object)_renderTexture); } if (val5.HasProperty("_EmissiveColor")) { val5.SetColor("_EmissiveColor", Color.white * 1.5f); } val5.EnableKeyword("_EMISSION"); val5.EnableKeyword("_EMISSIVE_COLOR_MAP"); } } private bool AlreadyOverridden(MeshRenderer r) { foreach (var overriddenRenderer in _overriddenRenderers) { if ((Object)(object)overriddenRenderer.renderer == (Object)(object)r) { return true; } } return false; } private bool AlreadyDisabled(Behaviour b) { foreach (var disabledComponent in _disabledComponents) { if ((Object)(object)disabledComponent.component == (Object)(object)b) { return true; } } return false; } private static bool IsMonitorScreen(MeshRenderer r) { if ((Object)(object)r == (Object)null) { return false; } string name = ((Object)((Component)r).gameObject).name; if (name.Contains("BodyCam") || name.Contains("Button") || name.Contains("Overlay")) { return false; } Material sharedMaterial = ((Renderer)r).sharedMaterial; if ((Object)(object)sharedMaterial == (Object)null) { return false; } return ((Object)sharedMaterial).name.StartsWith("TerminalTex", StringComparison.Ordinal); } private static void DumpHierarchy(Transform t, int depth) { if (!((Object)(object)t == (Object)null) && depth <= 6) { string text = new string(' ', depth * 2); MeshRenderer component = ((Component)t).GetComponent(); string text2 = ""; string text3 = ""; if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).sharedMaterial != (Object)null && (Object)(object)((Renderer)component).sharedMaterial.mainTexture != (Object)null) { text2 = ((Object)((Renderer)component).sharedMaterial.mainTexture).name; text3 = " " + ((object)((Renderer)component).sharedMaterial.mainTexture).GetType().Name; } Plugin.Log.LogInfo((object)("[TakeoverManager] " + text + ((Object)t).name + " (MR=" + (((Object)(object)component != (Object)null) ? "Y" : "N") + " tex=" + text2 + text3 + ")")); for (int i = 0; i < t.childCount; i++) { DumpHierarchy(t.GetChild(i), depth + 1); } } } private static string GetHierarchyPath(Transform t) { if ((Object)(object)t == (Object)null) { return ""; } List list = new List(); while ((Object)(object)t != (Object)null) { list.Add(((Object)t).name); t = t.parent; } list.Reverse(); return string.Join("/", list); } [IteratorStateMachine(typeof(d__71))] private IEnumerator BlitMapScreenLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__71(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__72))] private IEnumerator PlayMumbleSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__72(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__73))] private IEnumerator ShowDialogue(string passage) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__73(0) { <>4__this = this, passage = passage }; } private static AudioClip CreateTypewriterTick() { int num = 44100; int num2 = (int)((float)num * 0.02f); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = Mathf.Exp((0f - (float)i / (float)num2) * 35f); float num4 = Mathf.Sin((float)i * 2f * MathF.PI * 1200f / (float)num); float num5 = Random.value * 2f - 1f; array[i] = (num4 * 0.7f + num5 * 0.3f) * num3 * 0.95f; } AudioClip obj = AudioClip.Create("Y4NGZ_Tick", num2, 1, num, false); obj.SetData(array, 0); return obj; } [IteratorStateMachine(typeof(d__75))] private IEnumerator CRTTransition() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__75(0) { <>4__this = this }; } private void SetAllMonitorTexture(Texture tex) { foreach (RawImage topMonitorOverlayImage in _topMonitorOverlayImages) { if ((Object)(object)topMonitorOverlayImage != (Object)null) { topMonitorOverlayImage.texture = tex; } } if ((Object)(object)_videoReelRawImage != (Object)null) { _videoReelRawImage.texture = tex; } foreach (var overriddenRenderer in _overriddenRenderers) { MeshRenderer item = overriddenRenderer.renderer; try { if ((Object)(object)item == (Object)null) { continue; } Material[] materials = ((Renderer)item).materials; if (materials == null) { continue; } foreach (Material val in materials) { if (!((Object)(object)val == (Object)null)) { try { val.mainTexture = tex; } catch { } if (val.HasProperty("_BaseColorMap")) { val.SetTexture("_BaseColorMap", tex); } if (val.HasProperty("_EmissiveColorMap")) { val.SetTexture("_EmissiveColorMap", tex); } } } } catch { } } } private void PlayStaticBurst() { //IL_0094: 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_00c5: Expected O, but got Unknown int num = 44100; int num2 = (int)((float)num * 0.35f); float[] array = new float[num2]; for (int i = 0; i < num2; i++) { float num3 = 1f; if ((float)i > (float)num2 * 0.75f) { num3 = 1f - ((float)i - (float)num2 * 0.75f) / ((float)num2 * 0.25f); } array[i] = (Random.value * 2f - 1f) * 0.45f * num3; } AudioClip val = AudioClip.Create("Y4NGZ_Static", num2, 1, num, false); val.SetData(array, 0); GameObject val2 = new GameObject("Y4NGZ_StaticBurst"); AudioSource obj = val2.AddComponent(); obj.spatialBlend = 0f; obj.volume = 0.5f; obj.PlayOneShot(val); Object.Destroy((Object)val2, 1.5f); } private static Texture2D CreateSolidTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, color); val.Apply(); return val; } private static Texture2D CreateNoiseTexture(int width, int height) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)0; Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { float value = Random.value; array[i] = new Color(value, value, value, 1f); } val.SetPixels(array); val.Apply(); return val; } [IteratorStateMachine(typeof(d__80))] private IEnumerator RestoreCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__80(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__81))] private IEnumerator RestoreLights() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__81(0) { <>4__this = this }; } private void RestoreAll(bool immediate) { //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; RestoreHUD(); if ((Object)(object)instance != (Object)null) { try { SetEnabled((Behaviour)(object)instance.profitQuotaMonitorText, _profitTextWasEnabled); SetEnabled((Behaviour)(object)instance.profitQuotaMonitorBGImage, _profitBGWasEnabled); SetEnabled((Behaviour)(object)instance.deadlineMonitorText, _deadlineTextWasEnabled); SetEnabled((Behaviour)(object)instance.deadlineMonitorBGImage, _deadlineBGWasEnabled); } catch { } } if ((Object)(object)instance != (Object)null) { try { VideoPlayer screenLevelVideoReel = instance.screenLevelVideoReel; if ((Object)(object)screenLevelVideoReel != (Object)null) { screenLevelVideoReel.Stop(); screenLevelVideoReel.clip = _savedVideoClip; screenLevelVideoReel.isLooping = _savedVideoLooping; if (_savedVideoPlaying && (Object)(object)_savedVideoClip != (Object)null) { screenLevelVideoReel.Play(); } } SetEnabled((Behaviour)(object)instance.screenLevelDescription, _levelDescWasEnabled); } catch { } } if ((Object)(object)_videoReelRawImage != (Object)null) { try { _videoReelRawImage.texture = _savedVideoReelTexture; } catch { } _videoReelRawImage = null; _savedVideoReelTexture = null; } foreach (RawImage topMonitorOverlayImage in _topMonitorOverlayImages) { if ((Object)(object)topMonitorOverlayImage != (Object)null) { Object.Destroy((Object)(object)((Component)topMonitorOverlayImage).gameObject); } } _topMonitorOverlayImages.Clear(); foreach (var (val, enabled) in _disabledComponents) { try { if ((Object)(object)val != (Object)null) { val.enabled = enabled; } } catch { } } _disabledComponents.Clear(); foreach (var (val2, mainTexture) in _overriddenRenderers) { try { if ((Object)(object)val2 == (Object)null) { continue; } Material[] materials = ((Renderer)val2).materials; if ((Object)(object)((Renderer)val2).sharedMaterial != (Object)null) { ((Renderer)val2).sharedMaterial.mainTexture = mainTexture; } _savedHDRPState.TryGetValue(val2, out (bool, Texture, Texture, Texture, Color, bool, bool)[] value); for (int i = 0; i < materials.Length; i++) { Material val3 = materials[i]; if ((Object)(object)val3 == (Object)null || value == null || i >= value.Length) { continue; } (bool, Texture, Texture, Texture, Color, bool, bool) tuple3 = value[i]; if (tuple3.Item1) { try { val3.mainTexture = tuple3.Item2; } catch { } if (val3.HasProperty("_BaseColorMap")) { val3.SetTexture("_BaseColorMap", tuple3.Item3); } if (val3.HasProperty("_EmissiveColorMap")) { val3.SetTexture("_EmissiveColorMap", tuple3.Item4); } if (val3.HasProperty("_EmissiveColor")) { val3.SetColor("_EmissiveColor", tuple3.Item5); } if (tuple3.Item6) { val3.EnableKeyword("_EMISSION"); } else { val3.DisableKeyword("_EMISSION"); } if (tuple3.Item7) { val3.EnableKeyword("_EMISSIVE_COLOR_MAP"); } else { val3.DisableKeyword("_EMISSIVE_COLOR_MAP"); } } } ((Renderer)val2).SetPropertyBlock((MaterialPropertyBlock)null); } catch { } } _overriddenRenderers.Clear(); _savedHDRPState.Clear(); if (immediate) { foreach (var (val4, intensity, color) in _savedLights) { try { if ((Object)(object)val4 != (Object)null) { val4.intensity = intensity; val4.color = color; } } catch { } } _savedLights.Clear(); } if (_speakerVolumeSaved && (Object)(object)instance?.speakerAudioSource != (Object)null) { instance.speakerAudioSource.volume = _savedSpeakerVolume; _speakerVolumeSaved = false; } if (_flashCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_flashCoroutine); _flashCoroutine = null; } if (_mapBlitCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_mapBlitCoroutine); _mapBlitCoroutine = null; } _mapScreenRT = null; if ((Object)(object)_videoPlayer != (Object)null) { Object.Destroy((Object)(object)_videoPlayer); _videoPlayer = null; } if ((Object)(object)_alarmSource != (Object)null) { Object.Destroy((Object)(object)((Component)_alarmSource).gameObject); _alarmSource = null; } if ((Object)(object)_droneSource != (Object)null) { Object.Destroy((Object)(object)((Component)_droneSource).gameObject); _droneSource = null; } if ((Object)(object)_mumbleSource != (Object)null) { Object.Destroy((Object)(object)((Component)_mumbleSource).gameObject); _mumbleSource = null; } if ((Object)(object)_dialogueCanvasGO != (Object)null) { Object.Destroy((Object)(object)_dialogueCanvasGO); _dialogueCanvasGO = null; } if ((Object)(object)_renderTexture != (Object)null) { _renderTexture.Release(); Object.Destroy((Object)(object)_renderTexture); _renderTexture = null; } _savedVideoClip = null; OpenBodyCamsCompat.Restore(); } private static bool SetEnabled(Behaviour component, bool enabled) { if ((Object)(object)component == (Object)null) { return false; } bool enabled2 = component.enabled; component.enabled = enabled; return enabled2; } private static void AssignVanillaFont(TextMeshProUGUI tmp) { try { HUDManager instance = HUDManager.Instance; object obj; if (instance == null) { obj = null; } else { TextMeshProUGUI clockNumber = instance.clockNumber; obj = ((clockNumber != null) ? ((TMP_Text)clockNumber).font : null); } if ((Object)obj != (Object)null) { ((TMP_Text)tmp).font = ((TMP_Text)HUDManager.Instance.clockNumber).font; return; } } catch { } try { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); foreach (TMP_FontAsset val in array) { if (((Object)val).name.Contains("3270") || ((Object)val).name.Contains("edunline") || ((Object)val).name.Contains("EdgeOf") || ((Object)val).name.Contains("Consolas")) { ((TMP_Text)tmp).font = val; break; } } } catch { } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LGUMonitorTakeover"; public const string PLUGIN_NAME = "LGUMonitorTakeover"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }