Decompiled source of OmniscyeDemo v1.0.0

OmniDemo.dll

Decompiled a week ago
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OmniDemo")]
[assembly: AssemblyTitle("OmniDemo")]
[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.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;
		}
	}
	[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 OmniDemo
{
	[BepInPlugin("Omniscye.OmniDemo", "OmniDemo", "1.0")]
	public class OmniDemo : BaseUnityPlugin
	{
		internal static OmniDemo Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}
namespace Empress.Cracktro
{
	[BepInPlugin("empress.omniscye.cracktro", "Omniscye Cracktro", "1.1.5")]
	public class OmniscyeCracktro : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "empress.omniscye.cracktro";

		public const string PLUGIN_NAME = "Omniscye Cracktro";

		public const string PLUGIN_VERSION = "1.1.5";

		private CracktroController _controller;

		private string _pluginDir;

		private void Awake()
		{
			_pluginDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Omniscye Cracktro init -> " + _pluginDir));
		}

		private void Start()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_controller == (Object)null)
			{
				GameObject val = new GameObject("OmniscyeCracktroOverlay");
				Object.DontDestroyOnLoad((Object)(object)val);
				Camera val2 = val.AddComponent<Camera>();
				val2.clearFlags = (CameraClearFlags)2;
				val2.backgroundColor = Color.black;
				val2.cullingMask = int.MinValue;
				val2.depth = 999f;
				val2.allowHDR = false;
				val2.allowMSAA = false;
				val2.nearClipPlane = 0.01f;
				val2.farClipPlane = 1000f;
				_controller = val.AddComponent<CracktroController>();
				_controller.PluginLogger = ((BaseUnityPlugin)this).Logger;
				_controller.PluginDirectory = _pluginDir;
				_controller.LogoText = "Omniscye";
				_controller.MasterIntensity = 1f;
				_controller.Initialize();
			}
			_controller.EnableCracktro(on: true);
		}
	}
	internal class CracktroController : MonoBehaviour
	{
		private struct Cube
		{
			public Vector3 orbitAxis;

			public float orbitAngle;

			public float orbitSpeed;

			public float orbitRadius;

			public Vector3 spinAxis;

			public float spinAngle;

			public float spinSpeed;

			public float z;

			public float scale;

			public Color color;

			public float life;

			public float wobble;
		}

		private struct Star
		{
			public float X;

			public float Y;

			public float Z;

			private static float _fov = 1.2f;

			public static Star Random(Random r)
			{
				Star result = default(Star);
				result.X = (float)(r.NextDouble() * 2.0 - 1.0) * 1.8f;
				result.Y = (float)(r.NextDouble() * 2.0 - 1.0) * 1.4f;
				result.Z = (float)(r.NextDouble() * 1.0 + 0.2);
				return result;
			}

			public void Reinit()
			{
				X = Random.Range(-1.8f, 1.8f);
				Y = Random.Range(-1.4f, 1.4f);
				Z = Random.Range(0.9f, 1.9f);
			}

			public bool OutOfBounds()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: 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)
				Vector2 val = ProjectToScreen();
				return val.x < -50f || val.x > (float)(Screen.width + 50) || val.y < -50f || val.y > (float)(Screen.height + 50);
			}

			public Vector2 ProjectToScreen()
			{
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				float num = X / Z * ((float)Screen.height * _fov) + (float)Screen.width * 0.5f;
				float num2 = Y / Z * ((float)Screen.height * _fov) + (float)Screen.height * 0.5f;
				return new Vector2(num, num2);
			}

			public float SpeedBias()
			{
				return Mathf.InverseLerp(1.9f, 0.2f, Z);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass88_0
		{
			public string[] exts;

			public CracktroController <>4__this;

			public string pick;

			internal bool <TryLoadAndPlayTrackCoroutine>b__0(string p)
			{
				return exts.Contains(Path.GetExtension(p).ToLowerInvariant());
			}

			internal void <TryLoadAndPlayTrackCoroutine>b__1(AudioClip clip)
			{
				if ((Object)(object)clip == (Object)null)
				{
					ManualLogSource pluginLogger = <>4__this.PluginLogger;
					if (pluginLogger != null)
					{
						pluginLogger.LogWarning((object)("Failed to load clip: " + pick));
					}
					return;
				}
				<>4__this._audio.clip = clip;
				<>4__this._audio.Play();
				ManualLogSource pluginLogger2 = <>4__this.PluginLogger;
				if (pluginLogger2 != null)
				{
					pluginLogger2.LogInfo((object)("Playing track: " + Path.GetFileName(pick)));
				}
			}
		}

		[CompilerGenerated]
		private sealed class <LoadClipFromFile>d__89 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string path;

			public Action<AudioClip> done;

			public CracktroController <>4__this;

			private string <ext>5__1;

			private AudioType <type>5__2;

			private string <url>5__3;

			private string <>s__4;

			private WWW <www>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadClipFromFile>d__89(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();
					}
				}
				<ext>5__1 = null;
				<url>5__3 = null;
				<>s__4 = null;
				<www>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Expected O, but got Unknown
				//IL_0090: 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)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						<ext>5__1 = Path.GetExtension(path).ToLowerInvariant();
						<type>5__2 = (AudioType)0;
						string text = <ext>5__1;
						<>s__4 = text;
						switch (<>s__4)
						{
						case ".ogg":
							<type>5__2 = (AudioType)14;
							break;
						case ".wav":
							<type>5__2 = (AudioType)20;
							break;
						case ".mp3":
							<type>5__2 = (AudioType)13;
							break;
						}
						<>s__4 = null;
						<url>5__3 = "file:///" + path.Replace("\\", "/");
						<www>5__5 = new WWW(<url>5__3);
						<>1__state = -3;
						<>2__current = <www>5__5;
						<>1__state = 1;
						return true;
					}
					case 1:
						<>1__state = -3;
						if (!string.IsNullOrEmpty(<www>5__5.error))
						{
							ManualLogSource pluginLogger = <>4__this.PluginLogger;
							if (pluginLogger != null)
							{
								pluginLogger.LogWarning((object)("Audio load error: " + <www>5__5.error));
							}
							done?.Invoke(null);
						}
						else
						{
							done?.Invoke(<www>5__5.GetAudioClip(false, true));
						}
						<>m__Finally1();
						<www>5__5 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			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__5 != null)
				{
					((IDisposable)<www>5__5).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <TryLoadAndPlayTrackCoroutine>d__88 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CracktroController <>4__this;

			private <>c__DisplayClass88_0 <>8__1;

			private string[] <files>5__2;

			private Exception <e>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TryLoadAndPlayTrackCoroutine>d__88(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<files>5__2 = null;
				<e>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass88_0();
					<>8__1.<>4__this = <>4__this;
					<>8__1.exts = new string[3] { ".ogg", ".wav", ".mp3" };
					<files>5__2 = Array.Empty<string>();
					try
					{
						<files>5__2 = (from p in Directory.GetFiles(<>4__this.PluginDirectory, "*", SearchOption.TopDirectoryOnly)
							where <>8__1.exts.Contains(Path.GetExtension(p).ToLowerInvariant())
							select p).ToArray();
					}
					catch (Exception ex)
					{
						<e>5__3 = ex;
						ManualLogSource pluginLogger = <>4__this.PluginLogger;
						if (pluginLogger != null)
						{
							pluginLogger.LogWarning((object)("Music search failed: " + <e>5__3.Message));
						}
					}
					if (<files>5__2.Length == 0)
					{
						ManualLogSource pluginLogger2 = <>4__this.PluginLogger;
						if (pluginLogger2 != null)
						{
							pluginLogger2.LogInfo((object)"No audio files (.ogg/.wav/.mp3) found next to the DLL. Visuals still run.");
						}
						return false;
					}
					<>8__1.pick = <files>5__2[Random.Range(0, <files>5__2.Length)];
					<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClipFromFile(<>8__1.pick, delegate(AudioClip clip)
					{
						if ((Object)(object)clip == (Object)null)
						{
							ManualLogSource pluginLogger3 = <>8__1.<>4__this.PluginLogger;
							if (pluginLogger3 != null)
							{
								pluginLogger3.LogWarning((object)("Failed to load clip: " + <>8__1.pick));
							}
						}
						else
						{
							<>8__1.<>4__this._audio.clip = clip;
							<>8__1.<>4__this._audio.Play();
							ManualLogSource pluginLogger4 = <>8__1.<>4__this.PluginLogger;
							if (pluginLogger4 != null)
							{
								pluginLogger4.LogInfo((object)("Playing track: " + Path.GetFileName(<>8__1.pick)));
							}
						}
					}));
					<>1__state = 1;
					return true;
				case 1:
					<>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();
			}
		}

		private AudioSource _audio;

		private float[] _spectrum;

		private float _bass;

		private float _mid;

		private float _treble;

		private float _energy;

		private float _smoothedBass;

		private float _smoothedEnergy;

		private Material _glMat2D;

		private Material _meshMatUnlit;

		private Mesh _cubeMesh;

		private Camera _ownCam;

		private float _nukeTick;

		private bool _nukeLogged;

		private const int StarLayers = 3;

		private Star[][] _stars;

		private readonly int[] _starCounts = new int[3] { 420, 260, 160 };

		private readonly float[] _starSpeed = new float[3] { 12f, 6.5f, 2.8f };

		private readonly float[] _starSize = new float[3] { 2.2f, 1.5f, 1f };

		private Font _font;

		private float _scrollX;

		private float _scrollSpeed = 120f;

		private float _scrollWobbleAmp = 22f;

		private string _scrollText;

		private float _scrollTextWidth;

		private float _logoPulse = 1f;

		private float _hue;

		private const int EQ_BANDS = 64;

		private float[] _eqHeights = new float[64];

		private readonly List<Cube> _cubes = new List<Cube>(256);

		private float _cubeSpawnTimer;

		private const int MAX_CUBES = 220;

		private TextMesh _3dLogo;

		private float _time;

		public ManualLogSource PluginLogger { get; set; }

		public string PluginDirectory { get; set; }

		public string LogoText { get; set; } = "Omniscye";


		public float MasterIntensity { get; set; } = 1f;


		public float Reactivity { get; set; } = 0.2f;


		public bool Enabled { get; private set; }

		private int Phase => (int)(Mathf.Floor(_time / 20f) % 4f);

		public void Initialize()
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_014d: 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_016d: 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)
			Enabled = false;
			_ownCam = ((Component)this).GetComponent<Camera>();
			if ((Object)(object)_ownCam == (Object)null)
			{
				_ownCam = ((Component)this).gameObject.AddComponent<Camera>();
				_ownCam.clearFlags = (CameraClearFlags)2;
				_ownCam.backgroundColor = Color.black;
				_ownCam.cullingMask = int.MinValue;
				_ownCam.depth = 999f;
				_ownCam.allowHDR = false;
				_ownCam.allowMSAA = false;
				_ownCam.nearClipPlane = 0.01f;
				_ownCam.farClipPlane = 1000f;
			}
			GameObject val = new GameObject("3DLogo");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.layer = 31;
			_3dLogo = val.AddComponent<TextMesh>();
			_3dLogo.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			_3dLogo.text = LogoText;
			_3dLogo.characterSize = 0.1f;
			_3dLogo.anchor = (TextAnchor)4;
			_3dLogo.alignment = (TextAlignment)1;
			((Component)_3dLogo).transform.position = new Vector3(0f, 0f, 20f);
			((Component)_3dLogo).transform.localScale = Vector3.one * 5f;
			((Component)_3dLogo).gameObject.SetActive(false);
			_audio = ((Component)this).gameObject.AddComponent<AudioSource>();
			_audio.playOnAwake = false;
			_audio.loop = true;
			_audio.spatialBlend = 0f;
			_audio.volume = 1f;
			_spectrum = new float[1024];
			_glMat2D = CreateMaterial(new string[5] { "Hidden/Internal-Colored", "UI/Default", "Sprites/Default", "Legacy Shaders/Particles/Alpha Blended", "Mobile/Particles/Alpha Blended" }, out string picked);
			if ((Object)(object)_glMat2D == (Object)null)
			{
				ManualLogSource pluginLogger = PluginLogger;
				if (pluginLogger != null)
				{
					pluginLogger.LogError((object)"No usable shader found for 2D GL rendering. Cracktro disabled.");
				}
				Enabled = false;
				return;
			}
			ManualLogSource pluginLogger2 = PluginLogger;
			if (pluginLogger2 != null)
			{
				pluginLogger2.LogInfo((object)("2D material using shader: " + picked));
			}
			TrySet(_glMat2D, "_SrcBlend", 5f);
			TrySet(_glMat2D, "_DstBlend", 10f);
			TrySet(_glMat2D, "_Cull", 0f);
			TrySet(_glMat2D, "_ZWrite", 0f);
			_meshMatUnlit = CreateMaterial(new string[5] { "Unlit/Color", "UI/Default", "Sprites/Default", "Legacy Shaders/Particles/Alpha Blended", "Mobile/Particles/Alpha Blended" }, out string picked2);
			if ((Object)(object)_meshMatUnlit == (Object)null)
			{
				ManualLogSource pluginLogger3 = PluginLogger;
				if (pluginLogger3 != null)
				{
					pluginLogger3.LogWarning((object)"No usable shader found for 3D cubes. Cubes disabled.");
				}
			}
			else
			{
				ManualLogSource pluginLogger4 = PluginLogger;
				if (pluginLogger4 != null)
				{
					pluginLogger4.LogInfo((object)("3D material using shader: " + picked2));
				}
			}
			_cubeMesh = CreateCubeMesh();
			_font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			_stars = new Star[3][];
			Random r = new Random(1987);
			for (int i = 0; i < 3; i++)
			{
				_stars[i] = new Star[_starCounts[i]];
				for (int j = 0; j < _starCounts[i]; j++)
				{
					_stars[i][j] = Star.Random(r);
				}
			}
			_scrollText = LoadScrollText() ?? "// OMNISCYE // LOOL> — GREETZ TO THE R.E.P.O MODDING COMMUNITY — ALWAYS CURSED";
			((MonoBehaviour)this).StartCoroutine(TryLoadAndPlayTrackCoroutine());
			NukeGameRendering(log: true);
		}

		public void EnableCracktro(bool on)
		{
			Enabled = on;
			if (on)
			{
				if ((Object)(object)_audio != (Object)null && (Object)(object)_audio.clip != (Object)null)
				{
					_audio.Play();
				}
				return;
			}
			AudioSource audio = _audio;
			if (audio != null)
			{
				audio.Pause();
			}
		}

		private void Update()
		{
			//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_0724: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_074f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled)
			{
				return;
			}
			_time += Time.deltaTime;
			_nukeTick += Time.unscaledDeltaTime;
			if (_nukeTick > 1f)
			{
				_nukeTick = 0f;
				NukeGameRendering(!_nukeLogged);
				_nukeLogged = true;
			}
			if ((Object)(object)_audio != (Object)null)
			{
				try
				{
					_audio.GetSpectrumData(_spectrum, 0, (FFTWindow)5);
				}
				catch
				{
				}
				_bass = SumRange(_spectrum, 0, 14) * 65f;
				_mid = SumRange(_spectrum, 15, 96) * 26f;
				_treble = SumRange(_spectrum, 97, 256) * 22f;
				_energy = _bass * 0.6f + _mid * 0.3f + _treble * 0.1f;
				_smoothedBass = Mathf.Lerp(_smoothedBass, _bass, Time.deltaTime * 6f);
				_smoothedEnergy = Mathf.Lerp(_smoothedEnergy, _energy, Time.deltaTime * 6f);
				for (int i = 0; i < 64; i++)
				{
					int start = Mathf.RoundToInt(Mathf.Lerp(0f, (float)(_spectrum.Length - 2), (float)i / 64f));
					int end = Mathf.RoundToInt(Mathf.Lerp(0f, (float)(_spectrum.Length - 1), (float)(i + 1) / 64f));
					float num = SumRange(_spectrum, start, end) * 110f * Reactivity;
					_eqHeights[i] = Mathf.Max(_eqHeights[i] * 0.9f, num);
				}
			}
			_hue += Time.deltaTime * (0.08f + _smoothedEnergy * 0.03f * Reactivity);
			float num2 = 1f + Mathf.Clamp(_smoothedBass * (0.15f * Reactivity), 0f, 0.12f);
			_logoPulse = Mathf.Lerp(_logoPulse, num2, Time.deltaTime * 7f);
			float num3 = (1f + Mathf.Clamp(_smoothedEnergy * 0.9f * Reactivity, 0f, 2f)) * MasterIntensity;
			for (int j = 0; j < 3; j++)
			{
				float num4 = _starSpeed[j] * num3;
				for (int k = 0; k < _stars[j].Length; k++)
				{
					Star star = _stars[j][k];
					star.Z -= num4 * Time.deltaTime * (1f + GetPhaseSpeedBoost());
					if (star.Z < 0.2f || star.OutOfBounds())
					{
						star.Reinit();
					}
					_stars[j][k] = star;
				}
			}
			int fontSize = Mathf.Max(18, (int)Mathf.Round((float)Screen.height * 0.035f));
			_scrollTextWidth = MeasureTextWidth(_scrollText, fontSize);
			float num5 = 70f + Mathf.Clamp01(_smoothedEnergy * Reactivity) * 140f;
			_scrollSpeed = Mathf.Lerp(_scrollSpeed, num5, Time.deltaTime * 1.5f);
			_scrollX -= _scrollSpeed * Time.deltaTime;
			float num6 = Mathf.Max((float)Screen.width * 2.5f, _scrollTextWidth + (float)Screen.width);
			if (_scrollX < 0f - num6)
			{
				_scrollX = (float)Screen.width * 1.1f;
			}
			float num7 = 10f;
			float num8 = 6f * GetPhaseSpawnBoost();
			float num9 = Mathf.Clamp01(_smoothedEnergy) * (18f * Reactivity);
			float num10 = (num7 + num8 + num9) * MasterIntensity;
			_cubeSpawnTimer += Time.deltaTime * num10;
			while (_cubeSpawnTimer >= 1f && _cubes.Count < 220)
			{
				_cubeSpawnTimer -= 1f;
				_cubes.Add(SpawnCube());
			}
			for (int num11 = _cubes.Count - 1; num11 >= 0; num11--)
			{
				Cube value = _cubes[num11];
				value.orbitAngle += value.orbitSpeed * Time.deltaTime;
				value.spinAngle += value.spinSpeed * Time.deltaTime;
				value.life = Mathf.Clamp01(value.life + Time.deltaTime * 0.8f);
				float num12 = 1f + Mathf.Sin(_time * 2f + value.wobble) * 0.05f + Mathf.Clamp(_smoothedBass * 0.08f, 0f, 0.3f);
				value.orbitRadius *= Mathf.Lerp(1f, num12, 0.15f);
				value.z -= Time.deltaTime * (0.8f + _smoothedEnergy * 2.2f * Reactivity + GetPhaseForwardBoost());
				if (value.z < 2.5f)
				{
					_cubes.RemoveAt(num11);
				}
				else
				{
					_cubes[num11] = value;
				}
			}
			bool flag = Phase % 2 == 1;
			((Component)_3dLogo).gameObject.SetActive(flag);
			if (flag)
			{
				((Component)_3dLogo).transform.position = new Vector3(Mathf.Sin(_time * 0.5f) * 2f, 0f + Mathf.Cos(_time * 0.3f) * 1f, 20f - _smoothedEnergy * 2f);
				((Component)_3dLogo).transform.localScale = Vector3.one * 5f * _logoPulse;
				_3dLogo.color = ColorFromHSV(_hue * 360f % 360f, 0.75f, 1f);
				((Component)_3dLogo).transform.LookAt(((Component)_ownCam).transform.position);
				Transform transform = ((Component)_3dLogo).transform;
				Quaternion rotation = ((Component)_3dLogo).transform.rotation;
				transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y + 180f, 0f);
			}
		}

		private void OnPostRender()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled || (Object)(object)_glMat2D == (Object)null)
			{
				return;
			}
			DrawTunnel3D();
			DrawCubes3D();
			_glMat2D.SetPass(0);
			GL.PushMatrix();
			GL.LoadPixelMatrix(0f, (float)Screen.width, (float)Screen.height, 0f);
			DrawFullscreenGradient(new Color(0f, 0f, 0f, 0.25f), new Color(0f, 0f, 0f, 0.05f));
			for (int i = 0; i < 3; i++)
			{
				float num = _starSize[i] * (1f + _smoothedEnergy * 0.7f * Reactivity) * MasterIntensity;
				Color val = ColorFromHSV((_hue * 360f + (float)i * 35f) % 360f, 0.55f + 0.15f * (float)i, 0.95f);
				val.a = 0.75f;
				GL.Begin(1);
				GL.Color(val);
				for (int j = 0; j < _stars[i].Length; j++)
				{
					Vector2 val2 = _stars[i][j].ProjectToScreen();
					if (!(val2.x < -10f) && !(val2.x > (float)(Screen.width + 10)) && !(val2.y < -10f) && !(val2.y > (float)(Screen.height + 10)))
					{
						float num2 = num * (1f + _stars[i][j].SpeedBias());
						GL.Vertex3(val2.x, val2.y, 0f);
						GL.Vertex3(val2.x + num2, val2.y, 0f);
					}
				}
				GL.End();
			}
			float num3 = (float)Screen.width / 64f;
			for (int k = 0; k < 64; k++)
			{
				float num4 = Mathf.Min((float)Screen.height * 0.22f, _eqHeights[k] * 900f * MasterIntensity);
				float num5 = (float)k * num3;
				float num6 = (float)Screen.height - num4 - 6f;
				DrawQuad(new Rect(num5 + 2f, num6, num3 - 4f, num4), ColorFromHSV((_hue * 360f + (float)k * 7f) % 360f, 0.85f, 1f, 0.65f));
			}
			DrawScanlines();
			GL.PopMatrix();
		}

		private void OnGUI()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Expected O, but got Unknown
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Expected O, but got Unknown
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_01a9: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Expected O, but got Unknown
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled || (Object)(object)_font == (Object)null || (int)Event.current.type != 7)
			{
				return;
			}
			if (Phase % 2 == 0)
			{
				string logoText = LogoText;
				float num = Mathf.Round((float)Screen.height * 0.08f * _logoPulse);
				int fontSize = (int)num;
				GUIStyle val = new GUIStyle
				{
					font = _font,
					fontSize = fontSize,
					alignment = (TextAnchor)1
				};
				float num2 = MeasureTextWidth(logoText, fontSize);
				float num3 = (float)Screen.width * 0.5f;
				float num4 = (float)Screen.height * 0.22f;
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(num3, num4 + num * 0.5f);
				float num5 = Mathf.Clamp01((_logoPulse - 1f) / 0.22f);
				Color textColor = ColorFromHSV((_hue * 360f + 30f) % 360f, 0.6f, 1f, 0.25f);
				Matrix4x4 matrix = GUI.matrix;
				GUIUtility.ScaleAroundPivot(new Vector2(1f + num5 * 0.22f, 1f + num5 * 0.22f), val2);
				Vector2 val3 = default(Vector2);
				for (int i = 0; i < 8; i++)
				{
					float num6 = (float)i * MathF.PI * 0.25f;
					float num7 = 3f + num5 * 6f;
					((Vector2)(ref val3))..ctor(Mathf.Cos(num6) * num7, Mathf.Sin(num6) * num7);
					GUIStyle val4 = new GUIStyle(val);
					val4.normal.textColor = textColor;
					GUI.Label(new Rect(num3 - num2 / 2f + val3.x, num4 + val3.y, num2, num * 1.2f), logoText, val4);
				}
				GUIStyle val5 = new GUIStyle(val);
				val5.normal.textColor = new Color(1f, 0.2f, 0.6f, 0.55f * (0.3f + num5));
				GUI.Label(new Rect(num3 - num2 / 2f - (2f + 3f * num5), num4, num2, num * 1.2f), logoText, val5);
				GUIStyle val6 = new GUIStyle(val);
				val6.normal.textColor = new Color(0.2f, 1f, 1f, 0.55f * (0.3f + num5));
				GUI.Label(new Rect(num3 - num2 / 2f + (2f + 3f * num5), num4, num2, num * 1.2f), logoText, val6);
				DrawOutlineLabel(new Rect(num3 - num2 / 2f, num4, num2, num * 1.2f), logoText, val, Color.black, 4);
				val.normal.textColor = ColorFromHSV(_hue * 360f % 360f, 0.75f, 1f);
				GUI.Label(new Rect(num3 - num2 / 2f, num4, num2, num * 1.2f), logoText, val);
				GUI.matrix = matrix;
			}
			int num8 = Mathf.Max(18, (int)Mathf.Round((float)Screen.height * 0.035f));
			GUIStyle val7 = new GUIStyle
			{
				font = _font,
				fontSize = num8,
				alignment = (TextAnchor)3,
				wordWrap = false
			};
			float num9 = (float)Screen.height * 0.86f + Mathf.Sin(Time.time * 2.5f + _smoothedBass * 3f * Reactivity) * _scrollWobbleAmp * 0.6f;
			float num10 = Mathf.Max((float)Screen.width * 2.5f, _scrollTextWidth + (float)Screen.width);
			GUIStyle val8 = new GUIStyle(val7);
			val8.normal.textColor = new Color(0f, 0f, 0f, 0.6f);
			GUI.Label(new Rect(_scrollX + 3f, num9 + 3f, num10, (float)num8 * 1.6f), _scrollText, val8);
			val7.normal.textColor = ColorFromHSV((_hue * 360f + 180f) % 360f, 0.85f, 1f);
			GUI.Label(new Rect(_scrollX, num9, num10, (float)num8 * 1.6f), _scrollText, val7);
		}

		private void DrawCubes3D()
		{
			//IL_0069: 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_0073: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_meshMatUnlit == (Object)null) && !((Object)(object)_cubeMesh == (Object)null) && _cubes.Count != 0)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0f, 0f, 10f);
				for (int i = 0; i < _cubes.Count; i++)
				{
					Cube cube = _cubes[i];
					Quaternion val2 = Quaternion.AngleAxis(cube.orbitAngle, cube.orbitAxis);
					Vector3 val3 = val + val2 * (Vector3.right * cube.orbitRadius);
					val3.y += Mathf.Sin((_time + cube.wobble) * 1.4f) * 0.6f;
					val3.z += cube.z;
					float num = cube.scale * (1f + Mathf.Clamp(_smoothedEnergy * 0.7f * Reactivity, 0f, 1.8f)) * MasterIntensity;
					Quaternion val4 = Quaternion.AngleAxis(cube.spinAngle, cube.spinAxis);
					Matrix4x4 val5 = Matrix4x4.TRS(val3, val4, Vector3.one * num);
					TrySetColor(_meshMatUnlit, new Color(cube.color.r, cube.color.g, cube.color.b, 0.9f * cube.life));
					_meshMatUnlit.SetPass(0);
					Graphics.DrawMeshNow(_cubeMesh, val5);
				}
			}
		}

		private void DrawTunnel3D()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_glMat2D == (Object)null)
			{
				return;
			}
			_glMat2D.SetPass(0);
			GL.PushMatrix();
			GL.LoadIdentity();
			GL.MultMatrix(_ownCam.worldToCameraMatrix);
			GL.LoadProjectionMatrix(_ownCam.projectionMatrix);
			Color val = ColorFromHSV((_hue * 360f + 90f) % 360f, 0.6f, 0.9f, 0.25f + Mathf.Clamp01(_smoothedEnergy) * 0.2f);
			int num = 22;
			float num2 = 1f;
			int num3 = 48;
			Vector3 val2 = default(Vector3);
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < num; i++)
			{
				float num4 = 8f + (float)i * num2 * (1f + GetPhaseTunnelStretch());
				float num5 = 1f + (float)i * 0.18f * (1f + Mathf.Clamp(_smoothedEnergy * 0.8f, 0f, 2f));
				GL.Begin(1);
				GL.Color(val);
				for (int j = 0; j < num3; j++)
				{
					float num6 = (float)j / (float)num3 * MathF.PI * 2f;
					float num7 = (float)(j + 1) / (float)num3 * MathF.PI * 2f;
					((Vector3)(ref val2))..ctor(Mathf.Cos(num6) * num5, Mathf.Sin(num6) * num5, num4);
					((Vector3)(ref val3))..ctor(Mathf.Cos(num7) * num5, Mathf.Sin(num7) * num5, num4);
					GL.Vertex(val2);
					GL.Vertex(val3);
				}
				GL.End();
			}
			GL.PopMatrix();
		}

		private void NukeGameRendering(bool log)
		{
			Camera[] allCameras = Camera.allCameras;
			foreach (Camera val in allCameras)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)_ownCam || !((Behaviour)val).enabled)
				{
					continue;
				}
				((Behaviour)val).enabled = false;
				if (log)
				{
					ManualLogSource pluginLogger = PluginLogger;
					if (pluginLogger != null)
					{
						pluginLogger.LogInfo((object)("Disabled camera: " + ((Object)val).name));
					}
				}
			}
			Canvas[] array = Resources.FindObjectsOfTypeAll<Canvas>();
			foreach (Canvas val2 in array)
			{
				if ((Object)(object)val2 == (Object)null || !((Behaviour)val2).enabled)
				{
					continue;
				}
				((Behaviour)val2).enabled = false;
				if (log)
				{
					ManualLogSource pluginLogger2 = PluginLogger;
					if (pluginLogger2 != null)
					{
						pluginLogger2.LogInfo((object)("Disabled canvas: " + ((Object)val2).name));
					}
				}
			}
		}

		private Cube SpawnCube()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Cube result = default(Cube);
			Vector3 val;
			switch (Phase)
			{
			case 0:
				result.orbitAxis = Vector3.up;
				break;
			case 1:
				val = Vector3.up + Vector3.right;
				result.orbitAxis = ((Vector3)(ref val)).normalized;
				break;
			case 2:
				result.orbitAxis = Vector3.forward;
				break;
			default:
				val = Vector3.up + Vector3.forward * 0.6f;
				result.orbitAxis = ((Vector3)(ref val)).normalized;
				break;
			}
			result.orbitAngle = Random.Range(0f, 360f);
			result.orbitSpeed = 40f + Random.Range(-10f, 25f) + _smoothedEnergy * 50f + GetPhaseOrbitBoost();
			result.orbitRadius = Random.Range(0.8f, 3.6f) * (1f + GetPhaseRadiusBoost());
			result.spinAxis = Random.onUnitSphere;
			result.spinAngle = Random.Range(0f, 360f);
			result.spinSpeed = 60f + Random.Range(-30f, 120f) + _smoothedEnergy * 120f;
			result.z = Random.Range(0f, 18f);
			result.scale = 0.25f + Random.Range(0f, 0.6f);
			result.color = ColorFromHSV((_hue * 360f + Random.Range(0f, 180f)) % 360f, 0.85f, 1f);
			result.life = 0f;
			result.wobble = Random.Range(0f, MathF.PI * 2f);
			return result;
		}

		private float GetPhaseSpeedBoost()
		{
			return (Phase == 1) ? 0.5f : ((Phase == 2) ? 1.2f : ((Phase == 3) ? 0.2f : 0f));
		}

		private float GetPhaseSpawnBoost()
		{
			return (Phase == 1) ? 3f : ((Phase == 2) ? 6f : ((Phase == 3) ? 8f : 0f));
		}

		private float GetPhaseForwardBoost()
		{
			return (Phase == 2) ? 3.2f : ((Phase == 3) ? 1f : 0.5f);
		}

		private float GetPhaseOrbitBoost()
		{
			return (Phase == 1) ? 30f : ((Phase == 2) ? 10f : ((Phase == 3) ? 50f : 0f));
		}

		private float GetPhaseRadiusBoost()
		{
			return (Phase == 1) ? 0.6f : ((Phase == 2) ? 0.2f : ((Phase == 3) ? 1.1f : 0.3f));
		}

		private float GetPhaseTunnelStretch()
		{
			return (Phase == 2) ? 0.9f : ((Phase == 3) ? 0.4f : 0.2f);
		}

		private Material CreateMaterial(string[] shaderNames, out string picked)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			picked = null;
			foreach (string text in shaderNames)
			{
				Shader val = Shader.Find(text);
				if ((Object)(object)val != (Object)null)
				{
					picked = text;
					return new Material(val)
					{
						hideFlags = (HideFlags)61
					};
				}
			}
			return null;
		}

		private void TrySet(Material m, string prop, float value)
		{
			if ((Object)(object)m != (Object)null && m.HasProperty(prop))
			{
				m.SetFloat(prop, value);
			}
		}

		private void TrySetColor(Material m, Color c)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)m == (Object)null))
			{
				if (m.HasProperty("_Color"))
				{
					m.SetColor("_Color", c);
				}
				else if (m.HasProperty("_TintColor"))
				{
					m.SetColor("_TintColor", c);
				}
			}
		}

		private float SumRange(float[] arr, int start, int end)
		{
			start = Mathf.Clamp(start, 0, arr.Length - 1);
			end = Mathf.Clamp(end, 0, arr.Length - 1);
			float num = 0f;
			for (int i = start; i <= end; i++)
			{
				num += arr[i];
			}
			return num;
		}

		private string LoadScrollText()
		{
			try
			{
				string path = Path.Combine(PluginDirectory, "scroll.txt");
				if (File.Exists(path))
				{
					string text = File.ReadAllText(path);
					if (!string.IsNullOrWhiteSpace(text))
					{
						return text.Trim();
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource pluginLogger = PluginLogger;
				if (pluginLogger != null)
				{
					pluginLogger.LogWarning((object)("Failed to read scroll.txt: " + ex.Message));
				}
			}
			return null;
		}

		private float MeasureTextWidth(string s, int fontSize)
		{
			if ((Object)(object)_font == (Object)null || string.IsNullOrEmpty(s))
			{
				return 0f;
			}
			_font.RequestCharactersInTexture(s, fontSize, (FontStyle)0);
			float num = 0f;
			CharacterInfo val = default(CharacterInfo);
			for (int i = 0; i < s.Length; i++)
			{
				num = ((!_font.GetCharacterInfo(s[i], ref val, fontSize, (FontStyle)0)) ? (num + (float)fontSize * 0.5f) : (num + (float)((CharacterInfo)(ref val)).advance));
			}
			return num;
		}

		private void DrawOutlineLabel(Rect r, string text, GUIStyle style, Color outline, int thickness)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Color textColor = style.normal.textColor;
			style.normal.textColor = outline;
			for (int i = -thickness; i <= thickness; i++)
			{
				for (int j = -thickness; j <= thickness; j++)
				{
					if (i != 0 || j != 0)
					{
						GUI.Label(new Rect(((Rect)(ref r)).x + (float)i, ((Rect)(ref r)).y + (float)j, ((Rect)(ref r)).width, ((Rect)(ref r)).height), text, style);
					}
				}
			}
			style.normal.textColor = textColor;
		}

		private static Color ColorFromHSV(float h, float s, float v, float a = 1f)
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			h = Mathf.Repeat(h, 360f);
			s = Mathf.Clamp01(s);
			v = Mathf.Clamp01(v);
			float num = v * s;
			float num2 = num * (1f - Mathf.Abs(h / 60f % 2f - 1f));
			float num3 = v - num;
			float num4 = 0f;
			float num5 = 0f;
			float num6 = 0f;
			if (h < 60f)
			{
				num4 = num;
				num5 = num2;
				num6 = 0f;
			}
			else if (h < 120f)
			{
				num4 = num2;
				num5 = num;
				num6 = 0f;
			}
			else if (h < 180f)
			{
				num4 = 0f;
				num5 = num;
				num6 = num2;
			}
			else if (h < 240f)
			{
				num4 = 0f;
				num5 = num2;
				num6 = num;
			}
			else if (h < 300f)
			{
				num4 = num2;
				num5 = 0f;
				num6 = num;
			}
			else
			{
				num4 = num;
				num5 = 0f;
				num6 = num2;
			}
			return new Color(num4 + num3, num5 + num3, num6 + num3, a);
		}

		private void DrawQuad(Rect r, Color c)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GL.Begin(4);
			GL.Color(c);
			GL.Vertex3(((Rect)(ref r)).x, ((Rect)(ref r)).y, 0f);
			GL.Vertex3(((Rect)(ref r)).x + ((Rect)(ref r)).width, ((Rect)(ref r)).y, 0f);
			GL.Vertex3(((Rect)(ref r)).x + ((Rect)(ref r)).width, ((Rect)(ref r)).y + ((Rect)(ref r)).height, 0f);
			GL.Vertex3(((Rect)(ref r)).x, ((Rect)(ref r)).y, 0f);
			GL.Vertex3(((Rect)(ref r)).x + ((Rect)(ref r)).width, ((Rect)(ref r)).y + ((Rect)(ref r)).height, 0f);
			GL.Vertex3(((Rect)(ref r)).x, ((Rect)(ref r)).y + ((Rect)(ref r)).height, 0f);
			GL.End();
		}

		private void DrawFullscreenGradient(Color top, Color bottom)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			GL.Begin(7);
			GL.Color(top);
			GL.Vertex3(0f, 0f, 0f);
			GL.Vertex3((float)Screen.width, 0f, 0f);
			GL.Color(bottom);
			GL.Vertex3((float)Screen.width, (float)Screen.height, 0f);
			GL.Vertex3(0f, (float)Screen.height, 0f);
			GL.End();
		}

		private void DrawScanlines()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			int num = 3;
			float num2 = 0.06f + Mathf.Clamp(_smoothedEnergy * 0.04f, 0f, 0.12f);
			Color val = default(Color);
			((Color)(ref val))..ctor(0f, 0f, 0f, num2);
			GL.Begin(7);
			GL.Color(val);
			for (int i = 0; i < Screen.height; i += num)
			{
				GL.Vertex3(0f, (float)i, 0f);
				GL.Vertex3((float)Screen.width, (float)i, 0f);
				GL.Vertex3((float)Screen.width, (float)(i + 1), 0f);
				GL.Vertex3(0f, (float)(i + 1), 0f);
			}
			GL.End();
		}

		private Mesh CreateCubeMesh()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			Vector3[] vertices = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(-0.5f, -0.5f, -0.5f),
				new Vector3(0.5f, -0.5f, -0.5f),
				new Vector3(0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, 0.5f, -0.5f),
				new Vector3(-0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, -0.5f, 0.5f),
				new Vector3(0.5f, 0.5f, 0.5f),
				new Vector3(-0.5f, 0.5f, 0.5f)
			};
			int[] array = new int[36]
			{
				0, 2, 1, 0, 3, 2, 4, 5, 6, 4,
				6, 7, 0, 7, 3, 0, 4, 7, 1, 2,
				6, 1, 6, 5, 0, 1, 5, 0, 5, 4,
				3, 7, 6, 3, 6, 2
			};
			val.SetVertices(vertices);
			val.SetTriangles(array, 0);
			val.RecalculateNormals();
			val.RecalculateBounds();
			return val;
		}

		[IteratorStateMachine(typeof(<TryLoadAndPlayTrackCoroutine>d__88))]
		private IEnumerator TryLoadAndPlayTrackCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TryLoadAndPlayTrackCoroutine>d__88(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<LoadClipFromFile>d__89))]
		private IEnumerator LoadClipFromFile(string path, Action<AudioClip> done)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadClipFromFile>d__89(0)
			{
				<>4__this = this,
				path = path,
				done = done
			};
		}
	}
}