Decompiled source of PeakAMap v1.2.2

plugins/PeakAMap/com.github.snowybunny.PeakAMap.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PeakAMap.Core;
using PeakAMap.UI;
using PeakAMap.Utilities;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.ControllerSupport;
using Zorro.Core;
using Zorro.UI.Modal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.snowybunny.PeakAMap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2+e0278e735ef709233cc6c607e2bbcdc3201a2e62")]
[assembly: AssemblyProduct("com.github.snowybunny.PeakAMap")]
[assembly: AssemblyTitle("PeakAMap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace PeakAMap
{
	[BepInPlugin("com.github.snowybunny.PeakAMap", "PeakAMap", "1.2.2")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.snowybunny.PeakAMap");

		public const string Id = "com.github.snowybunny.PeakAMap";

		internal static ManualLogSource Log { get; private set; }

		internal static PluginInfo LoadedInfo { get; private set; }

		public static string Name => "PeakAMap";

		public static string Version => "1.2.2";

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			LoadedInfo = ((BaseUnityPlugin)this).Info;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			UserConfig.Initialize(((BaseUnityPlugin)this).Config);
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
}
namespace PeakAMap.Utilities
{
	[HarmonyPatch]
	public static class BoardingPassUI
	{
		private static bool s_initialized;

		public static BoardingPass boardingPass { get; private set; }

		public static Image Panel { get; private set; }

		public static GameObject InnerBoardingPass { get; private set; }

		public static Button StartGameButton { get; private set; }

		public static Button IncrementAscentButton { get; private set; }

		public static GameObject Title { get; private set; }

		public static GameObject Plane { get; private set; }

		public static TMP_Text PlayerName { get; private set; }

		public static Vector2 Pivot { get; private set; }

		public static GameObject BlueTop { get; private set; }

		public static CustomOptionsWindow customOptionsWindow { get; private set; }

		public static Button CloseButtonCustom { get; private set; }

		public static GameObject CustomWindowPanel { get; private set; }

		public static GameObject CustomOptions { get; private set; }

		public static GameObject Background { get; private set; }

		public static GameObject Border { get; private set; }

		public static Button MiniRunButton { get; private set; }

		public static Button CustomOptionsButton { get; private set; }

		public static CustomOptionItemToggle CustomOptionItemTogglePrefab { get; private set; }

		public static TextMeshProUGUI AscentDescription { get; private set; }

		private static void Initialize()
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			boardingPass = GUIManager.instance.boardingPass;
			Panel = boardingPass.playerName.transform.parent.GetImage();
			InnerBoardingPass = ((Component)((Component)Panel).transform.parent).gameObject;
			StartGameButton = boardingPass.startGameButton;
			IncrementAscentButton = boardingPass.incrementAscentButton;
			Title = ((Component)Panel).gameObject.QueryChildren("BOARDING PASS");
			Plane = ((Component)Panel).gameObject.QueryChildren("Plane");
			PlayerName = boardingPass.playerName;
			Pivot = InnerBoardingPass.GetComponent<RectTransform>().pivot;
			BlueTop = ((Component)Panel).gameObject.QueryChildren("BlueTop");
			customOptionsWindow = boardingPass.customOptionsWindow;
			CloseButtonCustom = customOptionsWindow.closeButtonCustom;
			CustomWindowPanel = ((Component)((Component)CloseButtonCustom).transform.parent).gameObject;
			CustomOptions = ((Component)CustomWindowPanel.transform.parent).gameObject;
			Background = ((Component)customOptionsWindow).gameObject.QueryChildren("BG");
			Border = CustomOptions.QueryChildren("Border");
			MiniRunButton = customOptionsWindow.miniRunButton;
			CustomOptionsButton = boardingPass.customOptionsButton;
			CustomOptionItemTogglePrefab = customOptionsWindow.customOptionItemTogglePrefab;
			AscentDescription = ((Component)CustomOptionsButton).transform.parent.QueryChildren("Description").GetTMPro();
		}

		[HarmonyPatch(typeof(AirportCheckInKiosk), "Start")]
		[HarmonyPostfix]
		private static void InitializeBoardingPassUI()
		{
			if (!s_initialized)
			{
				Initialize();
				s_initialized = true;
			}
		}
	}
	public static class GameObjectUtility
	{
		public static RectTransform GetRectTransform(this GameObject gameObject)
		{
			return gameObject.GetComponent<RectTransform>();
		}

		public static Image GetImage(this GameObject gameObject)
		{
			return gameObject.GetComponent<Image>();
		}

		public static Color GetColor(this GameObject gameObject)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return gameObject.GetComponent<Graphic>().color;
		}

		public static TextMeshProUGUI GetTMPro(this GameObject gameObject)
		{
			return gameObject.GetComponent<TextMeshProUGUI>();
		}

		public static GameObject QueryChildren(this GameObject gameObject, string[] queries)
		{
			return ((Component)gameObject.transform.QueryChildren(queries)).gameObject;
		}

		public static GameObject QueryChildren(this GameObject gameObject, string queryOrPath)
		{
			return ((Component)gameObject.transform.QueryChildren(queryOrPath)).gameObject;
		}

		public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
		{
			T result = default(T);
			if (gameObject.TryGetComponent<T>(ref result))
			{
				return result;
			}
			return gameObject.AddComponent<T>();
		}

		public static Component GetOrAddComponent(this GameObject gameObject, Type type)
		{
			Component result = default(Component);
			if (gameObject.TryGetComponent(type, ref result))
			{
				return result;
			}
			return gameObject.AddComponent(type);
		}

		public static Component GetComponentInChildrenActiveSelf<T>(this GameObject gameObject) where T : Component
		{
			Component[] componentsInChildren = (Component[])(object)gameObject.GetComponentsInChildren<T>(true);
			Component[] array = componentsInChildren;
			foreach (Component val in array)
			{
				if (val.gameObject.activeSelf)
				{
					return val;
				}
			}
			return null;
		}

		public static GameObject PasteComponent<T>(this GameObject gameObject, T component, params string[] exclude) where T : Component
		{
			Type type = ((object)component).GetType();
			Component orAddComponent = gameObject.GetOrAddComponent(type);
			PropertyInfo[] properties = type.GetProperties();
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				if (propertyInfo.CanRead && propertyInfo.CanWrite && !exclude.Contains(propertyInfo.Name))
				{
					try
					{
						propertyInfo.SetValue(orAddComponent, propertyInfo.GetValue(component));
					}
					catch
					{
					}
				}
			}
			return gameObject;
		}

		public static string StripCloneInName(this GameObject gameObject)
		{
			string text = "(Clone)";
			if (((Object)gameObject).name.EndsWith(text))
			{
				int startIndex = ((Object)gameObject).name.Length - text.Length;
				((Object)gameObject).name = ((Object)gameObject).name.Remove(startIndex);
			}
			return ((Object)gameObject).name;
		}
	}
	public class JsonExtended
	{
		private static HashSet<char> s_startDelimiters = new HashSet<char> { '"', '{', '(', '[' };

		private static HashSet<char> s_endDelimiters = new HashSet<char> { '"', '}', ')', ']' };

		private static string s_tab = "    ";

		public static string Tab
		{
			get
			{
				return s_tab;
			}
			set
			{
				s_tab = value;
			}
		}

		public static string ListToJson<T>(List<T> items, bool prettyPrint = false)
		{
			return ArrayToJson(items.ToArray(), prettyPrint);
		}

		public static List<T> ListFromJson<T>(string json)
		{
			return ArrayFromJson<T>(json).ToList();
		}

		public static string ArrayToJson<T>(T[] items, bool prettyPrint = false)
		{
			string[] array = new string[items.Length];
			for (int i = 0; i < items.Length; i++)
			{
				array[i] = JsonUtility.ToJson((object)items[i], prettyPrint);
			}
			return EncaseCombine(array, '[', ']', prettyPrint);
		}

		public static T[] ArrayFromJson<T>(string json)
		{
			string[] array = SplitSections(json, '[', ']');
			T[] array2 = new T[array.Length];
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i] = JsonUtility.FromJson<T>(array[i]);
			}
			return array2;
		}

		public static string CombineJson(bool prettyPrint, params string[] objectJsons)
		{
			char c = objectJsons[0][0];
			string obj = objectJsons[0];
			char c2 = obj[obj.Length - 1];
			string[] array = new string[objectJsons.Length];
			for (int i = 0; i < objectJsons.Length; i++)
			{
				int num = i;
				string text = objectJsons[i];
				array[num] = text.Substring(2, text.Length - 2 - 2);
			}
			return c + "\n" + string.Join(",\n", array) + "\n" + c2;
		}

		public static string EncaseCombine(string[] objectJsons, char start, char end, bool prettyPrint = false)
		{
			if (!prettyPrint)
			{
				return start + string.Join(",", objectJsons) + end;
			}
			string text = start + "\n";
			for (int i = 0; i < objectJsons.Length; i++)
			{
				string[] array = objectJsons[i].Split("\n");
				for (int j = 0; j < array.Length; j++)
				{
					text = ((j >= array.Length - 1) ? (text + Tab + array[j]) : (text + Tab + array[j] + "\n"));
				}
				if (i < objectJsons.Length - 1)
				{
					text += ",\n";
				}
			}
			return text + "\n" + end;
		}

		public static string CreateJsonObject(string key, string value, bool prettyPrint = false)
		{
			if (!prettyPrint)
			{
				return "{\"" + key + "\":" + value + "}";
			}
			string text = "\"" + key + "\": " + value;
			return EncaseCombine(new string[1] { text }, '{', '}', prettyPrint);
		}

		public static string[] SplitSections(string json, char start, char end, bool prettyPrint = false)
		{
			List<string> list = new List<string>();
			string text = "";
			int num = _startSectionIndex(json, start);
			int num2 = _endSectionIndex(json, end);
			int num3 = 0;
			bool flag = false;
			for (int i = num; i <= num2; i++)
			{
				char c = json[i - 1];
				char c2 = json[i];
				if (c2 == '"' && c != '\\')
				{
					num3 = ((!flag) ? (num3 + 1) : (num3 - 1));
					flag = !flag;
					text += c2;
				}
				else if (flag)
				{
					text += c2;
				}
				else if (char.IsWhiteSpace(c2))
				{
					if (prettyPrint)
					{
						text += c2;
					}
				}
				else if (c2 == ',' && num3 == 0)
				{
					list.Add(text);
					text = "";
				}
				else if (s_startDelimiters.Contains(c2))
				{
					num3++;
					text += c2;
				}
				else if (s_endDelimiters.Contains(c2))
				{
					num3--;
					text += c2;
				}
				else
				{
					text += c2;
				}
			}
			list.Add(text);
			return list.ToArray();
		}

		public static string GetValueFromJson(string json, string key, bool prettyPrint = false)
		{
			string[] array = SplitSections(json, '{', '}', prettyPrint);
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].Contains(key))
				{
					int num = _startSectionIndex(array[i], ':');
					string text = array[i];
					int num2 = num;
					return text.Substring(num2, text.Length - num2);
				}
			}
			return "";
		}

		private static int _startSectionIndex(string text, char target)
		{
			bool started = false;
			for (int i = 0; i < text.Length; i++)
			{
				char currChar = text[i];
				if (_foundChar(ref started, currChar, target))
				{
					return i + 1;
				}
			}
			return -1;
		}

		private static int _endSectionIndex(string text, char target)
		{
			bool started = false;
			for (int num = text.Length - 1; num > -1; num--)
			{
				char currChar = text[num];
				if (_foundChar(ref started, currChar, target))
				{
					return num - 1;
				}
			}
			return -1;
		}

		private static bool _foundChar(ref bool started, char currChar, char target)
		{
			if (!started)
			{
				started = currChar == target;
			}
			return started;
		}
	}
	[HarmonyPatch]
	public static class MainMenuUI
	{
		private static bool s_initialized;

		public static GameObject Dropdown { get; private set; }

		public static GameObject SettingsBackButton { get; private set; }

		public static TextMeshProUGUI VersionTMPro { get; private set; }

		private static void Initialize(MainMenu instance)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			GameObject gameObject = ((Component)instance.credits.transform.parent.parent).gameObject;
			GameObject gameObject2 = ((Component)instance.credits.transform.parent).gameObject;
			GameObject val = new GameObject("MainMenuReference");
			Dropdown = Object.Instantiate<GameObject>(gameObject.QueryChildren("FirstTimeSetupPage/SettingParent/ENUM DROPDOWN/Dropdown"));
			Dropdown.transform.SetParent(val.transform, false);
			SettingsBackButton = Object.Instantiate<GameObject>(gameObject.QueryChildren("SettingsPage/SettingsPageShared/UI_MainMenuButton_LeaveGame (2)"));
			SettingsBackButton.transform.SetParent(val.transform, false);
			VersionTMPro = Object.Instantiate<TextMeshProUGUI>(gameObject2.QueryChildren("Version").GetTMPro());
			((TMP_Text)VersionTMPro).transform.SetParent(val.transform, false);
			DontDestroy.Add(val);
		}

		[HarmonyPatch(typeof(MainMenu), "Start")]
		[HarmonyPostfix]
		private static void InitializeMainMenu(MainMenu __instance)
		{
			if (!s_initialized)
			{
				Initialize(__instance);
				s_initialized = true;
			}
		}
	}
	public static class MapBakerUtility
	{
		public static bool ValidSelectedBiomes(this MapBaker instance)
		{
			return instance.selectedBiomes.Count == instance.ScenePaths.Length;
		}
	}
	[HarmonyPatch]
	public static class PassportUI
	{
		private static bool s_initialized;

		public static PassportManager passportManager { get; private set; }

		public static TextMeshProUGUI PassportText { get; private set; }

		private static void Initialize()
		{
			passportManager = PassportManager.instance;
			PassportText = passportManager.uiObject.QueryChildren("Canvas/Panel/Panel/BG/Portrait").GetComponentInChildren<TextMeshProUGUI>();
		}

		[HarmonyPatch(typeof(AirportCheckInKiosk), "Start")]
		[HarmonyPostfix]
		private static void InitializePassportUI()
		{
			if (!s_initialized)
			{
				Initialize();
				s_initialized = true;
			}
		}
	}
	public static class TransformUtility
	{
		public static Color GetColor(this Transform transform)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)transform).GetComponent<Graphic>().color;
		}

		public static Image GetImage(this Transform transform)
		{
			return ((Component)transform).GetComponent<Image>();
		}

		public static TextMeshProUGUI GetTMPro(this Transform transform)
		{
			return ((Component)transform).GetComponent<TextMeshProUGUI>();
		}

		public static Transform FindFromChildren(string path)
		{
			string[] array = path.Split("/");
			Transform transform = GameObject.Find(array[0]).transform;
			return transform.QueryChildren(array[1..]);
		}

		public static Transform QueryChildren(this Transform current, string[] queries)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (queries.Length == 0)
			{
				return current;
			}
			foreach (Transform item in current)
			{
				Transform val = item;
				if (((Object)val).name.Equals(queries[0]))
				{
					if (queries.Length == 1)
					{
						return val;
					}
					return val.QueryChildren(queries[1..]);
				}
			}
			if (queries.Length == 1 && string.IsNullOrEmpty(queries[0]))
			{
				return current;
			}
			Plugin.Log.LogWarning((object)("Cannot find " + queries[0] + " in " + ((Object)current).name + ". Returned null"));
			return null;
		}

		public static Transform QueryChildren(this Transform current, string queryOrPath)
		{
			string[] queries = queryOrPath.Split("/");
			return current.QueryChildren(queries);
		}

		public static Transform SetParentAndScale(this Transform child, Transform parent, bool worldPositionStays = true)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			child.SetParent(parent, worldPositionStays);
			RectTransform val = default(RectTransform);
			if (((Component)child).gameObject.TryGetComponent<RectTransform>(ref val))
			{
				((Transform)val).localScale = new Vector3(1f, 1f, 1f);
			}
			return child;
		}
	}
}
namespace PeakAMap.UI
{
	internal sealed class ConfigEntryTogglePrefab
	{
		private static readonly ConfigEntryTogglePrefab _instance;

		public static ConfigEntryTogglePrefab Instance => _instance;

		public GameObject gameObject { get; private set; }

		private ConfigEntryTogglePrefab()
		{
			Initialize();
		}

		static ConfigEntryTogglePrefab()
		{
			_instance = new ConfigEntryTogglePrefab();
		}

		private void Initialize()
		{
			gameObject = SetConfigEntryToggle();
			DontDestroy.Add(gameObject);
		}

		private GameObject SetConfigEntryToggle()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = ((Component)BoardingPassUI.CustomOptionItemTogglePrefab).gameObject;
			GameObject val2 = Object.Instantiate<GameObject>(val);
			((Object)val2).name = "ConfigEntryToggle";
			CustomOptionItemToggle component = val2.GetComponent<CustomOptionItemToggle>();
			Object.DestroyImmediate((Object)(object)component);
			RectTransform rectTransform = val2.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			TextMeshProUGUI componentInChildren = val2.GetComponentInChildren<TextMeshProUGUI>();
			Image val3 = ((Component)rectTransform).gameObject.QueryChildren("Toggle/Background")?.GetImage();
			Image val4 = ((val3 != null) ? ((Component)val3).transform.GetChild(0).GetImage() : null);
			Image val5 = ((val3 == null) ? null : ((Component)val3).transform.parent.QueryChildren("Image")?.GetImage());
			if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null || (Object)(object)val5 == (Object)null)
			{
				return val2;
			}
			((Graphic)componentInChildren).color = MapsBoardUI.MainFontColor;
			((Graphic)val3).color = MapsBoardUI.MainFontColor;
			((Graphic)val4).color = MapsBoardUI.AccentColor;
			((Graphic)val5).color = MapsBoardUI.Cell1Color;
			RectTransform rectTransform2 = ((Component)val5).gameObject.GetRectTransform();
			rectTransform2.sizeDelta = new Vector2(-40f, rectTransform2.sizeDelta.y);
			rectTransform2.anchoredPosition = new Vector2(0f, 0f);
			RectTransform rectTransform3 = ((Component)componentInChildren).gameObject.GetRectTransform();
			rectTransform3.anchoredPosition = new Vector2(-20f, 0f);
			Object.DestroyImmediate((Object)(object)((Component)componentInChildren).gameObject.GetComponent<LocalizedText>());
			return val2;
		}
	}
	internal sealed class DontDestroy
	{
		private static readonly DontDestroy _instance;

		public static DontDestroy Instance => _instance;

		public GameObject gameObject { get; private set; }

		private DontDestroy()
		{
			Initialize();
		}

		static DontDestroy()
		{
			_instance = new DontDestroy();
		}

		private void Initialize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			gameObject = new GameObject("PeakAMap");
			Object.DontDestroyOnLoad((Object)(object)gameObject);
		}

		public static void Add(GameObject child)
		{
			child.transform.SetParent(Instance.gameObject.transform);
		}
	}
	public sealed class LoadingMapsScreenPrefab
	{
		private static readonly LoadingMapsScreenPrefab _instance;

		public static LoadingMapsScreenPrefab Instance => _instance;

		public GameObject Description { get; set; }

		public GameObject QuitButton { get; set; }

		public GameObject gameObject { get; set; }

		private LoadingMapsScreenPrefab()
		{
			Initialize();
		}

		static LoadingMapsScreenPrefab()
		{
			_instance = new LoadingMapsScreenPrefab();
		}

		private void Initialize()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			gameObject = new GameObject("CustomLoadingMapsUI", new Type[1] { typeof(RectTransform) });
			Description = CreateDescription(gameObject);
			QuitButton = CreateQuitButton(gameObject);
			DontDestroy.Add(gameObject);
		}

		public void Instantiate(GameObject? parent = null)
		{
			Instantiate(parent, out GameObject _, out GameObject _);
		}

		public void Instantiate(GameObject? parent, out GameObject? description, out GameObject? cancelButton)
		{
			//IL_005e: 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)
			description = null;
			cancelButton = null;
			if (parent == null)
			{
				parent = GetLoadingScreen();
			}
			if ((Object)(object)parent == (Object)null)
			{
				Plugin.Log.LogError((object)"No valid parent object was found. Cannot add description and cancel button.");
				return;
			}
			description = Object.Instantiate<GameObject>(Description);
			description.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = description.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(35f, -20f);
			cancelButton = Object.Instantiate<GameObject>(QuitButton);
			cancelButton.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform2 = cancelButton.GetRectTransform();
			rectTransform2.anchoredPosition = new Vector2(-30f, -25f);
		}

		private GameObject? GetLoadingScreen()
		{
			//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)
			Scene scene = ((Component)GameHandler.Instance).gameObject.scene;
			GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
			GameObject result = null;
			for (int i = 0; i < ((Scene)(ref scene)).rootCount; i++)
			{
				if (((Object)rootGameObjects[i]).name.Equals("LoadingScreenSimple(Clone)"))
				{
					result = rootGameObjects[i];
				}
			}
			return result;
		}

		private GameObject CreateDescription(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Description", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.sizeDelta = new Vector2(500f, 100f);
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(0f, 1f);
			rectTransform.pivot = new Vector2(0f, 1f);
			TextMeshProUGUI tMPro = val.GetTMPro();
			TextMeshProUGUI versionTMPro = MainMenuUI.VersionTMPro;
			((TMP_Text)tMPro).text = "COULD NOT FIND FULL FILE FOR THIS PATCH'S MAP ROTATION.\nNOW SEARCHING FOR MAP INFO MANUALLY...";
			((TMP_Text)tMPro).font = ((TMP_Text)versionTMPro).font;
			((Graphic)tMPro).color = ((Graphic)versionTMPro).color;
			((TMP_Text)tMPro).fontSize = 24f;
			((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)1;
			((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)256;
			((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
			((TMP_Text)tMPro).lineSpacing = 15f;
			return val;
		}

		private GameObject CreateQuitButton(GameObject parent)
		{
			//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)
			GameObject val = Object.Instantiate<GameObject>(MainMenuUI.SettingsBackButton);
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchorMin = new Vector2(1f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(1f, 1f);
			Button val2 = default(Button);
			val.TryGetComponent<Button>(ref val2);
			((UnityEventBase)val2.onClick).RemoveAllListeners();
			LocalizedText componentInChildren = val.GetComponentInChildren<LocalizedText>();
			componentInChildren.index = "CANCEL";
			return val;
		}
	}
	public sealed class MapOptionPrefab
	{
		private static readonly MapOptionPrefab _instance;

		public static MapOptionPrefab Instance => _instance;

		public GameObject gameObject { get; set; }

		public string MapCodePlaceholder { get; set; } = "--";


		public string InfoTextPlaceholder { get; set; } = "???";


		public GameObject Info { get; set; }

		public GameObject Line { get; set; }

		private MapOptionPrefab()
		{
			Initialize();
		}

		static MapOptionPrefab()
		{
			_instance = new MapOptionPrefab();
		}

		private void Initialize()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject parent = CreateMapOption();
			GameObject parent2 = CreateMapCode(parent);
			GameObject val = CreateBiomes(parent);
			CreateCodeBorder(parent2);
			gameObject = parent;
			Info = CreateBiomeInfo();
			Line = CreateLine();
			for (int i = 0; i < 3; i++)
			{
				GameObject val2 = CreateTextInfo(Info);
				if (i > 0)
				{
					((Graphic)val2.GetTMPro()).color = MapsBoardUI.SubtitleColor;
				}
			}
			DontDestroy.Add(gameObject);
			DontDestroy.Add(Info);
		}

		private GameObject CreateMapOption()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MapOption", new Type[4]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button),
				typeof(NicksButtonSFX)
			});
			Image image = val.GetImage();
			image.type = MapsBoardUI.MainImageType;
			((Graphic)image).material = MapsBoardUI.MainMaterial;
			NicksButtonSFX component = val.GetComponent<NicksButtonSFX>();
			NicksButtonSFX component2 = ((Component)BoardingPassUI.CloseButtonCustom).GetComponent<NicksButtonSFX>();
			component.sfxClick = component2.sfxClick;
			component.sfxHover = component2.sfxHover;
			component.button = val.GetComponent<Button>();
			return val;
		}

		private GameObject CreateMapCode(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_003e: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			GameObject val = new GameObject("MapCode", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.sizeDelta = new Vector2((float)MapsBoardUI.MapCodeWidth, 0f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(0f, 1f);
			rectTransform.pivot = new Vector2(0f, 0.5f);
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).text = MapCodePlaceholder;
			((TMP_Text)tMPro).font = MapsBoardUI.MainFont;
			((Graphic)tMPro).color = MapsBoardUI.MapCodeColor;
			((TMP_Text)tMPro).fontWeight = (FontWeight)900;
			((TMP_Text)tMPro).fontSize = 36f;
			((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
			((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)2;
			((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)4096;
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			return val;
		}

		private GameObject CreateCodeBorder(GameObject parent)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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)
			GameObject val = Object.Instantiate<GameObject>(BoardingPassUI.Border);
			val.StripCloneInName();
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.sizeDelta = new Vector2(65f, 55f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			Image image = val.GetImage();
			image.pixelsPerUnitMultiplier = 5f;
			((Graphic)image).color = MapsBoardUI.AccentColor;
			val.SetActive(false);
			return val;
		}

		private GameObject CreateBiomes(GameObject parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//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_0071: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MapBiomes", new Type[1] { typeof(RectTransform) });
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.pivot = new Vector2(1f, 0.5f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.sizeDelta = new Vector2((float)(-MapsBoardUI.MapCodeWidth), -20f);
			HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)val2).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false;
			((LayoutGroup)val2).padding.right = 25;
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			return val;
		}

		private GameObject CreateBiomeInfo()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_003d: 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_0067: 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)
			GameObject val = new GameObject("BiomeInfo", new Type[2]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup)
			});
			RectTransform component = val.GetComponent<RectTransform>();
			component.pivot = new Vector2(0.5f, 0.5f);
			component.anchorMin = new Vector2(0.5f, 0.5f);
			component.anchorMax = new Vector2(0.5f, 0.5f);
			((Transform)component).localScale = new Vector3(1f, 1f, 1f);
			VerticalLayoutGroup component2 = val.GetComponent<VerticalLayoutGroup>();
			((LayoutGroup)component2).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true;
			return val;
		}

		private GameObject CreateTextInfo(GameObject parent)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)GUIManager.instance.boardingPass.playerName).gameObject);
			((Object)val).name = "Info";
			TextMeshProUGUI tMPro = val.GetTMPro();
			((Graphic)tMPro).color = MapsBoardUI.MainFontColor;
			((TMP_Text)tMPro).text = InfoTextPlaceholder;
			((TMP_Text)tMPro).fontSize = MapsBoardUI.InfoFontSize;
			((TMP_Text)tMPro).fontSizeMin = MapsBoardUI.InfoFontSizeMin;
			((TMP_Text)tMPro).fontSizeMax = MapsBoardUI.InfoFontSizeMax;
			((TMP_Text)tMPro).alignment = (TextAlignmentOptions)4098;
			((TMP_Text)tMPro).lineSpacing = -45f;
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			((Component)tMPro).gameObject.GetRectTransform().sizeDelta = new Vector2(0f, 19f);
			return val;
		}

		private GameObject CreateLine()
		{
			//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_0099: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)((Component)BoardingPassUI.customOptionsWindow).transform.GetChild(2)).gameObject);
			((Object)val).name = "Line";
			int num = 32;
			LayoutElement val2 = val.AddComponent<LayoutElement>();
			val2.minWidth = num;
			val2.preferredWidth = num;
			val2.minHeight = MapsBoardUI.LineDetailsHeight;
			val2.preferredHeight = MapsBoardUI.LineDetailsHeight;
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.sizeDelta = Vector2.op_Implicit(new Vector3((float)num, (float)MapsBoardUI.LineDetailsHeight));
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).fontSize = 24f;
			((TMP_Text)tMPro).lineSpacing = -85f;
			((Graphic)tMPro).color = MapsBoardUI.SubtitleColor;
			((TMP_Text)tMPro).alignment = (TextAlignmentOptions)4098;
			val.SetActive(false);
			return val;
		}
	}
	internal sealed class MapsBoardPrefab
	{
		private static readonly MapsBoardPrefab _instance;

		public static MapsBoardPrefab Instance => _instance;

		public GameObject gameObject { get; private set; }

		public GameObject Line { get; set; }

		private MapsBoardPrefab()
		{
			Initialize();
		}

		static MapsBoardPrefab()
		{
			_instance = new MapsBoardPrefab();
		}

		private void Initialize()
		{
			gameObject = SetBoard();
			DontDestroy.Add(gameObject);
			GameObject parent = CreateScreen(gameObject);
			GameObject parent2 = CreateHeader(parent);
			GameObject parent3 = CreateScrollView(parent);
			GameObject parent4 = CreateViewport(parent3);
			GameObject val = CreateScrollbar(parent3);
			GameObject val2 = CreateMapsList(parent4);
			GameObject parent5 = CreateTitle(parent2);
			GameObject parent6 = CreateSelectedMap(parent2);
			GameObject parent7 = CreateModeSelection(parent2);
			GameObject parent8 = CreateLogo(parent5);
			GameObject parent9 = CreateConfigOptions(parent2);
			CreateBorder(gameObject);
			CreateTitleText(parent5);
			CreatePlane(parent8);
			CreateSelectedMapLabel(parent6);
			CreateSelectedMapCode(parent6);
			CreateModeLabel(parent7);
			CreateDropdown(parent7);
			CreateCloseButton(parent2);
			CreateConfigEntryToggleUI(parent9);
			MapOptionPrefab.Instance.Line.transform.SetParentAndScale(gameObject.transform);
		}

		private GameObject SetBoard()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0037: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject result = new GameObject("MapsBoard", new Type[1] { typeof(RectTransform) });
			RectTransform rectTransform = result.GetRectTransform();
			RectTransform rectTransform2 = BoardingPassUI.CustomOptions.gameObject.GetRectTransform();
			rectTransform.sizeDelta = rectTransform2.sizeDelta;
			rectTransform.anchorMin = rectTransform2.anchorMin;
			rectTransform.anchorMax = rectTransform2.anchorMax;
			rectTransform.pivot = rectTransform2.pivot;
			return result;
		}

		private GameObject CreateScreen(GameObject parent)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_005d: 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_0087: 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_00b1: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Screen", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Mask)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.sizeDelta = new Vector2(MapsBoardUI.ScreenWidth, MapsBoardUI.ScreenHeight);
			rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			Image image = val.GetImage();
			Image image2 = BoardingPassUI.CustomWindowPanel.gameObject.GetImage();
			((Graphic)image).color = MapsBoardUI.ScreenColor;
			image.sprite = MapsBoardUI.MainSprite;
			((Graphic)image).material = MapsBoardUI.MainMaterial;
			image.type = MapsBoardUI.MainImageType;
			image.pixelsPerUnitMultiplier = image2.pixelsPerUnitMultiplier;
			return val;
		}

		private GameObject CreateBorder(GameObject parent)
		{
			GameObject val = Object.Instantiate<GameObject>(BoardingPassUI.Border);
			((Object)val).name = "Border";
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			return val;
		}

		private GameObject CreateHeader(GameObject parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0045: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Header", new Type[1] { typeof(RectTransform) });
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, (float)(-MapsBoardUI.roundedCornersAdjustment));
			rectTransform.sizeDelta = new Vector2(0f, (float)(MapsBoardUI.HeaderHeight - MapsBoardUI.roundedCornersAdjustment));
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 1f);
			return val;
		}

		private GameObject CreateCloseButton(GameObject parent)
		{
			//IL_004d: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Button val = Object.Instantiate<Button>(BoardingPassUI.CloseButtonCustom);
			((UnityEventBase)val.onClick).RemoveAllListeners();
			((Component)val).transform.SetParentAndScale(parent.transform);
			GameObject val2 = ((Component)val).gameObject;
			((Object)val2).name = "CloseButton";
			RectTransform rectTransform = val2.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(-30f, 0f);
			rectTransform.anchorMin = new Vector2(1f, 0.5f);
			rectTransform.anchorMax = new Vector2(1f, 0.5f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			return val2;
		}

		private GameObject CreateScrollView(GameObject parent)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_006c: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ScrollView", new Type[4]
			{
				typeof(RectTransform),
				typeof(ScrollRect),
				typeof(Mask),
				typeof(Image)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, (float)(-MapsBoardUI.HeaderHeight));
			rectTransform.sizeDelta = new Vector2((float)(-MapsBoardUI.roundedCornersAdjustment * 2), (float)(-MapsBoardUI.HeaderHeight - MapsBoardUI.roundedCornersAdjustment));
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 1f);
			ScrollRect component = val.GetComponent<ScrollRect>();
			component.horizontal = false;
			component.vertical = true;
			component.movementType = (MovementType)2;
			component.scrollSensitivity = 7f;
			component.verticalScrollbarVisibility = (ScrollbarVisibility)2;
			Image image = val.GetImage();
			((Graphic)image).color = MapsBoardUI.ScreenColor;
			((Graphic)image).material = MapsBoardUI.MainMaterial;
			image.type = MapsBoardUI.MainImageType;
			return val;
		}

		private GameObject CreateViewport(GameObject parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Viewport", new Type[1] { typeof(RectTransform) });
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.pivot = new Vector2(0f, 0.5f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.sizeDelta = new Vector2(0f, 0f);
			return val;
		}

		private GameObject CreateScrollbar(GameObject parent)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(MapsBoardUI.scrollbar);
			val.StripCloneInName();
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.sizeDelta = new Vector2(20f, 0f);
			return val;
		}

		private GameObject CreateMapsList(GameObject parent)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MapsList", new Type[3]
			{
				typeof(RectTransform),
				typeof(GridLayoutGroup),
				typeof(CanvasGroup)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			RectTransform rectTransform2 = parent.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			Rect rect = rectTransform2.rect;
			rectTransform.sizeDelta = new Vector2(0f, ((Rect)(ref rect)).height);
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0f, 1f);
			GridLayoutGroup component = val.GetComponent<GridLayoutGroup>();
			((LayoutGroup)component).childAlignment = (TextAnchor)0;
			component.startCorner = (Corner)0;
			component.startAxis = (Axis)1;
			component.constraint = (Constraint)0;
			component.constraintCount = MapsBoardUI.VisibleCols;
			rect = rectTransform.rect;
			float num = ((Rect)(ref rect)).width / (float)MapsBoardUI.VisibleCols;
			rect = rectTransform.rect;
			float num2 = ((Rect)(ref rect)).height / (float)MapsBoardUI.VisibleRows;
			component.cellSize = new Vector2(num, num2);
			return val;
		}

		private GameObject CreateTitle(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Title", new Type[2]
			{
				typeof(RectTransform),
				typeof(HorizontalLayoutGroup)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(40f, 0f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0f, 0.5f);
			HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>();
			((LayoutGroup)component).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)component).spacing = 20f;
			((LayoutGroup)component).padding.left = 10;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)component).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)component).childControlHeight = false;
			return val;
		}

		private GameObject CreateSelectedMap(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("SelectedMap", new Type[2]
			{
				typeof(RectTransform),
				typeof(HorizontalLayoutGroup)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.anchorMin = new Vector2(0.5f, 0f);
			rectTransform.anchorMax = new Vector2(0.5f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component).spacing = 15f;
			((LayoutGroup)component).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component).childControlHeight = false;
			return val;
		}

		private GameObject CreateSelectedMapLabel(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MAP:", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(0f, 1f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).text = "MAP:";
			((TMP_Text)tMPro).font = MapsBoardUI.MainFont;
			((Graphic)tMPro).color = MapsBoardUI.MainFontColor;
			((TMP_Text)tMPro).fontSize = 36f;
			((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)4;
			((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)4096;
			((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
			return val;
		}

		private GameObject CreateSelectedMapCode(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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)
			GameObject val = new GameObject("SelectedMapCode", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.sizeDelta = new Vector2(225f, 50f);
			rectTransform.anchorMin = new Vector2(1f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).text = "--";
			((TMP_Text)tMPro).font = MapsBoardUI.MainFont;
			((Graphic)tMPro).color = MapsBoardUI.MapCodeColor;
			((TMP_Text)tMPro).fontSize = 36f;
			((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)1;
			((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)4096;
			((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
			return val;
		}

		private GameObject CreateModeSelection(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ModeSelection", new Type[2]
			{
				typeof(RectTransform),
				typeof(HorizontalLayoutGroup)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(-450f, 0f);
			rectTransform.sizeDelta = new Vector2(320f, 0f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component).spacing = 20f;
			((LayoutGroup)component).childAlignment = (TextAnchor)5;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)component).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)component).childControlHeight = false;
			return val;
		}

		private GameObject CreateLogo(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Logo", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.sizeDelta = new Vector2(40f, 40f);
			rectTransform.anchorMin = new Vector2(0f, 0.5f);
			rectTransform.anchorMax = new Vector2(0f, 0.5f);
			rectTransform.pivot = new Vector2(0f, 0.5f);
			Image image = val.GetImage();
			((Graphic)image).color = MapsBoardUI.MainFontColor;
			image.sprite = MapsBoardUI.MainSprite;
			((Graphic)image).material = MapsBoardUI.MainMaterial;
			image.type = MapsBoardUI.MainImageType;
			image.pixelsPerUnitMultiplier = 12f;
			return val;
		}

		private GameObject CreateTitleText(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_004f: 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_007e: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MAP ROTATION", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParent(parent.transform, false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			((Transform)rectTransform).localScale = new Vector3(1.2f, 1f, 1f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0f, 0.5f);
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).text = "<b>MAP ROTATION</b>";
			((TMP_Text)tMPro).font = MapsBoardUI.AirlineFont;
			((Graphic)tMPro).color = MapsBoardUI.MainFontColor;
			((TMP_Text)tMPro).fontStyle = (FontStyles)2;
			((TMP_Text)tMPro).fontWeight = (FontWeight)900;
			((TMP_Text)tMPro).fontSize = 30f;
			((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
			((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)1;
			((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)4096;
			((TMP_Text)tMPro).characterSpacing = -3f;
			((TMP_Text)tMPro).wordSpacing = 20f;
			return val;
		}

		private GameObject CreatePlane(GameObject parent)
		{
			//IL_0035: 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_005f: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(BoardingPassUI.Plane).gameObject;
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.sizeDelta = new Vector2(35f, 35f);
			rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			Image image = val.GetImage();
			((Graphic)image).color = MapsBoardUI.ScreenColor;
			return val;
		}

		private GameObject CreateModeLabel(GameObject parent)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0050: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MODE:", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).text = "MODE:";
			((TMP_Text)tMPro).font = MapsBoardUI.MainFont;
			((Graphic)tMPro).color = MapsBoardUI.MainFontColor;
			((TMP_Text)tMPro).fontSize = 36f;
			((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)4;
			((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)4096;
			((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
			return val;
		}

		private GameObject CreateDropdown(GameObject parent)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(MapsBoardUI.dropdown);
			val.StripCloneInName();
			Object.Destroy((Object)(object)MapsBoardUI.dropdown);
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(0f, 0f);
			rectTransform.sizeDelta = new Vector2(165f, 50f);
			rectTransform.anchorMin = new Vector2(1f, 0.5f);
			rectTransform.anchorMax = new Vector2(1f, 0.5f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			TMP_Dropdown component = val.GetComponent<TMP_Dropdown>();
			((UnityEventBase)component.onValueChanged).RemoveAllListeners();
			component.ClearOptions();
			string[] names = LoadModeUtil.Names;
			foreach (string text in names)
			{
				component.AddOptions(new List<string>(1) { text.ToUpperInvariant() });
			}
			return val;
		}

		private GameObject CreateConfigOptions(GameObject parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0053: 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_007d: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ConfigOptions", new Type[1] { typeof(VerticalLayoutGroup) });
			val.transform.SetParentAndScale(parent.transform, worldPositionStays: false);
			((HorizontalOrVerticalLayoutGroup)val.GetComponent<VerticalLayoutGroup>()).spacing = -25f;
			RectTransform rectTransform = val.GetRectTransform();
			rectTransform.sizeDelta = new Vector2(325f, 0f);
			rectTransform.anchoredPosition = new Vector2(-100f, 0f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			rectTransform.anchorMin = new Vector2(1f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			return val;
		}

		private void CreateConfigEntryToggleUI(GameObject parent)
		{
			foreach (KeyValuePair<string, ConfigEntry<bool>> entryConfig in ConfigEntryToggle.entryConfigs)
			{
				GameObject val = ConfigEntryToggle.Instantiate(entryConfig.Key, parent.transform);
			}
		}

		internal void CreateMapOptions(GameObject parent)
		{
			int num = Math.Max(MapRotationHandler.Instance.CurrMapRotation.Length, SingletonAsset<MapBaker>.Instance.ScenePaths.Length);
			for (int i = 0; i < num; i++)
			{
				MapOption.Instantiate(i, parent.transform);
			}
		}

		internal void DynamicMapsList(GameObject mapsList, GameObject scrollView, GameObject viewport, GameObject scrollbar)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			RectTransform rectTransform = mapsList.GetRectTransform();
			GridLayoutGroup component = mapsList.GetComponent<GridLayoutGroup>();
			ScrollRect component2 = scrollView.GetComponent<ScrollRect>();
			RectTransform component3 = viewport.GetComponent<RectTransform>();
			component2.content = rectTransform;
			component2.viewport = component3;
			component2.verticalScrollbar = scrollbar.GetComponent<Scrollbar>();
			MapOption.UpdateAllBgColors(mapsList);
			int num = (int)Math.Ceiling((decimal)mapsList.transform.childCount / (decimal)MapsBoardUI.VisibleCols);
			if (num > MapsBoardUI.VisibleRows)
			{
				float y = component.cellSize.y;
				float num2 = y * (float)num;
				rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, num2);
				component.constraint = (Constraint)1;
				Rect rect = rectTransform.rect;
				float num3 = (((Rect)(ref rect)).width - scrollbar.GetRectTransform().sizeDelta.x) / (float)MapsBoardUI.VisibleCols;
				component.cellSize = new Vector2(num3, component.cellSize.y);
			}
		}
	}
	public static class MapsBoardUI
	{
		public static float ScreenWidth = BoardingPassUI.CustomOptions.GetRectTransform().sizeDelta.x;

		public static float ScreenHeight = BoardingPassUI.CustomOptions.GetRectTransform().sizeDelta.y;

		public static int VisibleRows = 11;

		public static int VisibleCols = 2;

		public static Color MainFontColor = ((Component)BoardingPassUI.Panel).gameObject.GetColor();

		public static Color SubtitleColor = new Color(MainFontColor.r, MainFontColor.g, MainFontColor.b, 0.55f);

		public static Color DarkFontColor = ((Graphic)BoardingPassUI.AscentDescription).color;

		public static Color AccentColor = new Color(0.731f, 1f, 0.998f, 1f);

		public static Color ScreenColor = BoardingPassUI.boardingPass.defaultColor;

		public static Color Cell1Color = BoardingPassUI.BlueTop.GetColor();

		public static TMP_FontAsset MainFont = BoardingPassUI.PlayerName.font;

		public static TMP_FontAsset AirlineFont = ((TMP_Text)PassportUI.PassportText).font;

		public static Sprite MainSprite = BoardingPassUI.Panel.sprite;

		public static Sprite RoughSprite = ((Selectable)BoardingPassUI.IncrementAscentButton).image.sprite;

		public static Material MainMaterial = ((Graphic)BoardingPassUI.Panel).material;

		public static Type MainImageType = BoardingPassUI.Panel.type;

		public static GameObject dropdown = MainMenuUI.Dropdown;

		public static GameObject scrollbar = ((Component)dropdown.GetComponentInChildren<Scrollbar>(true)).gameObject;

		public static SFX_Instance buttonClickSFX = ((CustomOptionBase)BoardingPassUI.CustomOptionItemTogglePrefab).sfxClick;

		public static SFX_Instance buttonHoverSFX = ((CustomOptionBase)BoardingPassUI.CustomOptionItemTogglePrefab).sfxHover;

		public static float OpenButtonYPosition = BoardingPassUI.Title.GetRectTransform().anchoredPosition.y;

		public static int roundedCornersAdjustment => 13;

		public static int HeaderHeight => 90;

		public static float MapsListHeight => ScreenHeight - (float)HeaderHeight;

		public static int MapOptionSpacing => 30;

		public static int MapCodeWidth => 85;

		public static Color MapCodeColor => AccentColor;

		public static Color Cell2Color => ScreenColor;

		public static int InfoFontSize => 20;

		public static int InfoFontSizeMin => 18;

		public static int InfoFontSizeMax => 24;

		public static int LineSimpleHeight => 24;

		public static int LineDetailsHeight => 28;
	}
}
namespace PeakAMap.Patches
{
	[HarmonyPatch(typeof(AirportCheckInKiosk))]
	internal class AirportCheckInKioskPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void InstantiateMapsBoard()
		{
			MapsBoard.Instantiate();
		}
	}
	[HarmonyPatch(typeof(AscentUI))]
	internal class AscentUIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void AddBiomesListToHUDPatch(ref TextMeshProUGUI ___text)
		{
			if (MapHandler.Exists && !MapRotationHandler.Instance.CurrentlyLoading)
			{
				AddBiomesListToHUD(___text);
			}
		}

		private static void AddBiomesListToHUD(TextMeshProUGUI refTmp)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_01a2: 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_01bf: 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_01dc: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: 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_0165: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			if (!UserConfig.ShowBiomesInHUD.Value)
			{
				Plugin.Log.LogInfo((object)"ShowBiomesInHUD set to false. Not creating biomes text.");
				return;
			}
			Plugin.Log.LogInfo((object)"ShowBiomesInHUD set to true. Creating biomes text.");
			GameObject val = new GameObject("MapBiomes", new Type[3]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI),
				typeof(MapBiomes)
			});
			MapBiomes component = val.GetComponent<MapBiomes>();
			List<LocalizedText> biomesLocalizedText = MapBiomes.GetBiomesLocalizedText(Singleton<MapHandler>.Instance.biomes);
			component.BiomesTextIds = biomesLocalizedText;
			GameObject gameObject = ((Component)GUIManager.instance.hudCanvas).gameObject;
			val.transform.SetParent(gameObject.transform, false);
			RectTransform rectTransform = ((Component)refTmp).gameObject.GetRectTransform();
			RectTransform rectTransform2 = val.GetRectTransform();
			((Transform)rectTransform2).localScale = ((Transform)rectTransform).localScale;
			rectTransform2.sizeDelta = new Vector2(rectTransform.sizeDelta.x * 5f, rectTransform.sizeDelta.y);
			TextMeshProUGUI tMPro = val.GetTMPro();
			((TMP_Text)tMPro).font = ((TMP_Text)refTmp).font;
			((Graphic)tMPro).color = ((Graphic)refTmp).color;
			((TMP_Text)tMPro).fontSize = ((TMP_Text)refTmp).fontSize;
			((TMP_Text)tMPro).verticalAlignment = ((TMP_Text)refTmp).verticalAlignment;
			((TMP_Text)tMPro).textWrappingMode = ((TMP_Text)refTmp).textWrappingMode;
			((TMP_Text)tMPro).overflowMode = ((TMP_Text)refTmp).overflowMode;
			if (string.IsNullOrEmpty(((TMP_Text)refTmp).text))
			{
				rectTransform2.anchoredPosition = rectTransform.anchoredPosition;
				rectTransform2.anchorMin = rectTransform.anchorMax;
				rectTransform2.anchorMax = rectTransform.anchorMax;
				rectTransform2.pivot = rectTransform.pivot;
				((TMP_Text)tMPro).horizontalAlignment = ((TMP_Text)refTmp).horizontalAlignment;
			}
			else
			{
				rectTransform2.anchoredPosition = new Vector2(0f, rectTransform.anchoredPosition.y);
				rectTransform2.anchorMin = new Vector2(0.5f, rectTransform.anchorMax.y);
				rectTransform2.anchorMax = new Vector2(0.5f, rectTransform.anchorMax.y);
				rectTransform2.pivot = new Vector2(0.5f, rectTransform.pivot.y);
				((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)2;
			}
		}
	}
	[HarmonyPatch(typeof(BoardingPass))]
	internal class BoardingPassPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__OpenMapsBoard;
		}

		public static BoardingPass boardingPass => GUIManager.instance.boardingPass;

		public static CustomMaps customMaps => CustomMaps.Instance;

		public static MapsBoard mapsBoard => MapsBoard.Instance;

		public static TextMeshProUGUI OpenButtonTMPro { get; private set; }

		public static GameObject Title { get; private set; }

		[HarmonyPatch("StartGame")]
		[HarmonyPrefix]
		private static bool StartCustomMapPatch()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			if (customMaps.loadMode == LoadMode.Custom)
			{
				Plugin.Log.LogInfo((object)$"Creating custom login response to load map {customMaps.CustomMapIndex}");
				LoginResponse val = new LoginResponse
				{
					VersionOkay = true,
					HoursUntilLevel = 0,
					MinutesUntilLevel = 0,
					SecondsUntilLevel = 0,
					LevelIndex = customMaps.CustomMapIndex,
					Message = "Using PeakAMap Message."
				};
				GameHandler.GetService<NextLevelService>().NewData(val);
			}
			return true;
		}

		[HarmonyPatch("Initialize")]
		[HarmonyPostfix]
		private static void AddOpenMapsBoardButton()
		{
			//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_0047: Expected O, but got Unknown
			GameObject val = CreateOpenButton(((Component)boardingPass.closeButton).transform.parent);
			val.SetActive(true);
			ButtonClickedEvent onClick = val.GetComponent<Button>().onClick;
			object obj = <>O.<0>__OpenMapsBoard;
			if (obj == null)
			{
				UnityAction val2 = OpenMapsBoard;
				<>O.<0>__OpenMapsBoard = val2;
				obj = (object)val2;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			OpenButtonTMPro = val.GetComponentInChildren<TextMeshProUGUI>();
			Title = ((Component)boardingPass.playerName.transform.parent).gameObject.QueryChildren("BOARDING PASS");
			ResizeBoardingPassTitle();
		}

		[HarmonyPatch("OnOpen")]
		[HarmonyPostfix]
		private static void UpdateOpenMapsBoardText()
		{
			RefreshOpenButtonText();
		}

		private static GameObject CreateOpenButton(Transform parent)
		{
			//IL_004d: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			Button val = Object.Instantiate<Button>(boardingPass.customOptionsButton);
			((UnityEventBase)val.onClick).RemoveAllListeners();
			GameObject gameObject = ((Component)val).gameObject;
			((Object)gameObject).name = "OpenMapsBoard";
			gameObject.transform.SetParentAndScale(parent);
			RectTransform rectTransform = gameObject.GetRectTransform();
			rectTransform.anchoredPosition = new Vector2(-465f, MapsBoardUI.OpenButtonYPosition);
			rectTransform.sizeDelta = new Vector2(185f, 60f);
			rectTransform.pivot = new Vector2(1f, 0.5f);
			rectTransform.anchorMin = new Vector2(1f, 0.5f);
			rectTransform.anchorMax = new Vector2(1f, 0.5f);
			gameObject.GetImage().pixelsPerUnitMultiplier = 5f;
			GameObject val2 = gameObject.QueryChildren("Text");
			TextMeshProUGUI tMPro = val2.GetTMPro();
			((TMP_Text)tMPro).fontSize = 28f;
			((TMP_Text)tMPro).fontSizeMax = 28f;
			Object.Destroy((Object)(object)val2.GetComponent<LocalizedText>());
			return gameObject;
		}

		public static void ResizeBoardingPassTitle()
		{
			//IL_0069: 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_0096: 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_00bc: 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)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			GameObject title = Title;
			GameObject gameObject = ((Component)title.transform.parent).gameObject;
			RectTransform component = gameObject.GetComponent<RectTransform>();
			RectTransform rectTransform = title.GetRectTransform();
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			Vector3[] array2 = (Vector3[])(object)new Vector3[4];
			component.GetWorldCorners(array);
			rectTransform.GetWorldCorners(array2);
			float x = array[0].x;
			float x2 = array2[0].x;
			float num = (x2 - x) / ((Transform)rectTransform).lossyScale.x;
			rectTransform.pivot = new Vector2(0f, 0.5f);
			rectTransform.anchorMin = new Vector2(0f, 0.5f);
			rectTransform.anchorMax = new Vector2(0f, 0.5f);
			rectTransform.sizeDelta = new Vector2(450f, rectTransform.sizeDelta.y);
			rectTransform.anchoredPosition = new Vector2(num, rectTransform.anchoredPosition.y);
		}

		public static void OpenMapsBoard()
		{
			((MenuWindow)boardingPass).Close();
			((MenuWindow)mapsBoard).Open();
		}

		private static void RefreshOpenButtonText()
		{
			if (customMaps.loadMode == LoadMode.Custom)
			{
				string text = customMaps.SelectedMapIndex.ToString(MapOption.MapCodeFormat);
				((TMP_Text)OpenButtonTMPro).text = "MAP " + text;
			}
			else
			{
				((TMP_Text)OpenButtonTMPro).text = "DAILY MAP";
			}
		}
	}
	[HarmonyPatch(typeof(GUIManager))]
	internal class GUIManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void SaveLoadedMapBiomesPatch()
		{
			if (MapHandler.Exists && !MapRotationHandler.Instance.CurrentlyLoading)
			{
				SaveLoadedMapBiomes();
			}
		}

		private static void SaveLoadedMapBiomes()
		{
			//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)
			Scene scene = ((Component)Singleton<MapHandler>.Instance).gameObject.scene;
			int num = Array.IndexOf(MapRotationHandler.Instance._sceneNames, ((Scene)(ref scene)).name);
			if (MapRotationHandler.Instance.CurrMapRotation[num] != null)
			{
				Plugin.Log.LogInfo((object)"Map info already saved. No need to save info.");
				return;
			}
			Plugin.Log.LogInfo((object)"Map info wasn't saved. Now saving info.");
			MapRotationHandler.Instance.CurrMapRotation.FillBiomesInfo(num, out GameObject _);
			DataFilesHandler.WriteMapRotation(MapRotationHandler.Instance.CurrMapRotation);
		}
	}
	[HarmonyPatch(typeof(MainMenuPageHandler))]
	internal class MainMenuPageHandlerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void SearchForAllMapsPatch()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			if (MapRotationHandler.Instance.NeedToLoad && !Modal.IsOpen)
			{
				Modal.OpenYesNoModal((HeaderModalOption)new DefaultHeaderModalOption("[PeakAMap]\nINCOMPLETE MAP ROTATION DATA", "Load and search for missing biome info?"), LocalizedText.GetText("BACK", true), LocalizedText.GetText("OK", true), (Action)delegate
				{
					MapRotationHandler.Instance._cancelIndicator = true;
				}, (Action)delegate
				{
					Plugin.Log.LogInfo((object)"Missing biomes data. Loading maps to gather missing biomes info.");
					MapRotationHandler.Instance.LoadAllMaps();
				}, (Action)null);
			}
		}
	}
}
namespace PeakAMap.Core
{
	[Serializable]
	public class BiomeInfo
	{
		public static readonly Dictionary<BiomeType, string[]> BiomeTextIds = new Dictionary<BiomeType, string[]>
		{
			{
				(BiomeType)0,
				new string[1] { "SHORE" }
			},
			{
				(BiomeType)1,
				new string[1] { "TROPICS" }
			},
			{
				(BiomeType)2,
				new string[1] { "ALPINE" }
			},
			{
				(BiomeType)3,
				new string[2] { "CALDERA", "THE KILN" }
			},
			{
				(BiomeType)5,
				new string[1] { "PEAK" }
			},
			{
				(BiomeType)6,
				new string[1] { "MESA" }
			},
			{
				(BiomeType)7,
				new string[1] { "ROOTS" }
			}
		};

		public static HashSet<BiomeType> HasVariants = new HashSet<BiomeType>
		{
			(BiomeType)0,
			(BiomeType)1,
			(BiomeType)2,
			(BiomeType)6,
			(BiomeType)7
		};

		public const int NumInfo = 3;

		public int BiomeTypeInt;

		public string Variant;

		public bool OpenTomb;

		private static HashSet<string> s_rootsIgnoreInVariant = new HashSet<string> { "Redwoods", "Redwood", "Variant" };

		public BiomeType biomeType => (BiomeType)BiomeTypeInt;

		public string[] TextId
		{
			get
			{
				//IL_0006: 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 (BiomeTextIds.TryGetValue(biomeType, out string[] value))
				{
					return value;
				}
				return new string[1] { Enum.GetName(typeof(BiomeType), biomeType).ToUpperInvariant() };
			}
		}

		public BiomeInfo(Biome biome, Component? variant = null, bool? openTomb = false)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected I4, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			BiomeTypeInt = (int)biome.biomeType;
			Variant = CleanVariant(((variant != null) ? ((Object)variant).name : null) ?? "", biome.biomeType);
			OpenTomb = openTomb.GetValueOrDefault();
		}

		public BiomeInfo(int biomeTypeInt, string variant = "", bool openTomb = false)
		{
			BiomeTypeInt = biomeTypeInt;
			Variant = CleanVariant(variant, (BiomeType)biomeTypeInt);
			OpenTomb = openTomb;
		}

		public static string CleanVariant(string variant, BiomeType biome)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			if ((int)biome == 7)
			{
				return CleanRootsVariant(variant);
			}
			if ((int)biome == 6)
			{
				return CleanMesaVariant(variant);
			}
			return variant;
		}

		private static string CleanRootsVariant(string variant)
		{
			string[] array = variant.Split(' ', '-');
			if (array.Length <= 1)
			{
				return variant;
			}
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i];
				if (text.Length > 0)
				{
					text = text.Substring(0, 1).ToUpperInvariant() + text.Substring(1).ToLowerInvariant();
				}
				if (s_rootsIgnoreInVariant.Contains(text))
				{
					text = "";
				}
				array[i] = text;
			}
			return string.Join("", array);
		}

		private static string CleanMesaVariant(string variant)
		{
			if (variant.Equals("NoVariant"))
			{
				return "Default";
			}
			if (variant.Equals("CacusHell"))
			{
				return "CactusHell";
			}
			return variant;
		}

		public override string ToString()
		{
			string text = string.Join(", ", TextId);
			if (!string.IsNullOrEmpty(Variant))
			{
				text = text + " (" + Variant + ")";
			}
			if (BiomeTypeInt == 6)
			{
				text += $" [OpenTomb: {OpenTomb}]";
			}
			return text;
		}
	}
	public class ConfigEntryToggle : CustomOptionBase
	{
		public enum ConfigNames
		{
			ShowBiomesInHUD,
			ShowBiomeDetails
		}

		public static Dictionary<string, ConfigEntry<bool>> entryConfigs = new Dictionary<string, ConfigEntry<bool>>
		{
			{
				"ShowBiomesInHUD",
				UserConfig.ShowBiomesInHUD
			},
			{
				"ShowBiomeDetails",
				UserConfig.ShowBiomeDetails
			}
		};

		public static Dictionary<string, string> entryLabels = new Dictionary<string, string>
		{
			{ "ShowBiomesInHUD", "DISPLAY BIOMES IN RUN" },
			{ "ShowBiomeDetails", "MORE DETAILS" }
		};

		public Toggle toggle { get; set; }

		public TextMeshProUGUI tmp { get; set; }

		public ConfigEntry<bool> entry { get; set; }

		public static GameObject Instantiate(string name, Transform parent)
		{
			GameObject val = Object.Instantiate<GameObject>(ConfigEntryTogglePrefab.Instance.gameObject, ((Component)parent).transform);
			((Object)val).name = name;
			ConfigEntryToggle configEntryToggle = val.AddComponent<ConfigEntryToggle>();
			((CustomOptionBase)configEntryToggle).sfxClick = MapsBoardUI.buttonClickSFX;
			((CustomOptionBase)configEntryToggle).sfxHover = MapsBoardUI.buttonHoverSFX;
			return val;
		}

		private void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val = item;
				if (((Object)val).name.Equals("Toggle"))
				{
					toggle = ((Component)val).GetComponent<Toggle>();
				}
				else if (((Object)val).name.Equals("Title"))
				{
					tmp = ((Component)val).gameObject.GetTMPro();
					((TMP_Text)tmp).text = entryLabels[((Object)this).name];
				}
			}
			entry = entryConfigs[((Object)this).name];
			((Component)toggle).gameObject.GetComponent<CustomOptionButtonHelper>().option = (CustomOptionBase)(object)this;
			Refresh();
		}

		private void Refresh()
		{
			toggle.SetIsOnWithoutNotify(entry.Value);
		}

		private void OnEnable()
		{
			Refresh();
		}

		public override void OnClick()
		{
			((CustomOptionBase)this).OnClick();
			entry.Value = !entry.Value;
			Refresh();
		}
	}
	public sealed class CustomMaps
	{
		private static readonly CustomMaps _instance;

		private int _customMapIndex;

		public static CustomMaps Instance => _instance;

		public LoadMode loadMode { get; set; }

		public string LoadModeName => loadMode.GetName();

		public int CustomMapIndex
		{
			get
			{
				return _customMapIndex;
			}
			set
			{
				_customMapIndex = value % SingletonAsset<MapBaker>.Instance.ScenePaths.Length;
			}
		}

		public int DailyMapIndex
		{
			get
			{
				NextLevelService service = GameHandler.GetService<NextLevelService>();
				int num = service.NextLevelIndexOrFallback + NextLevelService.debugLevelIndexOffset;
				return num % SingletonAsset<MapBaker>.Instance.ScenePaths.Length;
			}
		}

		public int SelectedMapIndex
		{
			get
			{
				if (loadMode != 0)
				{
					return DailyMapIndex;
				}
				return CustomMapIndex;
			}
		}

		private CustomMaps()
		{
			loadMode = LoadMode.Custom;
			_customMapIndex = DailyMapIndex;
		}

		static CustomMaps()
		{
			_instance = new CustomMaps();
		}
	}
	public static class DataFilesHandler
	{
		private static string s_dataDir = Path.GetFullPath(Plugin.LoadedInfo.Location + "/../data/");

		private static readonly string s_currVersion;

		private static string s_fileName;

		private static string s_currMapRotationPath;

		private static string[] s_dataFiles;

		public static string GetDataFileName(string version)
		{
			return "map_rotation-" + version + ".json";
		}

		public static string GetDataPath(string version)
		{
			return s_dataDir + GetDataFileName(version);
		}

		internal static MapRotation? ParseMapRotation(string? version = null)
		{
			if (version == null)
			{
				version = s_currVersion;
			}
			string dataFileName = GetDataFileName(version);
			string dataPath = GetDataPath(version);
			string text = "";
			if (s_dataFiles.Contains(dataPath))
			{
				try
				{
					text = File.ReadAllText(dataPath);
					return MapRotation.FromJson(text);
				}
				catch
				{
				}
			}
			Plugin.Log.LogWarning((object)("Cannot get data from " + dataFileName + ". Trying to get data from other files."));
			return FallbackMapRotationFiles();
		}

		private static MapRotation? FallbackMapRotationFiles()
		{
			string text = "";
			string text2 = "";
			for (int i = 0; i < s_dataFiles.Length; i++)
			{
				try
				{
					text2 = s_dataFiles[i];
					text = File.ReadAllText(text2);
					MapRotation mapRotation = MapRotation.FromJson(text);
					if (SingletonAsset<MapBaker>.Instance.ValidSelectedBiomes() && IsIdenticalToSelectedMaps(mapRotation))
					{
						Plugin.Log.LogWarning((object)("Found file " + Path.GetFileName(text2) + " with identical biomes to use as current map rotation data. Biome information details may contain inaccuracies as a result."));
						return mapRotation;
					}
				}
				catch
				{
				}
			}
			Plugin.Log.LogError((object)"Cannot find data from other files. Not able to load map rotation data.");
			return null;
		}

		private static bool IsIdenticalToSelectedMaps(MapRotation mapRotation)
		{
			List<BiomeResult> biomeResults = mapRotation.biomeResults;
			if (biomeResults.Count != SingletonAsset<MapBaker>.Instance.selectedBiomes.Count)
			{
				return false;
			}
			for (int i = 0; i < biomeResults.Count; i++)
			{
				if (!SingletonAsset<MapBaker>.Instance.selectedBiomes[i].IsIdenticalTo(biomeResults[i]))
				{
					return false;
				}
			}
			return true;
		}

		internal static void WriteMapRotation(MapRotation data)
		{
			try
			{
				Directory.CreateDirectory(s_dataDir);
			}
			catch
			{
			}
			try
			{
				File.WriteAllText(s_currMapRotationPath, MapRotation.ToJson(data));
			}
			catch
			{
				Plugin.Log.LogError((object)("Failed to save data to file. Issue with writing to " + s_currMapRotationPath));
			}
		}

		static DataFilesHandler()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			BuildVersion val = new BuildVersion(Application.version, "???");
			s_currVersion = ((object)(BuildVersion)(ref val)).ToString();
			s_fileName = "map_rotation-" + s_currVersion + ".json";
			s_currMapRotationPath = s_dataDir + s_fileName;
			s_dataFiles = (from s in Directory.GetFiles(s_dataDir, "*.json")
				orderby s descending
				select s).ToArray();
		}
	}
	public enum LoadMode
	{
		Custom,
		Daily
	}
	public static class LoadModeUtil
	{
		private static readonly Dictionary<string, LoadMode> s_nameToMode;

		public static readonly string[] Names;

		public static readonly Array Values;

		public static readonly int Length;

		static LoadModeUtil()
		{
			Names = Enum.GetNames(typeof(LoadMode));
			Values = Enum.GetValues(typeof(LoadMode));
			s_nameToMode = new Dictionary<string, LoadMode>();
			foreach (LoadMode value in Values)
			{
				s_nameToMode.Add(value.GetName(), value);
			}
			Length = Names.Length;
		}

		public static string GetName(this LoadMode mode)
		{
			return Names[(int)mode];
		}

		public static LoadMode GetLoadMode(string str)
		{
			return s_nameToMode[str];
		}
	}
	public class MapBiomes : MonoBehaviour
	{
		private List<LocalizedText> _biomesTextIds;

		public static string Separator = " | ";

		public TextMeshProUGUI TMPro { get; set; }

		public List<LocalizedText> BiomesTextIds
		{
			get
			{
				return _biomesTextIds;
			}
			set
			{
				_biomesTextIds = value;
				UpdateLocalizedText();
			}
		}

		public static List<LocalizedText> GetBiomesLocalizedText(List<BiomeInfo>? biomesInfo)
		{
			if (biomesInfo == null)
			{
				return new List<LocalizedText>();
			}
			List<BiomeType> biomeTypes = biomesInfo?.Select((BiomeInfo info) => (BiomeType)info.BiomeTypeInt).ToList();
			return GetBiomesLocalizedText(biomeTypes);
		}

		public static List<LocalizedText> GetBiomesLocalizedText(List<BiomeType>? biomeTypes)
		{
			//IL_001a: 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_0054: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			if (biomeTypes == null)
			{
				return new List<LocalizedText>();
			}
			List<LocalizedText> list = new List<LocalizedText>();
			for (int i = 0; i < biomeTypes.Count; i++)
			{
				if (BiomeInfo.BiomeTextIds.TryGetValue(biomeTypes[i], out string[] value))
				{
					for (int j = 0; j < value.Length; j++)
					{
						list.Add(new LocalizedText
						{
							index = value[j]
						});
					}
				}
				else
				{
					LocalizedText val = new LocalizedText();
					val.index = Enum.GetName(typeof(BiomeType), biomeTypes[i]).ToUpperInvariant();
					list.Add(val);
				}
			}
			return list;
		}

		private void Awake()
		{
			TMPro = ((Component)this).GetComponent<TextMeshProUGUI>();
		}

		private void Start()
		{
			LocalizedText.OnLangugageChanged = (Action)Delegate.Combine(LocalizedText.OnLangugageChanged, new Action(UpdateLocalizedText));
		}

		private void OnDestroy()
		{
			LocalizedText.OnLangugageChanged = (Action)Delegate.Remove(LocalizedText.OnLangugageChanged, new Action(UpdateLocalizedText));
		}

		private void UpdateLocalizedText()
		{
			try
			{
				string[] array = new string[BiomesTextIds.Count];
				for (int i = 0; i < array.Length; i++)
				{
					string index = BiomesTextIds[i].index;
					if (LocalizedText.mainTable.TryGetValue(index, out var _))
					{
						array[i] = LocalizedText.GetText(index, true);
					}
					else
					{
						array[i] = index;
					}
				}
				((TMP_Text)TMPro).text = string.Join(Separator, array);
				if (string.IsNullOrEmpty(((TMP_Text)TMPro).text))
				{
					((TMP_Text)TMPro).text = MapOptionPrefab.Instance.InfoTextPlaceholder;
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Issue with trying to update text for biomes.\n" + ex.Message));
			}
		}
	}
	public class MapOption : MonoBehaviour
	{
		public enum InfoType
		{
			BiomeNameInfo,
			OpenTombInfo,
			VariantInfo
		}

		public static string MapCodeFormat = "00";

		public const int DefaultNumBiomes = 5;

		public const int DefaultNumTextIDs = 1;

		public GameObject MapsList { get; set; }

		public GameObject MapBiomes { get; set; }

		public TextMeshProUGUI MapCode { get; set; }

		public Image BGImage { get; set; }

		public Button button { get; set; }

		public TextMeshProUGUI[] TextInfo { get; set; }

		public LayoutElement[] Lines { get; set; }

		public GameObject OpenTombInfo { get; set; }

		public GameObject VariantInfo { get; set; }

		public GameObject MapCodeBorder { get; set; }

		public bool Selected => false;

		public int MapIndex
		{
			get
			{
				int.TryParse(((TMP_Text)MapCode).text, out var result);
				return result;
			}
		}

		public static void Instantiate(int index, Transform parent)
		{
			GameObject val = Object.Instantiate<GameObject>(MapOptionPrefab.Instance.gameObject);
			val.StripCloneInName();
			val.transform.SetParentAndScale(parent, worldPositionStays: false);
			GameObject gameObject = val.QueryChildren("MapCode");
			((TMP_Text)gameObject.GetTMPro()).text = index.ToString(MapCodeFormat);
			FillMapBiomes(val.QueryChildren("MapBiomes"), index);
			MapOption mapOption = val.AddComponent<MapOption>();
		}

		private static void FillMapBiomes(GameObject mapBiomes, int mapIndex)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or miss