Decompiled source of Gamble Boot v1.0.0

GambleBoot.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
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: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GambleBoot")]
[assembly: AssemblyTitle("GambleBoot")]
[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 Omniscye.BootGamble
{
	[BepInPlugin("Omniscye.BootGamble", "BootGamble", "1.0.0")]
	public class BootGamble : BaseUnityPlugin
	{
		public const string PluginGuid = "Omniscye.BootGamble";

		public const string PluginName = "BootGamble";

		public const string PluginVersion = "1.0.0";

		internal static ConfigEntry<bool> CEnabled;

		internal static ConfigEntry<int> CPulls;

		internal static ConfigEntry<float> CVolume;

		internal static ConfigEntry<float> CStartChance;

		internal static ConfigEntry<bool> CRunOnlyOncePerLaunch;

		internal static BootGamble Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

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

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			CEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable the boot gambling gate.");
			CPulls = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Pulls", 10, "Number of spins before the game force-closes.");
			CVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 0.7f, "Master volume for slot sounds (0.0–1.0).");
			CStartChance = ((BaseUnityPlugin)this).Config.Bind<float>("Tuning", "JackpotChance", 0.35f, "Chance per symbol to be 7 (0.0–1.0).");
			CRunOnlyOncePerLaunch = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RunOncePerLaunch", true, "If true, gate runs only once per launch.");
			Patch();
			if (CEnabled.Value && (!GambleGate.HasRunThisLaunch || !CRunOnlyOncePerLaunch.Value))
			{
				GameObject val = new GameObject("Omniscye.BootGamble.Controller");
				((Object)val).hideFlags = (HideFlags)61;
				Object.DontDestroyOnLoad((Object)(object)val);
				val.AddComponent<GambleGate>();
			}
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} 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 class GambleGate : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <QuitAfterDelay>d__58 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float seconds;

			public GambleGate <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime(seconds);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					BootGamble.Logger.LogWarning((object)"BootGamble: No spins left → Force quitting.");
					Application.Quit();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

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

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

			private object <>2__current;

			public float seconds;

			public GambleGate <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime(seconds);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Time.timeScale = <>4__this._prevTimeScale;
					Cursor.lockState = <>4__this._prevCursorLock;
					Cursor.visible = <>4__this._prevCursorVisible;
					Object.Destroy((Object)(object)((Component)<>4__this).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();
			}
		}

		private bool _active;

		private static bool _hasRunThisLaunch;

		private float _prevTimeScale;

		private int _pullsRemaining;

		private bool _justWon;

		private bool _quitting;

		private bool _spinning;

		private string _statusMessage = "";

		private float _spinStartTime;

		private float _nextSymbolChangeTime;

		private readonly float[] _reelStopDelays = new float[3] { 0.7f, 1.3f, 1.9f };

		private readonly bool[] _reelStopped = new bool[3];

		private readonly Random _rng = new Random();

		private const int GridSize = 3;

		private const string WinSymbol = "7";

		private static readonly string[] LoserSymbols = new string[6] { "\ud83c\udf52", "\ud83c\udf4b", "\ud83c\udf4a", "\ud83c\udf47", "\ud83d\udd14", "BAR" };

		private static readonly string[] SpinningSymbols = new string[7] { "\ud83c\udf52", "\ud83c\udf4b", "\ud83c\udf4a", "\ud83c\udf47", "\ud83d\udd14", "BAR", "7" };

		private readonly string[,] _currentSymbols = new string[3, 3];

		private readonly string[,] _targetSymbols = new string[3, 3];

		private AudioSource _audio = null;

		private AudioClip _sndSpin = null;

		private AudioClip _sndClunk = null;

		private AudioClip _sndWin = null;

		private AudioClip _sndFail = null;

		private Texture2D _windowBg = null;

		private GUIStyle _title = null;

		private GUIStyle _statusStyle = null;

		private GUIStyle _cellOn = null;

		private GUIStyle _cellOff = null;

		private GUIStyle _label = null;

		private GUIStyle _button = null;

		private GUIStyle _bevelLight = null;

		private GUIStyle _bevelDark = null;

		private Rect _windowRect = new Rect(0f, 0f, 960f, 1000f);

		private bool _stylesBuilt;

		private int _cachedSkinId = -1;

		private bool _centered;

		private bool _prevCursorVisible;

		private CursorLockMode _prevCursorLock;

		internal static bool HasRunThisLaunch => _hasRunThisLaunch;

		private void Start()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			_hasRunThisLaunch = true;
			_pullsRemaining = Mathf.Max(1, BootGamble.CPulls.Value);
			_prevTimeScale = Time.timeScale;
			Time.timeScale = 0f;
			_active = true;
			_prevCursorVisible = Cursor.visible;
			_prevCursorLock = Cursor.lockState;
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			_audio = ((Component)this).gameObject.AddComponent<AudioSource>();
			_audio.spatialBlend = 0f;
			_audio.playOnAwake = false;
			_audio.volume = Mathf.Clamp01(BootGamble.CVolume.Value);
			BuildAudio();
			CreateWindowBg();
			InitializeGrid();
			BootGamble.Logger.LogInfo((object)$"GambleGate: ultimate slot active • spins={_pullsRemaining} • 7 chance={BootGamble.CStartChance.Value:0.00} • volume={_audio.volume:0.00}");
		}

		private void Update()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			if (!_active)
			{
				return;
			}
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			if (_justWon || _quitting)
			{
				float num = Mathf.Sin(Time.realtimeSinceStartup * 12f) * 0.5f + 0.5f;
				_statusStyle.normal.textColor = (_justWon ? Color.Lerp(new Color(1f, 0.2f, 0f), Color.yellow, num) : Color.Lerp(new Color(0.4f, 0f, 0f), new Color(0.8f, 0f, 0f), num));
			}
			if (!_spinning)
			{
				return;
			}
			float realtimeSinceStartup = Time.realtimeSinceStartup;
			float num2 = realtimeSinceStartup - _spinStartTime;
			bool flag = true;
			for (int i = 0; i < 3; i++)
			{
				if (_reelStopped[i])
				{
					continue;
				}
				flag = false;
				if (num2 >= _reelStopDelays[i])
				{
					_reelStopped[i] = true;
					for (int j = 0; j < 3; j++)
					{
						_currentSymbols[j, i] = _targetSymbols[j, i];
					}
					_audio.PlayOneShot(_sndClunk);
				}
				else if (realtimeSinceStartup >= _nextSymbolChangeTime)
				{
					_nextSymbolChangeTime = realtimeSinceStartup + 0.07f;
					for (int k = 0; k < 3; k++)
					{
						_currentSymbols[k, i] = SpinningSymbols[_rng.Next(SpinningSymbols.Length)];
					}
				}
			}
			if (flag)
			{
				_spinning = false;
				if (CheckWin())
				{
					_justWon = true;
					_statusMessage = "★★★ JACKPOT ★★★";
					_audio.PlayOneShot(_sndWin);
					((MonoBehaviour)this).StartCoroutine(ResumeAfterDelay(4f));
				}
				else if (_pullsRemaining <= 0)
				{
					_quitting = true;
					_statusMessage = "GAME OVER";
					_audio.PlayOneShot(_sndFail);
					((MonoBehaviour)this).StartCoroutine(QuitAfterDelay(3.5f));
				}
			}
		}

		private void CreateWindowBg()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			_windowBg = new Texture2D(1, 256);
			for (int i = 0; i < 256; i++)
			{
				float num = (float)i / 255f;
				Color val = Color.Lerp(new Color(0.02f, 0.02f, 0.08f), new Color(0.15f, 0f, 0.2f), num);
				_windowBg.SetPixel(0, i, val);
			}
			_windowBg.Apply();
		}

		private void BuildAudio()
		{
			_sndSpin = CreateSpinSound();
			_sndClunk = CreateClunkSound();
			AudioClip val = Sine(523f, 0.15f);
			AudioClip val2 = Sine(659f, 0.15f);
			AudioClip val3 = Sine(880f, 0.15f);
			AudioClip val4 = Sine(1319f, 0.2f);
			AudioClip val5 = Sine(1760f, 0.4f);
			_sndWin = Concat(val, val2, val3, val4, val5);
			AudioClip val6 = Sine(300f, 0.3f);
			AudioClip val7 = Sine(200f, 0.4f);
			AudioClip val8 = Sine(100f, 0.6f);
			_sndFail = Concat(val6, val7, val8);
		}

		private AudioClip CreateSpinSound()
		{
			int num = 44100;
			float num2 = 2.3f;
			int num3 = Mathf.CeilToInt((float)num * num2);
			float[] array = new float[num3];
			for (int i = 0; i < num3; i++)
			{
				float num4 = (float)i / (float)num;
				float num5 = 1400f - num4 * 700f;
				array[i] = Mathf.Sin(num4 * num5 * 0.12f) * (1f - num4 / num2) * 0.8f;
				array[i] += (float)(_rng.NextDouble() * 2.0 - 1.0) * 0.25f * (1f - num4 / num2);
			}
			AudioClip val = AudioClip.Create("slot_spin", num3, 1, num, false);
			val.SetData(array, 0);
			return val;
		}

		private AudioClip CreateClunkSound()
		{
			int num = 44100;
			float num2 = 0.22f;
			int num3 = Mathf.CeilToInt((float)num * num2);
			float[] array = new float[num3];
			for (int i = 0; i < num3; i++)
			{
				float num4 = (float)i / (float)num;
				array[i] = Mathf.Sin(180f * num4 * MathF.PI * 2f) * Mathf.Exp((0f - num4) * 10f) + (float)_rng.NextDouble() * 0.3f * Mathf.Exp((0f - num4) * 6f);
			}
			AudioClip val = AudioClip.Create("clunk", num3, 1, num, false);
			val.SetData(array, 0);
			return val;
		}

		private static AudioClip Sine(float hz, float seconds)
		{
			int num = 44100;
			int num2 = Mathf.CeilToInt((float)num * seconds);
			float[] array = new float[num2];
			float num3 = MathF.PI * 2f * hz / (float)num;
			float num4 = 0f;
			for (int i = 0; i < num2; i++)
			{
				array[i] = Mathf.Sin(num4) * 0.9f;
				num4 += num3;
			}
			AudioClip val = AudioClip.Create($"tone_{hz:0}", num2, 1, num, false);
			val.SetData(array, 0);
			return val;
		}

		private static AudioClip Concat(params AudioClip[] clips)
		{
			if (clips.Length == 0)
			{
				return Sine(440f, 0.01f);
			}
			int frequency = clips[0].frequency;
			int channels = clips[0].channels;
			int num = 0;
			foreach (AudioClip val in clips)
			{
				num += val.samples * channels;
			}
			float[] array = new float[num];
			int num2 = 0;
			foreach (AudioClip val2 in clips)
			{
				float[] array2 = new float[val2.samples * channels];
				val2.GetData(array2, 0);
				Array.Copy(array2, 0, array, num2, array2.Length);
				num2 += array2.Length;
			}
			AudioClip val3 = AudioClip.Create("combined", num / channels, channels, frequency, false);
			val3.SetData(array, 0);
			return val3;
		}

		private void InitializeGrid()
		{
			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j < 3; j++)
				{
					_currentSymbols[i, j] = "";
				}
			}
		}

		private void GenerateTargetGrid()
		{
			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j < 3; j++)
				{
					_targetSymbols[i, j] = ((_rng.NextDouble() < (double)BootGamble.CStartChance.Value) ? "7" : LoserSymbols[_rng.Next(LoserSymbols.Length)]);
				}
			}
		}

		private bool CheckWin()
		{
			for (int i = 0; i < 3; i++)
			{
				if (_targetSymbols[i, 0] == "7" && _targetSymbols[i, 1] == "7" && _targetSymbols[i, 2] == "7")
				{
					return true;
				}
			}
			for (int j = 0; j < 3; j++)
			{
				if (_targetSymbols[0, j] == "7" && _targetSymbols[1, j] == "7" && _targetSymbols[2, j] == "7")
				{
					return true;
				}
			}
			if (_targetSymbols[0, 0] == "7" && _targetSymbols[1, 1] == "7" && _targetSymbols[2, 2] == "7")
			{
				return true;
			}
			if (_targetSymbols[0, 2] == "7" && _targetSymbols[1, 1] == "7" && _targetSymbols[2, 0] == "7")
			{
				return true;
			}
			return false;
		}

		private void BuildStyles(GUISkin skin)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001e: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0052: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0086: Expected O, but got Unknown
			//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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_00cf: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01d3: 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_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(skin.label)
			{
				fontSize = 52,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			val.normal.textColor = new Color(1f, 0.85f, 0.2f);
			_title = val;
			GUIStyle val2 = new GUIStyle(skin.label)
			{
				fontSize = 84,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			val2.normal.textColor = Color.red;
			_statusStyle = val2;
			GUIStyle val3 = new GUIStyle(skin.label)
			{
				fontSize = 26,
				alignment = (TextAnchor)4
			};
			val3.normal.textColor = new Color(0.8f, 0.9f, 1f);
			_label = val3;
			GUIStyle val4 = new GUIStyle(skin.box);
			val4.normal.background = MakeTex(4, 4, new Color(1f, 0.15f, 0.05f));
			_cellOn = val4;
			GUIStyle val5 = new GUIStyle(skin.box);
			val5.normal.background = MakeTex(4, 4, new Color(0.08f, 0.08f, 0.22f));
			_cellOff = val5;
			GUIStyle val6 = new GUIStyle(skin.button)
			{
				fontSize = 42,
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			};
			val6.normal.textColor = Color.white;
			val6.normal.background = MakeTex(4, 4, new Color(0.9f, 0.05f, 0.05f));
			val6.hover.textColor = Color.yellow;
			val6.hover.background = MakeTex(4, 4, new Color(1f, 0.2f, 0.1f));
			_button = val6;
			GUIStyle val7 = new GUIStyle();
			val7.normal.background = MakeTex(2, 2, new Color(1f, 1f, 1f, 0.55f));
			_bevelLight = val7;
			GUIStyle val8 = new GUIStyle();
			val8.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0f, 0.6f));
			_bevelDark = val8;
			_stylesBuilt = true;
			_cachedSkinId = ((Object)skin).GetInstanceID();
		}

		private static Texture2D MakeTex(int width, int height, Color col)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private Rect Centered(Rect r)
		{
			//IL_0039: 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)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			((Rect)(ref r)).x = ((float)Screen.width - ((Rect)(ref r)).width) * 0.5f;
			((Rect)(ref r)).y = ((float)Screen.height - ((Rect)(ref r)).height) * 0.5f;
			return r;
		}

		private void OnGUI()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_008e: 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_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_005e: Unknown result type (might be due to invalid IL or missing references)
			if (_active)
			{
				if (!_stylesBuilt || _cachedSkinId != ((Object)GUI.skin).GetInstanceID())
				{
					BuildStyles(GUI.skin);
				}
				if (!_centered)
				{
					_windowRect = Centered(_windowRect);
					_centered = true;
				}
				_windowRect = GUILayout.Window(((Object)this).GetInstanceID(), _windowRect, new WindowFunction(DrawWindow), "", Array.Empty<GUILayoutOption>());
			}
		}

		private void DrawWindow(int id)
		{
			//IL_0021: 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_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Expected O, but got Unknown
			//IL_022d: Expected O, but got Unknown
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Expected O, but got Unknown
			GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height), (Texture)(object)_windowBg, (ScaleMode)0);
			GUILayout.Space(20f);
			GUILayout.Label("\ud83c\udfb0\ud83c\udfb0\ud83c\udfb0  BOOT SLOT  \ud83c\udfb0\ud83c\udfb0\ud83c\udfb0", _title, Array.Empty<GUILayoutOption>());
			GUILayout.Space(15f);
			GUILayout.Label("Land three 7's on any payline to launch the game", _label, Array.Empty<GUILayoutOption>());
			GUILayout.Label("(rows • columns • both diagonals count)", _label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(40f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < 3; i++)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.FlexibleSpace();
				for (int j = 0; j < 3; j++)
				{
					string text = _currentSymbols[i, j];
					bool flag = text == "7";
					GUIStyle val = (flag ? _cellOn : _cellOff);
					GUILayout.Box("", val, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(220f),
						GUILayout.Height(160f)
					});
					Rect lastRect = GUILayoutUtility.GetLastRect();
					GUI.Box(new Rect(((Rect)(ref lastRect)).x - 7f, ((Rect)(ref lastRect)).y - 7f, ((Rect)(ref lastRect)).width, ((Rect)(ref lastRect)).height), "", _bevelDark);
					GUI.Box(new Rect(((Rect)(ref lastRect)).x + 7f, ((Rect)(ref lastRect)).y + 7f, ((Rect)(ref lastRect)).width, ((Rect)(ref lastRect)).height), "", _bevelLight);
					if (!string.IsNullOrEmpty(text))
					{
						GUIStyle val2 = new GUIStyle(_label)
						{
							fontSize = (flag ? 120 : 90),
							alignment = (TextAnchor)4,
							fontStyle = (FontStyle)1
						};
						val2.normal.textColor = (flag ? new Color(1f, 1f, 0.3f) : new Color(1f, 1f, 1f));
						GUIStyle val3 = val2;
						if (flag)
						{
							for (int k = -5; k <= 5; k++)
							{
								for (int l = -5; l <= 5; l++)
								{
									if (Mathf.Abs(k) + Mathf.Abs(l) <= 6)
									{
										Rect val4 = new Rect(((Rect)(ref lastRect)).x + (float)k, ((Rect)(ref lastRect)).y + (float)l, ((Rect)(ref lastRect)).width, ((Rect)(ref lastRect)).height);
										GUIStyle val5 = new GUIStyle(val3);
										val5.normal.textColor = new Color(0.9f, 0f, 0f);
										GUI.Label(val4, text, val5);
									}
								}
							}
						}
						GUI.Label(lastRect, text, val3);
					}
					if (j < 2)
					{
						GUILayout.Space(35f);
					}
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
				if (i < 2)
				{
					GUILayout.Space(35f);
				}
			}
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(40f);
			if (!string.IsNullOrEmpty(_statusMessage))
			{
				GUILayout.Label(_statusMessage, _statusStyle, Array.Empty<GUILayoutOption>());
				Rect lastRect2 = GUILayoutUtility.GetLastRect();
				Color textColor = (_justWon ? new Color(1f, 0.9f, 0f) : new Color(0.1f, 0f, 0f));
				for (int m = -6; m <= 6; m++)
				{
					for (int n = -6; n <= 6; n++)
					{
						if (m * m + n * n <= 50)
						{
							Rect val6 = new Rect(((Rect)(ref lastRect2)).x + (float)m, ((Rect)(ref lastRect2)).y + (float)n, ((Rect)(ref lastRect2)).width, ((Rect)(ref lastRect2)).height);
							string statusMessage = _statusMessage;
							GUIStyle val7 = new GUIStyle(_statusStyle);
							val7.normal.textColor = textColor;
							GUI.Label(val6, statusMessage, val7);
						}
					}
				}
				GUILayout.Space(30f);
			}
			GUILayout.Label($"Spins remaining: {_pullsRemaining}", _label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(30f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUI.enabled = _pullsRemaining > 0 && !_spinning && !_justWon && !_quitting;
			if (GUILayout.Button("PULL LEVER!", _button, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(420f),
				GUILayout.Height(100f)
			}))
			{
				_pullsRemaining--;
				GenerateTargetGrid();
				Array.Clear(_reelStopped, 0, 3);
				_spinStartTime = Time.realtimeSinceStartup;
				_nextSymbolChangeTime = 0f;
				_spinning = true;
				_statusMessage = "";
				_audio.PlayOneShot(_sndSpin);
			}
			GUI.enabled = true;
			Rect lastRect3 = GUILayoutUtility.GetLastRect();
			GUI.Box(new Rect(((Rect)(ref lastRect3)).x + 10f, ((Rect)(ref lastRect3)).y + 10f, ((Rect)(ref lastRect3)).width, ((Rect)(ref lastRect3)).height), "", _bevelDark);
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(30f);
			GUILayout.Label("No mercy. Spin or the game force-closes forever.", _label, Array.Empty<GUILayoutOption>());
			GUI.DragWindow();
		}

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

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

		private void OnDestroy()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (_active)
			{
				Time.timeScale = _prevTimeScale;
				Cursor.lockState = _prevCursorLock;
				Cursor.visible = _prevCursorVisible;
			}
		}
	}
}