Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Map Selector v1.1.0
MapSelector.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Localization; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace MapSelector; internal sealed class GameCursor { private readonly RectTransform root; private readonly Canvas canvas; private RectTransform holder; private bool built; private bool fallback; private int attempts; private float nextAttempt; private bool usingMouse = true; private static Texture2D fallbackTex; private static readonly FieldInfo HudRectField = AccessTools.Field(typeof(HUDCanvas), "rect"); public GameCursor(RectTransform root, Canvas canvas) { this.root = root; this.canvas = canvas; } public void OnOpen() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 try { usingMouse = (int)SemiFunc.InputMode() == 0; } catch (Exception) { usingMouse = true; } } public void Hide() { if ((Object)(object)holder != (Object)null && ((Component)holder).gameObject.activeSelf) { ((Component)holder).gameObject.SetActive(false); } } public void Tick() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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) if (!built && Time.unscaledTime >= nextAttempt) { Build(); } if ((Object)(object)holder == (Object)null) { return; } Mouse current = Mouse.current; TrackDevice(current); bool flag = current != null && usingMouse; if (((Component)holder).gameObject.activeSelf != flag) { ((Component)holder).gameObject.SetActive(flag); } if (flag) { ((Transform)holder).SetAsLastSibling(); Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(root, ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue(), (Camera)null, ref val); ((Transform)holder).localPosition = new Vector3(val.x, val.y, 0f); if (fallback) { ((Transform)holder).localScale = Vector3.one; return; } Vector2 val2 = HudUnitToScreenPixels(); float num = ((canvas.scaleFactor > 0f) ? canvas.scaleFactor : 1f); ((Transform)holder).localScale = new Vector3(val2.x / num, val2.y / num, 1f); } } private void TrackDevice(Mouse mouse) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (mouse != null) { Vector2 val = ((InputControl<Vector2>)(object)((Pointer)mouse).delta).ReadValue(); if (!(((Vector2)(ref val)).sqrMagnitude > 1f) && !mouse.leftButton.wasPressedThisFrame && !mouse.rightButton.wasPressedThisFrame) { Vector2 val2 = ((InputControl<Vector2>)(object)mouse.scroll).ReadValue(); if (!(((Vector2)(ref val2)).sqrMagnitude > 0.01f)) { goto IL_0059; } } usingMouse = true; return; } goto IL_0059; IL_0059: Gamepad current = Gamepad.current; if (current == null) { return; } Vector2 val3 = ((InputControl<Vector2>)(object)current.leftStick).ReadValue(); if (!(((Vector2)(ref val3)).sqrMagnitude > 0.25f)) { Vector2 val4 = ((InputControl<Vector2>)(object)current.dpad).ReadValue(); if (!(((Vector2)(ref val4)).sqrMagnitude > 0.25f) && !current.buttonSouth.wasPressedThisFrame && !current.buttonEast.wasPressedThisFrame && !current.startButton.wasPressedThisFrame) { return; } } usingMouse = false; } private void Build() { MenuCursor instance = MenuCursor.instance; ResetHolder(); int num = 0; if ((Object)(object)instance != (Object)null) { try { num = CopyVisuals(((Component)instance).transform); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not copy REPO's menu cursor: " + ex.Message)); num = 0; ResetHolder(); } } if (num > 0) { fallback = false; built = true; Plugin.Log.LogInfo((object)("Using REPO's menu cursor (" + num + " part(s)).")); return; } MakeFallbackArrow(); fallback = true; attempts++; nextAttempt = Time.unscaledTime + 1f; if ((Object)(object)instance != (Object)null || attempts >= 5) { built = true; Plugin.Log.LogWarning((object)"REPO's menu cursor could not be copied; using a simple arrow instead."); } } private void ResetHolder() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)holder != (Object)null) { Object.Destroy((Object)(object)((Component)holder).gameObject); } GameObject val = new GameObject("GameCursor", new Type[1] { typeof(RectTransform) }); val.layer = ((Component)root).gameObject.layer; holder = (RectTransform)val.transform; ((Transform)holder).SetParent((Transform)(object)root, false); RectTransform obj = holder; Vector2 anchorMin = (holder.anchorMax = new Vector2(0.5f, 0.5f)); obj.anchorMin = anchorMin; holder.pivot = new Vector2(0.5f, 0.5f); holder.sizeDelta = Vector2.zero; CanvasGroup val3 = val.AddComponent<CanvasGroup>(); val3.blocksRaycasts = false; val3.interactable = false; val.SetActive(false); } private int CopyVisuals(Transform src) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) int num = 0; Transform meshChild = ((src.childCount > 0) ? src.GetChild(0) : null); List<string> list = new List<string>(); Matrix4x4 val = Matrix4x4.TRS(Vector3.zero, src.localRotation, Vector3.one); Transform[] componentsInChildren = ((Component)src).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (!ActiveUpTo(val2, src, meshChild)) { continue; } Matrix4x4 m = val * ChainToRoot(val2, src); Graphic component = ((Component)val2).GetComponent<Graphic>(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { if (CopyGraphic(component, m)) { num++; list.Add(((Object)val2).name + ":" + ((object)component).GetType().Name); } continue; } SpriteRenderer component2 = ((Component)val2).GetComponent<SpriteRenderer>(); if ((Object)(object)component2 != (Object)null && ((Renderer)component2).enabled && (Object)(object)component2.sprite != (Object)null) { CopySprite(component2, m); num++; list.Add(((Object)val2).name + ":Sprite"); continue; } MeshFilter component3 = ((Component)val2).GetComponent<MeshFilter>(); MeshRenderer component4 = ((Component)val2).GetComponent<MeshRenderer>(); if ((Object)(object)component3 != (Object)null && (Object)(object)component4 != (Object)null && ((Renderer)component4).enabled && (Object)(object)component3.sharedMesh != (Object)null && CopyMesh(component3.sharedMesh, component4, m)) { num++; list.Add(((Object)val2).name + ":Mesh"); } } Plugin.Log.LogInfo((object)("Menu cursor parts: " + ((list.Count > 0) ? string.Join(", ", list.ToArray()) : "(none)"))); return num; } private static bool ActiveUpTo(Transform t, Transform src, Transform meshChild) { Transform val = t; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)src) { if (!((Component)val).gameObject.activeSelf && (Object)(object)val != (Object)(object)meshChild) { return false; } val = val.parent; } return true; } private static Matrix4x4 ChainToRoot(Transform t, Transform src) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 val = Matrix4x4.identity; Transform val2 = t; while ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)src) { val = Matrix4x4.TRS(val2.localPosition, val2.localRotation, val2.localScale) * val; val2 = val2.parent; } return val; } private RectTransform NewPart(string name, Matrix4x4 m) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.layer = ((Component)holder).gameObject.layer; RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)holder, false); Vector2 anchorMin = (val2.anchorMax = new Vector2(0.5f, 0.5f)); val2.anchorMin = anchorMin; Vector3 val4 = Vector4.op_Implicit(((Matrix4x4)(ref m)).GetColumn(0)); Vector3 val5 = Vector4.op_Implicit(((Matrix4x4)(ref m)).GetColumn(1)); Vector3 val6 = Vector4.op_Implicit(((Matrix4x4)(ref m)).GetColumn(2)); ((Transform)val2).localPosition = Vector4.op_Implicit(((Matrix4x4)(ref m)).GetColumn(3)); ((Transform)val2).localRotation = ((((Vector3)(ref val6)).sqrMagnitude > 1E-10f && ((Vector3)(ref val5)).sqrMagnitude > 1E-10f) ? Quaternion.LookRotation(val6, val5) : Quaternion.identity); float magnitude = ((Vector3)(ref val6)).magnitude; ((Transform)val2).localScale = new Vector3(((Vector3)(ref val4)).magnitude, ((Vector3)(ref val5)).magnitude, (magnitude > 0f) ? magnitude : 1f); return val2; } private bool CopyGraphic(Graphic g, Matrix4x4 m) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Image val = (Image)(object)((g is Image) ? g : null); RawImage val2 = (RawImage)(object)((g is RawImage) ? g : null); if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return false; } if ((Object)(object)val != (Object)null && (Object)(object)val.sprite == (Object)null) { return false; } if ((Object)(object)val2 != (Object)null && (Object)(object)val2.texture == (Object)null) { return false; } RectTransform rectTransform = g.rectTransform; RectTransform val3 = NewPart(((Object)g).name, m); val3.pivot = rectTransform.pivot; Rect rect = rectTransform.rect; val3.sizeDelta = ((Rect)(ref rect)).size; if ((Object)(object)val != (Object)null) { Image val4 = ((Component)val3).gameObject.AddComponent<Image>(); val4.sprite = val.sprite; val4.type = val.type; val4.preserveAspect = val.preserveAspect; val4.fillCenter = val.fillCenter; val4.fillMethod = val.fillMethod; val4.fillAmount = val.fillAmount; val4.fillOrigin = val.fillOrigin; val4.fillClockwise = val.fillClockwise; ((Graphic)val4).color = ((Graphic)val).color; ((Graphic)val4).raycastTarget = false; } else { RawImage val5 = ((Component)val3).gameObject.AddComponent<RawImage>(); val5.texture = val2.texture; val5.uvRect = val2.uvRect; ((Graphic)val5).color = ((Graphic)val2).color; ((Graphic)val5).raycastTarget = false; } return true; } private void CopySprite(SpriteRenderer sr, Matrix4x4 m) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) Sprite sprite = sr.sprite; RectTransform val = NewPart(((Object)sr).name, m); Rect rect = sprite.rect; Vector2 size = ((Rect)(ref rect)).size; val.pivot = new Vector2(sprite.pivot.x / Mathf.Max(1f, size.x), sprite.pivot.y / Mathf.Max(1f, size.y)); val.sizeDelta = size / Mathf.Max(0.0001f, sprite.pixelsPerUnit); Vector3 localScale = ((Transform)val).localScale; if (sr.flipX) { localScale.x = 0f - localScale.x; } if (sr.flipY) { localScale.y = 0f - localScale.y; } ((Transform)val).localScale = localScale; Image val2 = ((Component)val).gameObject.AddComponent<Image>(); val2.sprite = sprite; ((Graphic)val2).color = sr.color; ((Graphic)val2).raycastTarget = false; } private bool CopyMesh(Mesh mesh, MeshRenderer mr, Matrix4x4 m) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Material sharedMaterial = ((Renderer)mr).sharedMaterial; Color color = Color.white; Texture val = null; if ((Object)(object)sharedMaterial != (Object)null) { if (sharedMaterial.HasProperty("_Color")) { color = sharedMaterial.color; } else if (sharedMaterial.HasProperty("_BaseColor")) { color = sharedMaterial.GetColor("_BaseColor"); } if (sharedMaterial.HasProperty("_MainTex")) { val = sharedMaterial.mainTexture; } } if (mesh.isReadable) { RectTransform val2 = NewPart(((Object)mr).name, m); val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = Vector2.zero; MeshGraphic meshGraphic = ((Component)val2).gameObject.AddComponent<MeshGraphic>(); ((Graphic)meshGraphic).raycastTarget = false; meshGraphic.Setup(mesh, val, color); return true; } if ((Object)(object)val != (Object)null) { Bounds bounds = mesh.bounds; RectTransform val3 = NewPart(((Object)mr).name, m * Matrix4x4.Translate(((Bounds)(ref bounds)).center)); val3.pivot = new Vector2(0.5f, 0.5f); val3.sizeDelta = new Vector2(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.y); RawImage val4 = ((Component)val3).gameObject.AddComponent<RawImage>(); val4.texture = val; ((Graphic)val4).color = color; ((Graphic)val4).raycastTarget = false; return true; } return false; } private static Vector2 HudUnitToScreenPixels() { //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) try { RectTransform val = null; HUDCanvas instance = HUDCanvas.instance; if ((Object)(object)instance != (Object)null) { if (HudRectField != null) { object? value = HudRectField.GetValue(instance); val = (RectTransform)((value is RectTransform) ? value : null); } if ((Object)(object)val == (Object)null) { val = ((Component)instance).GetComponent<RectTransform>(); } } RenderTextureMain instance2 = RenderTextureMain.instance; RawImage val2 = (((Object)(object)instance2 != (Object)null) ? instance2.overlayRawImage : null); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { Rect rect = val.rect; if (((Rect)(ref rect)).width > 0f) { Rect rect2 = val.rect; if (((Rect)(ref rect2)).height > 0f) { Vector3[] array = (Vector3[])(object)new Vector3[4]; ((Graphic)val2).rectTransform.GetWorldCorners(array); Canvas val3 = ((Graphic)val2).canvas; Camera val4 = (((Object)(object)val3 == (Object)null || (int)val3.renderMode == 0) ? null : val3.worldCamera); Vector2 val5 = RectTransformUtility.WorldToScreenPoint(val4, array[0]); Vector2 val6 = RectTransformUtility.WorldToScreenPoint(val4, array[2]); float num = Mathf.Abs(val6.x - val5.x); float num2 = Mathf.Abs(val6.y - val5.y); if (num > 1f && num2 > 1f) { Rect rect3 = val.rect; float num3 = num / ((Rect)(ref rect3)).width; Rect rect4 = val.rect; return new Vector2(num3, num2 / ((Rect)(ref rect4)).height); } } } } if ((Object)(object)val != (Object)null) { Rect rect5 = val.rect; if (((Rect)(ref rect5)).height > 0f) { float num4 = Screen.height; Rect rect6 = val.rect; float num5 = num4 / ((Rect)(ref rect6)).height; return new Vector2(num5, num5); } } } catch (Exception) { } return Vector2.one; } private void MakeFallbackArrow() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fallbackTex == (Object)null) { fallbackTex = DrawArrow(32, 48); } GameObject val = new GameObject("Arrow", new Type[1] { typeof(RectTransform) }); val.layer = ((Component)holder).gameObject.layer; RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)holder, false); Vector2 anchorMin = (val2.anchorMax = new Vector2(0.5f, 0.5f)); val2.anchorMin = anchorMin; val2.pivot = new Vector2(0f, 1f); val2.sizeDelta = new Vector2(30f, 45f); ((Transform)val2).localPosition = Vector3.zero; RawImage val4 = val.AddComponent<RawImage>(); val4.texture = (Texture)(object)fallbackTex; ((Graphic)val4).raycastTarget = false; } private static Texture2D DrawArrow(int w, int h) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008b: 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_00a7: 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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_01e7: 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) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)0; ((Texture)val).wrapMode = (TextureWrapMode)1; Vector2[] poly = (Vector2[])(object)new Vector2[7] { new Vector2(1f, 1f), new Vector2(1f, 40f), new Vector2(11f, 31f), new Vector2(18f, 46f), new Vector2(24f, 43f), new Vector2(17f, 29f), new Vector2(29f, 29f) }; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 1f, 1f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.05f, 0.05f, 0.06f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(0f, 0f, 0f, 0f); Vector2 val5 = default(Vector2); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { ((Vector2)(ref val5))..ctor((float)j + 0.5f, (float)i + 0.5f); Color val6 = val4; if (Inside(poly, val5)) { val6 = ((Inside(poly, val5 + new Vector2(2f, 0f)) && Inside(poly, val5 - new Vector2(2f, 0f)) && Inside(poly, val5 + new Vector2(0f, 2f)) && Inside(poly, val5 - new Vector2(0f, 2f))) ? val2 : val3); } val.SetPixel(j, h - 1 - i, val6); } } val.Apply(); return val; } private static bool Inside(Vector2[] poly, Vector2 p) { bool flag = false; int num = 0; int num2 = poly.Length - 1; while (num < poly.Length) { if (poly[num].y > p.y != poly[num2].y > p.y && p.x < (poly[num2].x - poly[num].x) * (p.y - poly[num].y) / (poly[num2].y - poly[num].y) + poly[num].x) { flag = !flag; } num2 = num++; } return flag; } } internal sealed class MeshGraphic : MaskableGraphic { private Mesh src; private Texture tex; private Color tint = Color.white; public override Texture mainTexture { get { if (!((Object)(object)tex != (Object)null)) { return (Texture)(object)Graphic.s_WhiteTexture; } return tex; } } public void Setup(Mesh mesh, Texture texture, Color color) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) src = mesh; tex = texture; tint = color; ((Graphic)this).SetAllDirty(); } protected override void OnPopulateMesh(VertexHelper vh) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00cf: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00f9: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) vh.Clear(); if ((Object)(object)src == (Object)null) { return; } Vector3[] vertices = src.vertices; Color[] colors = src.colors; Vector2[] uv = src.uv; int[] triangles = src.triangles; int num = vertices.Length; if (num != 0 && num <= 65000) { bool flag = colors != null && colors.Length == num; bool flag2 = uv != null && uv.Length == num; for (int i = 0; i < num; i++) { UIVertex simpleVert = UIVertex.simpleVert; simpleVert.position = new Vector3(vertices[i].x, vertices[i].y, 0f); Color val = (flag ? (colors[i] * tint) : tint); simpleVert.color = Color32.op_Implicit(val); simpleVert.uv0 = Vector4.op_Implicit(flag2 ? uv[i] : Vector2.zero); vh.AddVert(simpleVert); } for (int j = 0; j + 2 < triangles.Length; j += 3) { vh.AddTriangle(triangles[j], triangles[j + 1], triangles[j + 2]); } } } } public static class InputBlocker { public static bool Active; public static void Apply(Harmony h) { Block(h, typeof(InputManager), "KeyDown", "FalseBool"); Block(h, typeof(InputManager), "KeyUp", "FalseBool"); Block(h, typeof(InputManager), "KeyHold", "FalseBool"); Block(h, typeof(InputManager), "GetMovement", "ZeroVector2"); Block(h, typeof(InputManager), "GetUINavigate", "ZeroVector2"); Block(h, typeof(InputManager), "GetMenuMouseDelta", "ZeroVector2"); Block(h, typeof(InputManager), "GetRawMouseDelta", "ZeroVector2"); Block(h, typeof(InputManager), "GetMovementX", "ZeroFloat"); Block(h, typeof(InputManager), "GetMovementY", "ZeroFloat"); Block(h, typeof(InputManager), "GetMouseX", "ZeroFloat"); Block(h, typeof(InputManager), "GetMouseY", "ZeroFloat"); Block(h, typeof(InputManager), "GetScrollY", "ZeroFloat"); Block(h, typeof(SemiFunc), "UIMouseHover", "FalseBool"); } private static void Block(Harmony h, Type type, string method, string prefix) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null); if (methodInfo == null) { throw new MissingMethodException(type.Name, method); } h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(InputBlocker), prefix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Input block for " + type.Name + "." + method + " unavailable: " + ex.Message)); } } private static bool FalseBool(ref bool __result) { if (!Active) { return true; } __result = false; return false; } private static bool ZeroFloat(ref float __result) { if (!Active) { return true; } __result = 0f; return false; } private static bool ZeroVector2(ref Vector2 __result) { //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) if (!Active) { return true; } __result = Vector2.zero; return false; } } public class MapEntry { public string Id; public string DisplayName; public Level Level; public List<Sprite> Layers = new List<Sprite>(); public bool IsRandom => (Object)(object)Level == (Object)null; } public static class MapCatalog { public const string RandomId = ""; private static int[] cachedOrder; public static List<MapEntry> Build() { List<MapEntry> list = new List<MapEntry>(); MapEntry mapEntry = new MapEntry(); mapEntry.Id = ""; mapEntry.DisplayName = "Random"; list.Add(mapEntry); RunManager instance = RunManager.instance; if ((Object)(object)instance == (Object)null || instance.levels == null) { return list; } HashSet<string> hashSet = new HashSet<string>(); foreach (Level level in instance.levels) { if (!((Object)(object)level == (Object)null)) { string name = ((Object)level).name; if (!string.IsNullOrEmpty(name) && hashSet.Add(name)) { MapEntry mapEntry2 = new MapEntry(); mapEntry2.Id = name; mapEntry2.Level = level; mapEntry2.DisplayName = GetDisplayName(level); mapEntry2.Layers = LoadLayers(level); list.Add(mapEntry2); } } } return list; } public static Level FindLevel(string id) { if (string.IsNullOrEmpty(id)) { return null; } RunManager instance = RunManager.instance; if ((Object)(object)instance == (Object)null || instance.levels == null) { return null; } foreach (Level level in instance.levels) { if ((Object)(object)level != (Object)null && ((Object)level).name == id) { return level; } } return null; } public static string GetDisplayName(Level level) { if ((Object)(object)level == (Object)null) { return "Random"; } string text = null; try { if ((Object)(object)level.NarrativeNameLocalized != (Object)null) { text = level.NarrativeNameLocalized.GetLocalizedString((Locale)null); } } catch (Exception) { text = null; } if (string.IsNullOrEmpty(text)) { text = level.NarrativeName; } if (string.IsNullOrEmpty(text)) { text = ((Object)level).name ?? "Unknown"; if (text.StartsWith("Level - ")) { text = text.Substring("Level - ".Length); } } return text.Trim(); } public static string GetDisplayName(string id) { if (string.IsNullOrEmpty(id)) { return "Random"; } Level val = FindLevel(id); if ((Object)(object)val != (Object)null) { return GetDisplayName(val); } if (!id.StartsWith("Level - ")) { return id; } return id.Substring("Level - ".Length); } private static List<Sprite> LoadLayers(Level level) { List<KeyValuePair<int, Sprite>> list = new List<KeyValuePair<int, Sprite>>(); TryAdd(list, 0, level.LoadingGraphic01, ((Object)level).name); TryAdd(list, 1, level.LoadingGraphic02, ((Object)level).name); TryAdd(list, 2, level.LoadingGraphic03, ((Object)level).name); int[] order = LayerDrawOrder(); list.Sort((KeyValuePair<int, Sprite> a, KeyValuePair<int, Sprite> b) => order[a.Key].CompareTo(order[b.Key])); List<Sprite> list2 = new List<Sprite>(); foreach (KeyValuePair<int, Sprite> item in list) { list2.Add(item.Value); } return list2; } private static void TryAdd(List<KeyValuePair<int, Sprite>> layers, int slot, PrefabRef<Sprite> r, string levelName) { if (r == null) { return; } try { if (r.IsValid()) { Sprite prefab = r.Prefab; if ((Object)(object)prefab != (Object)null) { layers.Add(new KeyValuePair<int, Sprite>(slot, prefab)); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not load loading graphic " + (slot + 1) + " for " + levelName + ": " + ex.Message)); } } private static int[] LayerDrawOrder() { if (cachedOrder != null) { return cachedOrder; } int[] result = new int[3] { 0, 1, 2 }; try { LoadingUI instance = LoadingUI.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.loadingGraphic01 == (Object)null || (Object)(object)instance.loadingGraphic02 == (Object)null || (Object)(object)instance.loadingGraphic03 == (Object)null) { return result; } Image[] array = (Image[])(object)new Image[3] { instance.loadingGraphic01, instance.loadingGraphic02, instance.loadingGraphic03 }; List<int>[] paths = new List<int>[3]; for (int i = 0; i < 3; i++) { paths[i] = HierarchyPath(((Component)array[i]).transform); } int[] array2 = new int[3] { 0, 1, 2 }; Array.Sort(array2, (int a, int b) => ComparePaths(paths[a], paths[b])); int[] array3 = new int[3]; for (int num = 0; num < 3; num++) { array3[array2[num]] = num; } cachedOrder = array3; return array3; } catch (Exception) { return result; } } private static List<int> HierarchyPath(Transform t) { List<int> list = new List<int>(); while ((Object)(object)t != (Object)null) { list.Insert(0, t.GetSiblingIndex()); t = t.parent; } return list; } private static int ComparePaths(List<int> a, List<int> b) { int num = Math.Min(a.Count, b.Count); for (int i = 0; i < num; i++) { if (a[i] != b[i]) { return a[i].CompareTo(b[i]); } } return a.Count.CompareTo(b.Count); } } public static class MapSelection { public static string SelectedId { get { return Plugin.SelectedMap.Value ?? ""; } set { string text = value ?? ""; if (!(Plugin.SelectedMap.Value == text)) { Plugin.SelectedMap.Value = text; ((BaseUnityPlugin)Plugin.Instance).Config.Save(); Plugin.Log.LogInfo((object)("Selected map: " + ((text.Length == 0) ? "Random" : text))); } } } public static bool IsRandom => string.IsNullOrEmpty(SelectedId); public static Level ResolveForRunLevel(RunManager rm) { string selectedId = SelectedId; if (string.IsNullOrEmpty(selectedId)) { return null; } if (Plugin.Mode.Value == ApplyMode.FirstLevelOnly && rm.levelsCompleted > 0) { return null; } Level val = MapCatalog.FindLevel(selectedId); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)("Selected map '" + selectedId + "' is not in RunManager.levels; using a random map instead.")); MapSelectorUI.Toast("Map \"" + MapCatalog.GetDisplayName(selectedId) + "\" is unavailable - using a random map."); return null; } return val; } } public class MapSync : MonoBehaviour { public const string RoomKey = "MapSelector.Map"; private float timer; private void Update() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown timer -= Time.unscaledDeltaTime; if (timer > 0f) { return; } timer = 1f; try { if (!PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode) { return; } Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom != null) { string selectedId = MapSelection.SelectedId; if (((RoomInfo)currentRoom).CustomProperties == null || !((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"MapSelector.Map", out object value) || !(value as string == selectedId)) { Hashtable val = new Hashtable(); val[(object)"MapSelector.Map"] = selectedId; currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } } catch (Exception ex) { Plugin.Log.LogDebug((object)("Room property publish failed: " + ex.Message)); } } public static bool TryGetHostChoice(out string id) { id = null; try { if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null || ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties == null) { return false; } if (!((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"MapSelector.Map", out object value)) { return false; } id = (value as string) ?? ""; return true; } catch (Exception) { return false; } } } public class MapSelectorUI : MonoBehaviour { private enum OpenMode { Start, Browse } private class Card { public MapEntry Entry; public RectTransform Rect; public RectTransform ImageArea; public Image Frame; public RectTransform Viewport; public List<Image> Layers = new List<Image>(); public Image Shade; public TextMeshProUGUI Label; public GameObject ActiveTag; public float Scale = 1f; } private class UiButton { public RectTransform Rect; public Image Bg; public TextMeshProUGUI Label; public bool Primary; } private const float Border = 5f; private const float LabelH = 60f; private const float GapX = 36f; private const float GapY = 26f; private const float HeaderH = 200f; private const float FooterH = 190f; private const float SidePad = 90f; private const float MaxCardW = 540f; private const float MinCardW = 280f; public static MapSelectorUI Instance; private static readonly Color BgColor = new Color(0.025f, 0.025f, 0.03f, 0.95f); private static readonly Color Accent = new Color(1f, 0.6f, 0.08f, 1f); private static readonly Color TextMain = new Color(0.96f, 0.96f, 0.96f, 1f); private static readonly Color TextDim = new Color(0.62f, 0.62f, 0.66f, 1f); private static readonly Color FrameIdle = new Color(0.2f, 0.2f, 0.22f, 1f); private static readonly Color FrameHover = new Color(0.72f, 0.72f, 0.75f, 1f); private static readonly Color CardBg = new Color(0.08f, 0.08f, 0.09f, 1f); private static readonly Color ButtonIdle = new Color(0.14f, 0.14f, 0.16f, 1f); private static readonly Color ButtonHover = new Color(0.24f, 0.24f, 0.27f, 1f); private Canvas canvas; private CanvasScaler scaler; private RectTransform rootRect; private GameObject overlay; private RectTransform gridArea; private RectTransform gridContent; private TextMeshProUGUI titleText; private TextMeshProUGUI subtitleText; private TextMeshProUGUI noteText; private TextMeshProUGUI footerCaption; private TextMeshProUGUI footerName; private TextMeshProUGUI hintText; private UiButton confirmButton; private UiButton backButton; private GameCursor gameCursor; private GameObject toastObj; private TextMeshProUGUI toastText; private CanvasGroup toastGroup; private TMP_FontAsset font; private readonly List<Card> cards = new List<Card>(); private bool isOpen; private OpenMode mode; private Action pendingStart; private bool canEdit; private string roleLabel = ""; private int selected; private int hover = -1; private int cols = 1; private float scroll; private float scrollMax; private Vector2 lastLayoutSize; private float lastClickTime; private int lastClickIndex = -1; private Level lastLevel; private float navRepeat; private Vector2 lastStick; private int openedFrame = -1; private float releaseAt = -1f; private Action afterRelease; private static string queuedToast; private float toastUntil; private void Awake() { Instance = this; } private void Start() { BuildCanvas(); if (queuedToast != null) { ShowToast(queuedToast); queuedToast = null; } } private void Update() { try { TickRelease(); TickLevelChange(); TickHotkey(); if (isOpen) { TickOpen(); } TickToast(); } catch (Exception ex) { Plugin.Log.LogError((object)("Map Selector UI error: " + ex)); if (isOpen) { Close(confirmed: false); } } } public static void Toast(string msg) { Plugin.Log.LogInfo((object)("[toast] " + msg)); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance.toastObj != (Object)null) { Instance.ShowToast(msg); } else { queuedToast = msg; } } public void OpenForStart(string role, Action onStart) { Open(OpenMode.Start, role, onStart); } private void Open(OpenMode m, string role, Action onStart) { //IL_0086: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)canvas == (Object)null) { BuildCanvas(); } if (isOpen) { Close(confirmed: false); } mode = m; pendingStart = onStart; ComputeRole(role); ApplyFont(); RebuildCards(); string text = CurrentChoiceId(); selected = 0; bool flag = false; if (!string.IsNullOrEmpty(text)) { int num = IndexOf(text); if (num >= 0) { selected = num; } else { flag = true; } } hover = -1; scroll = 0f; lastLayoutSize = Vector2.zero; RefreshTexts(flag ? text : null); overlay.SetActive(true); isOpen = true; openedFrame = Time.frameCount; Canvas.ForceUpdateCanvases(); Layout(); Rect rect = rootRect.rect; lastLayoutSize = ((Rect)(ref rect)).size; AnimateCards(); RefreshFooter(); PositionContent(); InputBlocker.Active = true; releaseAt = -1f; afterRelease = null; Cursor.visible = false; if (gameCursor != null) { gameCursor.OnOpen(); gameCursor.Tick(); } ClearEventSystemSelection(); Sound(0); Plugin.Log.LogInfo((object)string.Concat("Map Selector opened (", m, ", ", roleLabel, ", ", cards.Count - 1, " maps).")); } private void Close(bool confirmed) { if (!isOpen) { return; } isOpen = false; overlay.SetActive(false); if (gameCursor != null) { gameCursor.Hide(); } Action action = null; if (confirmed) { if (canEdit && selected >= 0 && selected < cards.Count) { MapSelection.SelectedId = cards[selected].Entry.Id; } if (mode == OpenMode.Start) { action = pendingStart; } else if (canEdit) { Toast("Map set to: " + cards[selected].Entry.DisplayName); } } pendingStart = null; releaseAt = Time.unscaledTime + 0.15f; afterRelease = action; } private void TickRelease() { if (!(releaseAt < 0f) && !(Time.unscaledTime < releaseAt)) { releaseAt = -1f; if (!isOpen) { InputBlocker.Active = false; } Action action = afterRelease; afterRelease = null; action?.Invoke(); } } private void TickLevelChange() { RunManager instance = RunManager.instance; Level val = (((Object)(object)instance != (Object)null) ? instance.levelCurrent : null); if ((Object)(object)val != (Object)(object)lastLevel) { lastLevel = val; if (isOpen) { Close(confirmed: false); } } } private void TickHotkey() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null) { return; } Key value = Plugin.KeyOpenSelector.Value; if ((int)value == 0) { return; } KeyControl val; try { val = current[value]; } catch (Exception) { return; } if (val == null || !((ButtonControl)val).wasPressedThisFrame) { return; } if (isOpen) { if (mode == OpenMode.Browse) { Sound(2); Close(confirmed: false); } } else if (!(releaseAt >= 0f) && InSelectableContext()) { Open(OpenMode.Browse, null, null); } } private void TickOpen() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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) try { SemiFunc.CursorUnlock(0.25f); } catch (Exception) { } Cursor.lockState = (CursorLockMode)0; Cursor.visible = false; if (gameCursor != null) { gameCursor.Tick(); } ClearEventSystemSelection(); if (mode == OpenMode.Browse) { bool flag = canEdit; ComputeRole(null); if (flag != canEdit) { RefreshTexts(null); } } if (!canEdit) { string id; int num = (MapSync.TryGetHostChoice(out id) ? IndexOf(id) : 0); if (num < 0) { num = 0; } if (num != selected) { selected = num; } } Rect rect = rootRect.rect; Vector2 size = ((Rect)(ref rect)).size; if (size != lastLayoutSize) { Layout(); lastLayoutSize = size; } if (Time.frameCount != openedFrame) { HandleKeyboardAndGamepad(); if (!isOpen) { return; } HandleMouse(); if (!isOpen) { return; } } AnimateCards(); RefreshFooter(); PositionContent(); } private void HandleKeyboardAndGamepad() { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; Gamepad current2 = Gamepad.current; int num = 0; int num2 = 0; bool flag = false; bool flag2 = false; if (current != null) { if (((ButtonControl)current.leftArrowKey).wasPressedThisFrame || ((ButtonControl)current.aKey).wasPressedThisFrame) { num = -1; } if (((ButtonControl)current.rightArrowKey).wasPressedThisFrame || ((ButtonControl)current.dKey).wasPressedThisFrame) { num = 1; } if (((ButtonControl)current.upArrowKey).wasPressedThisFrame || ((ButtonControl)current.wKey).wasPressedThisFrame) { num2 = -1; } if (((ButtonControl)current.downArrowKey).wasPressedThisFrame || ((ButtonControl)current.sKey).wasPressedThisFrame) { num2 = 1; } if (((ButtonControl)current.enterKey).wasPressedThisFrame || ((ButtonControl)current.numpadEnterKey).wasPressedThisFrame || ((ButtonControl)current.spaceKey).wasPressedThisFrame) { flag = true; } if (((ButtonControl)current.escapeKey).wasPressedThisFrame || ((ButtonControl)current.backspaceKey).wasPressedThisFrame) { flag2 = true; } } if (current2 != null) { if (current2.dpad.left.wasPressedThisFrame) { num = -1; } if (current2.dpad.right.wasPressedThisFrame) { num = 1; } if (current2.dpad.up.wasPressedThisFrame) { num2 = -1; } if (current2.dpad.down.wasPressedThisFrame) { num2 = 1; } Vector2 val = ((InputControl<Vector2>)(object)current2.leftStick).ReadValue(); Vector2 zero = Vector2.zero; if (Mathf.Abs(val.x) > 0.6f) { zero.x = Mathf.Sign(val.x); } else if (Mathf.Abs(val.y) > 0.6f) { zero.y = 0f - Mathf.Sign(val.y); } if (zero != Vector2.zero) { navRepeat -= Time.unscaledDeltaTime; if (zero != lastStick || navRepeat <= 0f) { num = (int)zero.x; num2 = (int)zero.y; navRepeat = ((zero != lastStick) ? 0.4f : 0.15f); } } lastStick = zero; if (current2.buttonSouth.wasPressedThisFrame || current2.startButton.wasPressedThisFrame) { flag = true; } if (current2.buttonEast.wasPressedThisFrame) { flag2 = true; } } if (flag2) { Sound(2); Close(confirmed: false); } else if (flag) { Confirm(); } else if ((num != 0 || num2 != 0) && canEdit) { MoveSelection(num, num2); } } private void MoveSelection(int dx, int dy) { int count = cards.Count; if (count == 0) { return; } int num = selected; if (dx != 0) { num = Mathf.Clamp(num + dx, 0, count - 1); } if (dy != 0) { int num2 = num + dy * cols; if (num2 >= count && dy > 0) { int num3 = (count - 1) / cols * cols; num2 = ((num >= num3) ? num : (count - 1)); } if (num2 >= 0 && num2 < count) { num = num2; } } if (num != selected) { selected = num; Sound(1); EnsureVisible(selected); } } private void HandleMouse() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) Mouse current = Mouse.current; if (current == null) { return; } Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue(); float y = ((InputControl<Vector2>)(object)current.scroll).ReadValue().y; if (Mathf.Abs(y) > 0.01f && scrollMax > 0f) { scroll = Mathf.Clamp(scroll - Mathf.Sign(y) * 90f, 0f, scrollMax); } int num = -1; if (RectTransformUtility.RectangleContainsScreenPoint(gridArea, val, (Camera)null)) { for (int i = 0; i < cards.Count; i++) { if (RectTransformUtility.RectangleContainsScreenPoint(cards[i].Rect, val, (Camera)null)) { num = i; break; } } } if (num != hover) { hover = num; if (hover >= 0 && canEdit) { Sound(1); } } bool flag = ((Component)confirmButton.Rect).gameObject.activeSelf && RectTransformUtility.RectangleContainsScreenPoint(confirmButton.Rect, val, (Camera)null); bool flag2 = RectTransformUtility.RectangleContainsScreenPoint(backButton.Rect, val, (Camera)null); ((Graphic)confirmButton.Bg).color = ((!confirmButton.Primary) ? (flag ? ButtonHover : ButtonIdle) : (flag ? Color.Lerp(Accent, Color.white, 0.25f) : Accent)); ((Graphic)backButton.Bg).color = (flag2 ? ButtonHover : ButtonIdle); if (!current.leftButton.wasPressedThisFrame) { return; } if (flag) { Confirm(); } else if (flag2) { Sound(2); Close(confirmed: false); } else if (hover >= 0 && canEdit) { bool flag3 = hover == lastClickIndex && Time.unscaledTime - lastClickTime < 0.35f; lastClickIndex = hover; lastClickTime = Time.unscaledTime; if (hover != selected) { selected = hover; Sound(1); } if (flag3) { Confirm(); } } } private void Confirm() { if (!canEdit && mode == OpenMode.Start) { Sound(3); return; } Sound(0); Close(confirmed: true); } private void ComputeRole(string forcedRole) { bool flag = false; bool flag2 = true; try { flag = SemiFunc.IsMultiplayer(); flag2 = !flag || SemiFunc.IsMasterClient(); } catch (Exception) { } canEdit = flag2; if (forcedRole != null) { roleLabel = forcedRole; } else { roleLabel = ((!flag) ? "Single Player" : (flag2 ? "Multiplayer - Host" : "Multiplayer - Client")); } } private string CurrentChoiceId() { if (canEdit) { return MapSelection.SelectedId; } if (!MapSync.TryGetHostChoice(out var id)) { return ""; } return id; } private void RefreshTexts(string missingId) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)titleText).text = "SELECT MAP"; string text = ((!canEdit) ? (roleLabel + " | Only the host can choose the map") : ((!roleLabel.StartsWith("Multiplayer")) ? (roleLabel + " | Choose the map for this run") : (roleLabel + " | Every player will be sent to this map"))); ((TMP_Text)subtitleText).text = text; string text2 = ((Plugin.Mode.Value == ApplyMode.EveryLevel) ? "Applies to every level of the run" : "Applies to the first level of the run - later levels are random"); if (!canEdit) { text2 = (MapSync.TryGetHostChoice(out var _) ? "Showing the host's choice" : "The host is not using Map Selector - the map will be random"); } if (missingId != null) { text2 = "Your saved map \"" + MapCatalog.GetDisplayName(missingId) + "\" is not installed - Random is selected"; } ((TMP_Text)noteText).text = text2; bool flag = mode == OpenMode.Start; ((Component)confirmButton.Rect).gameObject.SetActive(canEdit || flag); ((TMP_Text)confirmButton.Label).text = ((!flag) ? "CONFIRM" : (roleLabel.StartsWith("Multiplayer") ? "START" : "START GAME")); confirmButton.Primary = true; ((TMP_Text)backButton.Label).text = (flag ? "BACK" : "CLOSE"); string text3 = ((object)Plugin.KeyOpenSelector.Value).ToString(); ((TMP_Text)hintText).text = (canEdit ? ("<color=#FFA51F>ARROWS / WASD</color> Move <color=#FFA51F>ENTER</color> " + (flag ? "Start" : "Confirm") + " <color=#FFA51F>ESC</color> Back <color=#FFA51F>MOUSE</color> Click to select, double-click to " + (flag ? "start" : "confirm") + (flag ? "" : (" <color=#FFA51F>" + text3 + "</color> Close"))) : "<color=#FFA51F>ESC</color> Close"); } private void RefreshFooter() { if (selected >= 0 && selected < cards.Count) { MapEntry entry = cards[selected].Entry; ((TMP_Text)footerCaption).text = (canEdit ? "SELECTED MAP" : "HOST'S MAP"); ((TMP_Text)footerName).text = (entry.IsRandom ? "Random <size=60%><color=#9A9AA0>(vanilla rotation)</color></size>" : entry.DisplayName); } } private void RebuildCards() { foreach (Card card in cards) { if ((Object)(object)card.Rect != (Object)null) { Object.Destroy((Object)(object)((Component)card.Rect).gameObject); } } cards.Clear(); List<MapEntry> list; try { list = MapCatalog.Build(); } catch (Exception ex) { Plugin.Log.LogError((object)("Building map list failed: " + ex)); list = new List<MapEntry>(); MapEntry mapEntry = new MapEntry(); mapEntry.Id = ""; mapEntry.DisplayName = "Random"; list.Add(mapEntry); } if (list.Count <= 1) { Plugin.Log.LogWarning((object)"No maps found in RunManager.levels - only Random is available."); } foreach (MapEntry item in list) { cards.Add(MakeCard(item)); } } private Card MakeCard(MapEntry e) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) Card card = new Card(); card.Entry = e; card.Rect = NewRect("Card " + e.DisplayName, (Transform)(object)gridContent); RectTransform rect = card.Rect; Vector2 anchorMin = (card.Rect.anchorMax = new Vector2(0f, 1f)); rect.anchorMin = anchorMin; card.Rect.pivot = new Vector2(0.5f, 0.5f); card.ImageArea = NewRect("Frame", (Transform)(object)card.Rect); card.ImageArea.anchorMin = new Vector2(0f, 1f); card.ImageArea.anchorMax = new Vector2(1f, 1f); card.ImageArea.pivot = new Vector2(0.5f, 1f); card.Frame = ((Component)card.ImageArea).gameObject.AddComponent<Image>(); ((Graphic)card.Frame).color = FrameIdle; ((Graphic)card.Frame).raycastTarget = false; card.Viewport = NewRect("Viewport", (Transform)(object)card.ImageArea); Stretch(card.Viewport, 5f); Image val2 = ((Component)card.Viewport).gameObject.AddComponent<Image>(); ((Graphic)val2).color = CardBg; ((Graphic)val2).raycastTarget = false; ((Component)card.Viewport).gameObject.AddComponent<RectMask2D>(); if (e.IsRandom) { Image val3 = NewImage("Glow", (Transform)(object)card.Viewport, new Color(Accent.r, Accent.g, Accent.b, 0.08f)); Stretch(((Graphic)val3).rectTransform, 0f); TextMeshProUGUI val4 = NewText("?", (Transform)(object)card.Viewport, 150f, Accent, (TextAlignmentOptions)514); Stretch(((TMP_Text)val4).rectTransform, 0f); ((TMP_Text)val4).fontStyle = (FontStyles)1; TextMeshProUGUI val5 = NewText("Sub", (Transform)(object)card.Viewport, 22f, TextDim, (TextAlignmentOptions)1026); Stretch(((TMP_Text)val5).rectTransform, 12f); ((TMP_Text)val5).text = "A different map each level"; } else { foreach (Sprite layer in e.Layers) { Image val6 = NewImage("Layer", (Transform)(object)card.Viewport, Color.white); val6.sprite = layer; val6.preserveAspect = false; RectTransform rectTransform = ((Graphic)val6).rectTransform; Vector2 anchorMin2 = (((Graphic)val6).rectTransform.anchorMax = new Vector2(0.5f, 0.5f)); rectTransform.anchorMin = anchorMin2; ((Graphic)val6).rectTransform.pivot = new Vector2(0.5f, 0.5f); card.Layers.Add(val6); } if (e.Layers.Count == 0) { TextMeshProUGUI val8 = NewText("NoArt", (Transform)(object)card.Viewport, 40f, TextDim, (TextAlignmentOptions)514); Stretch(((TMP_Text)val8).rectTransform, 0f); ((TMP_Text)val8).text = e.DisplayName.ToUpperInvariant(); } } card.Shade = NewImage("Shade", (Transform)(object)card.Viewport, new Color(0f, 0f, 0f, 0.4f)); Stretch(((Graphic)card.Shade).rectTransform, 0f); Image val9 = NewImage("ActiveTag", (Transform)(object)card.Viewport, Accent); RectTransform rectTransform2 = ((Graphic)val9).rectTransform; Vector2 anchorMin3 = (rectTransform2.anchorMax = new Vector2(0f, 1f)); rectTransform2.anchorMin = anchorMin3; rectTransform2.pivot = new Vector2(0f, 1f); rectTransform2.anchoredPosition = new Vector2(10f, -10f); rectTransform2.sizeDelta = new Vector2(112f, 32f); TextMeshProUGUI val11 = NewText("Text", (Transform)(object)rectTransform2, 20f, Color.black, (TextAlignmentOptions)514); Stretch(((TMP_Text)val11).rectTransform, 0f); ((TMP_Text)val11).fontStyle = (FontStyles)1; ((TMP_Text)val11).text = "ACTIVE"; card.ActiveTag = ((Component)val9).gameObject; card.Label = NewText("Name", (Transform)(object)card.Rect, 30f, TextMain, (TextAlignmentOptions)514); RectTransform rectTransform3 = ((TMP_Text)card.Label).rectTransform; rectTransform3.anchorMin = new Vector2(0f, 0f); rectTransform3.anchorMax = new Vector2(1f, 0f); rectTransform3.pivot = new Vector2(0.5f, 0f); rectTransform3.anchoredPosition = Vector2.zero; rectTransform3.sizeDelta = new Vector2(0f, 60f); ((TMP_Text)card.Label).text = (e.IsRandom ? "RANDOM" : e.DisplayName.ToUpperInvariant()); ((TMP_Text)card.Label).fontStyle = (FontStyles)1; return card; } private void Layout() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) Rect rect = rootRect.rect; Vector2 size = ((Rect)(ref rect)).size; float num = Mathf.Max(200f, size.x - 180f); float num2 = Mathf.Max(200f, size.y - 200f - 190f); int num3 = Mathf.Max(1, cards.Count); float num4 = -1f; int num5 = 1; for (int i = 1; i <= num3; i++) { int num6 = (num3 + i - 1) / i; float num7 = (num - (float)(i - 1) * 36f) / (float)i; float num8 = (num2 - (float)(num6 - 1) * 26f) / (float)num6; float num9 = (num8 - 60f) * 16f / 9f; float num10 = Mathf.Min(num7, Mathf.Min(num9, 540f)); if (num10 > num4 + 0.5f) { num4 = num10; num5 = i; } } if (num4 < 280f) { num5 = Mathf.Max(1, Mathf.FloorToInt((num + 36f) / 316f)); num4 = Mathf.Min(540f, (num - (float)(num5 - 1) * 36f) / (float)num5); } cols = num5; float num11 = num4 * 9f / 16f; float num12 = num11 + 60f; int num13 = (num3 + cols - 1) / cols; float num14 = (float)num13 * num12 + (float)(num13 - 1) * 26f; scrollMax = Mathf.Max(0f, num14 - num2); scroll = Mathf.Clamp(scroll, 0f, scrollMax); float num15 = ((scrollMax > 0f) ? 0f : ((num2 - num14) * 0.5f)); for (int j = 0; j < cards.Count; j++) { Card card = cards[j]; int num16 = j / cols; int num17 = j % cols; int num18 = Mathf.Min(cols, num3 - num16 * cols); float num19 = (float)num18 * num4 + (float)(num18 - 1) * 36f; float num20 = (num - num19) * 0.5f; float num21 = num20 + (float)num17 * (num4 + 36f) + num4 * 0.5f; float num22 = num15 + (float)num16 * (num12 + 26f) + num12 * 0.5f; card.Rect.sizeDelta = new Vector2(num4, num12); card.Rect.anchoredPosition = new Vector2(num21, 0f - num22); card.ImageArea.sizeDelta = new Vector2(0f, num11); card.ImageArea.anchoredPosition = Vector2.zero; ((TMP_Text)card.Label).fontSize = Mathf.Clamp(num4 * 0.062f, 20f, 32f); float vw = num4 - 10f; float vh = num11 - 10f; foreach (Image layer in card.Layers) { CoverFit(layer, vw, vh); } } EnsureVisible(selected); } private static void CoverFit(Image img, float vw, float vh) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) Sprite sprite = img.sprite; if (!((Object)(object)sprite == (Object)null) && !(vw <= 0f) && !(vh <= 0f)) { Rect rect = sprite.rect; float width = ((Rect)(ref rect)).width; Rect rect2 = sprite.rect; float height = ((Rect)(ref rect2)).height; if (!(width <= 0f) && !(height <= 0f)) { float num = Mathf.Max(vw / width, vh / height); ((Graphic)img).rectTransform.sizeDelta = new Vector2(width * num, height * num); ((Graphic)img).rectTransform.anchoredPosition = Vector2.zero; } } } private void EnsureVisible(int index) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0068: Unknown result type (might be due to invalid IL or missing references) if (!(scrollMax <= 0f) && index >= 0 && index < cards.Count) { Rect rect = gridArea.rect; float height = ((Rect)(ref rect)).height; RectTransform rect2 = cards[index].Rect; float num = 0f - rect2.anchoredPosition.y - rect2.sizeDelta.y * 0.5f; float num2 = num + rect2.sizeDelta.y; if (num - scroll < 0f) { scroll = num; } else if (num2 - scroll > height) { scroll = num2 - height; } scroll = Mathf.Clamp(scroll, 0f, scrollMax); } } private void PositionContent() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) gridContent.anchoredPosition = new Vector2(0f, scroll); } private void AnimateCards() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) string text = CurrentChoiceId(); float num = 1f - Mathf.Exp((0f - Time.unscaledDeltaTime) * 14f); for (int i = 0; i < cards.Count; i++) { Card card = cards[i]; bool flag = i == selected; bool flag2 = i == hover && canEdit; float num2 = (flag ? 1.045f : (flag2 ? 1.02f : 1f)); card.Scale = Mathf.Lerp(card.Scale, num2, num); ((Transform)card.Rect).localScale = new Vector3(card.Scale, card.Scale, 1f); ((Graphic)card.Frame).color = (flag ? Accent : (flag2 ? FrameHover : FrameIdle)); Color color = ((Graphic)card.Shade).color; color.a = Mathf.Lerp(color.a, flag ? 0f : (flag2 ? 0.12f : 0.42f), num); ((Graphic)card.Shade).color = color; ((Graphic)card.Label).color = (flag ? Accent : (flag2 ? TextMain : TextDim)); card.ActiveTag.SetActive(card.Entry.Id == text); if (flag) { ((Transform)card.Rect).SetAsLastSibling(); } } } private void ShowToast(string msg) { ApplyFont(); ((TMP_Text)toastText).text = msg; toastObj.SetActive(true); toastUntil = Time.unscaledTime + 3.5f; } private void TickToast() { if (!((Object)(object)toastObj == (Object)null) && toastObj.activeSelf) { float num = toastUntil - Time.unscaledTime; toastGroup.alpha = Mathf.Clamp01(num / 0.5f); if (num <= 0f) { toastObj.SetActive(false); } } } private static bool InSelectableContext() { RunManager instance = RunManager.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.levelCurrent == (Object)null) { return false; } Level levelCurrent = instance.levelCurrent; if ((Object)(object)levelCurrent == (Object)(object)instance.levelSplashScreen) { return false; } if ((Object)(object)levelCurrent == (Object)(object)instance.levelMainMenu || (Object)(object)levelCurrent == (Object)(object)instance.levelLobbyMenu || (Object)(object)levelCurrent == (Object)(object)instance.levelLobby) { return true; } if (instance.levelShop != null) { return instance.levelShop.Contains(levelCurrent); } return false; } private int IndexOf(string id) { for (int i = 0; i < cards.Count; i++) { if (cards[i].Entry.Id == (id ?? "")) { return i; } } return -1; } private static void ClearEventSystemSelection() { EventSystem current = EventSystem.current; if ((Object)(object)current != (Object)null && (Object)(object)current.currentSelectedGameObject != (Object)null) { current.SetSelectedGameObject((GameObject)null); } } private static void Sound(int kind) { try { MenuManager instance = MenuManager.instance; if (!((Object)(object)instance == (Object)null)) { switch (kind) { case 1: instance.MenuEffectHover(1f, 1f); break; case 2: instance.MenuEffectClick((MenuClickEffectType)2, (MenuPage)null, 1f, 1f, true, false); break; case 3: instance.MenuEffectClick((MenuClickEffectType)3, (MenuPage)null, 1f, 1f, true, false); break; default: instance.MenuEffectClick((MenuClickEffectType)1, (MenuPage)null, 1f, 1f, true, false); break; } } } catch (Exception) { } } private void BuildCanvas() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_009a: 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) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07e5: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)canvas != (Object)null)) { GameObject val = new GameObject("MapSelectorCanvas"); val.transform.SetParent(((Component)this).transform, false); canvas = val.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 32000; scaler = val.AddComponent<CanvasScaler>(); scaler.uiScaleMode = (ScaleMode)1; float num = Mathf.Clamp(Plugin.UiScale.Value, 0.6f, 1.6f); scaler.referenceResolution = new Vector2(1920f / num, 1080f / num); scaler.screenMatchMode = (ScreenMatchMode)0; scaler.matchWidthOrHeight = 1f; val.AddComponent<GraphicRaycaster>(); rootRect = (RectTransform)val.transform; ApplyFontLookup(); Image val2 = NewImage("Overlay", (Transform)(object)rootRect, BgColor); ((Graphic)val2).raycastTarget = true; Stretch(((Graphic)val2).rectTransform, 0f); overlay = ((Component)val2).gameObject; RectTransform rectTransform = ((Graphic)val2).rectTransform; titleText = NewText("Title", (Transform)(object)rectTransform, 72f, TextMain, (TextAlignmentOptions)258); TopBand(((TMP_Text)titleText).rectTransform, 46f, 84f); ((TMP_Text)titleText).fontStyle = (FontStyles)1; ((TMP_Text)titleText).characterSpacing = 6f; Image val3 = NewImage("Accent", (Transform)(object)rectTransform, Accent); RectTransform rectTransform2 = ((Graphic)val3).rectTransform; Vector2 anchorMin = (((Graphic)val3).rectTransform.anchorMax = new Vector2(0.5f, 1f)); rectTransform2.anchorMin = anchorMin; ((Graphic)val3).rectTransform.pivot = new Vector2(0.5f, 1f); ((Graphic)val3).rectTransform.sizeDelta = new Vector2(220f, 4f); ((Graphic)val3).rectTransform.anchoredPosition = new Vector2(0f, -132f); subtitleText = NewText("Subtitle", (Transform)(object)rectTransform, 26f, TextMain, (TextAlignmentOptions)258); TopBand(((TMP_Text)subtitleText).rectTransform, 142f, 32f); noteText = NewText("Note", (Transform)(object)rectTransform, 20f, TextDim, (TextAlignmentOptions)258); TopBand(((TMP_Text)noteText).rectTransform, 172f, 26f); ((TMP_Text)titleText).overflowMode = (TextOverflowModes)0; ((TMP_Text)subtitleText).overflowMode = (TextOverflowModes)0; ((TMP_Text)noteText).overflowMode = (TextOverflowModes)0; gridArea = NewRect("GridArea", (Transform)(object)rectTransform); gridArea.anchorMin = Vector2.zero; gridArea.anchorMax = Vector2.one; gridArea.offsetMin = new Vector2(90f, 190f); gridArea.offsetMax = new Vector2(-90f, -200f); ((Component)gridArea).gameObject.AddComponent<RectMask2D>(); gridContent = NewRect("Content", (Transform)(object)gridArea); gridContent.anchorMin = new Vector2(0f, 1f); gridContent.anchorMax = new Vector2(1f, 1f); gridContent.pivot = new Vector2(0.5f, 1f); gridContent.sizeDelta = new Vector2(0f, 0f); Image val5 = NewImage("FooterBar", (Transform)(object)rectTransform, new Color(0f, 0f, 0f, 0.45f)); RectTransform rectTransform3 = ((Graphic)val5).rectTransform; rectTransform3.anchorMin = new Vector2(0f, 0f); rectTransform3.anchorMax = new Vector2(1f, 0f); rectTransform3.pivot = new Vector2(0.5f, 0f); rectTransform3.sizeDelta = new Vector2(0f, 150f); rectTransform3.anchoredPosition = Vector2.zero; Image val6 = NewImage("FooterLine", (Transform)(object)rectTransform3, new Color(1f, 1f, 1f, 0.08f)); ((Graphic)val6).rectTransform.anchorMin = new Vector2(0f, 1f); ((Graphic)val6).rectTransform.anchorMax = new Vector2(1f, 1f); ((Graphic)val6).rectTransform.pivot = new Vector2(0.5f, 1f); ((Graphic)val6).rectTransform.sizeDelta = new Vector2(0f, 2f); footerCaption = NewText("Caption", (Transform)(object)rectTransform3, 20f, TextDim, (TextAlignmentOptions)257); LeftBand(((TMP_Text)footerCaption).rectTransform, 22f, 28f, 584f); ((TMP_Text)footerCaption).characterSpacing = 4f; footerName = NewText("Name", (Transform)(object)rectTransform3, 46f, Accent, (TextAlignmentOptions)257); LeftBand(((TMP_Text)footerName).rectTransform, 50f, 60f, 584f); ((TMP_Text)footerName).fontStyle = (FontStyles)1; ((TMP_Text)footerName).enableAutoSizing = true; ((TMP_Text)footerName).fontSizeMin = 26f; ((TMP_Text)footerName).fontSizeMax = 46f; confirmButton = NewButton("Confirm", rectTransform3, new Vector2(-90f, -30f), new Vector2(300f, 76f)); backButton = NewButton("Back", rectTransform3, new Vector2(-414f, -30f), new Vector2(220f, 76f)); hintText = NewText("Hint", (Transform)(object)rectTransform3, 19f, TextDim, (TextAlignmentOptions)1026); ((TMP_Text)hintText).rectTransform.anchorMin = new Vector2(0f, 0f); ((TMP_Text)hintText).rectTransform.anchorMax = new Vector2(1f, 0f); ((TMP_Text)hintText).rectTransform.pivot = new Vector2(0.5f, 0f); ((TMP_Text)hintText).rectTransform.sizeDelta = new Vector2(-180f, 28f); ((TMP_Text)hintText).rectTransform.anchoredPosition = new Vector2(0f, 12f); ((TMP_Text)hintText).richText = true; overlay.SetActive(false); gameCursor = new GameCursor(rootRect, canvas); Image val7 = NewImage("Toast", (Transform)(object)rootRect, new Color(0.05f, 0.05f, 0.06f, 0.92f)); ((Graphic)val7).raycastTarget = false; RectTransform rectTransform4 = ((Graphic)val7).rectTransform; Vector2 anchorMin2 = (rectTransform4.anchorMax = new Vector2(0.5f, 0f)); rectTransform4.anchorMin = anchorMin2; rectTransform4.pivot = new Vector2(0.5f, 0f); rectTransform4.anchoredPosition = new Vector2(0f, 210f); rectTransform4.sizeDelta = new Vector2(900f, 56f); Image val9 = NewImage("Line", (Transform)(object)rectTransform4, Accent); ((Graphic)val9).rectTransform.anchorMin = new Vector2(0f, 0f); ((Graphic)val9).rectTransform.anchorMax = new Vector2(0f, 1f); ((Graphic)val9).rectTransform.pivot = new Vector2(0f, 0.5f); ((Graphic)val9).rectTransform.sizeDelta = new Vector2(6f, 0f); toastText = NewText("Text", (Transform)(object)rectTransform4, 22f, TextMain, (TextAlignmentOptions)514); Stretch(((TMP_Text)toastText).rectTransform, 8f); toastGroup = ((Component)val7).gameObject.AddComponent<CanvasGroup>(); toastGroup.blocksRaycasts = false; toastGroup.interactable = false; toastObj = ((Component)val7).gameObject; toastObj.SetActive(false); } } private UiButton NewButton(string name, RectTransform parent, Vector2 topRightOffset, Vector2 size) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) UiButton uiButton = new UiButton(); uiButton.Rect = ((Graphic)(uiButton.Bg = NewImage(name + "Button", (Transform)(object)parent, ButtonIdle))).rectTransform; RectTransform rect = uiButton.Rect; Vector2 anchorMin = (uiButton.Rect.anchorMax = new Vector2(1f, 1f)); rect.anchorMin = anchorMin; uiButton.Rect.pivot = new Vector2(1f, 1f); uiButton.Rect.anchoredPosition = topRightOffset; uiButton.Rect.sizeDelta = size; uiButton.Label = NewText("Label", (Transform)(object)uiButton.Rect, 30f, TextMain, (TextAlignmentOptions)514); Stretch(((TMP_Text)uiButton.Label).rectTransform, 4f); ((TMP_Text)uiButton.Label).fontStyle = (FontStyles)1; ((TMP_Text)uiButton.Label).characterSpacing = 3f; return uiButton; } private void ApplyFontLookup() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) try { Dictionary<TMP_FontAsset, int> dictionary = new Dictionary<TMP_FontAsset, int>(); TextMeshProUGUI[] array = Resources.FindObjectsOfTypeAll<TextMeshProUGUI>(); foreach (TextMeshProUGUI val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((TMP_Text)val).font == (Object)null)) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid() && !((TMP_Text)val).transform.IsChildOf(((Component)this).transform)) { dictionary.TryGetValue(((TMP_Text)val).font, out var value); dictionary[((TMP_Text)val).font] = value + 1; } } } TMP_FontAsset val2 = null; int num = 0; foreach (KeyValuePair<TMP_FontAsset, int> item in dictionary) { if (item.Value > num) { val2 = item.Key; num = item.Value; } } if ((Object)(object)val2 != (Object)null) { font = val2; } } catch (Exception) { } if ((Object)(object)font == (Object)null) { font = TMP_Settings.defaultFontAsset; } } private void ApplyFont() { TMP_FontAsset val = font; ApplyFontLookup(); if (!((Object)(object)font == (Object)null) && !((Object)(object)font == (Object)(object)val)) { TextMeshProUGUI[] componentsInChildren = ((Component)this).GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val2 in componentsInChildren) { ((TMP_Text)val2).font = font; } } } private static RectTransform NewRect(string name, Transform parent) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return (RectTransform)val.transform; } private static Image NewImage(string name, Transform parent, Color color) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect(name, parent); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; return val2; } private TextMeshProUGUI NewText(string name, Transform parent, float size, Color color, TextAlignmentOptions align) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect(name, parent); TextMeshProUGUI val2 = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).fontSize = size; ((Graphic)val2).color = color; ((TMP_Text)val2).alignment = align; ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).richText = true; ((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val2).overflowMode = (TextOverflowModes)1; ((TMP_Text)val2).text = ((name == "?") ? "?" : ""); return val2; } private static void Stretch(RectTransform r, float inset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) r.anchorMin = Vector2.zero; r.anchorMax = Vector2.one; r.offsetMin = new Vector2(inset, inset); r.offsetMax = new Vector2(0f - inset, 0f - inset); } private static void TopBand(RectTransform r, float top, float height) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) r.anchorMin = new Vector2(0f, 1f); r.anchorMax = new Vector2(1f, 1f); r.pivot = new Vector2(0.5f, 1f); r.anchoredPosition = new Vector2(0f, 0f - top); r.sizeDelta = new Vector2(-180f, height); } private static void LeftBand(RectTransform r, float top, float height, float rightInset) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_005e: Unknown result type (might be due to invalid IL or missing references) r.anchorMin = new Vector2(0f, 1f); r.anchorMax = new Vector2(1f, 1f); r.pivot = new Vector2(0f, 1f); r.offsetMin = new Vector2(90f, 0f - top - height); r.offsetMax = new Vector2(0f - (90f + rightInset), 0f - top); } } public static class Patches { internal static bool Bypass; private static FieldInfo joiningPlayerField; public static void Apply(Harmony h) { Patch(h, typeof(RunManager), "SetRunLevel", null, "SetRunLevelPostfix", critical: true); Patch(h, typeof(SemiFunc), "MenuActionSingleplayerGame", "SingleplayerStartPrefix", null, critical: false); Patch(h, typeof(MenuPageLobby), "ButtonStart", "LobbyStartPrefix", null, critical: false); joiningPlayerField = AccessTools.Field(typeof(MenuPageLobby), "joiningPlayer"); } private static void Patch(Harmony h, Type type, string method, string prefix, string postfix, bool critical) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) try { MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null); if (methodInfo == null) { throw new MissingMethodException(type.Name, method); } HarmonyMethod val = ((prefix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(Patches), prefix, (Type[])null)); HarmonyMethod val2 = ((postfix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(Patches), postfix, (Type[])null)); h.Patch((MethodBase)methodInfo, val, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { string text = "Could not patch " + type.Name + "." + method + ": " + ex.Message; if (critical) { Plugin.Log.LogError((object)(text + " - map selection will NOT be applied (game update?).")); } else { Plugin.Log.LogWarning((object)(text + " - the selector will not open automatically there (hotkey still works).")); } } } private static void SetRunLevelPostfix(RunManager __instance) { try { if (!((Object)(object)__instance == (Object)null) && SemiFunc.IsMasterClientOrSingleplayer()) { Level val = MapSelection.ResolveForRunLevel(__instance); if (!((Object)(object)val == (Object)null)) { __instance.levelCurrent = val; Plugin.Log.LogInfo((object)("Map Selector: next level forced to " + ((Object)val).name + " (" + MapCatalog.GetDisplayName(val) + ")")); } } } catch (Exception ex) { Plugin.Log.LogError((object)("SetRunLevel postfix failed, keeping the random map: " + ex)); } } private static bool SingleplayerStartPrefix(string saveFileName, List<string> saveFileBackups) { if (Bypass || !Plugin.ShowSelectorOnStart.Value) { return true; } try { MapSelectorUI instance = MapSelectorUI.Instance; if ((Object)(object)instance == (Object)null)