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 AudioMod.AudioSequence;
using AudioMod.Handlers;
using AudioMod.Unity;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TerminalPoolSystem;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Networking;
using Util;
using Utils.Logging;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("AudioMod_BepInEx5_Thunderstore")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+28e64f9ace313cf7f597c4bb8d3099b067058625")]
[assembly: AssemblyProduct("AudioMod_BepInEx5_Thunderstore")]
[assembly: AssemblyTitle("AudioMod_BepInEx5_Thunderstore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace Utils.Logging
{
internal class PluginLogger
{
private readonly ManualLogSource _logger;
internal void LogInfo(string text)
{
_logger.LogInfo((object)text);
}
internal void LogError(string text)
{
_logger.LogError((object)text);
}
internal void LogDebug(string text)
{
_logger.LogDebug((object)text);
}
public PluginLogger(ManualLogSource logger)
{
_logger = logger;
}
}
}
namespace AudioMod
{
[BepInPlugin("nl.pvanhalm.plugins.greyhack.audio-mod", "Audio Mod", "0.2.1")]
public class Plugin : BaseUnityPlugin
{
private bool _initialized;
internal static PluginLogger Logger;
internal static PluginInfo Info;
private void OnEnable()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (!_initialized)
{
_initialized = true;
Logger = new PluginLogger(((BaseUnityPlugin)this).Logger);
Info = ((BaseUnityPlugin)this).Info;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
new GameObject("AudioManager").AddComponent<AudioManager>();
AudioLib.Load();
}
}
}
public class AudioLib
{
private const string SFX_AUDIO_GROUP_NAME = "SFX";
private static string AudioDirectory = Path.Combine(Path.GetDirectoryName(Plugin.Info.Location), "Audio");
public static AudioClip BootupBeep;
public static AudioClip HardDiskSpinUp;
public static AudioClip HardDiskLoop;
public static AudioClip HardDiskSpinDown;
public static AudioClip OSBoot;
public static AudioClip OSNotification;
public static AudioClip OSActionFail;
public static AudioClip OSError;
public static AudioClip CPUFanLoop;
public static AudioClip TraceBeep;
public static AudioClip SystemFailureLoop;
public static AudioMixer Mixer;
public static AudioMixerGroup? SfxAudioGroup
{
get
{
if (!Object.op_Implicit((Object)(object)Mixer))
{
return null;
}
return Mixer.FindMatchingGroups("SFX").FirstOrDefault();
}
}
public static void Load()
{
if (Object.op_Implicit((Object)(object)SingletonMonoBehaviour<AudioManager>.Instance))
{
AudioManager instance = SingletonMonoBehaviour<AudioManager>.Instance;
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "bootup-beep.wav"), delegate(AudioClip clip)
{
BootupBeep = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "harddrive-spinup.wav"), delegate(AudioClip clip)
{
HardDiskSpinUp = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "harddrive-loop.wav"), delegate(AudioClip clip)
{
HardDiskLoop = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "harddrive-spindown.wav"), delegate(AudioClip clip)
{
HardDiskSpinDown = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "os-boot.wav"), delegate(AudioClip clip)
{
OSBoot = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "os-notification.wav"), delegate(AudioClip clip)
{
OSNotification = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "os-action-fail.wav"), delegate(AudioClip clip)
{
OSActionFail = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "os-error.wav"), delegate(AudioClip clip)
{
OSError = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "cpu-fan-loop.wav"), delegate(AudioClip clip)
{
CPUFanLoop = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "trace-beep.wav"), delegate(AudioClip clip)
{
TraceBeep = clip;
}));
((MonoBehaviour)instance).StartCoroutine(instance.LoadAudioClipFromFile(Path.Combine(AudioDirectory, "system-failure-loop.wav"), delegate(AudioClip clip)
{
SystemFailureLoop = clip;
}));
}
}
}
public class PluginConstants
{
public const string GUID = "nl.pvanhalm.plugins.greyhack.audio-mod";
public const string NAME = "Audio Mod";
public const string VERSION = "0.2.1";
}
}
namespace AudioMod.Unity
{
public class AudioManager : SingletonMonoBehaviour<AudioManager>
{
[CompilerGenerated]
private sealed class <LoadAudioClipFromFile>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string path;
public Action<AudioClip> callback;
private UnityWebRequest <www>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAudioClipFromFile>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<www>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Invalid comparison between Unknown and I4
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
bool result;
try
{
switch (<>1__state)
{
default:
result = false;
break;
case 0:
{
<>1__state = -1;
UriBuilder uriBuilder = new UriBuilder(path)
{
Scheme = Uri.UriSchemeFile
};
<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(uriBuilder.ToString(), AudioTypeFromExtension(Path.GetExtension(path)));
<>1__state = -3;
<>2__current = <www>5__2.SendWebRequest();
<>1__state = 1;
result = true;
break;
}
case 1:
<>1__state = -3;
if ((int)<www>5__2.result != 1)
{
Plugin.Logger.LogError($"Could not load AudioClip from: {path}\nError: {<www>5__2.error}\nStatus: {<www>5__2.result}");
result = false;
}
else
{
callback(DownloadHandlerAudioClip.GetContent(<www>5__2));
Plugin.Logger.LogInfo("Successfully loaded AudioClip from: " + path);
result = false;
}
<>m__Finally1();
break;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
return result;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<www>5__2 != null)
{
((IDisposable)<www>5__2).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
protected override bool DontDestroyInstanceOnLoad => true;
private static AudioType AudioTypeFromExtension(string extension)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
string text = extension.ToLower();
switch (text)
{
case ".mp3":
return (AudioType)13;
case ".mp4":
return (AudioType)13;
case ".ogg":
return (AudioType)14;
case ".wav":
return (AudioType)20;
default:
{
global::<PrivateImplementationDetails>.ThrowSwitchExpressionException(text);
AudioType result = default(AudioType);
return result;
}
}
}
[IteratorStateMachine(typeof(<LoadAudioClipFromFile>d__3))]
public IEnumerator LoadAudioClipFromFile(string path, Action<AudioClip> callback)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAudioClipFromFile>d__3(0)
{
path = path,
callback = callback
};
}
public AudioSource CreateSource()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
val.transform.SetParent(((Component)this).transform);
val.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
return val.AddComponent<AudioSource>();
}
}
[DefaultExecutionOrder(-1)]
public abstract class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour, new()
{
public static T Instance { get; private set; }
protected abstract bool DontDestroyInstanceOnLoad { get; }
protected virtual void Awake()
{
T val = (T)(object)((this is T) ? this : null);
if (Object.op_Implicit((Object)(object)Instance) && (Object)(object)Instance != (Object)(object)val)
{
Object.Destroy((Object)(object)this);
return;
}
Instance = val;
if (DontDestroyInstanceOnLoad)
{
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
}
}
}
namespace AudioMod.Patches
{
[HarmonyPatch(typeof(AdminMonitor), "CancelCuentaAtras")]
public class AdminMonitor_CancelCuentaAtras
{
private static void Postfix(string ipRemotePc, string remoteComputerID)
{
AdminMonitorHandler.CancelTrace(remoteComputerID);
}
}
[HarmonyPatch(typeof(AdminMonitor), "CuentaAtras")]
public class AdminMonitor_CuentaAtras
{
private static bool Prefix(InfoMonitor infoMonitor, ref IEnumerator __result, AdminMonitor __instance)
{
__result = AdminMonitorHandler.CustomCoroutine(__instance, infoMonitor);
return false;
}
}
[HarmonyPatch(typeof(BiosMenu), "ConfigGameAudio")]
public static class BiosMenu_ConfigGameAudio
{
private static void Postfix(BiosMenu __instance)
{
AudioLib.Mixer = __instance.gameMixer;
}
}
[HarmonyPatch(typeof(BootUp), "AnimScreen")]
public class BootUp_AnimScreen
{
[CompilerGenerated]
private sealed class <Wrap>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public IEnumerator inner;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Wrap>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (Bootup.Booted)
{
<>2__current = (object)new WaitUntil((Func<bool>)(() => !AudioSequence<Fan>.Instance.IsRunning && !AudioSequence<HardDisk>.Instance.IsRunning));
<>1__state = 1;
return true;
}
goto IL_0069;
case 1:
<>1__state = -1;
Bootup.Booted = false;
goto IL_0069;
case 2:
{
<>1__state = -1;
break;
}
IL_0069:
AudioSequence<Bootup>.Instance.Start();
break;
}
if (inner.MoveNext())
{
<>2__current = inner.Current;
<>1__state = 2;
return true;
}
Bootup.Booted = 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();
}
}
private static void Postfix(ref IEnumerator __result)
{
__result = Wrap(__result);
}
[IteratorStateMachine(typeof(<Wrap>d__1))]
private static IEnumerator Wrap(IEnumerator inner)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Wrap>d__1(0)
{
inner = inner
};
}
}
[HarmonyPatch(typeof(BootUp), "InterruptBoot")]
public class BootUp_InterruptBoot
{
private static void Prefix()
{
AudioSequence<Fan>.Instance.Stop();
AudioSequence<HardDisk>.Instance.Stop();
}
}
[HarmonyPatch(typeof(BootUp), "MemoryTesting")]
public class BootUp_MemoryTesting
{
[CompilerGenerated]
private sealed class <Wrap>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public BootUp instance;
private int <maxNum>5__2;
private int <incremento>5__3;
private int <indiceTest>5__4;
private int <i>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Wrap>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
TMP_Text textoScreen;
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<maxNum>5__2 = ((((Computer)instance.pc).GetHardware() != null) ? (((Computer)instance.pc).GetHardware().GetTotalMemoryRam() * 1024) : 131072);
<incremento>5__3 = (int)((float)<maxNum>5__2 * (1f / 64f));
<indiceTest>5__4 = instance.textoScreen.text.IndexOf("Testing: ", StringComparison.Ordinal) + "Testing: ".Length;
<i>5__5 = 0;
goto IL_0112;
case 1:
<>1__state = -1;
goto IL_0112;
case 2:
{
<>1__state = -1;
return false;
}
IL_0112:
if (<i>5__5 <= <maxNum>5__2)
{
string text = <i>5__5.ToString();
instance.textoScreen.text = instance.textoScreen.text.Substring(0, <indiceTest>5__4) + text + "K";
<i>5__5 += <incremento>5__3;
<>2__current = null;
<>1__state = 1;
return true;
}
textoScreen = instance.textoScreen;
textoScreen.text += " OK";
AudioSequence<Bootup>.Instance.MotherboardPostBeep();
<>2__current = (object)new WaitForSeconds(0.65f);
<>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 static bool Prefix(ref IEnumerator __result, BootUp __instance)
{
__result = Wrap(__instance);
return false;
}
[IteratorStateMachine(typeof(<Wrap>d__1))]
private static IEnumerator Wrap(BootUp instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Wrap>d__1(0)
{
instance = instance
};
}
}
[HarmonyPatch(typeof(ChatGuild), "RecibeMensaje", new Type[] { typeof(ChatMessage) })]
public class ChatGuild_RecibeMensaje
{
private static void Postfix()
{
AudioSequenceLayered<Notification>.Instance.Start();
}
}
[HarmonyPatch(typeof(Downloads), "DownloadProgress")]
public class Download_DownloadProgress
{
[CompilerGenerated]
private sealed class <Wrap>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public IEnumerator inner;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Wrap>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
AudioSequence<HardDisk>.Instance.TransferWindowOpened();
break;
case 1:
<>1__state = -1;
break;
}
if (inner.MoveNext())
{
<>2__current = inner.Current;
<>1__state = 1;
return true;
}
AudioSequence<HardDisk>.Instance.TransferWindowClosed();
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();
}
}
private static void Postfix(ref IEnumerator __result)
{
__result = Wrap(__result);
}
[IteratorStateMachine(typeof(<Wrap>d__1))]
private static IEnumerator Wrap(IEnumerator inner)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Wrap>d__1(0)
{
inner = inner
};
}
}
[HarmonyPatch(typeof(InstallOS), "FinishInstall")]
public class InstallOS_FinishInstall
{
private static void Postfix()
{
AudioSequence<HardDisk>.Instance.TransferWindowClosed();
}
}
[HarmonyPatch(typeof(InstallOS), "ShowAnimInstall", new Type[]
{
typeof(string),
typeof(string),
typeof(string)
})]
public class InstallOS_ShowAnimInstall
{
private static void Postfix()
{
AudioSequence<HardDisk>.Instance.TransferWindowOpened();
}
}
[HarmonyPatch(typeof(KernelPanic), "Iniciar")]
public class KernelPanic_Iniciar
{
private static void Postfix()
{
AudioSequence<SystemFailure>.Instance.Start();
}
}
[HarmonyPatch(typeof(OS), "ShowError")]
public static class OS_ShowError
{
private static void Postfix(string msg)
{
AudioSequenceLayered<OSError>.Instance.Start();
}
}
[HarmonyPatch(typeof(PlayerClientMethods), "PlayerRecibeMail", new Type[]
{
typeof(string),
typeof(string),
typeof(byte[])
})]
public class PlayerClientMethods_PlayerRecibeMail
{
private static void Postfix()
{
AudioSequenceLayered<Notification>.Instance.Start();
}
}
[HarmonyPatch(typeof(RamWidget), "Update")]
public class RamWidget_Awake
{
private static bool Initialized;
private static void Prefix()
{
try
{
if (Object.op_Implicit((Object)(object)PlayerClient.Singleton) && PlayerClient.Singleton.player != null && PlayerClient.Singleton.player.pc != null && ((Computer)PlayerClient.Singleton.player.pc).procesos != null && !Initialized)
{
Initialized = true;
float num = ((Computer)PlayerClient.Singleton.player.pc).procesos.Sum((Proceso process) => process.ramUsedMb);
int totalMemoryRam = ((Computer)PlayerClient.Singleton.player.pc).GetHardware().GetTotalMemoryRam();
float memoryUsage = num * 100f / (float)totalMemoryRam * 0.01f;
AudioSequence<Fan>.Instance.setMemoryUsage(memoryUsage);
}
}
catch
{
Initialized = false;
}
}
}
[HarmonyPatch(typeof(RamWidget), "UpdateProcesos", new Type[] { typeof(List<Proceso>) })]
public class RamWidget_UpdateProcesos
{
private static void Prefix(List<Proceso> origProcesos)
{
float num = origProcesos.Sum((Proceso process) => process.ramUsedMb);
int totalMemoryRam = ((Computer)PlayerClient.Singleton.player.pc).GetHardware().GetTotalMemoryRam();
float memoryUsage = num * 100f / (float)totalMemoryRam * 0.01f;
AudioSequence<Fan>.Instance.setMemoryUsage(memoryUsage);
}
}
[HarmonyPatch(typeof(SfxPlayer), "PlayClip")]
public static class SfxPlayer_PlayClip
{
private static bool Prefix(SfxID index, float volume = 1f)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
if ((int)index <= 2)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(TerminalListAdapter), "BackSpace")]
public static class TerminalListAdapter_Backspace
{
private static bool Prefix(TerminalListAdapter __instance)
{
return TerminalInputHandler.Backspace(__instance);
}
}
[HarmonyPatch(typeof(TerminalListAdapter), "Delete")]
public static class TerminalListAdapter_Delete
{
private static bool Prefix(TerminalListAdapter __instance)
{
return TerminalInputHandler.Delete(__instance);
}
}
[HarmonyPatch(typeof(Terminal), "ClosingPrograms")]
public class Terminal_ClosingPrograms
{
[CompilerGenerated]
private sealed class <Wrap>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Terminal instance;
public bool exitGame;
private Ventana[] <programas>5__2;
private int <i>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Wrap>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<programas>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Expected O, but got Unknown
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<programas>5__2 = ((Component)((Component)instance).transform.root).GetComponentsInChildren<Ventana>();
<i>5__3 = 0;
goto IL_010c;
case 1:
<>1__state = -1;
goto IL_00fc;
case 2:
<>1__state = -1;
((Ventana)instance).CloseTaskBar();
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 3;
return true;
case 3:
{
<>1__state = -1;
AudioSequence<SystemFailure>.Instance.Stop();
AudioSequence<Fan>.Instance.Stop();
AudioSequence<HardDisk>.Instance.Stop();
if (!exitGame)
{
return false;
}
BootUp componentInChildren = ((Component)((Component)instance).transform.root).GetComponentInChildren<BootUp>(true);
((Component)componentInChildren).gameObject.SetActive(true);
Cursor.visible = false;
((Behaviour)componentInChildren.fondoNegro).enabled = true;
componentInChildren.textoScreen.text = "";
componentInChildren.ActivarImagenes(false);
((Component)componentInChildren).transform.SetAsLastSibling();
GameObject obj = GameObject.Find("TaskBar");
Canvas val = ((obj != null) ? obj.GetComponent<Canvas>() : null);
if ((Object)(object)val != (Object)null)
{
val.sortingOrder = 0;
}
<>2__current = (object)new WaitUntil((Func<bool>)(() => !AudioSequence<Fan>.Instance.IsRunning && !AudioSequence<HardDisk>.Instance.IsRunning && !AudioSequence<SystemFailure>.Instance.IsRunning));
<>1__state = 4;
return true;
}
case 4:
{
<>1__state = -1;
Application.Quit();
return false;
}
IL_00fc:
<i>5__3++;
goto IL_010c;
IL_010c:
if (<i>5__3 < <programas>5__2.Length)
{
if ((Object)(object)<programas>5__2[<i>5__3] != (Object)(object)instance)
{
Ventana obj2 = <programas>5__2[<i>5__3];
if ((Object)(object)((obj2 is Welcome) ? obj2 : null) != (Object)null || (Object)/*isinst with value type is only supported in some contexts*/ != (Object)null)
{
<programas>5__2[<i>5__3].CloseTaskBar(true);
}
else
{
<programas>5__2[<i>5__3].LinkTutorial((AdvancedTutorial)null);
<programas>5__2[<i>5__3].CloseTaskBar();
}
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 1;
return true;
}
goto IL_00fc;
}
<>2__current = (object)new WaitForSeconds(0.05f);
<>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 static void Postfix(bool exitGame, ref IEnumerator __result, Terminal __instance)
{
__result = Wrap(__instance, exitGame);
}
[IteratorStateMachine(typeof(<Wrap>d__1))]
private static IEnumerator Wrap(Terminal instance, bool exitGame)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Wrap>d__1(0)
{
instance = instance,
exitGame = exitGame
};
}
}
[HarmonyPatch(typeof(Terminal), "ResumeAutoCompletar")]
public static class Terminal_ResumeAutoCompletar
{
private static bool Prefix(byte[]? zipOutput, bool listFiles)
{
return TerminalInputHandler.AutoComplete(zipOutput, listFiles);
}
}
[HarmonyPatch(typeof(Ventana), "OnEndDownload")]
public static class Ventana_OnEndDownload
{
private static void Prefix(HardDisk hardDisk, Ventana __instance)
{
PlayerComputer pc = PlayerClient.Singleton.player.pc;
if (!(__instance.GetRemoteNetID() != ((Computer)pc).GetID()))
{
((Computer)pc).GetHardware().hardDisk = hardDisk;
if (!(hardDisk.performance >= 100f))
{
AudioSequenceLayered<OSError>.Instance.Start();
}
}
}
}
[HarmonyPatch(typeof(Ventana), "ShowHardwareWarning")]
public static class Ventana_ShowHardwareWarning
{
private static void Prefix(Hardware hardware, PlayerComputer localPC)
{
if (!(hardware.powerSupply.GetAvailablePower(hardware) >= 1f) || !(hardware.GetLowestHealthCpus() >= 45f) || !(hardware.GetLowestHealthRam() >= 45f) || !(((ItemHardware)hardware.motherBoard).health >= 45f))
{
AudioSequenceLayered<OSError>.Instance.Start();
}
}
}
}
namespace AudioMod.Handlers
{
public static class AdminMonitorHandler
{
[CompilerGenerated]
private sealed class <CustomCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public InfoMonitor infoMonitor;
public AdminMonitor __instance;
private float? <updateDisplayTick>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CustomCoroutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
OnStartTrace(infoMonitor);
__instance.panelClock.SetActive(true);
__instance.StartBlinking();
<updateDisplayTick>5__2 = null;
break;
case 1:
{
<>1__state = -1;
<updateDisplayTick>5__2 += Time.deltaTime;
InfoMonitor obj = infoMonitor;
obj.tiempoRestante -= Time.deltaTime;
if (Tracking == infoMonitor)
{
AudioSequence<TraceBeep>.Instance.Detection = 1f - infoMonitor.tiempoRestante / 15f;
}
break;
}
}
if (infoMonitor.tiempoRestante > 0f)
{
int num = ((infoMonitor.tiempoRestante <= 10f || __instance.activeTraces.Count <= 1) ? 1 : 10);
if (!<updateDisplayTick>5__2.HasValue || <updateDisplayTick>5__2 >= (float)num)
{
<updateDisplayTick>5__2 = 0f;
if (__instance.activeTraces.Count <= 1)
{
TimeSpan timeSpan = TimeSpan.FromSeconds((int)infoMonitor.tiempoRestante);
__instance.clockLabel.text = ((timeSpan.TotalHours >= 1.0) ? $"{(int)timeSpan.TotalHours:D2}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}" : $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}");
}
else
{
string text = "";
for (int i = 0; i < __instance.activeTraces.Count; i++)
{
text += "! ";
}
__instance.clockLabel.text = text;
__instance.AddTexto($"<color=\"red\">[!] {StringExtensions.CensorAddress(infoMonitor.remoteComputerIp)} : Active trace {infoMonitor.tiempoRestante:N0} seconds left.</color>\n");
}
}
<>2__current = null;
<>1__state = 1;
return true;
}
__instance.AddTexto("<color=\"red\">[!] " + StringExtensions.CensorAddress(infoMonitor.remoteComputerIp) + " : Active Trace completed.</color>\n");
__instance.activeTraces.Remove(infoMonitor.remoteComputerID);
CancelTrace(infoMonitor.remoteComputerID);
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();
}
}
private static InfoMonitor? Tracking = null;
private static List<InfoMonitor> AllTraces = new List<InfoMonitor>();
private const float InitialTraceTime = 15f;
private static void OnStartTrace(InfoMonitor infoMonitor)
{
if (!AllTraces.Contains(infoMonitor))
{
AllTraces.Add(infoMonitor);
}
if (Tracking == null || !(infoMonitor.tiempoRestante >= Tracking.tiempoRestante))
{
Tracking = infoMonitor;
if (!AudioSequence<TraceBeep>.Instance.IsRunning)
{
AudioSequence<TraceBeep>.Instance.Detection = 0f;
AudioSequence<TraceBeep>.Instance.Start();
}
}
}
[IteratorStateMachine(typeof(<CustomCoroutine>d__4))]
public static IEnumerator CustomCoroutine(AdminMonitor __instance, InfoMonitor infoMonitor)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CustomCoroutine>d__4(0)
{
__instance = __instance,
infoMonitor = infoMonitor
};
}
public static void CancelTrace(string remoteComputerID)
{
string remoteComputerID2 = remoteComputerID;
int num = AllTraces.FindIndex((InfoMonitor trace) => trace.remoteComputerID == remoteComputerID2);
if (num >= 0)
{
AllTraces.RemoveAt(num);
}
if (Tracking?.remoteComputerID == remoteComputerID2)
{
Tracking = null;
}
if (AllTraces.Count == 0)
{
if (AudioSequence<TraceBeep>.Instance.IsRunning)
{
AudioSequence<TraceBeep>.Instance.Stop();
}
return;
}
Tracking = AllTraces[0];
for (int i = 1; i < AllTraces.Count; i++)
{
if (!(AllTraces[i].tiempoRestante >= Tracking.tiempoRestante))
{
Tracking = AllTraces[i];
}
}
}
}
public static class TerminalInputHandler
{
public static bool Backspace(TerminalListAdapter instance)
{
if (instance.GetLastViewLine() == null)
{
return true;
}
if (instance.charIndexInput > instance.minPosCursor)
{
return true;
}
AudioSequenceLayered<ActionError>.Instance.Start();
return false;
}
public static bool Delete(TerminalListAdapter instance)
{
if (instance.GetLastViewLine() == null)
{
return true;
}
int lastLineIndex = instance.GetLastLineIndex();
if (instance.charIndexInput < instance.Data[lastLineIndex].line.Length - 1)
{
return true;
}
AudioSequenceLayered<ActionError>.Instance.Start();
return false;
}
public static bool AutoComplete(byte[]? zipOutput, bool listFiles)
{
if (zipOutput == null || zipOutput.Length == 0)
{
AudioSequenceLayered<ActionError>.Instance.Start();
return true;
}
if (!listFiles)
{
return true;
}
AudioSequenceLayered<ActionError>.Instance.Start();
return true;
}
}
}
namespace AudioMod.AudioSequence
{
public class ActionError : AudioSequenceLayered<ActionError>
{
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
public AudioSource source;
internal bool <Loop>b__0()
{
return !source.isPlaying;
}
}
[CompilerGenerated]
private sealed class <Loop>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AudioSource source;
public ActionError <>4__this;
private <>c__DisplayClass3_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
int num = <>1__state;
ActionError actionError = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass3_0();
<>8__1.source = source;
<>8__1.source.Play();
<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.source.isPlaying));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = ((AudioSequenceLayered<ActionError>)actionError).Loop(<>8__1.source);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
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();
}
}
protected override AudioClip _clip => AudioLib.OSActionFail;
public override void Start()
{
Init();
AudioSource source = GetSource();
source.volume = 0.3f;
Start(source);
}
[IteratorStateMachine(typeof(<Loop>d__3))]
protected override IEnumerator Loop(AudioSource source)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__3(0)
{
<>4__this = this,
source = source
};
}
}
public abstract class AudioSequence<T> where T : AudioSequence<T>, new()
{
[CompilerGenerated]
private sealed class <Loop>d__15 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AudioSequence<T> <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__15(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AudioSequence<T> audioSequence = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
Plugin.Logger.LogDebug("Cleanup Loop => " + audioSequence.GetType().Name);
foreach (AudioSource source in audioSequence.Sources)
{
source.Stop();
}
audioSequence._loopRoutine = 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();
}
}
public static readonly T Instance = new T();
protected bool isStopping;
private bool isInitialized;
protected AudioManager _audioManager;
private Coroutine? _loopRoutine;
private readonly List<AudioSource> _sources = new List<AudioSource>();
public bool IsRunning => _loopRoutine != null;
protected abstract AudioClip[] _clips { get; }
protected IReadOnlyList<AudioSource> Sources => _sources;
protected virtual void Init()
{
isStopping = false;
if (isInitialized)
{
return;
}
Plugin.Logger.LogDebug("Init => " + GetType().Name);
if (!Object.op_Implicit((Object)(object)_audioManager))
{
_audioManager = SingletonMonoBehaviour<AudioManager>.Instance;
}
if (_sources.Count == 0)
{
_sources.Clear();
AudioClip[] clips = _clips;
foreach (AudioClip clip in clips)
{
AudioSource val = _audioManager.CreateSource();
val.outputAudioMixerGroup = AudioLib.SfxAudioGroup;
val.clip = clip;
val.playOnAwake = false;
_sources.Add(val);
}
isInitialized = true;
}
}
public virtual void Start()
{
Init();
_loopRoutine = ((MonoBehaviour)_audioManager).StartCoroutine(Loop());
}
public virtual void Stop(bool immediate = false)
{
if (!IsRunning)
{
return;
}
if (immediate)
{
Plugin.Logger.LogDebug("Stopping Loop Immediately => " + GetType().Name);
((MonoBehaviour)_audioManager).StopCoroutine(_loopRoutine);
{
foreach (AudioSource source in _sources)
{
source.Stop();
}
return;
}
}
isStopping = true;
Plugin.Logger.LogDebug("Stopping Loop => " + GetType().Name);
}
[IteratorStateMachine(typeof(AudioSequence<>.<Loop>d__15))]
protected virtual IEnumerator Loop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__15(0)
{
<>4__this = this
};
}
}
public abstract class AudioSequenceLayered<T> where T : AudioSequenceLayered<T>, new()
{
[CompilerGenerated]
private sealed class <Loop>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AudioSequenceLayered<T> <>4__this;
public AudioSource source;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
AudioSequenceLayered<T> audioSequenceLayered = <>4__this;
if (num != 0)
{
return false;
}
<>1__state = -1;
Plugin.Logger.LogDebug("Cleanup Loop => " + audioSequenceLayered.GetType().Name);
source.Stop();
Object.Destroy((Object)(object)((Component)source).gameObject);
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();
}
}
public static readonly T Instance = new T();
private bool isInitialized;
private AudioManager _audioManager;
protected abstract AudioClip _clip { get; }
protected void Init()
{
if (!isInitialized)
{
Plugin.Logger.LogDebug("Init => " + GetType().Name);
if (!Object.op_Implicit((Object)(object)_audioManager))
{
_audioManager = SingletonMonoBehaviour<AudioManager>.Instance;
}
isInitialized = true;
}
}
protected AudioSource GetSource()
{
AudioSource obj = _audioManager.CreateSource();
obj.outputAudioMixerGroup = AudioLib.SfxAudioGroup;
obj.clip = _clip;
obj.playOnAwake = false;
return obj;
}
public virtual void Start()
{
Init();
Start(GetSource());
}
protected void Start(AudioSource source)
{
Init();
((MonoBehaviour)_audioManager).StartCoroutine(Loop(source));
}
[IteratorStateMachine(typeof(AudioSequenceLayered<>.<Loop>d__9))]
protected virtual IEnumerator Loop(AudioSource source)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__9(0)
{
<>4__this = this,
source = source
};
}
}
public class Bootup : AudioSequence<Bootup>
{
[CompilerGenerated]
private sealed class <Loop>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Bootup <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
int num = <>1__state;
Bootup CS$<>8__locals0 = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
AudioSequence<HardDisk>.Instance.BootStarted();
<>2__current = (object)new WaitUntil((Func<bool>)(() => Booted));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
AudioSequence<HardDisk>.Instance.BootEnded();
CS$<>8__locals0.Sources[1].Play();
<>2__current = (object)new WaitUntil((Func<bool>)(() => !CS$<>8__locals0.Sources[1].isPlaying));
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = ((AudioSequence<Bootup>)CS$<>8__locals0).Loop();
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
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();
}
}
public static bool Booted;
protected override AudioClip[] _clips => (AudioClip[])(object)new AudioClip[2]
{
AudioLib.BootupBeep,
AudioLib.OSBoot
};
public override void Start()
{
Init();
Booted = false;
base.Sources[0].volume = 0.1f;
base.Sources[1].volume = 0.5f;
base.Start();
AudioSequence<HardDisk>.Instance.Start();
AudioSequence<Fan>.Instance.Start();
}
[IteratorStateMachine(typeof(<Loop>d__4))]
protected override IEnumerator Loop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__4(0)
{
<>4__this = this
};
}
public void MotherboardPostBeep()
{
base.Sources[0].Play();
}
}
public class Fan : AudioSequence<Fan>
{
[CompilerGenerated]
private sealed class <Loop>d__31 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Fan <>4__this;
private float <idleRpm>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__31(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
Fan fan = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
float num6 = 0f;
fan.UpdateThermal(fan.ComputeLoad(Time.deltaTime), Time.deltaTime);
float num7 = Mathf.Clamp01(Mathf.Max(0.03f, fan._thermal));
fan._targetRpm = Mathf.Lerp(400f, 3200f, num7);
<idleRpm>5__2 = Mathf.Max(100f, 0f);
goto IL_011f;
}
case 1:
<>1__state = -1;
goto IL_011f;
case 2:
<>1__state = -1;
goto IL_01ed;
case 3:
{
<>1__state = -1;
float deltaTime = Time.deltaTime;
float load = fan.ComputeLoad(deltaTime);
fan.UpdateThermal(load, deltaTime);
float num2 = Mathf.Clamp01(Mathf.Max(0.03f, fan._thermal));
fan._targetRpm = Mathf.Lerp(400f, 3200f, num2);
float num3 = ((fan._targetRpm > fan._rpm) ? 900f : 600f) * deltaTime;
fan._rpm = Mathf.MoveTowards(fan._rpm, fan._targetRpm, num3);
float rpmNorm = Mathf.InverseLerp(400f, 3200f, fan._rpm);
float time = Time.time;
float num4 = Mathf.Sin(time * MathF.PI * 2f * 0.33f);
float num5 = Mathf.PerlinNoise(fan._perlinSeed, time * 2.5f) * 2f - 1f;
float pitchMod = 1f + num4 * 0.0125f + num5 * 0.01f;
float volMod = 1f + num4 * 0.06f + num5 * 0.05f;
fan.ApplyAudio(rpmNorm, pitchMod, volMod);
goto IL_033e;
}
case 4:
<>1__state = -1;
goto IL_03e0;
case 5:
{
<>1__state = -1;
return false;
}
IL_033e:
if (!fan.isStopping)
{
<>2__current = null;
<>1__state = 3;
return true;
}
goto IL_03e0;
IL_03e0:
if (fan._rpm > 0f || fan.Sources[0].volume > 0.001f)
{
float deltaTime2 = Time.deltaTime;
fan._rpm = Mathf.MoveTowards(fan._rpm, 0f, 2400f * deltaTime2);
float rpmNorm2 = Mathf.Clamp01(Mathf.InverseLerp(400f, 3200f, Mathf.Max(fan._rpm, 0f)));
float volMod2 = Mathf.InverseLerp(0f, 100f, Mathf.Min(fan._rpm, 100f));
fan.ApplyAudio(rpmNorm2, 1f, volMod2);
<>2__current = null;
<>1__state = 4;
return true;
}
fan.Sources[0].Stop();
<>2__current = ((AudioSequence<Fan>)fan).Loop();
<>1__state = 5;
return true;
IL_011f:
if (fan._rpm < Mathf.Min(<idleRpm>5__2, fan._targetRpm))
{
float num6 = Time.deltaTime;
fan._rpm = Mathf.MoveTowards(fan._rpm, <idleRpm>5__2, 1260f * num6);
float rpmNorm3 = Mathf.Clamp01(Mathf.InverseLerp(400f, 3200f, Mathf.Max(fan._rpm, 400f)));
float volMod3 = Mathf.InverseLerp(0f, <idleRpm>5__2, fan._rpm);
fan.ApplyAudio(rpmNorm3, 1f, volMod3);
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_01ed;
IL_01ed:
if (fan._rpm < fan._targetRpm && !fan.isStopping)
{
float num6 = Time.deltaTime;
float load2 = fan.ComputeLoad(num6);
fan.UpdateThermal(load2, num6);
float num8 = Mathf.Clamp01(Mathf.Max(0.03f, fan._thermal));
fan._targetRpm = Mathf.Lerp(400f, 3200f, num8);
float num9 = 1260f * num6;
fan._rpm = Mathf.MoveTowards(fan._rpm, fan._targetRpm, num9);
float rpmNorm4 = Mathf.Clamp01(Mathf.InverseLerp(400f, 3200f, fan._rpm));
fan.ApplyAudio(rpmNorm4, 1f);
<>2__current = null;
<>1__state = 2;
return true;
}
goto IL_033e;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[Header("Curves (X = normalized RPM 0..1)")]
private readonly AnimationCurve _volumeCurve = AnimationCurve.EaseInOut(0f, 0.04f, 1f, 0.1f);
private readonly AnimationCurve _pitchCurve = AnimationCurve.EaseInOut(0f, 0.7f, 1f, 1.2f);
[Header("RPM Model")]
[Range(200f, 3000f)]
private const float MinRpm = 400f;
[Range(1000f, 8000f)]
private const float MaxRpm = 3200f;
private const float AccelRpmPerSec = 900f;
private const float DecelRpmPerSec = 600f;
[Header("Thermal Model")]
[Range(0f, 1f)]
private const float AmbientLoad = 0.03f;
private const float HeatRiseTime = 6f;
private const float CoolFallTime = 12f;
[Header("Load Inputs (0..1)")]
[SerializeField]
[Range(0f, 1f)]
private float _memoryUsage;
[Range(0f, 1f)]
private const float MemoryWeight = 0.35f;
private const bool IncludeFrameLoad = true;
[Range(20f, 240f)]
private const int TargetFps = 60;
[Range(0f, 1f)]
private const float FrameLoadWeight = 0.45f;
[Range(0f, 1f)]
private const float NoiseWeight = 0.2f;
[Header("Micro Modulation (Character)")]
[Range(0.05f, 2f)]
private const float WobbleHz = 0.33f;
[Range(0f, 0.2f)]
private const float WobbleVolDepth = 0.06f;
[Range(0f, 0.05f)]
private const float WobblePitchDepth = 0.0125f;
[Range(0.5f, 12f)]
private const float WowHz = 2.5f;
[Range(0f, 0.04f)]
private const float WowPitchDepth = 0.01f;
[Range(0f, 0.12f)]
private const float WowVolDepth = 0.05f;
[Header("Startup/Shutdown")]
private const float StartupAccelMultiplier = 1.4f;
private const float ShutdownDecelMultiplier = 4f;
private float _rpm;
private float _targetRpm;
private float _thermal;
private float _perlinSeed;
protected override AudioClip[] _clips => (AudioClip[])(object)new AudioClip[1] { AudioLib.CPUFanLoop };
public void setMemoryUsage(float usage)
{
_memoryUsage = usage;
}
public override void Start()
{
Init();
_perlinSeed = Random.value * 1000f;
_thermal = 0.03f;
base.Sources[0].loop = true;
base.Sources[0].Play();
_rpm = 0f;
float rpmNorm = 0f;
ApplyAudio(rpmNorm, 1f, 0f);
base.Start();
}
[IteratorStateMachine(typeof(<Loop>d__31))]
protected override IEnumerator Loop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__31(0)
{
<>4__this = this
};
}
private float ComputeLoad(float dt)
{
float num = Mathf.Clamp01(_memoryUsage);
float num2 = 0f;
float num3 = 1f / (float)Mathf.Max(1, 60);
float num4 = Mathf.Lerp(num3, Time.smoothDeltaTime, 0.85f);
num2 = Mathf.InverseLerp(num3 * 0.9f, num3 * 2f, num4);
num2 = Mathf.Clamp01(num2);
float num5 = Mathf.PerlinNoise(_perlinSeed + 17.123f, Time.time * 0.35f);
float num6 = 0.35f;
float num7 = 0.45f;
float num8 = 0.2f;
float num9 = num6 + num7 + num8;
if (num9 > 1f)
{
num6 /= num9;
num7 /= num9;
num8 /= num9;
}
return Mathf.Clamp01(Mathf.Max(num * num6 + num2 * num7 + num5 * num8, 0.03f));
}
private void UpdateThermal(float load, float dt)
{
float num = ((load > _thermal) ? Mathf.Max(0.001f, 6f) : Mathf.Max(0.001f, 12f));
_thermal += (load - _thermal) * (dt / num);
_thermal = Mathf.Clamp01(_thermal);
}
private void ApplyAudio(float rpmNorm, float pitchMod, float volMod = 1f)
{
float num = _pitchCurve.Evaluate(rpmNorm);
float num2 = _volumeCurve.Evaluate(rpmNorm);
base.Sources[0].pitch = num * pitchMod;
base.Sources[0].volume = num2 * volMod;
}
}
public class HardDisk : AudioSequence<HardDisk>
{
[CompilerGenerated]
private sealed class <Loop>d__44 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public HardDisk <>4__this;
private Coroutine <modulatorRoutine>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__44(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<modulatorRoutine>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Expected O, but got Unknown
int num = <>1__state;
HardDisk CS$<>8__locals0 = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<modulatorRoutine>5__2 = ((MonoBehaviour)CS$<>8__locals0._audioManager).StartCoroutine(CS$<>8__locals0.ModulatePitchAndVolume());
CS$<>8__locals0.Sources[0].Play();
<>2__current = (object)new WaitUntil((Func<bool>)(() => !CS$<>8__locals0.Sources[0].isPlaying || CS$<>8__locals0.isStopping));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (!CS$<>8__locals0.isStopping)
{
CS$<>8__locals0.Sources[2].Play();
goto IL_00b2;
}
goto IL_00cb;
case 2:
<>1__state = -1;
goto IL_00b2;
case 3:
<>1__state = -1;
((MonoBehaviour)CS$<>8__locals0._audioManager).StopCoroutine(<modulatorRoutine>5__2);
<>2__current = ((AudioSequence<HardDisk>)CS$<>8__locals0).Loop();
<>1__state = 4;
return true;
case 4:
{
<>1__state = -1;
return false;
}
IL_00cb:
CS$<>8__locals0.transferCount = 0;
CS$<>8__locals0.explorerWindowCount = 0;
CS$<>8__locals0.Sources[1].Play();
<>2__current = (object)new WaitUntil((Func<bool>)(() => !CS$<>8__locals0.Sources[1].isPlaying));
<>1__state = 3;
return true;
IL_00b2:
if (!CS$<>8__locals0.isStopping)
{
<>2__current = null;
<>1__state = 2;
return true;
}
CS$<>8__locals0.Sources[2].Stop();
goto IL_00cb;
}
}
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 <ModulatePitchAndVolume>d__43 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public HardDisk <>4__this;
private float <pitch>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ModulatePitchAndVolume>d__43(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
HardDisk hardDisk = <>4__this;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
hardDisk.ComputeNormalizedPV(Time.deltaTime, out var p, out var v);
float num2 = hardDisk._pitchCurve.Evaluate(p);
float volume = hardDisk._volumeCurve.Evaluate(v);
if (!Mathf.Approximately(<pitch>5__2, num2))
{
float num3 = 0.04f * Time.deltaTime;
float num4 = Mathf.MoveTowards(<pitch>5__2, num2, num3);
<pitch>5__2 = num4;
}
hardDisk.ApplyPitchAndVolume(<pitch>5__2, volume);
}
else
{
<>1__state = -1;
<pitch>5__2 = hardDisk._pitchCurve.Evaluate(0f);
}
<>2__current = null;
<>1__state = 1;
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 readonly AnimationCurve _pitchCurve = AnimationCurve.EaseInOut(0f, 0.75f, 1f, 1.2f);
private readonly AnimationCurve _volumeCurve = AnimationCurve.EaseInOut(0f, 0.05f, 1f, 0.12f);
private const float SPEED_UP_TICK = 0.04f;
private ushort transferCount;
private int explorerWindowCount;
private float tauT = 2f;
private float tauE = 5f;
private float wT = 0.8f;
private float wE = 0.5f;
private float gammaLoud = 0.6f;
private float alphaPitch = 0.75f;
private float attackS = 0.08f;
private float releaseS = 0.35f;
private float changeWeight = 0.9f;
private float changeHalfLifeS = 0.25f;
private float bootAttackS = 0.15f;
private float bootReleaseS = 1f;
private float bootBoostGain = 1.2f;
private bool isBooting;
private float bootEnv;
private float bootPitchWeight = 0.6f;
private float bootPitchEase = 0.15f;
private float noise1Hz = 1.7f;
private float noise2Hz = 4.3f;
private float noiseAmpV = 0.1f;
private float noiseAmpP = 0.15f;
private float activitySmoothed;
private float phase1;
private float phase2;
private float prevT;
private float prevE;
private float changeMem;
protected override AudioClip[] _clips => (AudioClip[])(object)new AudioClip[3]
{
AudioLib.HardDiskSpinUp,
AudioLib.HardDiskSpinDown,
AudioLib.HardDiskLoop
};
public void TransferWindowOpened()
{
transferCount++;
Plugin.Logger.LogDebug("HardDisk => Transfer started");
}
public void TransferWindowClosed()
{
if (transferCount > 0)
{
transferCount--;
}
Plugin.Logger.LogDebug("HardDisk => Transfer ended");
}
public void ExplorerWindowOpened()
{
explorerWindowCount++;
Plugin.Logger.LogDebug("HardDisk => File explorer opened");
}
public void ExplorerWindowClosed()
{
if (explorerWindowCount > 0)
{
explorerWindowCount--;
}
Plugin.Logger.LogDebug("HardDisk => File explorer closed");
}
public void BootStarted()
{
isBooting = true;
Plugin.Logger.LogDebug("HardDisk => Boot Started");
}
public void BootEnded()
{
isBooting = false;
Plugin.Logger.LogDebug("HardDisk => Boot Ended");
}
public override void Start()
{
Init();
base.Sources[0].volume = _volumeCurve.Evaluate(0f);
base.Sources[1].volume = _volumeCurve.Evaluate(0f);
base.Sources[2].loop = true;
base.Sources[2].pitch = _pitchCurve.Evaluate(0f);
base.Sources[2].volume = _volumeCurve.Evaluate(0f);
prevT = (int)transferCount;
prevE = Mathf.Max(0, explorerWindowCount);
changeMem = 0f;
bootEnv = 0f;
base.Start();
}
private void ComputeNormalizedPV(float dt, out float p01, out float v01)
{
float num = (int)transferCount;
float num2 = Mathf.Max(0, explorerWindowCount);
float num3 = 1f - Mathf.Exp((0f - num) / Mathf.Max(0.0001f, tauT));
float num4 = 1f - Mathf.Exp((0f - num2) / Mathf.Max(0.0001f, tauE));
float num5 = Mathf.Max(0f, (num - prevT) / Mathf.Max(0.0001f, dt));
float num6 = Mathf.Max(0f, (num2 - prevE) / Mathf.Max(0.0001f, dt));
float num7 = 1f - Mathf.Exp((0f - num5) / 3f);
float num8 = 1f - Mathf.Exp((0f - num6) / 6f);
float num9 = 1f - Mathf.Exp((0f - dt) / Mathf.Max(0.0001f, changeHalfLifeS));
float num10 = Mathf.Clamp01(0.7f * num7 + 0.3f * num8);
changeMem += num9 * (num10 - changeMem);
float num11 = (isBooting ? 1f : 0f);
float num12 = 1f - Mathf.Exp((0f - dt) / Mathf.Max(0.0001f, isBooting ? bootAttackS : bootReleaseS));
bootEnv += num12 * (num11 - bootEnv);
float num13 = bootBoostGain * Mathf.Clamp01(bootEnv);
float num14 = wT * num3 + wE * num4;
float num15 = changeWeight * changeMem;
float num16 = 1f - Mathf.Exp(0f - (num14 + num15 + num13));
float num17 = 1f - Mathf.Exp((0f - dt) / Mathf.Max(0.0001f, attackS));
float num18 = 1f - Mathf.Exp((0f - dt) / Mathf.Max(0.0001f, releaseS));
activitySmoothed += ((num16 > activitySmoothed) ? num17 : num18) * (num16 - activitySmoothed);
float num19 = Mathf.Clamp01(activitySmoothed);
phase1 = (phase1 + noise1Hz * dt) % 1f;
phase2 = (phase2 + noise2Hz * dt) % 1f;
float num20 = Mathf.Sin(MathF.PI * 2f * phase1);
float num21 = 0.6f * Mathf.Sin(MathF.PI * 2f * phase2) + 0.4f * (Random.value * 2f - 1f);
float num22 = Mathf.Pow(num19, gammaLoud);
v01 = Mathf.Clamp01(num22 + noiseAmpV * num20);
float num23 = Mathf.Clamp01(alphaPitch * num3 + (1f - alphaPitch) * Mathf.Sqrt(num4));
float num24 = Mathf.Clamp01(bootEnv);
float num25 = Mathf.SmoothStep(0f, 1f, num24);
float num26 = Mathf.Lerp(num24, num25, Mathf.Clamp01(bootPitchEase));
float num27 = Mathf.Clamp01(Mathf.Lerp(num23, num26, Mathf.Clamp01(bootPitchWeight)));
float num28 = 0.15f;
p01 = Mathf.Clamp01(num27 * (0.85f + num28 * num19) + noiseAmpP * num21);
prevT = num;
prevE = num2;
}
private void ApplyPitchAndVolume(float pitch, float volume)
{
foreach (AudioSource source in base.Sources)
{
source.pitch = pitch;
source.volume = volume;
}
}
[IteratorStateMachine(typeof(<ModulatePitchAndVolume>d__43))]
private IEnumerator ModulatePitchAndVolume()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ModulatePitchAndVolume>d__43(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<Loop>d__44))]
protected override IEnumerator Loop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__44(0)
{
<>4__this = this
};
}
}
public class Notification : AudioSequenceLayered<Notification>
{
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
public AudioSource source;
internal bool <Loop>b__0()
{
return !source.isPlaying;
}
}
[CompilerGenerated]
private sealed class <Loop>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AudioSource source;
public Notification <>4__this;
private <>c__DisplayClass3_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
int num = <>1__state;
Notification notification = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass3_0();
<>8__1.source = source;
<>8__1.source.Play();
<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.source.isPlaying));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = ((AudioSequenceLayered<Notification>)notification).Loop(<>8__1.source);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
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();
}
}
protected override AudioClip _clip => AudioLib.OSNotification;
public override void Start()
{
Init();
AudioSource source = GetSource();
source.volume = 0.3f;
Start(source);
}
[IteratorStateMachine(typeof(<Loop>d__3))]
protected override IEnumerator Loop(AudioSource source)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__3(0)
{
<>4__this = this,
source = source
};
}
}
public class OSError : AudioSequenceLayered<OSError>
{
[CompilerGenerated]
private sealed class <>c__DisplayClass3_0
{
public AudioSource source;
internal bool <Loop>b__0()
{
return !source.isPlaying;
}
}
[CompilerGenerated]
private sealed class <Loop>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AudioSource source;
public OSError <>4__this;
private <>c__DisplayClass3_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
int num = <>1__state;
OSError oSError = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass3_0();
<>8__1.source = source;
<>8__1.source.Play();
<>2__current = (object)new WaitUntil((Func<bool>)(() => !<>8__1.source.isPlaying));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = ((AudioSequenceLayered<OSError>)oSError).Loop(<>8__1.source);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
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();
}
}
protected override AudioClip _clip => AudioLib.OSError;
public override void Start()
{
Init();
AudioSource source = GetSource();
source.volume = 0.3f;
Start(source);
}
[IteratorStateMachine(typeof(<Loop>d__3))]
protected override IEnumerator Loop(AudioSource source)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__3(0)
{
<>4__this = this,
source = source
};
}
}
public class SystemFailure : AudioSequence<SystemFailure>
{
[CompilerGenerated]
private sealed class <Loop>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public SystemFailure <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
SystemFailure systemFailure = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
systemFailure.Sources[0].Play();
goto IL_0053;
case 1:
<>1__state = -1;
goto IL_0053;
case 2:
{
<>1__state = -1;
return false;
}
IL_0053:
if (!systemFailure.isStopping)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = ((AudioSequence<SystemFailure>)systemFailure).Loop();
<>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();
}
}
protected override AudioClip[] _clips => (AudioClip[])(object)new AudioClip[1] { AudioLib.SystemFailureLoop };
public override void Start()
{
Init();
base.Sources[0].loop = true;
base.Sources[0].volume = 0.3f;
base.Start();
}
[IteratorStateMachine(typeof(<Loop>d__3))]
protected override IEnumerator Loop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__3(0)
{
<>4__this = this
};
}
}
public class TraceBeep : AudioSequence<TraceBeep>
{
[CompilerGenerated]
private sealed class <Loop>d__8 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public TraceBeep <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Loop>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
TraceBeep traceBeep = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
traceBeep.Sources[0].Play();
goto IL_0075;
case 1:
<>1__state = -1;
goto IL_0075;
case 2:
{
<>1__state = -1;
return false;
}
IL_0075:
if (!traceBeep.isStopping)
{
traceBeep.Sources[0].pitch = traceBeep._pitchCurve.Evaluate(traceBeep.Detection);
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = ((AudioSequence<TraceBeep>)traceBeep).Loop();
<>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 readonly AnimationCurve _pitchCurve = AnimationCurve.EaseInOut(0f, 0.5f, 1f, 2f);
public float Detection { get; set; }
protected override AudioClip[] _clips => (AudioClip[])(object)new AudioClip[1] { AudioLib.TraceBeep };
public override void Start()
{
Init();
base.Sources[0].loop = true;
base.Sources[0].volume = 0.3f;
base.Sources[0].pitch = _pitchCurve.Evaluate(Detection);
base.Start();
}
[IteratorStateMachine(typeof(<Loop>d__8))]
protected override IEnumerator Loop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Loop>d__8(0)
{
<>4__this = this
};
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}