Decompiled source of UltimateMenu v1.6.1

UltimateMenu v1.6.1.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using BepInEx;
using BepInEx.Logging;
using GorillaLocomotion;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.XR;
using Valve.VR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UltimateMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UltimateMenu")]
[assembly: AssemblyTitle("UltimateMenu")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace UltimateMenu
{
	[BepInPlugin("com.mattrax.ultimatemenu", "UltimateMenu", "1.6.1")]
	public class Log : BaseUnityPlugin
	{
		private static ManualLogSource _log;

		private Harmony harmony;

		public static string PluginName;

		public static string PluginVersion;

		public static string PluginGuid;

		public static Log Instance { get; private set; }

		private void Awake()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0052: Expected O, but got Unknown
			Instance = this;
			_log = ((BaseUnityPlugin)this).Logger;
			BepInPlugin metadata = MetadataHelper.GetMetadata((object)this);
			PluginName = metadata.Name;
			PluginVersion = metadata.Version.ToString();
			PluginGuid = metadata.GUID;
			Harmony val = new Harmony(PluginGuid);
			Harmony val2 = val;
			harmony = val;
			val2.PatchAll();
			try
			{
				ModConfig.Load();
			}
			catch (Exception e)
			{
				Err("Config", e);
			}
			foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypes()
				where t.Namespace == typeof(Log).Namespace && t.IsClass && !t.IsAbstract && typeof(MonoBehaviour).IsAssignableFrom(t) && t != typeof(Log) && t != typeof(GorillaInterface)
				select t)
			{
				try
				{
					((Component)this).gameObject.AddComponent(item);
				}
				catch (Exception e2)
				{
					Err("Skipping Mod - " + item.Name, e2);
				}
			}
		}

		private void Update()
		{
			if (ModConfig.HasPending)
			{
				ModConfig.ApplyPendingImport();
			}
		}

		private void OnDestroy()
		{
			ModConfig.Save();
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}

		public static void Info(string m)
		{
			ManualLogSource log = _log;
			if (log != null)
			{
				log.LogInfo((object)m);
			}
		}

		public static void Err(string m, Exception e)
		{
			ManualLogSource log = _log;
			if (log != null)
			{
				log.LogError((object)("[ERR] " + m + " : " + e.Message + "\n" + e.StackTrace));
			}
		}
	}
	public enum ThemePreset
	{
		SombreVert,
		Clair,
		SombreViolet,
		SombreBleu,
		Custom
	}
	public enum MenuCategory
	{
		Gameplay,
		Camera,
		Apparence,
		Technique,
		Social,
		Environnement,
		Experimental,
		Mocap,
		Stream,
		Cosmetique,
		Tracking
	}
	public static class SoundFX
	{
		public enum Sound
		{
			Aigue,
			Moyen,
			Grave
		}

		private static readonly Dictionary<Sound, AudioClip> _clips = new Dictionary<Sound, AudioClip>();

		private static AudioSource _source;

		private static bool _loaded;

		public static bool Enabled
		{
			get
			{
				return PlayerPrefs.GetInt("MUM_SoundEnabled", 1) == 1;
			}
			set
			{
				PlayerPrefs.SetInt("MUM_SoundEnabled", value ? 1 : 0);
				PlayerPrefs.Save();
			}
		}

		public static float Volume
		{
			get
			{
				return PlayerPrefs.GetFloat("MUM_SoundVolume", 0.6f);
			}
			set
			{
				PlayerPrefs.SetFloat("MUM_SoundVolume", Mathf.Clamp01(value));
				PlayerPrefs.Save();
			}
		}

		private static void EnsureLoaded()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!_loaded)
			{
				_loaded = true;
				GameObject val = new GameObject("MUM_SoundFX");
				Object.DontDestroyOnLoad((Object)(object)val);
				_source = val.AddComponent<AudioSource>();
				_source.playOnAwake = false;
				_source.spatialBlend = 0f;
				LoadClip(Sound.Aigue, "Assets.Menu.Sounds.Aigue.wav");
				LoadClip(Sound.Moyen, "Assets.Menu.Sounds.Moyen.wav");
				LoadClip(Sound.Grave, "Assets.Menu.Sounds.Grave.wav");
			}
		}

		private static void LoadClip(Sound key, string logicalNameSuffix)
		{
			try
			{
				Assembly assembly = typeof(SoundFX).Assembly;
				string text = null;
				string[] manifestResourceNames = assembly.GetManifestResourceNames();
				foreach (string text2 in manifestResourceNames)
				{
					if (text2.EndsWith(logicalNameSuffix, StringComparison.OrdinalIgnoreCase))
					{
						text = text2;
						break;
					}
				}
				if (text == null)
				{
					Log.Err("SoundFX.LoadClip", new Exception("Ressource introuvable: " + logicalNameSuffix));
					return;
				}
				byte[] wav;
				using (Stream stream = assembly.GetManifestResourceStream(text))
				{
					using MemoryStream memoryStream = new MemoryStream();
					stream.CopyTo(memoryStream);
					wav = memoryStream.ToArray();
				}
				AudioClip val = WavToAudioClip(wav, key.ToString());
				if ((Object)(object)val != (Object)null)
				{
					_clips[key] = val;
				}
			}
			catch (Exception e)
			{
				Log.Err("SoundFX.LoadClip", e);
			}
		}

		private static AudioClip WavToAudioClip(byte[] wav, string name)
		{
			try
			{
				int num = 12;
				int num2 = 1;
				int num3 = 16;
				int num4 = 44100;
				byte[] array = null;
				while (num + 8 <= wav.Length)
				{
					string text = Encoding.ASCII.GetString(wav, num, 4);
					int num5 = BitConverter.ToInt32(wav, num + 4);
					int num6 = num + 8;
					if (text == "fmt ")
					{
						num2 = BitConverter.ToInt16(wav, num6 + 2);
						num4 = BitConverter.ToInt32(wav, num6 + 4);
						num3 = BitConverter.ToInt16(wav, num6 + 14);
					}
					else if (text == "data")
					{
						array = new byte[num5];
						Array.Copy(wav, num6, array, 0, num5);
					}
					num = num6 + num5 + num5 % 2;
				}
				if (array == null)
				{
					return null;
				}
				int num7 = Mathf.Max(1, num3 / 8);
				int num8 = array.Length / num7;
				float[] array2 = new float[num8];
				for (int i = 0; i < num8; i++)
				{
					int num9 = i * num7;
					switch (num3)
					{
					case 16:
						array2[i] = (float)BitConverter.ToInt16(array, num9) / 32768f;
						break;
					case 8:
						array2[i] = (float)(array[num9] - 128) / 128f;
						break;
					case 32:
						array2[i] = (float)BitConverter.ToInt32(array, num9) / 2.1474836E+09f;
						break;
					default:
						array2[i] = 0f;
						break;
					}
				}
				AudioClip val = AudioClip.Create(name, num8 / Mathf.Max(1, num2), Mathf.Max(1, num2), num4, false);
				val.SetData(array2, 0);
				return val;
			}
			catch (Exception e)
			{
				Log.Err("SoundFX.WavToAudioClip", e);
				return null;
			}
		}

		public static void PlaySound(string name)
		{
			if (Enabled)
			{
				EnsureLoaded();
				if (!((Object)(object)_source == (Object)null) && Enum.TryParse<Sound>(name, ignoreCase: true, out var result) && _clips.TryGetValue(result, out AudioClip value) && !((Object)(object)value == (Object)null))
				{
					_source.PlayOneShot(value, Volume);
				}
			}
		}
	}
	public static class Theme
	{
		private struct Preset
		{
			public Color Accent;

			public Color BG;

			public Color BG2;

			public Color BG3;

			public Color Text;

			public Color Dim;
		}

		public static Color Accent = new Color(0.1f, 0.9f, 0.4f, 1f);

		public static Color BG = new Color(0.11f, 0.11f, 0.115f, 0.94f);

		public static Color BG2 = new Color(0.16f, 0.16f, 0.17f, 0.9f);

		public static Color BG3 = new Color(0.22f, 0.22f, 0.23f, 0.95f);

		public static Color Text = new Color(0.95f, 0.95f, 0.96f, 1f);

		public static Color Dim = new Color(0.58f, 0.58f, 0.6f, 1f);

		public static readonly Color Green = new Color(0.1f, 0.8f, 0.3f, 1f);

		public static readonly Color Red = new Color(0.85f, 0.15f, 0.15f, 1f);

		public static readonly Color Yellow = new Color(0.85f, 0.7f, 0.05f, 1f);

		public static ThemePreset Current
		{
			get
			{
				return (ThemePreset)PlayerPrefs.GetInt("MUM_ThemePreset", 0);
			}
			set
			{
				PlayerPrefs.SetInt("MUM_ThemePreset", (int)value);
				PlayerPrefs.Save();
			}
		}

		public static float BgAlpha
		{
			get
			{
				return PlayerPrefs.GetFloat("MUM_BgAlpha", 0.97f);
			}
			set
			{
				PlayerPrefs.SetFloat("MUM_BgAlpha", Mathf.Clamp01(value));
				PlayerPrefs.Save();
				BG.a = Mathf.Clamp01(value);
			}
		}

		public static bool BoldText
		{
			get
			{
				return PlayerPrefs.GetInt("MUM_BoldText", 1) == 1;
			}
			set
			{
				PlayerPrefs.SetInt("MUM_BoldText", value ? 1 : 0);
				PlayerPrefs.Save();
			}
		}

		private static Preset Get(ThemePreset p)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_012b: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_01ab: 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_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: 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_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: 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_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			return p switch
			{
				ThemePreset.Clair => new Preset
				{
					Accent = new Color(0.15f, 0.55f, 0.95f, 1f),
					BG = new Color(0.95f, 0.95f, 0.95f, 1f),
					BG2 = new Color(0.85f, 0.85f, 0.85f, 1f),
					BG3 = new Color(0.78f, 0.78f, 0.78f, 1f),
					Text = new Color(0.08f, 0.08f, 0.08f, 1f),
					Dim = new Color(0.35f, 0.35f, 0.35f, 1f)
				}, 
				ThemePreset.SombreViolet => new Preset
				{
					Accent = new Color(0.62f, 0.3f, 0.95f, 1f),
					BG = new Color(0.08f, 0.08f, 0.1f, 0.97f),
					BG2 = new Color(0.13f, 0.12f, 0.16f, 1f),
					BG3 = new Color(0.19f, 0.17f, 0.23f, 1f),
					Text = new Color(0.92f, 0.92f, 0.94f, 1f),
					Dim = new Color(0.52f, 0.5f, 0.56f, 1f)
				}, 
				ThemePreset.SombreBleu => new Preset
				{
					Accent = new Color(0.2f, 0.6f, 0.95f, 1f),
					BG = new Color(0.07f, 0.09f, 0.11f, 0.97f),
					BG2 = new Color(0.11f, 0.14f, 0.17f, 1f),
					BG3 = new Color(0.16f, 0.2f, 0.24f, 1f),
					Text = new Color(0.9f, 0.93f, 0.96f, 1f),
					Dim = new Color(0.48f, 0.54f, 0.58f, 1f)
				}, 
				_ => new Preset
				{
					Accent = new Color(0.1f, 0.9f, 0.4f, 1f),
					BG = new Color(0.08f, 0.08f, 0.08f, 0.97f),
					BG2 = new Color(0.12f, 0.12f, 0.12f, 1f),
					BG3 = new Color(0.18f, 0.18f, 0.18f, 1f),
					Text = new Color(0.92f, 0.92f, 0.92f, 1f),
					Dim = new Color(0.5f, 0.5f, 0.5f, 1f)
				}, 
			};
		}

		public static void Apply(ThemePreset p)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Current = p;
			if (p != ThemePreset.Custom)
			{
				Preset preset = Get(p);
				Accent = preset.Accent;
				BG = preset.BG;
				BG2 = preset.BG2;
				BG3 = preset.BG3;
				Text = preset.Text;
				Dim = preset.Dim;
				BG.a = BgAlpha;
				SaveCustom();
			}
			MenuUI.Instance?.RebuildTex();
		}

		public static void SetAccent(float h, float s, float v)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Accent = Color.HSVToRGB(h, s, v);
			Current = ThemePreset.Custom;
			SaveCustom();
			MenuUI.Instance?.RebuildTex();
		}

		public static void SaveCustom()
		{
			//IL_0006: 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_0030: 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_005a: 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)
			PlayerPrefs.SetString("MUM_CAccent", ColorUtility.ToHtmlStringRGB(Accent));
			PlayerPrefs.SetString("MUM_CBG", ColorUtility.ToHtmlStringRGB(BG));
			PlayerPrefs.SetString("MUM_CBG2", ColorUtility.ToHtmlStringRGB(BG2));
			PlayerPrefs.SetString("MUM_CBG3", ColorUtility.ToHtmlStringRGB(BG3));
			PlayerPrefs.SetString("MUM_CText", ColorUtility.ToHtmlStringRGB(Text));
			PlayerPrefs.SetString("MUM_CDim", ColorUtility.ToHtmlStringRGB(Dim));
			PlayerPrefs.Save();
		}

		public static void LoadSaved()
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//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_002c: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			ThemePreset current = Current;
			if (current == ThemePreset.Custom)
			{
				Accent = LoadColor("MUM_CAccent", Accent);
				BG = LoadColor("MUM_CBG", BG);
				BG2 = LoadColor("MUM_CBG2", BG2);
				BG3 = LoadColor("MUM_CBG3", BG3);
				Text = LoadColor("MUM_CText", Text);
				Dim = LoadColor("MUM_CDim", Dim);
				BG.a = BgAlpha;
			}
			else
			{
				Preset preset = Get(current);
				Accent = preset.Accent;
				BG = preset.BG;
				BG2 = preset.BG2;
				BG3 = preset.BG3;
				Text = preset.Text;
				Dim = preset.Dim;
				BG.a = BgAlpha;
			}
		}

		private static Color LoadColor(string key, Color fallback)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			string text = PlayerPrefs.GetString(key, "");
			if (string.IsNullOrEmpty(text))
			{
				return fallback;
			}
			Color val = default(Color);
			return ColorUtility.TryParseHtmlString("#" + text, ref val) ? val : fallback;
		}
	}
	public static class UI
	{
		private static Font _font;

		public const float RefHeight = 540f;

		public static float Scale = 1f;

		private static readonly Dictionary<(int w, int h, int r, int colorHash), Texture2D> _roundedCache = new Dictionary<(int, int, int, int), Texture2D>();

		private static readonly Dictionary<int, GUIStyle> _roundedShapes = new Dictionary<int, GUIStyle>();

		private static GUIStyle _emptyScrollStyle;

		public static Font BodyFont
		{
			get
			{
				if ((Object)(object)_font != (Object)null)
				{
					return _font;
				}
				try
				{
					_font = Font.CreateDynamicFontFromOSFont("Arial", 14);
				}
				catch (Exception e)
				{
					Log.Err("UI.BodyFont", e);
				}
				return (Font)(((Object)(object)_font != (Object)null) ? ((object)_font) : ((object)GUI.skin.font));
			}
		}

		public static Color SecondaryText => Color.Lerp(Theme.Dim, Theme.Text, 0.55f);

		public static GUIStyle EmptyScrollStyle
		{
			get
			{
				//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_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				if (_emptyScrollStyle == null)
				{
					_emptyScrollStyle = new GUIStyle(GUIStyle.none)
					{
						fixedWidth = 0f,
						fixedHeight = 0f
					};
				}
				return _emptyScrollStyle;
			}
		}

		public static Texture2D MakeTex(Color c)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, c);
			val.Apply();
			((Texture)val).filterMode = (FilterMode)0;
			return val;
		}

		public static int Px(float refSize)
		{
			return Mathf.Max(11, Mathf.RoundToInt(refSize * Scale));
		}

		public static GUIStyle Sty(Color c, float s = 10f, bool bold = false, TextAnchor align = (TextAnchor)3)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = Px(s),
				fontStyle = (FontStyle)((bold || Theme.BoldText) ? 1 : 0),
				alignment = align,
				wordWrap = true,
				font = BodyFont
			};
			val.normal.textColor = ((c == Theme.Dim) ? SecondaryText : c);
			return val;
		}

		public static GUIStyle BtnS(Texture2D bg, Color tc, float s = 10f)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0024: 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_0036: 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_004a: 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_0059: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.button)
			{
				fontSize = Px(s),
				fontStyle = (FontStyle)1,
				font = BodyFont
			};
			val.normal.textColor = tc;
			val.normal.background = bg;
			val.padding = new RectOffset(8, 8, 4, 4);
			val.wordWrap = true;
			return val;
		}

		public static GUIStyle CardS(Color bg)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0042: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.box);
			val.normal.background = MakeTex(bg);
			val.padding = new RectOffset(8, 8, 6, 6);
			val.margin = new RectOffset(0, 0, 1, 1);
			return val;
		}

		public unsafe static Texture2D MakeRoundedTex(Color c, int w, int h, int r)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			w = Mathf.Max(4, w);
			h = Mathf.Max(4, h);
			r = Mathf.Clamp(r, 0, Mathf.Min(w, h) / 2);
			int hashCode = ((object)(*(Color*)(&c))/*cast due to .constrained prefix*/).GetHashCode();
			(int, int, int, int) key = (w, h, r, hashCode);
			if (_roundedCache.TryGetValue(key, out Texture2D value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Texture2D val = new Texture2D(w, h, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color[] array = (Color[])(object)new Color[w * h];
			for (int i = 0; i < h; i++)
			{
				for (int j = 0; j < w; j++)
				{
					array[i * w + j] = new Color(c.r, c.g, c.b, c.a * CornerAlpha(j, i, w, h, r));
				}
			}
			val.SetPixels(array);
			val.Apply(false);
			_roundedCache[key] = val;
			return val;
		}

		private static float CornerAlpha(int x, int y, int w, int h, int r)
		{
			if (r <= 0)
			{
				return 1f;
			}
			float num = Mathf.Clamp(x, r, w - r);
			float num2 = Mathf.Clamp(y, r, h - r);
			float num3 = (float)x - num;
			float num4 = (float)y - num2;
			float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
			return 1f - Mathf.Clamp01((num5 - (float)r + 2f) / 2f);
		}

		public static void DrawShadow(Rect r, int radius = 20, float offsetY = 8f, float strength = 0.28f, float blur = 1.35f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_0027: 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)
			if ((int)Event.current.type == 7)
			{
				((Rect)(ref r)).y = ((Rect)(ref r)).y + offsetY;
				DrawRounded(r, new Color(0f, 0f, 0f, strength * 0.55f), radius);
			}
		}

		public static void DrawRounded(Rect r, Color c, int radius = 14)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00bf: Expected O, but got Unknown
			if ((int)Event.current.type == 7 && !(((Rect)(ref r)).width <= 0f) && !(((Rect)(ref r)).height <= 0f))
			{
				radius = Mathf.Clamp(radius, 0, Mathf.Min(96, Mathf.FloorToInt(Mathf.Min(((Rect)(ref r)).width, ((Rect)(ref r)).height) * 0.5f)));
				if (!_roundedShapes.TryGetValue(radius, out GUIStyle value))
				{
					int num = Mathf.Max(4, radius * 2 + 2);
					GUIStyle val = new GUIStyle(GUIStyle.none);
					val.normal.background = MakeRoundedTex(Color.white, num, num, radius);
					val.border = new RectOffset(radius, radius, radius, radius);
					value = val;
					_roundedShapes[radius] = value;
				}
				Color color = GUI.color;
				GUI.color = color * c;
				value.Draw(r, GUIContent.none, false, false, false, false);
				GUI.color = color;
			}
		}

		public static void DrawRoundedBorder(Rect r, Color c, int radius = 14, float thickness = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_006b: 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)
			DrawRounded(r, c, radius);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).x + thickness, ((Rect)(ref r)).y + thickness, ((Rect)(ref r)).width - thickness * 2f, ((Rect)(ref r)).height - thickness * 2f);
			if (((Rect)(ref val)).width > 2f && ((Rect)(ref val)).height > 2f)
			{
				Color color = GUI.color;
				GUI.color = Color.clear;
				GUI.color = color;
			}
		}

		public static void DrawOutline(Rect r, Color outlineColor, int radius, float thickness)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref r)).x - thickness, ((Rect)(ref r)).y - thickness, ((Rect)(ref r)).width + thickness * 2f, ((Rect)(ref r)).height + thickness * 2f);
			DrawRounded(r2, outlineColor, Mathf.RoundToInt((float)radius + thickness));
		}

		public static GUIStyle CardRoundedS(Color bg, int radius = 14)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0036: 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_0049: Expected O, but got Unknown
			//IL_004a: 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_0059: Expected O, but got Unknown
			//IL_005b: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.box);
			val.normal.background = MakeRoundedTex(bg, 80, 80, radius);
			val.border = new RectOffset(radius, radius, radius, radius);
			val.padding = new RectOffset(14, 14, 12, 12);
			val.margin = new RectOffset(0, 0, 3, 3);
			return val;
		}

		public static GUIStyle BtnRoundedS(Color bg, Color tc, float s = 10f, int radius = 10)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0024: 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_0038: 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_0045: 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_005c: 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_0069: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00c6: 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_00d5: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.button)
			{
				fontSize = Px(s),
				fontStyle = (FontStyle)1,
				font = BodyFont,
				alignment = (TextAnchor)4
			};
			val.normal.textColor = tc;
			val.normal.background = MakeRoundedTex(bg, 80, 40, radius);
			val.hover.textColor = tc;
			val.hover.background = MakeRoundedTex(bg, 80, 40, radius);
			val.active.textColor = tc;
			val.active.background = MakeRoundedTex(bg, 80, 40, radius);
			val.border = new RectOffset(radius, radius, radius, radius);
			val.padding = new RectOffset(10, 10, 4, 4);
			val.margin = new RectOffset(0, 0, 0, 0);
			val.wordWrap = true;
			return val;
		}

		public static void ClearRoundedCache()
		{
			foreach (KeyValuePair<(int, int, int, int), Texture2D> item in _roundedCache)
			{
				if ((Object)(object)item.Value != (Object)null)
				{
					Object.Destroy((Object)(object)item.Value);
				}
			}
			_roundedCache.Clear();
			_roundedShapes.Clear();
		}
	}
	public static class CategoryNames
	{
		public static string Get(MenuCategory category)
		{
			return I18n.T("Category." + category);
		}
	}
	public static class Keys
	{
		private static readonly Dictionary<string, KeyCode> _def = new Dictionary<string, KeyCode>();

		public static KeyCode CreateKey(string name, KeyCode def)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			if (!_def.ContainsKey(name))
			{
				_def[name] = def;
			}
			return GetKey(name);
		}

		public unsafe static void ModifyKey(string name, KeyCode kc)
		{
			PlayerPrefs.SetString("MUM_" + name, ((object)(*(KeyCode*)(&kc))/*cast due to .constrained prefix*/).ToString());
			PlayerPrefs.Save();
		}

		public unsafe static KeyCode GetKey(string name)
		{
			//IL_004e: 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_0013: 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_0014: 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)
			KeyCode value;
			KeyCode result = (KeyCode)(_def.TryGetValue(name, out value) ? ((int)value) : 0);
			string value2 = PlayerPrefs.GetString("MUM_" + name, ((object)(*(KeyCode*)(&result))/*cast due to .constrained prefix*/).ToString());
			try
			{
				return (KeyCode)Enum.Parse(typeof(KeyCode), value2);
			}
			catch
			{
				return result;
			}
		}

		public unsafe static void ResetKey(string name)
		{
			if (_def.TryGetValue(name, out var value))
			{
				PlayerPrefs.SetString("MUM_" + name, ((object)(*(KeyCode*)(&value))/*cast due to .constrained prefix*/).ToString());
				PlayerPrefs.Save();
			}
		}

		public static IEnumerable<KeyValuePair<string, KeyCode>> All()
		{
			foreach (KeyValuePair<string, KeyCode> kv in _def)
			{
				yield return new KeyValuePair<string, KeyCode>(kv.Key, GetKey(kv.Key));
			}
		}
	}
	public enum Layout
	{
		Unset,
		Azerty,
		Qwerty,
		Qwertz,
		Jcuken
	}
	public static class KeyLayout
	{
		private static readonly Dictionary<KeyCode, string> _azerty = new Dictionary<KeyCode, string>
		{
			{
				(KeyCode)113,
				"A"
			},
			{
				(KeyCode)119,
				"Z"
			},
			{
				(KeyCode)97,
				"Q"
			},
			{
				(KeyCode)122,
				"W"
			},
			{
				(KeyCode)109,
				","
			},
			{
				(KeyCode)59,
				"M"
			},
			{
				(KeyCode)44,
				";"
			},
			{
				(KeyCode)46,
				":"
			},
			{
				(KeyCode)47,
				"!"
			}
		};

		private static readonly Dictionary<KeyCode, string> _qwertz = new Dictionary<KeyCode, string>
		{
			{
				(KeyCode)121,
				"Z"
			},
			{
				(KeyCode)122,
				"Y"
			}
		};

		private static readonly Dictionary<KeyCode, string> _jcuken = new Dictionary<KeyCode, string>
		{
			{
				(KeyCode)113,
				"Й"
			},
			{
				(KeyCode)119,
				"Ц"
			},
			{
				(KeyCode)101,
				"У"
			},
			{
				(KeyCode)114,
				"К"
			},
			{
				(KeyCode)116,
				"Е"
			},
			{
				(KeyCode)121,
				"Н"
			},
			{
				(KeyCode)117,
				"Г"
			},
			{
				(KeyCode)105,
				"Ш"
			},
			{
				(KeyCode)111,
				"Щ"
			},
			{
				(KeyCode)112,
				"З"
			},
			{
				(KeyCode)97,
				"Ф"
			},
			{
				(KeyCode)115,
				"Ы"
			},
			{
				(KeyCode)100,
				"В"
			},
			{
				(KeyCode)102,
				"А"
			},
			{
				(KeyCode)103,
				"П"
			},
			{
				(KeyCode)104,
				"Р"
			},
			{
				(KeyCode)106,
				"О"
			},
			{
				(KeyCode)107,
				"Л"
			},
			{
				(KeyCode)108,
				"Д"
			},
			{
				(KeyCode)59,
				"Ж"
			},
			{
				(KeyCode)39,
				"Э"
			},
			{
				(KeyCode)122,
				"Я"
			},
			{
				(KeyCode)120,
				"Ч"
			},
			{
				(KeyCode)99,
				"С"
			},
			{
				(KeyCode)118,
				"М"
			},
			{
				(KeyCode)98,
				"И"
			},
			{
				(KeyCode)110,
				"Т"
			},
			{
				(KeyCode)109,
				"Ь"
			},
			{
				(KeyCode)44,
				"Б"
			},
			{
				(KeyCode)46,
				"Ю"
			}
		};

		public static Layout Current
		{
			get
			{
				return (Layout)PlayerPrefs.GetInt("MUM_Layout", 0);
			}
			set
			{
				PlayerPrefs.SetInt("MUM_Layout", (int)value);
				PlayerPrefs.Save();
			}
		}

		public static void DetectAndApply()
		{
			if (Keyboard.current == null)
			{
				return;
			}
			string keyboardLayout = Keyboard.current.keyboardLayout;
			if (!string.IsNullOrEmpty(keyboardLayout))
			{
				Layout layout = FromSystemName(keyboardLayout);
				if (layout != Layout.Unset && Current != layout)
				{
					Current = layout;
				}
			}
		}

		private static Layout FromSystemName(string name)
		{
			string text = name.ToLowerInvariant();
			if (text.Contains("french") || text.Contains("azerty") || text.Contains("belg"))
			{
				return Layout.Azerty;
			}
			if (text.Contains("german") || text.Contains("swiss") || text.Contains("austria") || text.Contains("qwertz"))
			{
				return Layout.Qwertz;
			}
			if (text.Contains("russian") || text.Contains("jcuken") || text.Contains("йцукен"))
			{
				return Layout.Jcuken;
			}
			if (text.Contains("us") || text.Contains("english") || text.Contains("united") || text.Contains("uk") || text.Contains("qwerty"))
			{
				return Layout.Qwerty;
			}
			return Layout.Unset;
		}

		private static Dictionary<KeyCode, string> TableFor(Layout layout)
		{
			return layout switch
			{
				Layout.Azerty => _azerty, 
				Layout.Qwertz => _qwertz, 
				Layout.Jcuken => _jcuken, 
				_ => null, 
			};
		}

		public unsafe static string Display(KeyCode kc)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<KeyCode, string> dictionary = TableFor(Current);
			if (dictionary != null && dictionary.TryGetValue(kc, out var value))
			{
				return value;
			}
			return ((object)(*(KeyCode*)(&kc))/*cast due to .constrained prefix*/).ToString();
		}

		public unsafe static string Display(KeyCode kc, Layout layout)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<KeyCode, string> dictionary = TableFor(layout);
			if (dictionary != null && dictionary.TryGetValue(kc, out var value))
			{
				return value;
			}
			return ((object)(*(KeyCode*)(&kc))/*cast due to .constrained prefix*/).ToString();
		}

		public static KeyCode Physical(string label, Layout layout)
		{
			//IL_0070: 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_006b: 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_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)
			Dictionary<KeyCode, string> dictionary = TableFor(layout);
			if (dictionary != null)
			{
				foreach (KeyValuePair<KeyCode, string> item in dictionary)
				{
					if (item.Value == label)
					{
						return item.Key;
					}
				}
			}
			if (Enum.TryParse<KeyCode>(label, ignoreCase: true, out KeyCode result))
			{
				return result;
			}
			return (KeyCode)0;
		}
	}
	public static class ModConfig
	{
		private static string[] _pendingLines;

		public static bool HasPending => _pendingLines != null;

		private static CultureInfo Inv => CultureInfo.InvariantCulture;

		public static void Load()
		{
			Log.Info("Config Loaded !");
		}

		public static void Save()
		{
			PlayerPrefs.Save();
		}

		public static void SetKey(string name, KeyCode kc)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Keys.ModifyKey(name, kc);
		}

		public static void Export()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder stringBuilder = new StringBuilder("[MattraxUltimateMenu v1.2]\n");
			foreach (KeyValuePair<string, KeyCode> item in Keys.All())
			{
				stringBuilder.AppendLine("MUM_" + item.Key + "=" + ((object)item.Value/*cast due to .constrained prefix*/).ToString());
			}
			stringBuilder.AppendLine("MUM_CamSpeed=" + PlayerPrefs.GetFloat("MUM_CamSpeed", 5f).ToString(Inv));
			stringBuilder.AppendLine("MUM_CamSens=" + PlayerPrefs.GetFloat("MUM_CamSens", 2f).ToString(Inv));
			stringBuilder.AppendLine("MUM_names=" + PlayerPrefs.GetString("MUM_names", "{}"));
			stringBuilder.AppendLine("MUM_UIScale=" + PlayerPrefs.GetFloat("MUM_UIScale", 1f).ToString(Inv));
			stringBuilder.AppendLine("MUM_ThemePreset=" + PlayerPrefs.GetInt("MUM_ThemePreset", 0));
			stringBuilder.AppendLine("MUM_BgAlpha=" + PlayerPrefs.GetFloat("MUM_BgAlpha", 0.97f).ToString(Inv));
			stringBuilder.AppendLine("MUM_Layout=" + PlayerPrefs.GetInt("MUM_Layout", 0));
			stringBuilder.AppendLine("MUM_Lang=" + PlayerPrefs.GetInt("MUM_Lang", 0));
			string content = stringBuilder.ToString();
			Thread thread = new Thread((ThreadStart)delegate
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: 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_002c: Expected O, but got Unknown
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Invalid comparison between Unknown and I4
				try
				{
					SaveFileDialog val = new SaveFileDialog
					{
						Title = "Exporter config",
						FileName = "MattraxConfig.txt",
						Filter = "txt|*.txt|*|*.*"
					};
					if ((int)((CommonDialog)val).ShowDialog() == 1)
					{
						File.WriteAllText(((FileDialog)val).FileName, content);
						Log.Info("Exporté : " + ((FileDialog)val).FileName);
					}
				}
				catch (Exception e)
				{
					Log.Err("Export", e);
				}
			});
			thread.SetApartmentState(ApartmentState.STA);
			thread.Start();
		}

		public static void Import()
		{
			Thread thread = new Thread((ThreadStart)delegate
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Expected O, but got Unknown
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Invalid comparison between Unknown and I4
				try
				{
					OpenFileDialog val = new OpenFileDialog
					{
						Title = "Importer config",
						Filter = "txt|*.txt|*|*.*"
					};
					if ((int)((CommonDialog)val).ShowDialog() == 1)
					{
						_pendingLines = File.ReadAllLines(((FileDialog)val).FileName);
					}
				}
				catch (Exception e)
				{
					Log.Err("Import", e);
				}
			});
			thread.SetApartmentState(ApartmentState.STA);
			thread.Start();
		}

		public static void ApplyPendingImport()
		{
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			if (_pendingLines == null)
			{
				return;
			}
			string[] pendingLines = _pendingLines;
			_pendingLines = null;
			string[] array = pendingLines;
			foreach (string text in array)
			{
				string text2 = text.Trim();
				if (!text2.Contains("=") || text2.StartsWith("["))
				{
					continue;
				}
				string[] array2 = text2.Split(new char[1] { '=' }, 2);
				string text3 = array2[0].Trim();
				string text4 = array2[1].Trim();
				if (!text3.StartsWith("MUM_"))
				{
					continue;
				}
				string text5 = text3.Substring(4);
				bool flag = false;
				foreach (KeyValuePair<string, KeyCode> item in Keys.All())
				{
					if (item.Key == text5)
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					try
					{
						Keys.ModifyKey(text5, (KeyCode)Enum.Parse(typeof(KeyCode), text4));
					}
					catch
					{
					}
					continue;
				}
				switch (text3)
				{
				default:
					if (!(text3 == "MUM_BgAlpha"))
					{
						if (text3 == "MUM_ThemePreset" || text3 == "MUM_Layout" || text3 == "MUM_Lang")
						{
							if (int.TryParse(text4, out var result))
							{
								PlayerPrefs.SetInt(text3, result);
							}
						}
						else
						{
							PlayerPrefs.SetString(text3, text4);
						}
						break;
					}
					goto case "MUM_CamSpeed";
				case "MUM_CamSpeed":
				case "MUM_CamSens":
				case "MUM_UIScale":
				{
					if (float.TryParse(text4, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
					{
						PlayerPrefs.SetFloat(text3, result2);
					}
					break;
				}
				}
			}
			PlayerPrefs.Save();
			GorillaCamera.Instance?.ReloadConfig();
			Theme.LoadSaved();
			MenuUI.Instance?.RebuildTex();
			Log.Info("Config importée !");
		}
	}
	public class Setting
	{
		public enum Kind
		{
			Slider,
			Toggle,
			Button,
			Info,
			IntSlider
		}

		public Kind Type;

		public string Label;

		public Func<float> GetFloat;

		public Action<float> SetFloat;

		public float Min;

		public float Max;

		public string Format = "0.00";

		public float Step = 0.05f;

		public Func<bool> GetBool;

		public Action<bool> SetBool;

		public Func<string> GetValueText;

		public Action OnActivate;

		public static Setting Slider(string label, Func<float> get, Action<float> set, float min, float max, string fmt = "0.00", float step = 0.05f)
		{
			return new Setting
			{
				Type = Kind.Slider,
				Label = label,
				GetFloat = get,
				SetFloat = set,
				Min = min,
				Max = max,
				Format = fmt,
				Step = step
			};
		}

		public static Setting IntSlider(string label, Func<float> get, Action<float> set, int min, int max)
		{
			return new Setting
			{
				Type = Kind.IntSlider,
				Label = label,
				GetFloat = get,
				SetFloat = set,
				Min = min,
				Max = max,
				Format = "0",
				Step = 1f
			};
		}

		public static Setting Toggle(string label, Func<bool> get, Action<bool> set)
		{
			return new Setting
			{
				Type = Kind.Toggle,
				Label = label,
				GetBool = get,
				SetBool = set
			};
		}

		public static Setting Button(string label, Action onActivate, Func<string> getValueText = null)
		{
			return new Setting
			{
				Type = Kind.Button,
				Label = label,
				OnActivate = onActivate,
				GetValueText = getValueText
			};
		}

		public static Setting Info(string label, Func<string> getValueText)
		{
			return new Setting
			{
				Type = Kind.Info,
				Label = label,
				GetValueText = getValueText
			};
		}

		public void DrawPC(MenuUI ui)
		{
			switch (Type)
			{
			case Kind.Slider:
			{
				float num = ui.Slider(Label, GetFloat(), Min, Max, Format);
				if (!Mathf.Approximately(num, GetFloat()))
				{
					SetFloat(num);
				}
				break;
			}
			case Kind.IntSlider:
			{
				int num2 = ui.IntSlider(Label, Mathf.RoundToInt(GetFloat()), Mathf.RoundToInt(Min), Mathf.RoundToInt(Max));
				if (num2 != Mathf.RoundToInt(GetFloat()))
				{
					SetFloat(num2);
				}
				break;
			}
			case Kind.Toggle:
			{
				bool flag = ui.Toggle(Label, GetBool());
				if (flag != GetBool())
				{
					SetBool(flag);
				}
				break;
			}
			case Kind.Button:
			{
				string text = ((GetValueText != null) ? GetValueText() : "");
				if (ui.Btn(string.IsNullOrEmpty(text) ? Label : (Label + " : " + text)))
				{
					OnActivate?.Invoke();
				}
				break;
			}
			case Kind.Info:
				ui.InfoRow(Label, GetValueText());
				break;
			}
		}
	}
	public class Page
	{
		public string Icon;

		public string Title;

		public MenuCategory Category;

		public bool IsCustom;

		public Action<MenuUI> Draw;

		public List<Setting> Settings = new List<Setting>();

		private string PrefKey => "MUM_ModEnabled_" + Title;

		public bool Enabled
		{
			get
			{
				return PlayerPrefs.GetInt(PrefKey, 1) == 1;
			}
			set
			{
				PlayerPrefs.SetInt(PrefKey, value ? 1 : 0);
				PlayerPrefs.Save();
			}
		}

		public Page(string icon, string title, Action<MenuUI> draw, MenuCategory category = MenuCategory.Gameplay, bool isCustom = false)
		{
			Icon = icon;
			Title = title;
			Draw = draw;
			Category = category;
			IsCustom = isCustom;
		}
	}
	[DefaultExecutionOrder(10000)]
	public class MenuUI : MonoBehaviour
	{
		private sealed class VrScroll
		{
			public string Key;

			public Vector2 Position;

			public Rect Viewport;

			public VrScroll Parent;
		}

		private sealed class VrControl
		{
			public string Key;

			public Rect Rect;

			public bool Slider;

			public VrScroll Scroll;
		}

		private List<Page> _pages = new List<Page>();

		private int _nav = -1;

		private Vector2 _scrollModes;

		private Vector2 _scrollPage;

		private bool _visible;

		private float _scale = 1f;

		private Rect _rect;

		private bool _dragging;

		private Vector2 _dragOff;

		private int _lastScreenW;

		private int _lastScreenH;

		private bool _themeOpen;

		private bool _langOpen;

		private float _animT;

		private bool _animOpening;

		private const float AnimDur = 0.1f;

		private readonly Texture2D[] _navigationIcons = (Texture2D[])(object)new Texture2D[8];

		private int? _pendingNav;

		private int _selectedConfig = -3;

		private Vector2 _scrollSettings;

		private float _settingsContentH = 1f;

		private GUISkin _scrollSkin;

		private float _scrollSkinScale;

		private readonly Stack<GUISkin> _scrollSkinStack = new Stack<GUISkin>();

		private List<string> _keyHistory = new List<string>();

		public Texture2D TA;

		public Texture2D TB;

		public Texture2D TB2;

		public Texture2D TB3;

		public Texture2D TW;

		public Texture2D TG;

		public Texture2D TR;

		public Texture2D TY;

		private KeyCode _keyMenu;

		private string _search = "";

		private float _homeContentH = 1f;

		private float _modesContentH = 1f;

		private float _pageContentH = 1f;

		private const string DonateUrl = "https://www.patreon.com/cw/MATTRAXER64xp";

		private GorillaInterface _gorillaInterface;

		private const int WindowRadius = 28;

		private const int RowRadius = 12;

		private RenderTexture _vrMenuTexture;

		private string _drawingPageTitle;

		private readonly List<VrControl> _vrControls = new List<VrControl>();

		private readonly Dictionary<string, int> _vrOccurrences = new Dictionary<string, int>();

		private readonly Dictionary<string, Vector2> _vrScrollRequests = new Dictionary<string, Vector2>();

		private readonly Stack<VrScroll> _vrScrollStack = new Stack<VrScroll>();

		private bool _vrInDraw;

		private bool _vrKeyboardDrawing;

		private bool _vrEnsureVisible;

		private string _vrFocus;

		private string _vrPress;

		private string _vrAdjustKey;

		private string _vrKeyboardTarget;

		private string _vrTextTarget;

		private string _vrTextResult;

		private string _vrKeyboardValue = "";

		private bool _vrUpper = true;

		private int _vrAdjustment;

		public static MenuUI Instance { get; private set; }

		public bool WaitingKey { get; private set; }

		public string RebindTarget { get; private set; }

		public static float StandardRoundBtnSize => 28f * UI.Scale;

		public float WinW => ((Rect)(ref _rect)).width;

		public float WinH => ((Rect)(ref _rect)).height;

		private bool VrActive => _vrInDraw && (Object)(object)GorillaInterface.Instance != (Object)null && GorillaInterface.Instance.CastRequested;

		private bool VrCanSelect => VrActive && (_vrKeyboardTarget == null || _vrKeyboardDrawing);

		public static bool IsVrActivation { get; private set; }

		private void Awake()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				((Behaviour)this).enabled = false;
				Object.Destroy((Object)(object)this);
				return;
			}
			Instance = this;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			Trad.Register();
			_scale = PlayerPrefs.GetFloat("MUM_UIScale", 1f);
			_keyMenu = Keys.CreateKey("KeyMenu", (KeyCode)282);
			Theme.LoadSaved();
			RebuildTex();
			LoadNavigationIcons();
			_gorillaInterface = GorillaInterface.Instance;
			if ((Object)(object)_gorillaInterface == (Object)null)
			{
				GameObject val = new GameObject("MUM_GorillaInterface");
				Object.DontDestroyOnLoad((Object)(object)val);
				_gorillaInterface = val.AddComponent<GorillaInterface>();
			}
		}

		private void Start()
		{
			ComputeRect();
		}

		public void ApplyWindowPreferences()
		{
			_scale = PlayerPrefs.GetFloat("MUM_UIScale", 1f);
			ComputeRect();
		}

		private void OnDestroy()
		{
			if ((Object)(object)Instance != (Object)(object)this)
			{
				return;
			}
			Instance = null;
			if ((Object)(object)_gorillaInterface != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_gorillaInterface).gameObject);
			}
			ReleaseVrTexture();
			Texture2D[] navigationIcons = _navigationIcons;
			foreach (Texture2D val in navigationIcons)
			{
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
			}
			if ((Object)(object)_scrollSkin != (Object)null)
			{
				Object.Destroy((Object)(object)_scrollSkin);
			}
		}

		public void RebuildTex()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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)
			if ((Object)(object)_scrollSkin != (Object)null)
			{
				Object.Destroy((Object)(object)_scrollSkin);
				_scrollSkin = null;
			}
			UI.ClearRoundedCache();
			Texture2D[] array = (Texture2D[])(object)new Texture2D[8] { TA, TB, TB2, TB3, TW, TG, TR, TY };
			foreach (Texture2D val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
			}
			TA = UI.MakeTex(Theme.Accent);
			TB = UI.MakeTex(Theme.BG);
			TB2 = UI.MakeTex(Theme.BG2);
			TB3 = UI.MakeTex(Theme.BG3);
			TW = UI.MakeTex(Color.white);
			TG = UI.MakeTex(Theme.Green);
			TR = UI.MakeTex(Theme.Red);
			TY = UI.MakeTex(Theme.Yellow);
		}

		public void RegisterPage(string icon, string title, Action<MenuUI> draw, MenuCategory category = MenuCategory.Gameplay)
		{
			_pages.Add(new Page(icon, title, draw, category));
		}

		public void RegisterPage(string icon, string title, Action<MenuUI> draw, MenuCategory category, bool isCustom)
		{
			_pages.Add(new Page(icon, title, draw, category, isCustom));
		}

		public void RegisterPage(string title, Action<MenuUI> draw, MenuCategory category = MenuCategory.Gameplay)
		{
			_pages.Add(new Page("", title, draw, category));
		}

		public void RegisterPageWithSettings(string title, List<Setting> settings, MenuCategory category = MenuCategory.Gameplay, Action<MenuUI> draw = null)
		{
			Page page = new Page("", title, draw, category);
			page.Settings = settings ?? new List<Setting>();
			_pages.Add(page);
		}

		public bool IsModEnabled(string title)
		{
			return _pages.FirstOrDefault((Page p) => p.Title == title)?.Enabled ?? true;
		}

		public List<Page> GetAllPagesSorted()
		{
			List<Page> list = new List<Page>(_pages);
			list.Sort(delegate(Page a, Page b)
			{
				int num = a.Category.CompareTo(b.Category);
				return (num != 0) ? num : string.Compare(I18n.T(a.Title), I18n.T(b.Title), StringComparison.OrdinalIgnoreCase);
			});
			return list;
		}

		public void StartRebind(string keyName)
		{
			RebindTarget = keyName;
			WaitingKey = true;
			if ((Object)(object)GorillaInterface.Instance != (Object)null && GorillaInterface.Instance.CastRequested)
			{
				_vrKeyboardTarget = "@rebind";
				_vrFocus = null;
			}
		}

		public void ToggleVisible()
		{
			bool flag = !_visible || !_animOpening;
			SoundFX.PlaySound(flag ? "Aigue" : "Grave");
			if (flag)
			{
				_visible = true;
				_animOpening = true;
				ComputeRect();
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
			else
			{
				_animOpening = false;
			}
		}

		private void ComputeRect()
		{
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			_lastScreenW = Screen.width;
			_lastScreenH = Screen.height;
			float num = Mathf.Clamp(600f * _scale, Mathf.Min(360f, Mathf.Max(1f, (float)Screen.width - 90f)), (Screen.width > 0) ? Mathf.Max(1f, (float)Screen.width - 90f) : 600f);
			float num2 = Mathf.Clamp(660f * _scale, Mathf.Min(420f, Mathf.Max(1f, (float)Screen.height - 20f)), (Screen.height > 0) ? Mathf.Max(1f, (float)Screen.height - 20f) : 660f);
			float num4;
			float num3;
			if (PlayerPrefs.HasKey("MUM_PosX") && PlayerPrefs.HasKey("MUM_PosY"))
			{
				num3 = Mathf.Clamp(PlayerPrefs.GetFloat("MUM_PosX"), 0f, Mathf.Max(0f, (float)Screen.width - num));
				num4 = Mathf.Clamp(PlayerPrefs.GetFloat("MUM_PosY"), 0f, Mathf.Max(0f, (float)Screen.height - num2));
			}
			else
			{
				num3 = (float)Screen.width * 0.05f;
				num4 = ((float)Screen.height - num2) / 2f;
			}
			float num5 = 70f * Mathf.Min(num / 600f, num2 / 660f);
			num3 = Mathf.Clamp(num3, num5 + 10f, Mathf.Max(num5 + 10f, (float)Screen.width - num - 10f));
			_rect = new Rect(num3, num4, num, num2);
		}

		private void SavePosition()
		{
			PlayerPrefs.SetFloat("MUM_PosX", ((Rect)(ref _rect)).x);
			PlayerPrefs.SetFloat("MUM_PosY", ((Rect)(ref _rect)).y);
			PlayerPrefs.Save();
		}

		private unsafe void Update()
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Invalid comparison between Unknown and I4
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			KeyLayout.DetectAndApply();
			if ((_visible || ((Object)(object)GorillaInterface.Instance != (Object)null && GorillaInterface.Instance.CastRequested)) && (Screen.width != _lastScreenW || Screen.height != _lastScreenH))
			{
				_lastScreenW = Screen.width;
				_lastScreenH = Screen.height;
				ComputeRect();
			}
			if (_visible)
			{
				float num = (_animOpening ? 1f : 0f);
				_animT = Mathf.MoveTowards(_animT, num, Time.unscaledDeltaTime / 0.1f);
				if (!_animOpening && _animT <= 0f)
				{
					_visible = false;
					Cursor.lockState = (CursorLockMode)1;
					Cursor.visible = false;
				}
			}
			_keyMenu = Keys.GetKey("KeyMenu");
			if (Keyboard.current == null)
			{
				return;
			}
			Key val = ToInputKey(_keyMenu);
			if ((int)val != 0 && ((ButtonControl)Keyboard.current[val]).wasPressedThisFrame)
			{
				ToggleVisible();
			}
			if (!WaitingKey || !(_vrKeyboardTarget != "@rebind"))
			{
				return;
			}
			if (((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame)
			{
				WaitingKey = false;
				RebindTarget = null;
				return;
			}
			Enumerator<KeyControl> enumerator = Keyboard.current.allKeys.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					KeyControl current = enumerator.Current;
					if (!((ButtonControl)current).wasPressedThisFrame)
					{
						continue;
					}
					KeyCode val2 = FromInputKey(current.keyCode);
					if ((int)val2 == 0)
					{
						continue;
					}
					Keys.ModifyKey(RebindTarget, val2);
					WaitingKey = false;
					RebindTarget = null;
					_keyHistory.Insert(0, ((object)(*(KeyCode*)(&val2))/*cast due to .constrained prefix*/).ToString());
					if (_keyHistory.Count > 5)
					{
						_keyHistory.RemoveAt(5);
					}
					break;
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
		}

		private unsafe static Key ToInputKey(KeyCode kc)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Invalid comparison between Unknown and I4
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_013c: Invalid comparison between Unknown and I4
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Invalid comparison between Unknown and I4
			//IL_0187: 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_01a9: Expected I4, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected I4, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Invalid comparison between Unknown and I4
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Invalid comparison between Unknown and I4
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Invalid comparison between Unknown and I4
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Invalid comparison between Unknown and I4
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Invalid comparison between Unknown and I4
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Expected I4, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Invalid comparison between Unknown and I4
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Invalid comparison between Unknown and I4
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: 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)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: 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_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			string text = ((object)(*(KeyCode*)(&kc))/*cast due to .constrained prefix*/).ToString();
			if (text.Length == 1 && char.IsLetter(text[0]))
			{
				return (Key)Enum.Parse(typeof(Key), text.ToUpper());
			}
			if (text.StartsWith("Alpha") && text.Length == 6)
			{
				return (Key)Enum.Parse(typeof(Key), "Digit" + text.Substring(5));
			}
			if (text.StartsWith("Keypad") && text.Length == 7 && char.IsDigit(text[6]))
			{
				return (Key)Enum.Parse(typeof(Key), "Numpad" + text.Substring(6));
			}
			KeyCode val = kc;
			KeyCode val2 = val;
			if ((int)val2 <= 32)
			{
				if ((int)val2 <= 9)
				{
					if ((int)val2 == 8)
					{
						return (Key)65;
					}
					if ((int)val2 == 9)
					{
						return (Key)3;
					}
				}
				else
				{
					if ((int)val2 == 13)
					{
						return (Key)2;
					}
					if ((int)val2 == 27)
					{
						return (Key)60;
					}
					if ((int)val2 == 32)
					{
						return (Key)1;
					}
				}
			}
			else if ((int)val2 <= 61)
			{
				switch (val2 - 39)
				{
				default:
					if ((int)val2 != 59)
					{
						if ((int)val2 != 61)
						{
							break;
						}
						return (Key)14;
					}
					return (Key)6;
				case 5:
					return (Key)7;
				case 7:
					return (Key)8;
				case 8:
					return (Key)9;
				case 0:
					return (Key)5;
				case 6:
					return (Key)13;
				case 1:
				case 2:
				case 3:
				case 4:
					break;
				}
			}
			else
			{
				switch (val2 - 91)
				{
				default:
					if ((int)val2 != 127)
					{
						switch (val2 - 273)
						{
						case 9:
							return (Key)94;
						case 10:
							return (Key)95;
						case 11:
							return (Key)96;
						case 12:
							return (Key)97;
						case 13:
							return (Key)98;
						case 14:
							return (Key)99;
						case 15:
							return (Key)100;
						case 16:
							return (Key)101;
						case 17:
							return (Key)102;
						case 18:
							return (Key)103;
						case 19:
							return (Key)104;
						case 20:
							return (Key)105;
						case 31:
							return (Key)51;
						case 30:
							return (Key)52;
						case 33:
							return (Key)55;
						case 32:
							return (Key)56;
						case 35:
							return (Key)53;
						case 34:
							return (Key)54;
						case 0:
							return (Key)63;
						case 1:
							return (Key)64;
						case 3:
							return (Key)61;
						case 2:
							return (Key)62;
						case 28:
							return (Key)72;
						}
						break;
					}
					return (Key)71;
				case 0:
					return (Key)11;
				case 2:
					return (Key)12;
				case 1:
					return (Key)10;
				case 5:
					return (Key)4;
				case 3:
				case 4:
					break;
				}
			}
			return (Key)0;
		}

		private static KeyCode FromInputKey(Key k)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Invalid comparison between Unknown and I4
			//IL_008d: 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_0090: 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_0094: 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_00d5: Expected I4, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0154: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: 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_020e: 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)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected I4, but got Unknown
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: 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_01bc: 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_0173: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			if ((int)k >= 15 && (int)k <= 40)
			{
				return (KeyCode)(97 + (k - 15));
			}
			if ((int)k >= 50 && (int)k <= 49)
			{
				return (KeyCode)(48 + (k - 50));
			}
			if ((int)k >= 94 && (int)k <= 105)
			{
				return (KeyCode)(282 + (k - 94));
			}
			if ((int)k >= 84 && (int)k <= 93)
			{
				return (KeyCode)(256 + (k - 84));
			}
			switch (k - 1)
			{
			default:
				switch (k - 51)
				{
				case 26:
					break;
				case 9:
					return (KeyCode)27;
				case 14:
					return (KeyCode)8;
				case 20:
					return (KeyCode)127;
				case 0:
					return (KeyCode)304;
				case 1:
					return (KeyCode)303;
				case 4:
					return (KeyCode)306;
				case 5:
					return (KeyCode)305;
				case 2:
					return (KeyCode)308;
				case 3:
					return (KeyCode)307;
				case 12:
					return (KeyCode)273;
				case 13:
					return (KeyCode)274;
				case 10:
					return (KeyCode)276;
				case 11:
					return (KeyCode)275;
				case 21:
					return (KeyCode)301;
				default:
					return (KeyCode)0;
				}
				goto case 1;
			case 0:
				return (KeyCode)32;
			case 1:
				return (KeyCode)13;
			case 2:
				return (KeyCode)9;
			case 6:
				return (KeyCode)44;
			case 7:
				return (KeyCode)46;
			case 8:
				return (KeyCode)47;
			case 5:
				return (KeyCode)59;
			case 4:
				return (KeyCode)39;
			case 10:
				return (KeyCode)91;
			case 11:
				return (KeyCode)93;
			case 9:
				return (KeyCode)92;
			case 12:
				return (KeyCode)45;
			case 13:
				return (KeyCode)61;
			case 3:
				return (KeyCode)96;
			}
		}

		private void LoadNavigationIcons()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			string[] array = new string[8] { "Home", "Mods", "Settings", "Arrow", "Donation", "Minus", "Plus", "Cross" };
			Assembly assembly = typeof(MenuUI).Assembly;
			for (int i = 0; i < array.Length; i++)
			{
				try
				{
					using Stream stream = assembly.GetManifestResourceStream("UltimateMenu.Assets.Menu.Icos." + array[i] + ".png");
					if (stream == null)
					{
						Log.Err("MenuUI.LoadNavigationIcons", new FileNotFoundException("Missing embedded icon: " + array[i]));
						continue;
					}
					using MemoryStream memoryStream = new MemoryStream();
					stream.CopyTo(memoryStream);
					Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
					if (!ImageConversion.LoadImage(val, memoryStream.ToArray()))
					{
						Object.Destroy((Object)(object)val);
						continue;
					}
					((Texture)val).filterMode = (FilterMode)1;
					((Texture)val).wrapMode = (TextureWrapMode)1;
					_navigationIcons[i] = val;
				}
				catch (Exception e)
				{
					Log.Err("MenuUI.LoadNavigationIcons", e);
				}
			}
		}

		private void DrawMenuIcon(Rect rect, int icon, float angle = 0f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Event.current.type != 7 || (Object)(object)_navigationIcons[icon] == (Object)null)
			{
				return;
			}
			Matrix4x4 matrix = GUI.matrix;
			try
			{
				if (angle != 0f)
				{
					GUIUtility.RotateAroundPivot(angle, ((Rect)(ref rect)).center);
				}
				GUI.DrawTexture(rect, (Texture)(object)_navigationIcons[icon], (ScaleMode)2);
			}
			finally
			{
				GUI.matrix = matrix;
			}
		}

		private bool IconButton(Rect rect, int icon, string tooltip, float angle = 0f)
		{
			//IL_0008: 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_001e: 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_007a: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			bool flag = ((Rect)(ref rect)).Contains(Event.current.mousePosition);
			UI.DrawRounded(rect, flag ? Theme.BG3 : Theme.BG2, Mathf.RoundToInt(((Rect)(ref rect)).height * 0.5f));
			float num = ((Rect)(ref rect)).height * 0.23f;
			DrawMenuIcon(new Rect(((Rect)(ref rect)).x + num, ((Rect)(ref rect)).y + num, ((Rect)(ref rect)).width - 2f * num, ((Rect)(ref rect)).height - 2f * num), icon, angle);
			return ControlButton(rect, new GUIContent(((Object)(object)_navigationIcons[icon] == (Object)null) ? tooltip : "", tooltip), GUIStyle.none);
		}

		private void NavigateTo(int target)
		{
			CancelVrInput();
			_pendingNav = target;
			GUI.FocusControl((string)null);
			SoundFX.PlaySound("Moyen");
		}

		private void DrawNavigationItem(Rect rect, int index, string label, bool selected)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ((Rect)(ref rect)).Contains(Event.current.mousePosition);
			if (selected || flag)
			{
				Color c = (selected ? Color.Lerp(Theme.BG3, Theme.Text, 0.12f) : Theme.BG3);
				UI.DrawOutline(rect, new Color(Theme.Text.r, Theme.Text.g, Theme.Text.b, selected ? 0.15f : 0.05f), Mathf.RoundToInt(((Rect)(ref rect)).height * 0.5f), 1f);
				UI.DrawRounded(rect, c, Mathf.RoundToInt(((Rect)(ref rect)).height * 0.5f));
			}
			float num = 23f * UI.Scale;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref rect)).center.x - num * 0.5f, ((Rect)(ref rect)).center.y - num * 0.5f, num, num);
			if ((Object)(object)_navigationIcons[index] != (Object)null)
			{
				GUI.DrawTexture(val, (Texture)(object)_navigationIcons[index], (ScaleMode)2);
			}
			if ((Object)(object)_navigationIcons[index] == (Object)null)
			{
				GUI.Label(rect, label, UI.Sty(Theme.Text, 9f, selected, (TextAnchor)4));
			}
			if (ControlButton(rect, new GUIContent("", label), GUIStyle.none))
			{
				NavigateTo(index switch
				{
					1 => -2, 
					0 => -1, 
					_ => (_selectedConfig == -3) ? (-4) : _selectedConfig, 
				});
			}
		}

		private void ReleaseVrTexture()
		{
			if (!((Object)(object)_vrMenuTexture == (Object)null))
			{
				_vrMenuTexture.Release();
				Object.Destroy((Object)(object)_vrMenuTexture);
				_vrMenuTexture = null;
			}
		}

		private void OnGUI()
		{
			//IL_034d: 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_0314: 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_0058: Invalid comparison between Unknown and I4
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Invalid comparison between Unknown and I4
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Invalid comparison between Unknown and I4
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: 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_012a: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			GorillaInterface instance = GorillaInterface.Instance;
			bool flag = (Object)(object)instance != (Object)null && instance.CastRequested;
			if (!flag)
			{
				ReleaseVrTexture();
			}
			if ((!_visible && !flag) || (!_visible && (int)Event.current.type != 8 && (int)Event.current.type != 7))
			{
				return;
			}
			RenderTexture active = RenderTexture.active;
			bool flag2 = flag && (int)Event.current.type == 7;
			try
			{
				if (flag2)
				{
					int num = Mathf.Max(1, Screen.width);
					int num2 = Mathf.Max(1, Screen.height);
					if (num > SystemInfo.maxTextureSize || num2 > SystemInfo.maxTextureSize)
					{
						throw new InvalidOperationException("VR menu texture exceeds GPU limits.");
					}
					if ((Object)(object)_vrMenuTexture == (Object)null || ((Texture)_vrMenuTexture).width != num || ((Texture)_vrMenuTexture).height != num2)
					{
						ReleaseVrTexture();
						_vrMenuTexture = new RenderTexture(num, num2, 0, (RenderTextureFormat)0)
						{
							name = "UltimateMenu VR mirror",
							hideFlags = (HideFlags)61,
							filterMode = (FilterMode)1,
							wrapMode = (TextureWrapMode)1,
							useMipMap = false,
							autoGenerateMips = false,
							antiAliasing = 1
						};
					}
					if (!_vrMenuTexture.IsCreated() && !_vrMenuTexture.Create())
					{
						throw new InvalidOperationException("Cannot create VR menu texture.");
					}
					RenderTexture.active = _vrMenuTexture;
					GL.Clear(false, true, Color.clear);
				}
				_vrInDraw = true;
				_vrOccurrences.Clear();
				_vrScrollStack.Clear();
				if ((int)Event.current.type == 7)
				{
					_vrControls.Clear();
				}
				DrawMenu(flag);
				DrawVrKeyboard();
				FinishVrFrame();
				if (flag2)
				{
					float scale = UI.Scale;
					Rect crop = Rect.MinMaxRect(Mathf.Max(0f, ((Rect)(ref _rect)).x - 74f * scale), Mathf.Max(0f, ((Rect)(ref _rect)).y - 6f * scale), Mathf.Min((float)Screen.width, ((Rect)(ref _rect)).xMax + 6f * scale), Mathf.Min((float)Screen.height, ((Rect)(ref _rect)).yMax + 6f * scale));
					instance.PresentCast(_vrMenuTexture, crop);
				}
			}
			catch (ExitGUIException)
			{
				throw;
			}
			catch (Exception error)
			{
				if (!flag)
				{
					throw;
				}
				instance.FailCast(error);
			}
			finally
			{
				_vrInDraw = false;
				_vrScrollStack.Clear();
				RenderTexture.active = active;
			}
			if (flag2 && _visible && (Object)(object)_vrMenuTexture != (Object)null)
			{
				Color color = GUI.color;
				try
				{
					GUI.color = Color.white;
					GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_vrMenuTexture);
				}
				finally
				{
					GUI.color = color;
				}
			}
		}

		private void DrawMenu(bool cast)
		{
			//IL_08f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_090e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0916: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Invalid comparison between Unknown and I4
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Invalid comparison between Unknown and I4
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Unknown result type (might be due to invalid IL or missing references)
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Unknown result type (might be due to invalid IL or missing references)
			//IL_083f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0845: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
			if (((Rect)(ref _rect)).width < 10f)
			{
				ComputeRect();
			}
			if ((int)Event.current.type == 8 && _pendingNav.HasValue)
			{
				_nav = _pendingNav.Value;
				if (_nav == -4 || (_nav >= 0 && _nav < _pages.Count))
				{
					_selectedConfig = _nav;
				}
				_pendingNav = null;
				_scrollPage = Vector2.zero;
				ResetVrFocus();
			}
			UI.Scale = Mathf.Min(((Rect)(ref _rect)).width / 600f, ((Rect)(ref _rect)).height / 660f);
			float scale = UI.Scale;