Decompiled source of MICRO v0.3.3

plugins/MICRO/Micro.dll

Decompiled 12 hours 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.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using EntityStates;
using EntityStates.Toolbot;
using EthranetExplorer;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.Toolbot;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Micro")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.3.3.0")]
[assembly: AssemblyInformationalVersion("0.3.3")]
[assembly: AssemblyProduct("Micro")]
[assembly: AssemblyTitle("Micro")]
[assembly: AssemblyVersion("0.3.3.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 Micro
{
	internal static class AuthoredContent
	{
		internal static readonly Dictionary<string, AuthorAsset> Assets = new Dictionary<string, AuthorAsset>();

		private static readonly Dictionary<string, Texture2D?> textures = new Dictionary<string, Texture2D>();

		internal static void Load(Action<string> log)
		{
			Assembly assembly = typeof(Plugin).Assembly;
			HashSet<string> hashSet = new HashSet<string>();
			List<MicrogameKind> list = new List<MicrogameKind>();
			List<string> list2 = new List<string>();
			string[] manifestResourceNames = assembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				if (text.StartsWith("Micro.Authored.", StringComparison.Ordinal))
				{
					list2.Add(text);
				}
			}
			list2.Sort(StringComparer.Ordinal);
			foreach (string item in list2)
			{
				try
				{
					using Stream stream = assembly.GetManifestResourceStream(item);
					if (stream.Length > 12582912)
					{
						throw new InvalidDataException("Design exceeds 12 MB.");
					}
					using StreamReader streamReader = new StreamReader(stream);
					string text2 = streamReader.ReadToEnd();
					AuthorPack pack = JsonUtility.FromJson<AuthorPack>(text2);
					string text3 = AuthoredRules.Validate(pack);
					if (text3.Length > 0)
					{
						throw new InvalidDataException(text3);
					}
					if (hashSet.Contains(pack.id))
					{
						throw new InvalidDataException("Duplicate design ID.");
					}
					AuthorGame[] games = pack.games;
					foreach (AuthorGame authorGame in games)
					{
						if (AuthoredCatalog.Game(authorGame.slot) != null)
						{
							throw new InvalidDataException("Microgame slot is already used: " + authorGame.slot);
						}
					}
					hashSet.Add(pack.id);
					AuthorAsset[] assets = pack.assets;
					foreach (AuthorAsset authorAsset in assets)
					{
						Assets.Add(pack.id + "/" + authorAsset.id, authorAsset);
					}
					games = pack.games;
					foreach (AuthorGame authorGame2 in games)
					{
						Prefix(authorGame2.elements);
						AuthoredCatalog.Register(authorGame2);
						list.Add((MicrogameKind)authorGame2.slot);
					}
					log("Loaded compiled design " + pack.name + ": " + pack.pages.Length + " pages, " + pack.games.Length + " games.");
					void Prefix(AuthorElement[] elements)
					{
						foreach (AuthorElement authorElement in elements)
						{
							if (authorElement.image.Length > 0)
							{
								authorElement.image = pack.id + "/" + authorElement.image;
							}
						}
					}
				}
				catch (Exception ex)
				{
					log("Skipped compiled design " + item + ": " + ex.Message);
				}
			}
			Microgames.AddAuthored(list.ToArray());
		}

		internal static Texture2D? Texture(string id)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0046: Expected O, but got Unknown
			if (textures.TryGetValue(id, out Texture2D value))
			{
				return value;
			}
			textures[id] = null;
			if (!Assets.TryGetValue(id, out AuthorAsset value2))
			{
				return null;
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			try
			{
				if (!ImageConversion.LoadImage(val, Convert.FromBase64String(value2.data), true) || ((Texture)val).width > 2048 || ((Texture)val).height > 2048)
				{
					Object.Destroy((Object)(object)val);
					return null;
				}
				textures[id] = val;
				return val;
			}
			catch
			{
				Object.Destroy((Object)(object)val);
				return null;
			}
		}

		internal static void Dispose()
		{
			foreach (Texture2D value in textures.Values)
			{
				if (Object.op_Implicit((Object)(object)value))
				{
					Object.Destroy((Object)(object)value);
				}
			}
			textures.Clear();
		}
	}
	[Serializable]
	public sealed class AuthorPack
	{
		public int schema = 1;

		public string id = "";

		public string name = "";

		public AuthorPage[] pages = Array.Empty<AuthorPage>();

		public AuthorGame[] games = Array.Empty<AuthorGame>();

		public AuthorAsset[] assets = Array.Empty<AuthorAsset>();
	}
	[Serializable]
	public sealed class AuthorAsset
	{
		public string id = "";

		public string data = "";
	}
	[Serializable]
	public sealed class AuthorPage
	{
		public string address = "";

		public string title = "";

		public string background = "#ffffff";

		public string service = "None";

		public int height = 500;

		public AuthorElement[] elements = Array.Empty<AuthorElement>();
	}
	[Serializable]
	public sealed class AuthorGame
	{
		public int slot = 128;

		public string title = "";

		public string command = "CLICK!";

		public string mode = "click";

		public string background = "#008080";

		public float seconds = 8f;

		public float speed = 170f;

		public AuthorElement[] elements = Array.Empty<AuthorElement>();
	}
	[Serializable]
	public sealed class AuthorElement
	{
		public string id = "";

		public string kind = "box";

		public string label = "";

		public string color = "#ffffff";

		public string image = "";

		public string target = "";

		public float x;

		public float y;

		public float w = 100f;

		public float h = 40f;

		public float vx;

		public float vy;

		public int font = 16;
	}
	public static class AuthoredRules
	{
		private static string NormalizeAddress(string address)
		{
			if (!Uri.TryCreate(address, UriKind.Absolute, out Uri result) || (!(result.Scheme == "http") && !(result.Scheme == "https")) || !string.IsNullOrEmpty(result.UserInfo))
			{
				return "";
			}
			return result.GetLeftPart(UriPartial.Path).TrimEnd('/') + result.Query;
		}

		public static bool Identifier(string id)
		{
			if (string.IsNullOrEmpty(id) || id.Length > 48)
			{
				return false;
			}
			foreach (char c in id)
			{
				if (!char.IsLetterOrDigit(c) && c != '-' && c != '_' && c != '.')
				{
					return false;
				}
			}
			return true;
		}

		public static bool Hex(string value)
		{
			if (value == null || value.Length != 7 || value[0] != '#')
			{
				return false;
			}
			for (int i = 1; i < 7; i++)
			{
				if (!Uri.IsHexDigit(value[i]))
				{
					return false;
				}
			}
			return true;
		}

		private static bool Finite(float value)
		{
			if (!float.IsNaN(value))
			{
				return !float.IsInfinity(value);
			}
			return false;
		}

		public static string Validate(AuthorPack pack)
		{
			if (pack == null || pack.schema != 1 || !Identifier(pack.id) || string.IsNullOrWhiteSpace(pack.name) || pack.name.Length > 80)
			{
				return "Pack requires schema 1, an ID and a name (up to 80 characters).";
			}
			if (pack.pages == null || pack.games == null || pack.assets == null || pack.pages.Length > 24 || pack.games.Length > 32 || pack.assets.Length > 32)
			{
				return "Pack limits: 24 pages, 32 games and 32 images.";
			}
			HashSet<string> assets = new HashSet<string>();
			AuthorAsset[] assets2 = pack.assets;
			foreach (AuthorAsset authorAsset in assets2)
			{
				if (authorAsset == null || !Identifier(authorAsset.id) || !assets.Add(authorAsset.id) || string.IsNullOrEmpty(authorAsset.data) || authorAsset.data.Length > 1400000)
				{
					return "Images need unique IDs and must be below 1 MB each.";
				}
				try
				{
					Convert.FromBase64String(authorAsset.data);
				}
				catch (FormatException)
				{
					return "Invalid image base64.";
				}
			}
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			HashSet<int> hashSet2 = new HashSet<int>();
			AuthorPage[] pages = pack.pages;
			foreach (AuthorPage authorPage in pages)
			{
				if (authorPage == null || string.IsNullOrWhiteSpace(authorPage.title) || authorPage.title.Length > 80 || !Hex(authorPage.background) || authorPage.height < 360 || authorPage.height > 2400)
				{
					return "Pages require a title, valid background and height 360–2400.";
				}
				string text = NormalizeAddress(authorPage.address);
				if (text.Length == 0 || !hashSet.Add(text) || (!(authorPage.service == "None") && !(authorPage.service == "EShop") && !(authorPage.service == "MarketBuying") && !(authorPage.service == "MarketSelling")))
				{
					return "Pages require unique addresses and a supported service.";
				}
				string text2 = Elements(authorPage.elements, authorPage.height, game: false);
				if (text2.Length > 0)
				{
					return text2;
				}
			}
			AuthorGame[] games = pack.games;
			foreach (AuthorGame authorGame in games)
			{
				if (authorGame == null || authorGame.slot < 128 || authorGame.slot > 223 || !hashSet2.Add(authorGame.slot) || string.IsNullOrWhiteSpace(authorGame.title) || authorGame.title.Length > 80 || string.IsNullOrWhiteSpace(authorGame.command) || authorGame.command.Length > 20 || !Hex(authorGame.background) || !Finite(authorGame.seconds) || authorGame.seconds < 2f || authorGame.seconds > 30f || !Finite(authorGame.speed) || authorGame.speed < 20f || authorGame.speed > 400f)
				{
					return "Games require a unique slot 128–223, title, short cue, duration 2–30 and speed 20–400.";
				}
				if (authorGame.mode != "click" && authorGame.mode != "sequence" && authorGame.mode != "move" && authorGame.mode != "survive")
				{
					return "Unsupported microgame template.";
				}
				string text3 = Elements(authorGame.elements, 360, game: true);
				if (text3.Length > 0)
				{
					return text3;
				}
				int num = 0;
				int num2 = 0;
				int num3 = 0;
				int num4 = 0;
				AuthorElement[] elements = authorGame.elements;
				foreach (AuthorElement obj in elements)
				{
					if (obj.kind == "target")
					{
						num++;
					}
					if (obj.kind == "player")
					{
						num2++;
					}
					if (obj.kind == "goal")
					{
						num3++;
					}
					if (obj.kind == "hazard")
					{
						num4++;
					}
				}
				if ((authorGame.mode == "click" || authorGame.mode == "sequence") && num == 0)
				{
					return "Click games need at least one target.";
				}
				if ((authorGame.mode == "move" || authorGame.mode == "survive") && num2 != 1)
				{
					return "Movement games need exactly one player.";
				}
				if (authorGame.mode == "move" && num3 == 0)
				{
					return "Reach-the-goal games need a goal.";
				}
				if (authorGame.mode == "survive" && num4 == 0)
				{
					return "Survival games need a hazard.";
				}
				elements = authorGame.elements;
				foreach (AuthorElement authorElement in elements)
				{
					if (!(authorElement.kind == "player"))
					{
						continue;
					}
					AuthorElement[] elements2 = authorGame.elements;
					foreach (AuthorElement authorElement2 in elements2)
					{
						if ((authorElement2.kind == "hazard" || (authorGame.mode == "move" && authorElement2.kind == "goal")) && Overlaps(authorElement.x, authorElement.y, authorElement.w, authorElement.h, authorElement2.x, authorElement2.y, authorElement2.w, authorElement2.h))
						{
							return "The player must start clear of hazards and goals.";
						}
					}
				}
			}
			return "";
			string Elements(AuthorElement[] rows, int height, bool game)
			{
				if (rows == null || rows.Length > 48)
				{
					return "Each scene supports at most 48 elements.";
				}
				HashSet<string> hashSet3 = new HashSet<string>();
				foreach (AuthorElement authorElement3 in rows)
				{
					if (authorElement3 == null || !Identifier(authorElement3.id) || !hashSet3.Add(authorElement3.id) || !Hex(authorElement3.color) || authorElement3.label == null || authorElement3.label.Length > 1000 || authorElement3.image == null || authorElement3.target == null)
					{
						return "Elements require unique IDs, valid colors and bounded text.";
					}
					if (!Finite(authorElement3.x) || !Finite(authorElement3.y) || !Finite(authorElement3.w) || !Finite(authorElement3.h) || !Finite(authorElement3.vx) || !Finite(authorElement3.vy) || authorElement3.x < 0f || authorElement3.y < 0f || authorElement3.w < 8f || authorElement3.h < 8f || authorElement3.x + authorElement3.w > 800f || authorElement3.y + authorElement3.h > (float)height || Math.Abs(authorElement3.vx) > 400f || Math.Abs(authorElement3.vy) > 400f || authorElement3.font < 8 || authorElement3.font > 52)
					{
						return "Elements must fit the canvas; font 8–52 and velocity -400–400.";
					}
					if (authorElement3.image.Length > 0 && !assets.Contains(authorElement3.image))
					{
						return "An element refers to a missing image.";
					}
					if (!(authorElement3.kind == "box") && !(authorElement3.kind == "text") && !(authorElement3.kind == "image"))
					{
						bool num6;
						if (!game)
						{
							num6 = authorElement3.kind == "link";
						}
						else
						{
							if (authorElement3.kind == "target" || authorElement3.kind == "hazard" || authorElement3.kind == "player")
							{
								goto IL_023d;
							}
							num6 = authorElement3.kind == "goal";
						}
						if (!num6)
						{
							return "Unsupported element type.";
						}
					}
					goto IL_023d;
					IL_023d:
					if (authorElement3.kind == "link" && NormalizeAddress(authorElement3.target).Length == 0)
					{
						return "Links require an http(s) address for a registered in-game page.";
					}
					if (authorElement3.kind == "image" && authorElement3.image.Length == 0)
					{
						return "Image elements require an image.";
					}
				}
				return "";
			}
		}

		public static bool Overlaps(float x, float y, float w, float h, float bx, float by, float bw, float bh)
		{
			if (x < bx + bw && x + w > bx && y < by + bh)
			{
				return y + h > by;
			}
			return false;
		}

		public static float Position(float start, float velocity, float time, float extent)
		{
			if (extent <= 0f)
			{
				return 0f;
			}
			float num = (start + velocity * time) % (extent * 2f);
			if (num < 0f)
			{
				num += extent * 2f;
			}
			if (!(num <= extent))
			{
				return extent * 2f - num;
			}
			return num;
		}
	}
	public static class AuthoredCatalog
	{
		private static readonly Dictionary<int, AuthorGame> games = new Dictionary<int, AuthorGame>();

		public static AuthorGame? Game(int slot)
		{
			if (!games.TryGetValue(slot, out AuthorGame value))
			{
				return null;
			}
			return value;
		}

		public static void Register(AuthorGame game)
		{
			games.Add(game.slot, game);
		}
	}
	public sealed class AuthoredRound
	{
		public readonly AuthorGame Game;

		public ulong Mask;

		public float X;

		public float Y;

		public float Elapsed;

		public int Outcome;

		private int player = -1;

		public AuthoredRound(AuthorGame game)
		{
			Game = game;
			for (int i = 0; i < game.elements.Length; i++)
			{
				if (game.elements[i].kind == "player")
				{
					player = i;
					X = game.elements[i].x;
					Y = game.elements[i].y;
				}
			}
		}

		public (float X, float Y) Position(int index, float time, float speed)
		{
			AuthorElement authorElement = Game.elements[index];
			if (index == player)
			{
				return (X: X, Y: Y);
			}
			return (X: AuthoredRules.Position(authorElement.x, authorElement.vx, time * speed, 800f - authorElement.w), Y: AuthoredRules.Position(authorElement.y, authorElement.vy, time * speed, 360f - authorElement.h));
		}

		public int Click(int index)
		{
			if (Outcome != 0 || index < 0 || index >= Game.elements.Length)
			{
				return 0;
			}
			AuthorElement authorElement = Game.elements[index];
			if (Game.mode != "click" && Game.mode != "sequence")
			{
				return 0;
			}
			if (authorElement.kind == "hazard" && Elapsed >= 0.6f)
			{
				return Outcome = -1;
			}
			if ((Game.mode != "click" && Game.mode != "sequence") || authorElement.kind != "target" || (Mask & (ulong)(1L << index)) != 0L)
			{
				return 0;
			}
			if (Game.mode == "sequence")
			{
				for (int i = 0; i < index; i++)
				{
					if (Game.elements[i].kind == "target" && (Mask & (ulong)(1L << i)) == 0L)
					{
						if (!(Elapsed >= 0.6f))
						{
							return 0;
						}
						return Outcome = -1;
					}
				}
			}
			Mask |= (ulong)(1L << index);
			for (int j = 0; j < Game.elements.Length; j++)
			{
				if (Game.elements[j].kind == "target" && (Mask & (ulong)(1L << j)) == 0L)
				{
					return 0;
				}
			}
			return Outcome = 1;
		}

		public int Step(float dt, float speed, float duration, float inputX, float inputY)
		{
			if (Outcome != 0)
			{
				return 0;
			}
			Elapsed += Math.Max(0f, dt);
			if (player >= 0)
			{
				AuthorElement authorElement = Game.elements[player];
				float num = (float)Math.Sqrt(inputX * inputX + inputY * inputY);
				if (num > 1f)
				{
					inputX /= num;
					inputY /= num;
				}
				X = Math.Max(0f, Math.Min(800f - authorElement.w, X + inputX * Game.speed * dt));
				Y = Math.Max(0f, Math.Min(360f - authorElement.h, Y + inputY * Game.speed * dt));
				bool flag = false;
				for (int i = 0; i < Game.elements.Length; i++)
				{
					AuthorElement authorElement2 = Game.elements[i];
					(float, float) tuple = Position(i, Elapsed, speed);
					if (AuthoredRules.Overlaps(X, Y, authorElement.w, authorElement.h, tuple.Item1, tuple.Item2, authorElement2.w, authorElement2.h))
					{
						if (authorElement2.kind == "hazard" && Elapsed >= 0.6f)
						{
							return Outcome = -1;
						}
						if (authorElement2.kind == "goal")
						{
							flag = true;
						}
					}
				}
				if (Game.mode == "move" && flag)
				{
					return Outcome = 1;
				}
			}
			if (Elapsed >= duration)
			{
				return Outcome = ((Game.mode == "survive") ? 1 : (-1));
			}
			return 0;
		}
	}
	internal static class MicroView
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_InstantiatePauseScreen <0>__Pause;
		}

		private static readonly Color[] BlockColors = (Color[])(object)new Color[7]
		{
			new Color(0f, 0.85f, 0.85f),
			new Color(1f, 0.85f, 0f),
			new Color(0.7f, 0.15f, 0.8f),
			new Color(1f, 0.5f, 0f),
			new Color(0.15f, 0.3f, 1f),
			new Color(0.2f, 0.85f, 0.2f),
			new Color(0.95f, 0.15f, 0.15f)
		};

		private static MicroController? local;

		private static DesktopInputScope? focus;

		private static StagePreviewCamera? preview;

		private static int hovered = -1;

		private static int previewPage = -1;

		private static GUIStyle? text;

		private static GUIStyle? large;

		private static GUIStyle? buttonText;

		private static GUIStyle? tileText;

		private static MicroFeedback? feedback;

		private static Texture2D? cursor;

		private static GameObject? ui;

		private static readonly Color Gray = new Color(0.75f, 0.75f, 0.75f);

		private static readonly Color Navy = new Color(0.03f, 0.04f, 0.45f);

		private static int customMove;

		private static bool acceptUiInput;

		private static float chipMoveAt;

		private static float softDropAt;

		private static Color AuthorColor(string hex)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			ColorUtility.TryParseHtmlString(hex, ref result);
			return result;
		}

		private static void AuthorElementDraw(Rect rect, AuthorElement element, float scale)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//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_0082: 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_0091: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			bool flag = element.kind == "text" || element.kind == "link";
			if (!flag)
			{
				Fill(rect, AuthorColor(element.color));
			}
			if (element.image.Length > 0)
			{
				Texture2D val = AuthoredContent.Texture(element.image);
				if (Object.op_Implicit((Object)(object)val))
				{
					GUI.DrawTexture(rect, (Texture)(object)val, (ScaleMode)2);
				}
			}
			GUIStyle val2 = new GUIStyle(text)
			{
				fontSize = Mathf.RoundToInt((float)element.font * scale),
				alignment = (TextAnchor)4,
				wordWrap = true
			};
			val2.normal.textColor = (flag ? AuthorColor(element.color) : Color.white);
			if (element.label.Length > 0)
			{
				Label(rect, element.label, val2);
			}
			if (element.kind == "link")
			{
				Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 2f, ((Rect)(ref rect)).width, 1f), AuthorColor(element.color));
			}
		}

		private static void DrawAuthoredGame(GameSession actor, Vector2 pointer)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			AuthoredRound customRound = actor.CustomRound;
			if (customRound == null)
			{
				return;
			}
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(145f, 144f, 670f, 301.5f);
			Fill(rect, AuthorColor(customRound.Game.background));
			float time = (actor.GameResolved ? actor.ResolvedElapsed : (actor.Duration - actor.Remaining));
			for (int i = 0; i < customRound.Game.elements.Length; i++)
			{
				AuthorElement authorElement = customRound.Game.elements[i];
				(float, float) tuple = customRound.Position(i, time, actor.GameSpeed);
				Rect rect2 = new Rect(((Rect)(ref rect)).x + tuple.Item1 * 0.8375f, ((Rect)(ref rect)).y + tuple.Item2 * 0.8375f, authorElement.w * 0.8375f, authorElement.h * 0.8375f);
				bool num = (customRound.Mask & (ulong)(1L << i)) != 0;
				Color color = GUI.color;
				if (num)
				{
					GUI.color = new Color(1f, 1f, 1f, 0.35f);
				}
				AuthorElementDraw(rect2, authorElement, 0.8375f);
				GUI.color = color;
			}
			if ((int)Event.current.type != 0)
			{
				return;
			}
			for (int num2 = customRound.Game.elements.Length - 1; num2 >= 0; num2--)
			{
				AuthorElement authorElement2 = customRound.Game.elements[num2];
				if (!(authorElement2.kind != "target") || !(authorElement2.kind != "hazard"))
				{
					(float, float) tuple2 = customRound.Position(num2, time, actor.GameSpeed);
					if (Clicked(new Rect(((Rect)(ref rect)).x + tuple2.Item1 * 0.8375f, ((Rect)(ref rect)).y + tuple2.Item2 * 0.8375f, authorElement2.w * 0.8375f, authorElement2.h * 0.8375f), pointer))
					{
						Send(num2);
						break;
					}
				}
			}
		}

		private static void Fill(Rect rect, Color color)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color2;
		}

		private static void Bevel(Rect rect, Color face, bool inset = false)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_0067: 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_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)
			Fill(rect, inset ? Color.black : Color.white);
			Fill(new Rect(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width - 2f, ((Rect)(ref rect)).height - 2f), (Color)(inset ? Color.white : new Color(0.25f, 0.25f, 0.25f)));
			Fill(new Rect(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width - 4f, ((Rect)(ref rect)).height - 4f), face);
		}

		private static void Label(Rect rect, string value, GUIStyle? style = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			DesktopUI.Label(rect, value, (style ?? text).fontSize, (Color?)(style ?? text).normal.textColor, (style ?? text).alignment);
		}

		private static void DrawGame(GameSession actor, Vector2 pointer)
		{
			//IL_0014: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00eb: 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_0140: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: 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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			Fill(new Rect(0f, 0f, 960f, 540f), new Color(0f, 0.12f, 0.12f, 0.85f));
			Bevel(new Rect(130f, 78f, 700f, 420f), Gray);
			Fill(new Rect(136f, 84f, 688f, 24f), Navy);
			Label(new Rect(155f, 84f, 640f, 24f), Microgames.Title(actor.Kind));
			Fill(new Rect(136f, 108f, 688f, 22f), Gray);
			GUIStyle val = new GUIStyle(text)
			{
				alignment = (TextAnchor)3,
				fontSize = 14
			};
			val.normal.textColor = Color.black;
			Label(new Rect(149f, 108f, 650f, 22f), "Game     Options     Help", val);
			float num = Mathf.Clamp01(actor.Remaining / actor.Duration);
			Bevel(new Rect(150f, 480f, 660f, 8f), Color.black, inset: true);
			Fill(new Rect(152f, 482f, 656f * num, 4f), (num < 0.25f) ? new Color(1f, 0.3f, 0.2f) : new Color(0.3f, 1f, 0.65f));
			bool flag = acceptUiInput;
			acceptUiInput &= !actor.GameResolved;
			if (actor.CustomRound != null)
			{
				DrawAuthoredGame(actor, pointer);
			}
			else
			{
				switch (actor.Kind)
				{
				case MicrogameKind.Pinball:
					DrawPinball(actor, pointer);
					break;
				case MicrogameKind.StartMenu:
					DrawStartMenu(actor, pointer);
					break;
				case MicrogameKind.Paint:
					DrawPaint(actor, pointer);
					break;
				case MicrogameKind.Chips:
					DrawChips(actor, pointer);
					break;
				case MicrogameKind.Golf:
					DrawGolf(actor, pointer);
					break;
				case MicrogameKind.Blackjack:
					DrawBlackjack(actor, pointer);
					break;
				case MicrogameKind.Tut:
					DrawTomb(actor, pointer);
					break;
				case MicrogameKind.TetraVex:
					DrawVex(actor, pointer);
					break;
				case MicrogameKind.Tetris:
					DrawBlocks(actor, pointer);
					break;
				case MicrogameKind.SkiFree:
					DrawSki(actor, pointer);
					break;
				case MicrogameKind.PipeDream:
					DrawPipes(actor, pointer);
					break;
				case MicrogameKind.Rodent:
					DrawRodent(actor, pointer);
					break;
				case MicrogameKind.Minesweeper:
					DrawMines(actor, pointer);
					break;
				default:
					DrawTaipei(actor, pointer);
					break;
				}
			}
			acceptUiInput = flag;
		}

		private static bool Clicked(Rect rect, Vector2 pointer, int button = 0)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!acceptUiInput || (int)Event.current.type != 0 || Event.current.button != button || !((Rect)(ref rect)).Contains(pointer))
			{
				return false;
			}
			Event.current.Use();
			return true;
		}

		private static bool Button(Rect rect, Vector2 pointer, string label, bool enabled = true)
		{
			//IL_0000: 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_0013: 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_0024: 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_0054: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			Bevel(rect, (Color)((!enabled) ? new Color(0.4f, 0.4f, 0.4f) : (((Rect)(ref rect)).Contains(pointer) ? new Color(0.9f, 0.9f, 0.8f) : Gray)));
			Color color = GUI.color;
			GUI.color = (enabled ? Color.black : Color.gray);
			Label(rect, label, buttonText);
			GUI.color = color;
			if (enabled)
			{
				return Clicked(rect, pointer);
			}
			return false;
		}

		private static void GameText(Rect rect, string value, int size = 16)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(text)
			{
				fontSize = size
			};
			val.normal.textColor = Color.black;
			Label(rect, value, val);
		}

		private static void DrawTaipei(GameSession actor, Vector2 pointer)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			Fill(new Rect(140f, 130f, 680f, 344f), new Color(0f, 0.5f, 0f));
			for (int i = 0; i < 6; i++)
			{
				int num;
				switch (i)
				{
				default:
					num = 12;
					break;
				case 1:
				case 4:
					num = 10;
					break;
				case 0:
				case 5:
					num = 8;
					break;
				}
				int num2 = num;
				for (int j = 0; j < num2; j++)
				{
					Rect rect = new Rect((float)(480 - num2 * 19 + j * 38), (float)(151 + i * 34), 38f, 38f);
					Color color = GUI.color;
					GUI.color = new Color(0.55f, 0.65f, 0.55f);
					DiskArt.Draw(rect, "tp_" + (1 + (j + i * 11 + actor.GameSeed % 17 + 42) % 42));
					GUI.color = color;
				}
			}
			Rect rect2 = default(Rect);
			for (int k = 0; k < 6; k++)
			{
				if (!actor.GameResolved || !actor.Won || (k != actor.Selected && k != actor.CommittedChoice))
				{
					((Rect)(ref rect2))..ctor((float)(288 + k * 64), 381f, 58f, 58f);
					bool flag = MatchBoard.IsFree(k);
					if (actor.Selected == k)
					{
						Fill(new Rect(((Rect)(ref rect2)).x - 3f, ((Rect)(ref rect2)).y - 3f, ((Rect)(ref rect2)).width + 6f, ((Rect)(ref rect2)).height + 6f), Color.yellow);
					}
					Color color2 = GUI.color;
					GUI.color = (Color)(flag ? Color.white : new Color(0.4f, 0.5f, 0.4f));
					DiskArt.Draw(rect2, "tp_" + (actor.Tiles[k] + 1));
					GUI.color = color2;
					if (Clicked(rect2, pointer))
					{
						Send(k);
					}
				}
			}
		}

		private static void DrawTomb(GameSession actor, Vector2 pointer)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			if (actor.Tomb == null)
			{
				return;
			}
			Fill(new Rect(140f, 130f, 680f, 344f), new Color(0f, 0.5f, 0f));
			DiskArt.Draw(new Rect(240f, 142f, 480f, 318f), "tutstomb_1");
			DiskArt.Draw(new Rect(165f, 376f, 45f, 61f), "cards_54");
			DiskArt.Draw(new Rect(219f, 376f, 45f, 61f), "cards_54");
			Rect rect = default(Rect);
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j <= i; j++)
				{
					((Rect)(ref rect))..ctor((float)(480 - (i + 1) * 24 + j * 48), (float)(144 + i * 37), 45f, 61f);
					int num = ((i != 6) ? (-1) : (j switch
					{
						6 => 5, 
						3 => 4, 
						0 => 3, 
						_ => -1, 
					}));
					if (num < 0 || !actor.GameResolved || !actor.Won || (num != actor.Selected && num != actor.CommittedChoice))
					{
						if (num >= 0 && actor.Selected == num)
						{
							Fill(new Rect(((Rect)(ref rect)).x - 3f, ((Rect)(ref rect)).y - 3f, 51f, 67f), Color.yellow);
						}
						DiskArt.Draw(rect, (num < 0) ? "cards_54" : ("cards_" + actor.Tomb.Cards[num]));
						if (num >= 0 && Clicked(rect, pointer))
						{
							Send(num);
						}
					}
				}
			}
		}

		private static void VexTile(Rect rect, int[] values, bool hover = false)
		{
			//IL_0046: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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)
			if (hover)
			{
				Fill(new Rect(((Rect)(ref rect)).x - 2f, ((Rect)(ref rect)).y - 2f, ((Rect)(ref rect)).width + 4f, ((Rect)(ref rect)).height + 4f), Color.yellow);
			}
			DiskArt.Draw(rect, "tetravex_13");
			float num = ((Rect)(ref rect)).width * 0.5f;
			Rect[] array = (Rect[])(object)new Rect[4]
			{
				new Rect(((Rect)(ref rect)).x + num - 12f, ((Rect)(ref rect)).y + 2f, 24f, 23f),
				new Rect(((Rect)(ref rect)).xMax - 25f, ((Rect)(ref rect)).y + num - 11f, 24f, 23f),
				new Rect(((Rect)(ref rect)).x + num - 12f, ((Rect)(ref rect)).yMax - 25f, 24f, 23f),
				new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y + num - 11f, 24f, 23f)
			};
			for (int i = 0; i < 4; i++)
			{
				GameText(array[i], values[i].ToString(), 18);
			}
		}

		private static void DrawVex(GameSession actor, Vector2 pointer)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: 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)
			if (actor.Vex == null)
			{
				return;
			}
			Fill(new Rect(140f, 130f, 680f, 344f), Gray);
			Rect rect = default(Rect);
			for (int i = 0; i < 9; i++)
			{
				((Rect)(ref rect))..ctor((float)(215 + i % 3 * 68), (float)(181 + i / 3 * 68), 66f, 66f);
				if (i == actor.Vex.Missing && actor.GameResolved && actor.CommittedChoice >= 0 && actor.CommittedChoice < 3)
				{
					VexTile(rect, actor.Vex.Choices[actor.CommittedChoice], hover: true);
				}
				else if (i == actor.Vex.Missing)
				{
					Fill(new Rect(((Rect)(ref rect)).x - 3f, ((Rect)(ref rect)).y - 3f, ((Rect)(ref rect)).width + 6f, ((Rect)(ref rect)).height + 6f), new Color(0.25f, 0.6f, 1f));
					DiskArt.Draw(rect, "tetravex_14");
					GameText(rect, "?", 30);
				}
				else
				{
					VexTile(rect, actor.Vex.Fixed[i]);
				}
			}
			Fill(new Rect(454f, 165f, 2f, 235f), Color.gray);
			Rect rect2 = default(Rect);
			for (int j = 0; j < 9; j++)
			{
				((Rect)(ref rect2))..ctor((float)(505 + j % 3 * 68), (float)(181 + j / 3 * 68), 66f, 66f);
				if (j < 3)
				{
					VexTile(rect2, actor.Vex.Choices[j], ((Rect)(ref rect2)).Contains(pointer));
					if (Clicked(rect2, pointer))
					{
						Send(j);
					}
					continue;
				}
				Color color = GUI.color;
				GUI.color = new Color(0.6f, 0.6f, 0.6f);
				VexTile(rect2, new int[4] { 1, 2, 3, 4 });
				GUI.color = color;
			}
		}

		private static void BlockSprite(Rect rect, int shape)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Fill(rect, Color.black);
			Bevel(new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y + 1f, ((Rect)(ref rect)).width - 1f, ((Rect)(ref rect)).height - 1f), BlockColors[shape % 7]);
		}

		private static void DrawBlocks(GameSession actor, Vector2 pointer)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: 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_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			if (actor.Blocks == null)
			{
				return;
			}
			Fill(new Rect(140f, 130f, 680f, 344f), Gray);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(410f, 151f, 140f, 280f);
			Bevel(new Rect(((Rect)(ref val)).x - 4f, ((Rect)(ref val)).y - 4f, ((Rect)(ref val)).width + 8f, ((Rect)(ref val)).height + 8f), Color.black, inset: true);
			for (int i = 0; i < 10; i++)
			{
				for (int j = 0; j < 20; j++)
				{
					if (actor.Blocks.Filled[i, j])
					{
						BlockSprite(new Rect(((Rect)(ref val)).x + (float)(i * 14), ((Rect)(ref val)).y + (float)(j * 14), 14f, 14f), (i + j) % 7);
					}
				}
			}
			FallingBlock falling = actor.Falling;
			BlockCell[] array = actor.Blocks.Piece(falling.Rotation);
			for (int k = 0; k < array.Length; k++)
			{
				BlockCell blockCell = array[k];
				int num = falling.Column + blockCell.X;
				int num2 = falling.Row + blockCell.Y;
				if (num2 >= 0)
				{
					BlockSprite(new Rect(((Rect)(ref val)).x + (float)(num * 14), ((Rect)(ref val)).y + (float)(num2 * 14), 14f, 14f), actor.Blocks.Shape);
				}
			}
			Bevel(new Rect(200f, 150f, 175f, 285f), Gray, inset: true);
			GameText(new Rect(208f, 155f, 159f, 26f), "Statistics");
			for (int l = 0; l < 7; l++)
			{
				array = BlockBoard.Preview(l);
				for (int k = 0; k < array.Length; k++)
				{
					BlockCell blockCell2 = array[k];
					BlockSprite(new Rect((float)(220 + blockCell2.X * 11), (float)(191 + l * 33 + blockCell2.Y * 11), 11f, 11f), l);
				}
				GameText(new Rect(300f, (float)(189 + l * 33), 58f, 25f), "000");
			}
			Rect[] array2 = (Rect[])(object)new Rect[3]
			{
				new Rect(590f, 150f, 160f, 65f),
				new Rect(590f, 225f, 160f, 65f),
				new Rect(590f, 300f, 160f, 116f)
			};
			for (int k = 0; k < array2.Length; k++)
			{
				Bevel(array2[k], Gray, inset: true);
			}
			GameText(new Rect(595f, 154f, 150f, 25f), "Score");
			GameText(new Rect(595f, 179f, 150f, 27f), "000000", 20);
			GameText(new Rect(595f, 229f, 150f, 25f), "Lines       Level");
			GameText(new Rect(595f, 254f, 150f, 27f), "000          01", 20);
			GameText(new Rect(595f, 305f, 150f, 24f), "Next");
			array = BlockBoard.Preview((actor.Blocks.Shape + 1) % 7);
			for (int k = 0; k < array.Length; k++)
			{
				BlockCell blockCell3 = array[k];
				BlockSprite(new Rect((float)(635 + blockCell3.X * 18), (float)(342 + blockCell3.Y * 18), 18f, 18f), (actor.Blocks.Shape + 1) % 7);
			}
			if (!actor.GameResolved)
			{
				GameText(new Rect(185f, 443f, 590f, 24f), "A / D  Move       Q / E  Rotate       S  Soft drop       W  Drop", 14);
			}
		}

		private static void DrawSki(GameSession actor, Vector2 pointer)
		{
			//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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			if (actor.Ski == null)
			{
				return;
			}
			SkiBoard ski = actor.Ski;
			float num = DifficultyRules.SkiProgress(actor.GameResolved ? actor.ResolvedElapsed : (actor.Duration - actor.Remaining), actor.Duration, actor.GameSpeed);
			Fill(new Rect(140f, 130f, 680f, 344f), Color.white);
			DiskArt.Draw(new Rect(156f, 142f, 168f, 88f), "ski_53");
			GameText(new Rect(640f, 145f, 165f, 26f), "Distance  " + Mathf.FloorToInt(num * 200f) + " m", 14);
			for (int i = 0; i < 14; i++)
			{
				float num2 = ((i % 2 == 0) ? 335 : 622);
				float num3 = 145f + Mathf.Repeat((float)(i * 41) + num * 350f, 280f);
				DiskArt.Draw(new Rect(num2, num3, 24f, 48f), "ski_50");
			}
			for (int j = Mathf.Max(0, ski.Passed - ((actor.GameResolved && !actor.Won) ? 1 : 0)); j < ski.Blocked.Length; j++)
			{
				float num4 = 387f - (SkiBoard.CrossingProgress(j) - num) * 650f;
				if (num4 > 191f && num4 < 440f)
				{
					DiskArt.Draw(new Rect((float)(380 + ski.Blocked[j] * 80), num4 - 36f, 32f, 64f), "ski_51");
				}
			}
			DiskArt.Draw(new Rect((float)(380 + ski.Lane * 80), 375f, 32f, (float)((actor.GameResolved && !actor.Won) ? 32 : 64)), (actor.GameResolved && !actor.Won) ? "ski_12" : "ski_4");
			if (actor.GameResolved && actor.Won)
			{
				GameText(new Rect(380f, 300f, 260f, 35f), "FINISH!", 26);
			}
			for (int k = 0; k < 3; k++)
			{
				if (Clicked(new Rect((float)(356 + k * 80), 180f, 80f, 260f), pointer) && k != ski.Lane)
				{
					Send((k >= ski.Lane) ? 1 : 0);
				}
			}
			GameText(new Rect(160f, 438f, 640f, 28f), "A / D   Ski left / right", 14);
		}

		private static int PipeResource(int mask)
		{
			return mask switch
			{
				10 => 123, 
				5 => 124, 
				3 => 126, 
				6 => 128, 
				12 => 127, 
				9 => 125, 
				_ => 120, 
			};
		}

		private static void PipeTile(Rect rect, int mask)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			DiskArt.Draw(rect, "pipe_" + PipeResource(mask));
		}

		private static void DrawPipes(GameSession actor, Vector2 pointer)
		{
			//IL_0029: 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)
			//IL_005b: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: 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)
			if (actor.Pipes == null)
			{
				return;
			}
			_ = actor.Pipes.Required;
			Fill(new Rect(140f, 130f, 680f, 344f), new Color(0.5f, 0f, 0.5f));
			Bevel(new Rect(208f, 147f, 267f, 267f), Gray, inset: true);
			PipeBoard pipes = actor.Pipes;
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < 7; j++)
				{
					PipeTile(new Rect((float)(212 + j * 37), (float)(151 + i * 37), 37f, 37f), pipes.Cells[j + i * 7]);
				}
			}
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor((float)(212 + pipes.Missing % 7 * 37), (float)(151 + pipes.Missing / 7 * 37), 37f, 37f);
			if (actor.GameResolved && actor.CommittedChoice >= 0 && actor.CommittedChoice < PipeBoard.Pieces.Length)
			{
				PipeTile(rect, PipeBoard.Pieces[actor.CommittedChoice]);
			}
			else
			{
				Bevel(rect, Gray, inset: true);
				GameText(rect, "?", 28);
			}
			Bevel(new Rect(525f, 147f, 225f, 267f), Gray);
			GameText(new Rect(530f, 153f, 215f, 27f), "Next Pieces");
			Rect rect2 = default(Rect);
			for (int k = 0; k < 6; k++)
			{
				((Rect)(ref rect2))..ctor((float)(546 + k % 2 * 96), (float)(190 + k / 2 * 67), 55f, 55f);
				PipeTile(rect2, PipeBoard.Pieces[k]);
				if (((Rect)(ref rect2)).Contains(pointer))
				{
					Bevel(new Rect(((Rect)(ref rect2)).x, ((Rect)(ref rect2)).yMax - 2f, ((Rect)(ref rect2)).width, 2f), Color.yellow);
				}
				if (Clicked(rect2, pointer))
				{
					Send(k);
				}
			}
			GameText(new Rect(207f, 425f, 268f, 28f), "Level 1     Score 0000");
		}

		private static void ArtRegion(Rect destination, string name, Rect source)
		{
			//IL_0007: 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)
			Texture2D val = DiskArt.Get(name);
			GUI.DrawTextureWithTexCoords(destination, (Texture)(object)val, new Rect(((Rect)(ref source)).x / (float)((Texture)val).width, 1f - ((Rect)(ref source)).yMax / (float)((Texture)val).height, ((Rect)(ref source)).width / (float)((Texture)val).width, ((Rect)(ref source)).height / (float)((Texture)val).height));
		}

		private static void DrawStartMenu(GameSession actor, Vector2 pointer)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			StartMenuBoard startMenu = actor.StartMenu;
			Rect desktop = new Rect(160f, 132f, 640f, 336f);
			DiskArt.Draw(desktop, "Windows98");
			float scaleX = StartMenuLayout.ScaleX(((Rect)(ref desktop)).width);
			float scaleY = StartMenuLayout.ScaleY(((Rect)(ref desktop)).height);
			float top = StartMenuLayout.Top(((Rect)(ref desktop)).y, ((Rect)(ref desktop)).height);
			if (startMenu.Open)
			{
				ArtRegion(MenuRect(0f, 0f, 189f, 444f), "startbuttonnormal", new Rect(0f, 0f, 189f, 444f));
				for (int i = 0; i < 6; i++)
				{
					Rect rect = MenuRect(25f, StartMenuLayout.SlotY(i), 162f, 35f);
					if (i == startMenu.Target)
					{
						Fill(rect, Gray);
						ArtRegion(MenuRect(27f, StartMenuLayout.SlotY(i) + 1f, 30f, 32f), "startbuttonror2", new Rect(31f, (float)(118 + i * 35), 32f, 32f));
						GUIStyle val = new GUIStyle(text)
						{
							fontSize = 8,
							alignment = (TextAnchor)3
						};
						val.normal.textColor = Color.black;
						Label(MenuRect(61f, StartMenuLayout.SlotY(i), 126f, 35f), "Risk of Rain 2", val);
					}
					if (((Rect)(ref rect)).Contains(pointer))
					{
						Bevel(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 1f, ((Rect)(ref rect)).width, 1f), Color.yellow);
					}
					if (Clicked(rect, pointer))
					{
						Send(i + 1);
					}
				}
			}
			if (Clicked(new Rect(((Rect)(ref desktop)).x, ((Rect)(ref desktop)).y + 464f * ((Rect)(ref desktop)).height / 480f, 36f * ((Rect)(ref desktop)).width / 640f, 16f * ((Rect)(ref desktop)).height / 480f), pointer))
			{
				Send(0);
			}
			if (actor.GameResolved && actor.Won)
			{
				Bevel(new Rect(345f, 230f, 390f, 150f), Gray);
				Fill(new Rect(350f, 235f, 380f, 24f), Navy);
				Label(new Rect(355f, 235f, 370f, 24f), "Risk of Rain 2");
				GameText(new Rect(360f, 280f, 360f, 60f), "Launching Risk of Rain 2...", 20);
			}
			Rect MenuRect(float x, float y, float width, float height)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				return new Rect(((Rect)(ref desktop)).x + x * scaleX, top + y * scaleY, width * scaleX, height * scaleY);
			}
		}

		private static void DrawPaint(GameSession actor, Vector2 pointer)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			PaintBoard paint = actor.Paint;
			DiskArt.Draw(new Rect(180f, 132f, 600f, 331.5f), paint.Bucket ? "mspaint98Bucket" : "mspaint98Pencil");
			Rect rect = Map(57f, 40f, 533f, 303f);
			Fill(rect, (paint.Fill < 0) ? Color.white : Ink(paint.Fill));
			if (paint.Fill < 0)
			{
				GUIStyle val = new GUIStyle(large)
				{
					fontSize = 52
				};
				val.normal.textColor = Ink(paint.Target);
				Label(rect, PaintBoard.Names[paint.Target], val);
			}
			if (Clicked(Map(27f, 59f, 21f, 23f), pointer))
			{
				Send(0);
			}
			if (Clicked(Map(5f, 106f, 21f, 23f), pointer))
			{
				Send(1);
			}
			for (int i = 0; i < PaintBoard.Colors.Length; i++)
			{
				if (Clicked(Map(61 + i * 15, 379f, 14f, 15f), pointer))
				{
					Send(10 + i);
				}
			}
			if (paint.Selected >= 0)
			{
				Fill(Map(5f, 369f, 13f, 13f), Ink(paint.Selected));
			}
			if (Clicked(rect, pointer))
			{
				Send(2);
			}
			static Color Ink(int index)
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				int num = PaintBoard.Colors[index];
				return new Color((float)((num >> 16) & 0xFF) / 255f, (float)((num >> 8) & 0xFF) / 255f, (float)(num & 0xFF) / 255f);
			}
			static Rect Map(float x, float y, float width, float height)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				return new Rect(180f + x, 132f + y * 0.78f, width, height * 0.78f);
			}
		}

		private static void DrawPinball(GameSession actor, Vector2 pointer)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0079: 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_0160: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			PinballBoard b = actor.Pinball;
			Rect table = new Rect(220f, 132f, 282f, 331f);
			DiskArt.Draw(table, "pinball_table");
			DiskArt.Draw(new Rect(530f, 139f, 204f, 181f), "pinball_display");
			Fill(new Rect(541f, 330f, 184f, 47f), Color.black);
			Label(new Rect(541f, 330f, 184f, 47f), (b.Outcome == 0) ? "TIME YOUR FLIP" : "");
			if (b.Y <= 1f)
			{
				DiskArt.Draw(new Rect(((Rect)(ref table)).x + b.X * ((Rect)(ref table)).width - 6f, ((Rect)(ref table)).y + b.Y * ((Rect)(ref table)).height - 6f, 12f, 12f), "pinball_ball");
			}
			Flipper(left: true);
			Flipper(left: false);
			if (Button(new Rect(535f, 392f, 90f, 47f), pointer, "A / Q"))
			{
				Send(1);
			}
			if (Button(new Rect(635f, 392f, 90f, 47f), pointer, "D / E"))
			{
				Send(2);
			}
			void Flipper(bool left)
			{
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				float num = ((Rect)(ref table)).x + (left ? 0.27f : 0.73f) * ((Rect)(ref table)).width;
				float num2 = ((Rect)(ref table)).y + 0.9f * ((Rect)(ref table)).height;
				DiskArt.Draw(name: (!left) ? ((b.Right > 0f) ? "pinball_right_up" : "pinball_right_rest") : ((b.Left > 0f) ? "pinball_left_up" : "pinball_left_rest"), rect: new Rect(num - (float)(left ? 64 : 63), num2 - 48f, 128f, 96f));
			}
		}

		private static void DrawRodent(GameSession actor, Vector2 pointer)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: 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_028a: 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_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			if (actor.Rodent == null)
			{
				return;
			}
			RodentBoard rodent = actor.Rodent;
			Fill(new Rect(140f, 130f, 680f, 344f), Gray);
			Bevel(new Rect(210f, 143f, 355f, 322f), Gray, inset: true);
			Rect rect = default(Rect);
			for (int i = 0; i < 14; i++)
			{
				for (int j = 0; j < 12; j++)
				{
					((Rect)(ref rect))..ctor((float)(220 + i * 24), (float)(164 + j * 24), 24f, 24f);
					DiskArt.Draw(rect, "rodent_floor");
					if (i < 4 || i > 9 || j < 3 || j > 7)
					{
						if (i > 1 && i < 12 && j > 1 && j < 10)
						{
							DiskArt.Draw(rect, "rodent_box");
						}
						continue;
					}
					int num = i - 4;
					int num2 = j - 3;
					if (rodent.Walls[num, num2])
					{
						DiskArt.Draw(rect, "rodent_wall");
					}
					if (num == rodent.BoxX && num2 == rodent.BoxY)
					{
						DiskArt.Draw(rect, "rodent_box");
					}
					if (num == rodent.CatX && num2 == rodent.CatY)
					{
						DiskArt.Draw(rect, (actor.GameResolved && actor.Won) ? "rodent_trapped" : "rodent_cat");
					}
					if (num == rodent.X && num2 == rodent.Y)
					{
						DiskArt.Draw(rect, "rodent_mouse");
					}
				}
			}
			GameText(new Rect(580f, 154f, 200f, 27f), "Score       0000");
			GameText(new Rect(580f, 187f, 200f, 27f), "Level       1");
			string[] array = new string[4] { "W", "D / E", "S", "A / Q" };
			Rect[] array2 = (Rect[])(object)new Rect[4]
			{
				new Rect(650f, 255f, 60f, 36f),
				new Rect(695f, 296f, 70f, 36f),
				new Rect(650f, 337f, 60f, 36f),
				new Rect(595f, 296f, 80f, 36f)
			};
			for (int k = 0; k < 4; k++)
			{
				if (Button(array2[k], pointer, array[k]))
				{
					Send(k);
				}
			}
		}

		private static void MineCounter(Rect rect, int number)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			number = Mathf.Clamp(number, 0, 999);
			string text = number.ToString("D3");
			for (int i = 0; i < 3; i++)
			{
				DiskArt.Draw(new Rect(((Rect)(ref rect)).x + (float)i * ((Rect)(ref rect)).width / 3f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width / 3f, ((Rect)(ref rect)).height), "mine_digit_" + (11 - (text[i] - 48)));
			}
		}

		private static void DrawMines(GameSession actor, Vector2 pointer)
		{
			//IL_0038: 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)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			if (actor.Mines == null)
			{
				return;
			}
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(360f, 206f, 240f, 240f);
			Bevel(new Rect(346f, 139f, 268f, 321f), Gray);
			Bevel(new Rect(355f, 149f, 250f, 47f), Gray, inset: true);
			MineCounter(new Rect(364f, 155f, 45f, 32f), 4);
			MineCounter(new Rect(550f, 155f, 45f, 32f), Mathf.FloorToInt(actor.Duration - actor.Remaining));
			DiskArt.Draw(new Rect(464f, 155f, 32f, 32f), (!actor.GameResolved) ? "mine_face_0" : (actor.Won ? "mine_face_1" : "mine_face_2"));
			Bevel(new Rect(((Rect)(ref val)).x - 3f, ((Rect)(ref val)).y - 3f, ((Rect)(ref val)).width + 6f, ((Rect)(ref val)).height + 6f), Gray, inset: true);
			for (int i = 0; i < 8; i++)
			{
				for (int j = 0; j < 8; j++)
				{
					int num = j + i * 8;
					Rect rect = new Rect(((Rect)(ref val)).x + (float)(j * 30), ((Rect)(ref val)).y + (float)(i * 30), 30f, 30f);
					int num2 = ((!actor.Mines.Hidden[num]) ? (actor.Mines.Flagged[num] ? 1 : ((actor.Mines.Clues[num] > 0) ? (15 - actor.Mines.Clues[num]) : 15)) : 0);
					if (actor.GameResolved)
					{
						num2 = ((!actor.Mines.Mines[num]) ? ((actor.Mines.Clues[num] > 0) ? (15 - actor.Mines.Clues[num]) : 15) : ((actor.CommittedChoice == num && !actor.Won) ? 3 : (actor.Mines.Flagged[num] ? 1 : 5)));
					}
					DiskArt.Draw(rect, "mine_tile_" + num2);
					if (Clicked(rect, pointer))
					{
						Send(num);
					}
				}
			}
		}

		private static void DrawChips(GameSession actor, Vector2 pointer)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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)
			ChipsBoard chips = actor.Chips;
			if (chips == null)
			{
				return;
			}
			Fill(new Rect(140f, 130f, 680f, 344f), Gray);
			DiskArt.Draw(new Rect(165f, 150f, 257f, 282f), "chips_333");
			Rect rect = default(Rect);
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < 7; j++)
				{
					((Rect)(ref rect))..ctor((float)(340 + j * 38), (float)(155 + i * 38), 38f, 38f);
					int num = (chips.Walls[j, i] ? 1 : 0);
					if (j == chips.ExitX && i == chips.ExitY)
					{
						num = 21;
					}
					if (j == chips.KeyX && i == chips.KeyY && !chips.HasKey)
					{
						num = 100;
					}
					if (j == chips.DoorX && i == chips.DoorY && !chips.DoorOpen)
					{
						num = 22;
					}
					DiskArt.Draw(rect, "chips_" + num);
					if (j == chips.X && i == chips.Y)
					{
						DiskArt.Draw(rect, "chips_" + ((chips.Facing == 0) ? 108 : ((chips.Facing == 1) ? 111 : ((chips.Facing == 2) ? 110 : 109))));
					}
				}
			}
			Bevel(new Rect(635f, 155f, 150f, 266f), Gray);
			GameText(new Rect(640f, 174f, 140f, 30f), "LEVEL  001");
			DiskArt.Draw(new Rect(683f, 220f, 48f, 48f), "chips_100");
			GameText(new Rect(641f, 280f, 138f, 30f), chips.HasKey ? "KEY FOUND" : "GET THE KEY", 14);
			GameText(new Rect(640f, 330f, 140f, 60f), "OPEN THE DOOR\nREACH THE EXIT", 14);
			if (!actor.GameResolved)
			{
				GameText(new Rect(185f, 435f, 590f, 25f), "WASD move · Q/E left/right", 14);
			}
		}

		private static void Card(Rect rect, int card, bool selected = false)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (selected)
			{
				Fill(new Rect(((Rect)(ref rect)).x - 3f, ((Rect)(ref rect)).y - 3f, ((Rect)(ref rect)).width + 6f, ((Rect)(ref rect)).height + 6f), Color.yellow);
			}
			if (card > 0)
			{
				DiskArt.Draw(rect, "cards_" + card);
			}
			else
			{
				Bevel(rect, new Color(0f, 0.35f, 0f), inset: true);
			}
		}

		private static void DrawGolf(GameSession actor, Vector2 pointer)
		{
			//IL_001f: 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)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			GolfBoard golf = actor.Golf;
			if (golf == null)
			{
				return;
			}
			Fill(new Rect(140f, 130f, 680f, 344f), new Color(0f, 0.5f, 0f));
			Rect rect = default(Rect);
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < 5; j++)
				{
					if (j != 4 || (golf.Mask & (1 << i)) == 0)
					{
						((Rect)(ref rect))..ctor((float)(205 + i * 79), (float)(151 + j * 34), 52f, 71f);
						int card = golf.Tableau[i, j];
						Color color = GUI.color;
						if ((golf.Mask & (1 << i)) != 0)
						{
							GUI.color = new Color(0.45f, 0.45f, 0.45f);
						}
						Card(rect, card);
						GUI.color = color;
						if (j == 4 && Clicked(rect, pointer))
						{
							Send(i);
						}
					}
				}
			}
			Card(new Rect(250f, 380f, 49f, 67f), 54);
			Card(new Rect(390f, 380f, 49f, 67f), golf.TopCard);
			GameText(new Rect(470f, 393f, 260f, 32f), "CHAIN   " + golf.Cleared + " / 3", 20);
			GameText(new Rect(470f, 427f, 260f, 25f), "One rank up or down", 14);
		}

		private static void DrawBlackjack(GameSession actor, Vector2 pointer)
		{
			//IL_001f: 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)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			BlackjackBoard blackjack = actor.Blackjack;
			if (blackjack != null)
			{
				Fill(new Rect(140f, 130f, 680f, 344f), new Color(0f, 0.4f, 0.22f));
				GameText(new Rect(200f, 140f, 450f, 28f), "DEALER  " + blackjack.Dealer, 18);
				for (int i = 0; i < 2; i++)
				{
					Card(new Rect((float)(340 + i * 60), 178f, 52f, 71f), blackjack.DealerCards[i]);
				}
				GameText(new Rect(620f, 158f, 165f, 28f), "NEXT CARD", 14);
				Card(new Rect(675f, 191f, 52f, 71f), blackjack.Next);
				GameText(value: "PLAYER  " + (blackjack.Player + ((actor.GameResolved && actor.CommittedChoice == 0) ? Mathf.Min(10, GolfBoard.Rank(blackjack.Next)) : 0)), rect: new Rect(200f, 274f, 450f, 28f), size: 18);
				for (int j = 0; j < 2; j++)
				{
					Card(new Rect((float)(340 + j * 60), 309f, 52f, 71f), blackjack.PlayerCards[j]);
				}
				if (actor.GameResolved && actor.CommittedChoice == 0)
				{
					Card(new Rect(460f, 309f, 52f, 71f), blackjack.Next);
				}
				if (Button(new Rect(290f, 406f, 170f, 34f), pointer, "HIT"))
				{
					Send(0);
				}
				if (Button(new Rect(485f, 406f, 170f, 34f), pointer, "STAND"))
				{
					Send(1);
				}
				if (!actor.GameResolved)
				{
					DiskArt.Draw(new Rect(170f, 455f, 620f, 17f), "blakjak_31");
				}
			}
		}

		internal static void Install()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0043: 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_004e: Expected O, but got Unknown
			ui = new GameObject("MICRO interface");
			Object.DontDestroyOnLoad((Object)(object)ui);
			ui.AddComponent<MicroGUI>();
			feedback = ui.AddComponent<MicroFeedback>();
			object obj = <>O.<0>__Pause;
			if (obj == null)
			{
				hook_InstantiatePauseScreen val = Pause;
				<>O.<0>__Pause = val;
				obj = (object)val;
			}
			PauseScreenController.InstantiatePauseScreen += (hook_InstantiatePauseScreen)obj;
		}

		private static GameObject Pause(orig_InstantiatePauseScreen orig, bool minimal)
		{
			if (Object.op_Implicit((Object)(object)local) && local.Busy)
			{
				Send(-1);
				return null;
			}
			return orig.Invoke(minimal);
		}

		internal static void Tick()
		{
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			MicroController microController = null;
			foreach (NetworkUser readOnlyLocalPlayers in NetworkUser.readOnlyLocalPlayersList)
			{
				LocalUser localUser = readOnlyLocalPlayers.localUser;
				CharacterBody val = ((localUser != null) ? localUser.cachedBody : null);
				MicroController microController2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<MicroController>() : null);
				if (Object.op_Implicit((Object)(object)microController2) && microController2.Busy && val.healthComponent.alive && !Ethranet.IsBrowsing(val))
				{
					microController = microController2;
					break;
				}
			}
			if ((Object)(object)local != (Object)(object)microController)
			{
				ClearPreview(!Object.op_Implicit((Object)(object)local) || local.StageCooldown <= 0f);
				DesktopInputScope? obj = focus;
				if (obj != null)
				{
					obj.Dispose();
				}
				focus = null;
				local = microController;
				if (Object.op_Implicit((Object)(object)local))
				{
					PlayerCharacterMasterController component = ((Component)local.Body.master).GetComponent<PlayerCharacterMasterController>();
					if (Object.op_Implicit((Object)(object)component) && component.networkUser?.localUser != null)
					{
						LocalUser localUser2 = component.networkUser.localUser;
						focus = new DesktopInputScope(localUser2);
						if ((local.Phase == MicroPhase.Menu || local.Phase == MicroPhase.Stage) && Object.op_Implicit((Object)(object)localUser2.cameraRigController))
						{
							preview = new StagePreviewCamera(localUser2.cameraRigController);
						}
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)local) || (local.Phase != MicroPhase.Stage && local.Phase != MicroPhase.Menu))
			{
				ClearPreview(!Object.op_Implicit((Object)(object)local) || local.StageCooldown <= 0f);
			}
			if (Object.op_Implicit((Object)(object)local) && Object.op_Implicit((Object)(object)feedback))
			{
				feedback.Show(local);
			}
			if (!Object.op_Implicit((Object)(object)local) || !Application.isFocused || Input.GetKey((KeyCode)9) || local.Phase != MicroPhase.Playing || local.Game == null || local.Game.GameResolved)
			{
				return;
			}
			int num = -1;
			MicrogameKind kind = local.Game.Kind;
			if (local.Game.CustomRound != null && Microgames.UsesMovementKeys(kind))
			{
				int num2 = (int)((Input.GetKey((KeyCode)119) ? 1u : 0u) | (uint)(Input.GetKey((KeyCode)100) ? 2 : 0) | (uint)(Input.GetKey((KeyCode)115) ? 4 : 0)) | (Input.GetKey((KeyCode)97) ? 8 : 0);
				if (num2 != customMove)
				{
					customMove = num2;
					Send(9900 + num2);
				}
				return;
			}
			switch (kind)
			{
			case MicrogameKind.Pinball:
				num = ((Input.GetKeyDown((KeyCode)97) || Input.GetKeyDown((KeyCode)113)) ? 1 : 0) | ((Input.GetKeyDown((KeyCode)100) || Input.GetKeyDown((KeyCode)101)) ? 2 : 0);
				if (num == 0)
				{
					return;
				}
				break;
			case MicrogameKind.Tetris:
				if (Input.GetKeyDown((KeyCode)97))
				{
					num = 0;
				}
				else if (Input.GetKeyDown((KeyCode)100))
				{
					num = 1;
				}
				else if (Input.GetKeyDown((KeyCode)113))
				{
					num = 2;
				}
				else if (Input.GetKeyDown((KeyCode)101))
				{
					num = 3;
				}
				else if (Input.GetKeyDown((KeyCode)119))
				{
					num = 5;
				}
				else if (Input.GetKey((KeyCode)115) && Time.unscaledTime >= softDropAt)
				{
					num = 4;
					softDropAt = Time.unscaledTime + 0.08f;
				}
				break;
			case MicrogameKind.Rodent:
			case MicrogameKind.Chips:
				if (Time.unscaledTime < chipMoveAt)
				{
					return;
				}
				if (Input.GetKey((KeyCode)119))
				{
					num = 0;
				}
				else if (Input.GetKey((KeyCode)100) || Input.GetKey((KeyCode)101))
				{
					num = 1;
				}
				else if (Input.GetKey((KeyCode)115))
				{
					num = 2;
				}
				else if (Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)113))
				{
					num = 3;
				}
				if (num >= 0)
				{
					chipMoveAt = Time.unscaledTime + 0.13f;
				}
				break;
			case MicrogameKind.SkiFree:
				if (Input.GetKeyDown((KeyCode)97) || Input.GetKeyDown((KeyCode)113))
				{
					num = 0;
				}
				else if (Input.GetKeyDown((KeyCode)100) || Input.GetKeyDown((KeyCode)101))
				{
					num = 1;
				}
				break;
			}
			if (num >= 0)
			{
				Send(num);
			}
		}

		private static void Send(int code)
		{
			if (Object.op_Implicit((Object)(object)local))
			{
				MicroNetwork.Send(local, code);
			}
		}

		private static void Setup()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0035: 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_0056: Expected O, but got Unknown
			//IL_005b: 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_006d: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (text == null)
			{
				text = new GUIStyle(GUI.skin.label)
				{
					fontSize = 16,
					alignment = (TextAnchor)4
				};
				text.normal.textColor = Color.white;
				large = new GUIStyle(text)
				{
					fontSize = 40
				};
				buttonText = new GUIStyle(text)
				{
					fontSize = 14
				};
				tileText = new GUIStyle(text)
				{
					fontSize = 32
				};
				tileText.normal.textColor = Navy;
				cursor = DesktopUI.Cursor;
			}
		}

		internal static void Draw()
		{
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: 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_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)local) || !local.Body.healthComponent.alive || Input.GetKey((KeyCode)9))
			{
				return;
			}
			Setup();
			MicroController microController = local;
			PlayerCharacterMasterController component = ((Component)microController.Body.master).GetComponent<PlayerCharacterMasterController>();
			LocalUser val = ((component == null) ? null : component.networkUser?.localUser);
			CameraRigController val2 = ((val != null) ? val.cameraRigController : null);
			if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.sceneCam) || Object.op_Implicit((Object)(object)val.pauseScreenController))
			{
				return;
			}
			Rect pixelRect = val2.sceneCam.pixelRect;
			float num = Mathf.Min(((Rect)(ref pixelRect)).width / 960f, ((Rect)(ref pixelRect)).height / 540f);
			float num2 = ((Rect)(ref pixelRect)).x + (((Rect)(ref pixelRect)).width - 960f * num) / 2f;
			float num3 = (float)Screen.height - ((Rect)(ref pixelRect)).yMax + (((Rect)(ref pixelRect)).height - 540f * num) / 2f;
			Matrix4x4 matrix = GUI.matrix;
			Color color = GUI.color;
			acceptUiInput = Application.isFocused;
			try
			{
				GUI.matrix = Matrix4x4.TRS(new Vector3(num2, num3), Quaternion.identity, new Vector3(num, num, 1f));
				Vector2 val3 = default(Vector2);
				((Vector2)(ref val3))..ctor((Input.mousePosition.x - num2) / num, ((float)Screen.height - Input.mousePosition.y - num3) / num);
				if (microController.Phase == MicroPhase.Menu)
				{
					Bevel(new Rect(170f, 345f, 620f, 180f), Gray);
					Fill(new Rect(176f, 351f, 608f, 30f), Navy);
					Label(new Rect(180f, 351f, 600f, 30f), "BROWSE");
					if (Button(new Rect(190f, 394f, 280f, 60f), val3, (microController.StageCooldown > 0f) ? ("BROWSE STAGE\n" + Mathf.CeilToInt(microController.StageCooldown) + "s") : "BROWSE STAGE", microController.StageCooldown <= 0f))
					{
						Send(0);
					}
					if (Button(new Rect(490f, 394f, 280f, 60f), val3, "BROWSE ETHRANET"))
					{
						Send(1);
					}
					if (Button(new Rect(320f, 469f, 320f, 35f), val3, "CLOSE"))
					{
						Send(-1);
					}
				}
				else if (microController.Phase == MicroPhase.Stage)
				{
					if (previewPage != microController.Page)
					{
						hovered = -1;
						previewPage = microController.Page;
					}
					if (preview == null)
					{
						preview = new StagePreviewCamera(val2);
					}
					Bevel(new Rect(120f, 303f, 720f, 224f), Gray);
					Fill(new Rect(126f, 309f, 708f, 30f), Navy);
					Label(new Rect(130f, 309f, 700f, 30f), "BROWSE STAGE  " + (microController.Page + 1) + " / " + microController.Pages);
					Rect rect = default(Rect);
					for (int i = 0; i < microController.Labels.Length; i++)
					{
						((Rect)(ref rect))..ctor((float)(140 + i % 2 * 345), (float)(351 + i / 2 * 56), 335f, 48f);
						if (acceptUiInput && ((Rect)(ref rect)).Contains(val3) && hovered != microController.Keys[i] && i < microController.PreviewPoints.Length)
						{
							hovered = microController.Keys[i];
							preview.Focus(microController.PreviewPoints[i]);
						}
						if (Button(rect, val3, microController.Labels[i]))
						{
							Send(100 + microController.Keys[i]);
						}
					}
					if (microController.Labels.Length == 0)
					{
						GameText(new Rect(180f, 351f, 600f, 50f), "NO INTERACTABLES IN THIS STAGE");
					}
					if (Button(new Rect(140f, 467f, 160f, 34f), val3, "<", microController.Page > 0))
					{
						Send(-2001);
					}
					if (Button(new Rect(660f, 467f, 160f, 34f), val3, ">", microController.Page + 1 < microController.Pages))
					{
						Send(-2002);
					}
					if (Button(new Rect(330f, 467f, 300f, 34f), val3, "CLOSE"))
					{
						Send(-1);
					}
					GameText(new Rect(140f, 502f, 680f, 23f), microController.Status, 12);
				}
				else if (microController.Game != null)
				{
					if (microController.Phase == MicroPhase.Prompt)
					{
						Fill(new Rect(0f, 0f, 960f, 540f), new Color(0f, 0f, 0f, 0.65f));
						DesktopUI.Label(new Rect(80f, 160f, 800f, 130f), Microgames.Command(microController.Game.Kind), 76, (Color?)null, (TextAnchor)4);
						Label(new Rect(120f, 315f, 720f, 50f), Microgames.Controls(microController.Game.Kind));
					}
					else if (microController.Phase == MicroPhase.Playing)
					{
						DrawGame(microController.Game, val3);
					}
					else if (microController.Phase == MicroPhase.Success || microController.Phase == MicroPhase.Failure)
					{
						Label(new Rect(180f, 205f, 600f, 70f), (microController.Phase == MicroPhase.Success) ? "SUCCESS!" : "FAILURE!", large);
					}
				}
				GUI.DrawTexture(new Rect(val3.x, val3.y, 24f, 30f), (Texture)(object)cursor);
			}
			finally
			{
				GUI.matrix = matrix;
				GUI.color = color;
			}
		}

		private static void ClearPreview(bool restore = true)
		{
			preview?.Release(restore);
			preview = null;
			hovered = (previewPage = -1);
		}

		internal static void Dispose()
		{
			//IL_0016: 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)
			//IL_0021: Expected O, but got Unknown
			ClearPreview();
			object obj = <>O.<0>__Pause;
			if (obj == null)
			{
				hook_InstantiatePauseScreen val = Pause;
				<>O.<0>__Pause = val;
				obj = (object)val;
			}
			PauseScreenController.InstantiatePauseScreen -= (hook_InstantiatePauseScreen)obj;
			DesktopInputScope? obj2 = focus;
			if (obj2 != null)
			{
				obj2.Dispose();
			}
			focus = null;
			local = null;
			if (Object.op_Implicit((Object)(object)ui))
			{
				Object.Destroy((Object)(object)ui);
			}
			if (Object.op_Implicit((Object)(object)cursor))
			{
				Object.Destroy((Object)(object)cursor);
			}
			DiskArt.Dispose();
		}
	}
	public static class StartMenuLayout
	{
		public const float DesktopWidth = 640f;

		public const float DesktopHeight = 480f;

		public const float TaskbarY = 463f;

		public const float MenuWidth = 189f;

		public const float MenuHeight = 444f;

		public const float MenuDensity = 2f / 3f;

		public static float ScaleX(float width)
		{
			return width / 640f * (2f / 3f);
		}

		public static float ScaleY(float height)
		{
			return height / 480f * (2f / 3f);
		}

		public static float Top(float top, float height)
		{
			return top + height / 480f * 463f - 444f * ScaleY(height);
		}

		public static float SlotY(int slot)
		{
			return 117 + slot * 35;
		}
	}
	public sealed class StartMenuBoard
	{
		public const int Slots = 6;

		public readonly int Target;

		public bool Open;

		public int Chosen = -1;

		public StartMenuBoard(int seed)
		{
			Target = new Random(seed).Next(6);
		}

		public int Click(int code)
		{
			if (code == 0)
			{
				Open = !Open;
				return 0;
			}
			if (!Open || code < 1 || code > 6)
			{
				return 0;
			}
			Chosen = code - 1;
			if (Chosen != Target)
			{
				return -1;
			}
			return 1;
		}
	}
	public sealed class PaintBoard
	{
		public static readonly string[] Names = new string[6] { "RED", "YELLOW", "LIME", "CYAN", "BLUE", "MAGENTA" };

		public static readonly int[] Colors = new int[6] { 16711680, 16776960, 65280, 65535, 255, 16711935 };

		public readonly int Target;

		public bool Bucket;

		public int Selected = -1;

		public int Fill = -1;

		public PaintBoard(int seed)
		{
			Target = new Random(seed).Next(Names.Length);
		}

		public int Click(int code)
		{
			if (code == 0)
			{
				Bucket = true;
				return 0;
			}
			if (code == 1)
			{
				Bucket = false;
				return 0;
			}
			if (code >= 10 && code < 10 + Names.Length)
			{
				Selected = code - 10;
				return 0;
			}
			if (code != 2 || !Bucket || Selected < 0)
			{
				return 0;
			}
			Fill = Selected;
			if (Fill != Target)
			{
				return -1;
			}
			return 1;
		}
	}
	public sealed class PinballBoard
	{
		public const float LaunchSeconds = 1.2f;

		public const float TravelSeconds = 3.1f;

		public const float HalfWindow = 0.3f;

		public const int RouteCount = 6;

		public readonly int Route;

		public readonly int NeededMask;

		public float X = 0.88f;

		public float Y = 0.9f;

		public float Left;

		public float Right;

		public int Outcome;

		private float age;

		private float speed = 1f;

		private float previewAge;

		private float finishX;

		private float finishY;

		private bool armed;

		private readonly float[] pathX;

		private readonly float[] pathY;

		private readonly fl