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.Core;
[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.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+d8a92125cb30bae1fd1cacae70168f5b6edc81c5")]
[assembly: AssemblyProduct("com.github.snowybunny.PeakAMap")]
[assembly: AssemblyTitle("PeakAMap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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.0.3")]
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.0.3";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
LoadedInfo = ((BaseUnityPlugin)this).Info;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
_harmony.PatchAll(Assembly.GetExecutingAssembly());
UserConfig.Initialize(((BaseUnityPlugin)this).Config);
}
}
}
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 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; }
private static void Initialize()
{
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: 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;
Plane = (GameObject)(((object)((Component)Panel).gameObject.QueryChildren("Plane")) ?? ((object)new GameObject("PlaneFallback", new Type[2]
{
typeof(RectTransform),
typeof(Image)
})));
PlayerName = boardingPass.playerName;
Pivot = InnerboardingPass.GetComponent<RectTransform>().pivot;
BlueTop = (GameObject)(((object)((Component)Panel).gameObject.QueryChildren("BlueTop")) ?? ((object)new GameObject("BlueTopFallback", new Type[1] { typeof(Image) })));
}
[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)
{
Transform? obj = gameObject.transform.QueryChildren(queries);
return (obj != null) ? ((Component)obj).gameObject : null;
}
public static GameObject? QueryChildren(this GameObject gameObject, string queryOrPath)
{
Transform? obj = gameObject.transform.QueryChildren(queryOrPath);
return (obj != null) ? ((Component)obj).gameObject : null;
}
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 GameObject PasteComponent<T>(this GameObject gameObject, T component)
{
Type typeFromHandle = typeof(T);
T component2 = gameObject.GetComponent<T>();
if (component2 == null)
{
gameObject.AddComponent(typeFromHandle);
component2 = gameObject.GetComponent<T>();
}
PropertyInfo[] properties = typeFromHandle.GetProperties();
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
if (propertyInfo.CanRead && propertyInfo.CanWrite)
{
propertyInfo.SetValue(component2, propertyInfo.GetValue(component));
}
}
FieldInfo[] fields = typeFromHandle.GetFields();
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
fieldInfo.SetValue(component2, fieldInfo.GetValue(component));
}
return gameObject;
}
}
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
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_0116: 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)(((object)gameObject.QueryChildren("FirstTimeSetupPage/SettingParent/ENUM DROPDOWN/Dropdown")) ?? ((object)new GameObject("DropdownObjectFallback", new Type[1] { typeof(TMP_Dropdown) }))));
Dropdown.transform.SetParent(val.transform, false);
SettingsBackButton = Object.Instantiate<GameObject>((GameObject)(((object)gameObject.QueryChildren("SettingsPage/SettingsPageShared/UI_MainMenuButton_LeaveGame (2)")) ?? ((object)new GameObject("BackButtonFallback", new Type[1] { typeof(Button) }))));
SettingsBackButton.transform.SetParent(val.transform, false);
VersionTMPro = Object.Instantiate<TextMeshProUGUI>(gameObject2.QueryChildren("Version")?.GetTMPro()) ?? GameObjectUtility.GetTMPro(new GameObject("VersionFallback", new Type[1] { typeof(TextMeshProUGUI) }));
((TMP_Text)VersionTMPro).transform.SetParent(val.transform, false);
Object.DontDestroyOnLoad((Object)(object)val);
}
[HarmonyPatch(typeof(MainMenu), "Start")]
[HarmonyPostfix]
private static void InitializeMainMenu(MainMenu __instance)
{
if (!s_initialized)
{
Initialize(__instance);
s_initialized = true;
}
}
}
[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()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
passportManager = PassportManager.instance;
GameObject? obj = passportManager.uiObject.QueryChildren("Canvas/Panel/Panel/BG/Portrait");
PassportText = (TextMeshProUGUI)(((object)((obj != null) ? obj.GetComponentInChildren<TextMeshProUGUI>() : null)) ?? ((object)new 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);
}
}
}
namespace PeakAMap.UI
{
public sealed class LoadingMapsScreenUI
{
private static readonly LoadingMapsScreenUI _instance;
public static LoadingMapsScreenUI Instance => _instance;
public GameObject Description { get; set; }
public GameObject QuitButton { get; set; }
public GameObject gameObject { get; set; }
private LoadingMapsScreenUI()
{
Initialize();
}
static LoadingMapsScreenUI()
{
_instance = new LoadingMapsScreenUI();
}
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);
Object.DontDestroyOnLoad((Object)(object)gameObject);
}
public void Instantiate(GameObject? parent = null)
{
Instantiate(parent, out GameObject _, out GameObject _);
}
public void Instantiate(GameObject? parent, out GameObject? description, out GameObject? quitButton)
{
//IL_005d: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
description = null;
quitButton = 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 quit button.");
return;
}
description = Object.Instantiate<GameObject>(Description);
description.transform.SetParent(parent.transform, false);
RectTransform rectTransform = description.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(35f, -20f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
quitButton = Object.Instantiate<GameObject>(QuitButton);
quitButton.transform.SetParent(parent.transform, false);
RectTransform rectTransform2 = quitButton.GetRectTransform();
rectTransform2.anchoredPosition = new Vector2(-30f, -25f);
((Transform)rectTransform2).localScale = new Vector3(1f, 1f, 1f);
}
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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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.SetParent(parent.transform, 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(MainMenuUI.SettingsBackButton);
val.transform.SetParent(parent.transform, 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 = "QUIT";
return val;
}
}
public class MapOption : MonoBehaviour
{
public static string Separator = " | ";
public static string MapCodeFormat = "00";
private int _mapIndex;
public MapBiomes Biomes { get; set; }
public TextMeshProUGUI MapCode { get; set; }
public Image BGImage { get; set; }
public Button button { get; set; }
public int MapIndex
{
get
{
return _mapIndex;
}
set
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
_mapIndex = value;
((TMP_Text)MapCode).text = MapCodeText;
((Graphic)BGImage).color = BgColor;
List<BiomeInfo> biomesInfo = MapRotationHandler.Instance.CurrMapRotation[_mapIndex];
Biomes.BiomesTextIds = MapBiomes.GetBiomesLocalizedText(biomesInfo);
}
}
public Color BgColor
{
get
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
int num = MapIndex / MapsBoardUI.VisibleRows % 2;
int num2 = (MapIndex - MapsBoardUI.VisibleRows * num) % 2;
if (num != num2)
{
return MapsBoardUI.Cell2Color;
}
return MapsBoardUI.Cell1Color;
}
}
public string MapCodeText => MapIndex.ToString(MapCodeFormat);
public static void Instantiate(int index, Transform parent)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(MapOptionPrefab.Instance.gameObject);
val.transform.SetParent(parent, false);
MapOption mapOption = val.AddComponent<MapOption>();
mapOption.MapIndex = index;
RectTransform rectTransform = val.GetRectTransform();
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
}
private void Awake()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
BGImage = ((Component)this).GetComponent<Image>();
button = ((Component)this).GetComponent<Button>();
foreach (Transform item in ((Component)this).gameObject.transform)
{
Transform val = item;
if (((Object)val).name.Equals("MapCode"))
{
MapCode = val.GetTMPro();
}
else if (((Object)val).name.Equals("MapBiomes"))
{
Biomes = ((Component)val).gameObject.GetOrAddComponent<MapBiomes>();
}
}
}
}
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 BiomesTextPlaceholder { get; set; } = "???";
private MapOptionPrefab()
{
GameObject parent = CreateMapOption();
GameObject val = CreateMapCode(parent);
GameObject val2 = CreateBiomes(parent);
gameObject = parent;
Object.DontDestroyOnLoad((Object)(object)gameObject);
}
static MapOptionPrefab()
{
_instance = new MapOptionPrefab();
}
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(HorizontalLayoutGroup),
typeof(Button)
});
Image image = val.GetImage();
image.type = MapsBoardUI.MainImageType;
((Graphic)image).material = MapsBoardUI.MainMaterial;
HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>();
((LayoutGroup)component).padding.left = MapsBoardUI.MapOptionSpacing;
((LayoutGroup)component).padding.right = MapsBoardUI.MapOptionSpacing;
((HorizontalOrVerticalLayoutGroup)component).spacing = MapsBoardUI.MapOptionSpacing;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = true;
((HorizontalOrVerticalLayoutGroup)component).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)component).childScaleWidth = false;
((HorizontalOrVerticalLayoutGroup)component).childScaleHeight = false;
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_00a6: 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)
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);
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 = 28f;
((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.SetParent(parent.transform, false);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
return parent;
}
private GameObject CreateBiomes(GameObject parent)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MapBiomes", new Type[3]
{
typeof(RectTransform),
typeof(TextMeshProUGUI),
typeof(LayoutElement)
});
RectTransform rectTransform = val.GetRectTransform();
rectTransform.sizeDelta = new Vector2(MapsBoardUI.BiomesWidth, 0f);
rectTransform.anchorMin = new Vector2(0f, 0f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.pivot = new Vector2(0f, 0.5f);
LayoutElement component = val.GetComponent<LayoutElement>();
component.flexibleWidth = 1f;
TextMeshProUGUI tMPro = val.GetTMPro();
((TMP_Text)tMPro).text = BiomesTextPlaceholder;
((TMP_Text)tMPro).font = MapsBoardUI.MainFont;
((Graphic)tMPro).color = MapsBoardUI.MainColor;
((TMP_Text)tMPro).fontWeight = (FontWeight)600;
((TMP_Text)tMPro).fontSize = 20f;
((TMP_Text)tMPro).textWrappingMode = (TextWrappingModes)1;
((TMP_Text)tMPro).overflowMode = (TextOverflowModes)0;
((TMP_Text)tMPro).horizontalAlignment = (HorizontalAlignmentOptions)1;
((TMP_Text)tMPro).verticalAlignment = (VerticalAlignmentOptions)4096;
((TMP_Text)tMPro).lineSpacing = -35f;
val.transform.SetParent(parent.transform, false);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
return parent;
}
}
internal sealed class MapsBoard
{
private static readonly MapsBoard _instance;
public static MapsBoard Instance => _instance;
public GameObject gameObject { get; set; }
private MapsBoard()
{
Initialize();
}
static MapsBoard()
{
_instance = new MapsBoard();
}
private void Initialize()
{
gameObject = SetBoard();
Object.DontDestroyOnLoad((Object)(object)gameObject);
GameObject parent = CreateScreen(gameObject);
GameObject parent2 = CreateHeader(parent);
GameObject val = CreateScrollView(parent);
GameObject val2 = CreateMapsList(val);
GameObject parent3 = CreateTitle(parent2);
GameObject parent4 = CreateSelectedMap(parent2);
GameObject parent5 = CreateModeSelection(parent2);
GameObject parent6 = CreateLogo(parent3);
CreateTitleText(parent3);
CreatePlane(parent6);
CreateSelectedMapLabel(parent4);
CreateSelectedMapCode(parent4);
CreateModeLabel(parent5);
CreateDropdown(parent5);
CreateMapOptions(val2);
ScrollRect component = val.GetComponent<ScrollRect>();
component.content = val2.GetRectTransform();
UpdateMapsListFromCount(val2);
}
private GameObject SetBoard()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0086: 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 result = new GameObject("MapsBoard", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
RectTransform rectTransform = result.GetRectTransform();
rectTransform.sizeDelta = new Vector2((float)MapsBoardUI.BoardWidth, (float)MapsBoardUI.BoardHeight);
rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
rectTransform.pivot = MapsBoardUI.BoardPivot;
Image image = result.GetImage();
((Graphic)image).color = MapsBoardUI.BoardColor;
image.sprite = MapsBoardUI.MainSprite;
((Graphic)image).material = MapsBoardUI.MainMaterial;
image.type = MapsBoardUI.MainImageType;
image.pixelsPerUnitMultiplier = 3f;
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_005c: 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_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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
rectTransform.sizeDelta = new Vector2((float)MapsBoardUI.ScreenWidth, (float)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();
((Graphic)image).color = MapsBoardUI.ScreenColor;
image.sprite = MapsBoardUI.MainSprite;
((Graphic)image).material = MapsBoardUI.MainMaterial;
image.type = MapsBoardUI.MainImageType;
image.pixelsPerUnitMultiplier = 4f;
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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b9: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Header", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
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 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_0069: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: 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_00df: 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_012e: 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.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
rectTransform.sizeDelta = new Vector2((float)MapsBoardUI.ScreenWidth, (float)(MapsBoardUI.ScreenHeight - MapsBoardUI.HeaderHeight));
rectTransform.anchorMin = new Vector2(0.5f, 0f);
rectTransform.anchorMax = new Vector2(0.5f, 0f);
rectTransform.pivot = new Vector2(0.5f, 0f);
ScrollRect component = val.GetComponent<ScrollRect>();
component.horizontal = false;
component.vertical = true;
component.movementType = (MovementType)2;
component.scrollSensitivity = 3f;
Image image = val.GetImage();
((Graphic)image).color = MapsBoardUI.ScreenColor;
((Graphic)image).material = MapsBoardUI.MainMaterial;
image.type = MapsBoardUI.MainImageType;
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_005c: 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)
//IL_00b5: 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_00fb: 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.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
rectTransform.sizeDelta = new Vector2(MapsBoardUI.MapsListWidth, MapsBoardUI.MapsListHeight);
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.cellSize = new Vector2(MapsBoardUI.CellWidth, MapsBoardUI.CellHeight);
component.constraint = (Constraint)1;
component.constraintCount = MapsBoardUI.VisibleCols;
((LayoutGroup)component).padding.left = MapsBoardUI.roundedCornersAdjustment;
((LayoutGroup)component).padding.right = MapsBoardUI.roundedCornersAdjustment;
((LayoutGroup)component).padding.bottom = MapsBoardUI.roundedCornersAdjustment;
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_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)
GameObject val = new GameObject("Title", new Type[2]
{
typeof(RectTransform),
typeof(HorizontalLayoutGroup)
});
val.transform.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(40f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
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_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)
GameObject val = new GameObject("SelectedMap", new Type[2]
{
typeof(RectTransform),
typeof(HorizontalLayoutGroup)
});
val.transform.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(-460f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
rectTransform.anchorMin = new Vector2(1f, 0f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.pivot = new Vector2(1f, 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_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:", 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(1f, 1f, 1f);
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.MainColor;
((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_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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: 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.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00bd: 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.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(-30f, 0f);
rectTransform.sizeDelta = new Vector2(320f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
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_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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
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.MainColor;
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("CURRENT 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>CURRENT MAP ROTATION</b>";
((TMP_Text)tMPro).font = MapsBoardUI.AirlineFont;
((Graphic)tMPro).color = MapsBoardUI.MainColor;
((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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b4: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(boardingPassUI.Plane).gameObject;
val.transform.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
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_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("MODE:", 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(1f, 1f, 1f);
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.MainColor;
((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_0039: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(MapsBoardUI.Dropdown);
Object.Destroy((Object)(object)MainMenuUI.Dropdown);
val.transform.SetParent(parent.transform, false);
RectTransform rectTransform = val.GetRectTransform();
rectTransform.anchoredPosition = new Vector2(0f, 0f);
((Transform)rectTransform).localScale = new Vector3(1f, 1f, 1f);
rectTransform.sizeDelta = new Vector2(225f, 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();
component.AddOptions(LoadModeUtil.Names.ToList());
return val;
}
private static void CreateMapOptions(GameObject parent)
{
for (int i = 0; i < MapRotationHandler.Instance.CurrMapRotation.Length; i++)
{
MapOption.Instantiate(i, parent.transform);
}
}
private static void UpdateMapsListFromCount(GameObject mapsList)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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)
RectTransform rectTransform = mapsList.GetRectTransform();
int num = mapsList.transform.childCount / MapsBoardUI.VisibleCols;
float num2 = MapsBoardUI.CellHeight * (float)num + (float)MapsBoardUI.roundedCornersAdjustment;
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, num2);
if (num > MapsBoardUI.VisibleRows)
{
for (int i = 0; i < mapsList.transform.childCount; i++)
{
int num3 = i / num % 2;
int num4 = (i - num * num3) % 2;
Image image = mapsList.transform.GetChild(i).GetImage();
((Graphic)image).color = ((num3 == num4) ? MapsBoardUI.Cell1Color : MapsBoardUI.Cell2Color);
}
}
}
}
public static class MapsBoardUI
{
public static Vector2 boardingPassNewPivot = new Vector2(0.5f, 0.8f);
public static Vector2 BoardPivot = new Vector2(0.5f, -0.8f);
public static int BoardWidth = 1640;
public static int BoardHeight = 350;
public static int BezelSize = 15;
public static int HeaderHeight = 80;
public static int VisibleRows = 5;
public static int VisibleCols = 3;
public static Color MainColor = ((Component)boardingPassUI.Panel).gameObject.GetColor();
public static Color SubtitleColor = ((Graphic)boardingPassUI.PlayerName).color;
public static Color BoardColor = new Color(0.2f, 0.22f, 0.32f);
public static Color MapCodeColor = new Color(0.731f, 1f, 0.998f, 1f);
public static Color ScreenColor = ((Graphic)((Selectable)boardingPassUI.boardingPass.startGameButton).image).color;
public static Color Cell1Color = boardingPassUI.BlueTop.GetColor();
public static Color Cell2Color = ScreenColor;
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 int ScreenWidth => BoardWidth - BezelSize * 2;
public static int ScreenHeight => BoardHeight - BezelSize * 2;
public static int roundedCornersAdjustment => 8;
public static float MapsListWidth => ScreenWidth;
public static float MapsListHeight => ScreenHeight - HeaderHeight;
public static float CellWidth => (MapsListWidth - (float)(roundedCornersAdjustment * 2)) / (float)VisibleCols;
public static float CellHeight => (MapsListHeight - (float)roundedCornersAdjustment) / (float)VisibleRows;
public static int MapOptionSpacing => 20;
public static int MapCodeWidth => 30;
public static float BiomesWidth => CellWidth - (float)MapCodeWidth - (float)(MapOptionSpacing * 3);
}
}
namespace PeakAMap.Patches
{
[HarmonyPatch(typeof(AirportCheckInKiosk))]
internal class AirportCheckInKioskPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void InstantiateMapsBoard()
{
MapsBoardHandler.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
{
[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.Instance.loadMode == LoadMode.Custom)
{
Plugin.Log.LogInfo((object)$"Creating custom login response to load map {CustomMaps.Instance.CustomMapIndex}");
LoginResponse val = new LoginResponse
{
VersionOkay = true,
HoursUntilLevel = 0,
MinutesUntilLevel = 0,
SecondsUntilLevel = 0,
LevelIndex = CustomMaps.Instance.CustomMapIndex,
Message = "Using PeakAMap Message."
};
GameHandler.GetService<NextLevelService>().NewData(val);
}
return true;
}
}
[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(MainMenu))]
internal class MainMenuPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void SearchForAllMapsPatch()
{
if (MapRotationHandler.Instance.NeedToLoad)
{
Plugin.Log.LogInfo((object)"Missing biomes data. Loading maps to gather missing biomes info.");
MapRotationHandler.Instance.LoadAllMaps();
}
}
}
}
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 int BiomeTypeInt;
public string Variant;
public bool OpenTomb;
public BiomeType biomeType => (BiomeType)BiomeTypeInt;
public string[] TextId => BiomeTextIds[biomeType];
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
BiomeTypeInt = (int)biome.biomeType;
Variant = ((variant != null) ? ((Object)variant).name : null) ?? "";
OpenTomb = openTomb.GetValueOrDefault();
}
public BiomeInfo(int biomeTypeInt, string variant = "", bool openTomb = false)
{
BiomeTypeInt = biomeTypeInt;
Variant = variant;
OpenTomb = openTomb;
}
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 sealed class CustomMaps
{
private static readonly CustomMaps _instance;
private int _customMapIndex;
public static CustomMaps Instance => _instance;
public LoadMode loadMode { get; set; }
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 GetFileName(string version)
{
return "map_rotation-" + version + ".json";
}
public static string GetPath(string version)
{
return s_dataDir + GetFileName(version);
}
internal static MapRotation? ParseMapRotation(string? version = null)
{
if (version == null)
{
version = s_currVersion;
}
string fileName = GetFileName(version);
string path = GetPath(version);
string text = "";
if (s_dataFiles.Contains(path))
{
try
{
text = File.ReadAllText(path);
return MapRotation.FromJson(text);
}
catch
{
}
}
Plugin.Log.LogWarning((object)("Cannot get data from " + path + ". 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.selectedBiomes.Count == SingletonAsset<MapBaker>.Instance.ScenePaths.Length && IsIdenticalToSelectedMaps(mapRotation))
{
Plugin.Log.LogWarning((object)"Found data with identical biomes to use as current map rotation data. Biome information details may contain inaccuracies as a result.");
return mapRotation;
}
}
catch
{
}
}
Plugin.Log.LogWarning((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 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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++)
{
string[] array = BiomeInfo.BiomeTextIds[biomeTypes[i]];
for (int j = 0; j < array.Length; j++)
{
list.Add(new LocalizedText
{
index = array[j]
});
}
}
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[] value = BiomesTextIds.Select((LocalizedText ids) => LocalizedText.GetText(ids.index, true)).ToArray();
((TMP_Text)TMPro).text = string.Join(MapOption.Separator, value);
if (string.IsNullOrEmpty(((TMP_Text)TMPro).text))
{
((TMP_Text)TMPro).text = MapOptionPrefab.Instance.BiomesTextPlaceholder;
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)("Issue with trying to update text for biomes.\n" + ex.Message));
}
}
}
[Serializable]
public class MapRotation
{
public string BuildVersion;
public List<BiomeInfo>?[] MapBiomes;
public List<BiomeInfo>? this[int i]
{
get
{
return MapBiomes[i];
}
private set
{
MapBiomes[i] = value;
}
}
public int Length => MapBiomes.Length;
public List<BiomeResult> biomeResults
{
get
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
List<BiomeResult> list = new List<BiomeResult>();
List<BiomeType> list2 = new List<BiomeType>();
List<BiomeInfo>[] mapBiomes = MapBiomes;
foreach (List<BiomeInfo> list3 in mapBiomes)
{
list2.Clear();
foreach (BiomeInfo item in list3)
{
list2.Add(item.biomeType);
}
list.Add(new BiomeResult(list2));
}
return list;
}
}
internal MapRotation()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
BuildVersion val = new BuildVersion(Application.version, "???");
BuildVersion = ((object)(BuildVersion)(ref val)).ToString();
MapBiomes = new List<BiomeInfo>[SingletonAsset<MapBaker>.Instance.ScenePaths.Length];
}
public static MapRotation FromJson(string json)
{
MapRotation mapRotation = JsonUtility.FromJson<MapRotation>(json);
string valueFromJson = JsonExtended.GetValueFromJson(json, "MapBiomes", prettyPrint: true);
string[] array = JsonExtended.SplitSections(valueFromJson, '[', ']');
mapRotation.MapBiomes = new List<BiomeInfo>[array.Length];
for (int i = 0; i < array.Length; i++)
{
if (array[i] == "null")
{
mapRotation.MapBiomes[i] = null;
}
else
{
mapRotation.MapBiomes[i] = JsonExtended.ListFromJson<BiomeInfo>(array[i]);
}
}
return mapRotation;
}
public static string ToJson(MapRotation mapRotation)
{
string text = JsonUtility.ToJson((object)mapRotation, true);
if (text.Contains("\"MapBiomes\""))
{
return text;
}
string text2 = JsonExtended.CreateJsonObject("MapBiomes", MapBiomesToJson(mapRotation.MapBiomes), prettyPrint: true);
return JsonExtended.CombineJson(true, text, text2);
}
private static string MapBiomesToJson(List<BiomeInfo>?[] mapBiomes)
{
string[] array = new string[mapBiomes.Length];
for (int i = 0; i < mapBiomes.Length; i++)
{
List<BiomeInfo> list = mapBiomes[i];
if (list == null)
{
array[i] = "null";
}
else
{
array[i] = JsonExtended.ListToJson(list, prettyPrint: true);
}
}
return JsonExtended.EncaseCombine(array, '[', ']', prettyPrint: true);
}
internal List<BiomeInfo>? FillBiomesInfo(int index, out GameObject? mapObject)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Scene sceneByPath = SceneManager.GetSceneByPath(SingletonAsset<MapBaker>.Instance.ScenePaths[index]);
mapObject = null;
if (!((Scene)(ref sceneByPath)).isLoaded)
{
Plugin.Log.LogWarning((object)"Cannot get biomes info. Scene is not loaded.");
return MapBiomes[index];
}
List<BiomeInfo> list = new List<BiomeInfo>();
GameObject[] rootGameObjects = ((Scene)(ref sceneByPath)).GetRootGameObjects();
Biome biome = default(Biome);
for (int i = 0; i < ((Scene)(ref sceneByPath)).rootCount; i++)
{
if (((Object)rootGameObjects[i]).name != "Map")
{
continue;
}
mapObject = rootGameObjects[i];
for (int j = 0; j < mapObject.transform.childCount; j++)
{
Transform child = mapObject.transform.GetChild(j);
for (int k = 0; k < child.childCount; k++)
{
if (((Component)child.GetChild(k)).gameObject.activeInHierarchy && ((Component)child.GetChild(k)).TryGetComponent<Biome>(ref biome))
{
list.Add(new BiomeInfo(biome, FindVariant(biome), CheckOpenTomb(biome)));
}
}
}
break;
}
MapBiomes[index] = list;
return list;
}
private bool? CheckOpenTomb(Biome biome)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)biome.biomeType != 6)
{
return null;
}
Transform? obj = ((Component)biome).transform.QueryChildren("Desert_Segment/Platteau/Rocks/Timple/Enterences/2");
Transform val = ((obj != null) ? obj.GetChild(0) : null);
return val != null && val.childCount == 2;
}
private Component? FindVariant(Biome biome)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
BiomeType biomeType = biome.biomeType;
if ((int)biomeType > 2)
{
if (biomeType - 6 <= 1)
{
return ((Component)biome).GetComponentInChildren(typeof(VariantObject));
}
return null;
}
return ((Component)biome).GetComponentInChildren(typeof(BiomeVariant));
}
}
public sealed class MapRotationHandler
{
[CompilerGenerated]
private sealed class <EndSaveMapsLoad>d__26 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MapRotationHandler <>4__this;
public string originalLoadingText;
public string returnScene;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <EndSaveMapsLoad>d__26(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected I4, but got Unknown
int num = <>1__state;
MapRotationHandler mapRotationHandler = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
LocalizedText.mainTable[mapRotationHandler._loadingId][(int)LocalizedText.CURRENT_LANGUAGE] = originalLoadingText;
<>2__current = SceneManager.LoadSceneAsync(returnScene, (LoadSceneMode)0);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadSceneIndex>d__25 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MapRotationHandler <>4__this;
public int index;
private Scene <scene>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadSceneIndex>d__25(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
MapRotationHandler mapRotationHandler = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
if (SceneManager.loadedSceneCount < mapRotationHandler._maxLoadedScenes)
{
SceneManager.LoadSceneAsync(SingletonAsset<MapBaker>.Instance.GetLevel(index), (LoadSceneMode)1);
}
else
{
SceneManager.LoadSceneAsync(SingletonAsset<MapBaker>.Instance.GetLevel(index), (LoadSceneMode)0);
}
<scene>5__2 = SceneManager.GetSceneByPath(SingletonAsset<MapBaker>.Instance.ScenePaths[index]);
break;
case 1:
<>1__state = -1;
break;
}
if (!((Scene)(ref <scene>5__2)).isLoaded)
{
<>2__current = null;
<>1__state = 1;
return true;
}
mapRotationHandler.CurrMapRotation.FillBiomesInfo(index, out GameObject mapObject);
Object.Destroy((Object)(object)mapObject);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SaveMapsInfo>d__24 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MapRotationHandler <>4__this;
private string <returnScene>5__2;
private string <originalLoadingText>5__3;
private Button <button>5__4;
private int <i>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SaveMapsInfo>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<returnScene>5__2 = null;
<originalLoadingText>5__3 = null;
<button>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected I4, but got Unknown
int num = <>1__state;
MapRotationHandler mapRotationHandler = <>4__this;
Button obj;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
mapRotationHandler.CurrentlyLoading = true;
Ascents.currentAscent = -1;
Scene activeScene = SceneManager.GetActiveScene();
<returnScene>5__2 = ((Scene)(ref activeScene)).name;
<originalLoadingText>5__3 = LocalizedText.GetText(mapRotationHandler._loadingId, true);
mapRotationHandler.AddLoadingScreenExtraUI(out <button>5__4);
<i>5__5 = 0;
goto IL_0149;
}
case 1:
<>1__state = -1;
DataFilesHandler.WriteMapRotation(mapRotationHandler.CurrMapRotation);
goto IL_0137;
case 2:
{
<>1__state = -1;
mapRotationHandler.CurrentlyLoading = false;
return false;
}
IL_0149:
if (<i>5__5 < mapRotationHandler._sceneNames.Length && !mapRotationHandler._quitIndicator)
{
if (!mapRotationHandler.IsValidMapBiome(<i>5__5))
{
Plugin.Log.LogWarning((object)("Data at " + mapRotationHandler._sceneNames[<i>5__5] + " was not found. Map info will be loaded and saved."));
string text = $"{<i>5__5 + 1}/{mapRotationHandler._sceneNames.Length}";
LocalizedText.mainTable[mapRotationHandler._loadingId][(int)LocalizedText.CURRENT_LANGUAGE] = <originalLoadingText>5__3 + " (" + text + ")";
<>2__current = mapRotationHandler.LoadSceneIndex(<i>5__5);
<>1__state = 1;
return true;
}
goto IL_0137;
}
obj = <button>5__4;
if (obj != null)
{
((UnityEventBase)obj.onClick).RemoveAllListeners();
}
<>2__current = mapRotationHandler.EndSaveMapsLoad(<returnScene>5__2, <originalLoadingText>5__3);
<>1__state = 2;
return true;
IL_0137:
<i>5__5++;
goto IL_0149;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly MapRotationHandler _instance;
internal readonly string[] _sceneNames = new string[SingletonAsset<MapBaker>.Instance.ScenePaths.Length];
private bool _prevFoundAllMapBiomes;
private bool _quitIndicator;
private readonly string _loadingId = "LOADING";
private readonly int _maxLoadedScenes = 15;
public static MapRotationHandler Instance => _instance;
public MapRotation CurrMapRotation { get; private set; }
public bool CurrentlyLoading { get; private set; }
private bool FoundAllMapBiomes
{
get
{
if (_prevFoundAllMapBiomes)
{
return true;
}
for (int i = 0; i < _sceneNames.Length; i++)
{
if (!IsValidMapBiome(i))
{
return false;
}
}
_prevFoundAllMapBiomes = true;
return true;
}
}
public bool NeedToLoad
{
get
{
if (UserConfig.LoadMapsOnStart.Value && !FoundAllMapBiomes)
{
return !_quitIndicator;
}
return false;
}
}
private MapRotationHandler()
{
CurrMapRotation = DataFilesHandler.ParseMapRotation() ?? new MapRotation();
for (int i = 0; i < _sceneNames.Length; i++)
{
_sceneNames[i] = SingletonAsset<MapBaker>.Instance.GetLevel(i);
}
}
static MapRotationHandler()
{
_instance = new MapRotationHandler();
}
private bool IsValidMapBiome(int index)
{
return CurrMapRotation.MapBiomes[index] != null;
}
internal void LoadAllMaps()
{
RetrievableResourceSingleton<LoadingScreenHandler>.Instance.Load((LoadingScreenType)0, (Action)null, new IEnumerator[1] { SaveMapsInfo() });
}
[IteratorStateMachine(typeof(<SaveMapsInfo>d__24))]
private IEnumerator SaveMapsInfo()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SaveMapsInfo>d__24(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<LoadSceneIndex>d__25))]
private IEnumerator LoadSceneIndex(int index)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadSceneIndex>d__25(0)
{
<>4__this = this,
index = index
};
}
[IteratorStateMachine(typeof(<EndSaveMapsLoad>d__26))]
private IEnumerator EndSaveMapsLoad(string returnScene, string originalLoadingText)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EndSaveMapsLoad>d__26(0)
{
<>4__this = this,
returnScene = returnScene,
originalLoadingText = originalLoadingText
};
}
private void AddLoadingScreenExtraUI(out Button? button)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
button = null;
LoadingMapsScreenUI.Instance.Instantiate(null, out GameObject description, out GameObject quitButton);
if ((Object)(object)quitButton == (Object)null)
{
Plugin.Log.LogError((object)"Quit Button object was not found. Will not be able to exit out of loading screen.");
}
else if (!((Object)(object)description == (Object)null))
{
button = quitButton.GetComponent<Button>();
((UnityEvent)button.onClick).AddListener((UnityAction)delegate
{
IndicateQuit(description);
});
CanvasGroup val = default(CanvasGroup);
((Component)quitButton.transform.parent).TryGetComponent<CanvasGroup>(ref val);
val.interactable = true;
}
}
private void IndicateQuit(GameObject description)
{
_quitIndicator = true;
TextMeshProUGUI tMPro = description.GetTMPro();
if (!FoundAllMapBiomes)
{
((TMP_Text)tMPro).text = "DIDN'T FINISHED FINDING EVERY MAPS' INFO.\nSEARCH WILL CONTINUE ON NEXT LAUNCH.\n";
}
((TMP_Text)tMPro).text = ((TMP_Text)tMPro).text + "NOW QUITTING...";
}
}
public class MapsBoardHandler : Singleton<MapsBoardHandler>
{
public TextMeshProUGUI SelectedMapCode { get; set; }
public Transform MapsList { get; private set; }
public Transform Header { get; private set; }
private static Transform s_parent => GUIManager.instance.boardingPass.playerName.transform.parent.parent;
public static void Instantiate()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogInfo((object)"Creating MapsBoard.");
GameObject val = Object.Instantiate<GameObject>(MapsBoard.Instance.gameObject);
val.transform.SetParent(s_parent, false);
val.AddComponent<MapsBoardHandler>();
RectTransform component = val.GetComponent<RectTransform>();
component.anchoredPosition = new Vector2(0f, 0f);
((Transform)component).localScale = new Vector3(1f, 1f, 1f);
}
protected override void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
SelectedMapCode = (TextMeshProUGUI)(((object)((Component)this).transform.QueryChildren("Screen/Header/SelectedMap/SelectedMapCode")?.GetTMPro()) ?? ((object)new TextMeshProUGUI()));
MapsList = ((Component)this).transform.QueryChildren("Screen/ScrollView/MapsList") ?? new GameObject().transform;
Header = ((Component)this).transform.QueryChildren("Screen/Header") ?? new GameObject().transform;
}
private void Start()
{
UpdateSelectedMapCode();
UpdateUIPosition();
AddMapOptionFunctions();
AddDropdownFunctions();
}
private void Update()
{
if (CustomMaps.Instance.loadMode == LoadMode.Daily)
{
UpdateSelectedMapCode();
}
}
public override void OnDestroy()
{
RemoveButtonListeners();
RemoveDropdownListener();
}
private void UpdateUIPosition()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = ((Component)s_parent).GetComponent<RectTransform>();
component.pivot = MapsBoardUI.boardingPassNewPivot;
}
private void AddMapOptionFunctions()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
Button button = default(Button);
for (int i = 0; i < MapsList.childCount; i++)
{
((Component)MapsList.GetChild(i)).TryGetComponent<Button>(ref button);
((UnityEvent)button.onClick).AddListener((UnityAction)delegate
{
SetPlayMap(button);
});
MapBiomes componentInChildren = ((Component)MapsList.GetChild(i)).GetComponentInChildren<MapBiomes>();
componentInChildren.BiomesTextIds = MapBiomes.GetBiomesLocalizedText(MapRotationHandler.Instance.CurrMapRotation[i]);
}
}
private void SetPlayMap(Button button)
{
GameObject? obj = ((Component)button).gameObject.QueryChildren("MapCode");
string s = ((obj != null) ? ((TMP_Text)obj.GetTMPro()).text : null);
int customMapIndex = int.Parse(s);
CustomMaps.Instance.CustomMapIndex = customMapIndex;
UpdateSelectedMapCode();
Plugin.Log.LogInfo((object)("Custom map set to " + customMapIndex));
}
private void RemoveButtonListeners()
{
Button val = default(Button);
for (int i = 0; i < MapsList.childCount; i++)
{
((Component)MapsList.GetChild(i)).TryGetComponent<Button>(ref val);
((UnityEventBase)val.onClick).RemoveAllListeners();
}
}
private void AddDropdownFunctions()
{
TMP_Dropdown dropdown = ((Component)Header).GetComponentInChildren<TMP_Dropdown>();
((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate
{
UpdateDropdown(dropdown);
});
dropdown.value = (int)CustomMaps.Instance.loadMode;
UpdateInteractableButtons(dropdown);
}
private void UpdateDropdown(TMP_Dropdown dropdown)
{
CustomMaps.Instance.loadMode = (LoadMode)dropdown.value;
UpdateInteractableButtons(dropdown);
Plugin.Log.LogInfo((object)("Map mode set to " + ((LoadMode)dropdown.value).GetName()));
}
private void RemoveDropdownListener()
{
TMP_Dropdown componentInChildren = ((Component)Header).GetComponentInChildren<TMP_Dropdown>();
((UnityEventBase)componentInChildren.onValueChanged).RemoveAllListeners();
}
private void UpdateInteractableButtons(TMP_Dropdown dropdown)
{
Transform mapsList = MapsList;
CanvasGroup val = ((mapsList != null) ? ((Component)mapsList).GetComponent<CanvasGroup>() : null);
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogError((object)"Maps List component not found. Cannot update interactability of buttons");
return;
}
val.interactable = dropdown.value == 0;
UpdateSelectedMapCode();
}
private void UpdateSelectedMapCode()
{
if ((Object)(object)SelectedMapCode == (Object)null)
{
Plugin.Log.LogError((object)"SelectedMapCode was not found. Cannot update selected map display.");
}
else
{
((TMP_Text)SelectedMapCode).text = CustomMaps.Instance.SelectedMapIndex.ToString(MapOption.MapCodeFormat);
}
}
}
public class UserConfig
{
public static ConfigEntry<bool> LoadMapsOnStart;
public static ConfigEntry<bool> ShowBiomesInHUD;
public static void Initialize(ConfigFile config)
{
LoadMapsOnStart = config.Bind<bool>("General", "Pre-Load Missing Maps", true, "If enabled, any missing information on map biomes will be\r\nretrieved at the game's start.");
ShowBiomesInHUD = config.Bind<bool>("General", "Show Biomes In HUD", true, "If enabled, all biomes of the map you're playing in will appear \r\non screen during the run.");
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}