Decompiled source of Godhome v1.0.3

Godhome.dll

Decompiled 21 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BuffBind
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "cuckson.silksong-godhome";

		public const string PLUGIN_NAME = "Silksong Godhome";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace silksong_godhome_mod
{
	[BepInPlugin("cuckson.silksong-godhome", "Silksong Godhome", "1.0.0")]
	public sealed class Godhome : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(InputHandler), "SetCursorEnabled")]
		internal static class Patch_SetCursorEnabled
		{
			private static bool Prefix(ref bool isEnabled)
			{
				if (GodhomeMenuGUI.menuVisible)
				{
					isEnabled = true;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(InputHandler), "Update")]
		private class Patch_InputHandler_Update
		{
			private static void Postfix()
			{
				if (GodhomeMenuGUI.menuVisible)
				{
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)0;
				}
			}
		}

		[HarmonyPatch(typeof(GameManager), "SaveGame", new Type[]
		{
			typeof(int),
			typeof(Action<bool>),
			typeof(bool),
			typeof(AutoSaveName)
		})]
		internal static class Patch_SaveGame_Nullify
		{
			private static bool Prefix(int saveSlot, Action<bool> ogCallback, bool withAutoSave, AutoSaveName autoSaveName)
			{
				ogCallback?.Invoke(obj: true);
				return false;
			}
		}

		[CompilerGenerated]
		private sealed class <DoFancyTransition>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string targetScene;

			public string targetGate;

			public Godhome <>4__this;

			private AudioSource[] <>s__1;

			private int <>s__2;

			private AudioSource <src>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DoFancyTransition>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<src>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//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_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					ScreenFaderUtils.Fade(ScreenFaderUtils.GetColour(), Color.white, 1f);
					<>2__current = (object)new WaitForSeconds(1.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>s__1 = Object.FindObjectsByType<AudioSource>((FindObjectsInactive)1, (FindObjectsSortMode)1);
					for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
					{
						<src>5__3 = <>s__1[<>s__2];
						<src>5__3.Stop();
						<src>5__3 = null;
					}
					<>s__1 = null;
					GameManager.instance.BeginSceneTransition(new SceneLoadInfo
					{
						SceneName = targetScene,
						EntryGateName = targetGate,
						Visualization = (SceneLoadVisualizations)0,
						PreventCameraFadeOut = true
					});
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FixBossScenes>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Godhome <>4__this;

			private GameObject <trobbiostage>5__1;

			private GameObject <target>5__2;

			private GameObject <go>5__3;

			private Transform <t>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FixBossScenes>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<trobbiostage>5__1 = null;
				<target>5__2 = null;
				<go>5__3 = null;
				<t>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<trobbiostage>5__1 = GameObject.Find("Grand Stage Scene");
					if ((Object)(object)<trobbiostage>5__1 != (Object)null)
					{
						<go>5__3 = ((Component)<trobbiostage>5__1.transform.Find("Boss Scene TormentedTrobbio")).gameObject;
						<go>5__3.SetActive(true);
						<go>5__3 = null;
					}
					<target>5__2 = GameObject.Find("Black Thread States");
					if ((Object)(object)<target>5__2 != (Object)null)
					{
						Transform obj = <target>5__2.transform.Find("Normal World");
						object obj2;
						if (obj == null)
						{
							obj2 = null;
						}
						else
						{
							Transform obj3 = obj.Find("Battle Scene");
							obj2 = ((obj3 != null) ? obj3.Find("Wave 1") : null);
						}
						<t>5__4 = (Transform)obj2;
						if ((Object)(object)<t>5__4 != (Object)null)
						{
							((Component)<t>5__4).gameObject.SetActive(true);
						}
						<t>5__4 = null;
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static Godhome _instance;

		private string sceneInput = "";

		private string gateInput = "";

		public static ConfigEntry<KeyboardShortcut> ToggleMenuKey;

		private void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0030: 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_004f: Expected O, but got Unknown
			_instance = this;
			Harmony val = new Harmony("cuckson.silksong-godhome");
			val.PatchAll();
			ToggleMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "Toggle Menu", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), "Key used to open/close the Godhome menu");
			GameObject val2 = new GameObject("GodhomeMenu");
			Object.DontDestroyOnLoad((Object)(object)val2);
			val2.AddComponent<GodhomeMenuGUI>();
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		public static void DisableAllBoolsExcept(PlayerData data, params string[] exclude)
		{
			if (data == null)
			{
				return;
			}
			Type typeFromHandle = typeof(PlayerData);
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			FieldInfo[] fields = typeFromHandle.GetFields(bindingAttr);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.FieldType == typeof(bool) && !exclude.Contains<string>(fieldInfo.Name, StringComparer.OrdinalIgnoreCase))
				{
					try
					{
						fieldInfo.SetValue(data, false);
					}
					catch (Exception)
					{
					}
				}
			}
		}

		[IteratorStateMachine(typeof(<DoFancyTransition>d__6))]
		private IEnumerator DoFancyTransition(string targetScene, string targetGate)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DoFancyTransition>d__6(0)
			{
				<>4__this = this,
				targetScene = targetScene,
				targetGate = targetGate
			};
		}

		private void Update()
		{
			if (GodhomeMenuGUI.menuVisible)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		[IteratorStateMachine(typeof(<FixBossScenes>d__8))]
		private IEnumerator FixBossScenes()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FixBossScenes>d__8(0)
			{
				<>4__this = this
			};
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			GodhomeMenuGUI.menuVisible = false;
			if ((Object)(object)GodhomeMenuGUI.panelGO != (Object)null)
			{
				GodhomeMenuGUI.panelGO.SetActive(false);
			}
			((MonoBehaviour)this).StartCoroutine(FixBossScenes());
		}
	}
	public class GodhomeMenuGUI : MonoBehaviour
	{
		private struct SceneOption
		{
			public string displayName;

			public string sceneName;

			public string gateName;

			public Action onSelect;
		}

		[CompilerGenerated]
		private sealed class <DoFancyTransition>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string targetScene;

			public string targetGate;

			public GodhomeMenuGUI <>4__this;

			private AudioSource[] <>s__1;

			private int <>s__2;

			private AudioSource <src>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DoFancyTransition>d__10(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<src>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//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_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					ScreenFaderUtils.Fade(ScreenFaderUtils.GetColour(), Color.black, 1f);
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>s__1 = Object.FindObjectsByType<AudioSource>((FindObjectsInactive)1, (FindObjectsSortMode)1);
					for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
					{
						<src>5__3 = <>s__1[<>s__2];
						<src>5__3.Stop();
						<src>5__3 = null;
					}
					<>s__1 = null;
					GameManager.instance.BeginSceneTransition(new SceneLoadInfo
					{
						SceneName = targetScene,
						EntryGateName = targetGate,
						Visualization = (SceneLoadVisualizations)0,
						PreventCameraFadeOut = true
					});
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private GameObject canvasGO;

		public static GameObject panelGO;

		public static bool menuVisible;

		private List<SceneOption> options = new List<SceneOption>
		{
			new SceneOption
			{
				displayName = "Safe Zone",
				sceneName = "Bone_East_Umbrella",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Moss Mother",
				sceneName = "Tut_03",
				gateName = "right1",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredMossMother = false;
					GameManager.instance.playerData.defeatedMossMother = false;
				}
			},
			new SceneOption
			{
				displayName = "Bell Beast",
				sceneName = "Bone_05",
				gateName = "left1",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredBellBeast = true;
					GameManager.instance.playerData.defeatedBellBeast = false;
					GameManager.instance.playerData.blackThreadWorld = true;
				}
			},
			new SceneOption
			{
				displayName = "Lace",
				sceneName = "Bone_East_12",
				gateName = "bot1",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredLace1 = true;
				}
			},
			new SceneOption
			{
				displayName = "Fourth Chorus",
				sceneName = "Bone_East_08",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Savage Beastfly",
				sceneName = "Ant_19",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Sister Splinter",
				sceneName = "Shellwood_18",
				gateName = "right1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Skull Tyrant",
				sceneName = "Bone_15",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Widow",
				sceneName = "Belltown_Shrine",
				gateName = "top1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Moorwing",
				sceneName = "Greymoor_08",
				gateName = "top1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Last Judge",
				sceneName = "Coral_Judge_Arena",
				gateName = "door2",
				onSelect = delegate
				{
					GameManager.instance.playerData.bellShrineBellhart = true;
					GameManager.instance.playerData.bellShrineEnclave = true;
					GameManager.instance.playerData.bellShrineGreymoor = true;
					GameManager.instance.playerData.bellShrineShellwood = true;
					GameManager.instance.playerData.bellShrineWilds = true;
					GameManager.instance.playerData.bellShrineBoneForest = true;
					GameManager.instance.playerData.encounteredLastJudge = true;
				}
			},
			new SceneOption
			{
				displayName = "Great Conchflies",
				sceneName = "Coral_11",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Phantom",
				sceneName = "Organ_01",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Trobbio",
				sceneName = "Library_13",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Tormented Trobbio",
				sceneName = "Library_13",
				gateName = "left1",
				onSelect = delegate
				{
					GameManager.instance.playerData.blackThreadWorld = true;
				}
			},
			new SceneOption
			{
				displayName = "Cogwork Dancers",
				sceneName = "Cog_Dancers",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Second Sentinel",
				sceneName = "Hang_17b",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Crawfather",
				sceneName = "Room_CrowCourt_02",
				gateName = "top1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Raging Conchfly",
				sceneName = "Coral_27",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Seth",
				sceneName = "Shellwood_22",
				gateName = "right1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Grand Mother Silk",
				sceneName = "Cradle_03",
				gateName = "right2",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Clover Dancers",
				sceneName = "Clover_10",
				gateName = "left1",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredCloverDancers = true;
				}
			},
			new SceneOption
			{
				displayName = "Lace 2",
				sceneName = "Song_Tower_01",
				gateName = "door_cutsceneEndLaceTower",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredLaceTower = true;
					GameManager.instance.playerData.defeatedLaceTower = false;
				}
			},
			new SceneOption
			{
				displayName = "Karmelita",
				sceneName = "Memory_Ant_Queen",
				gateName = "door_wakeInMemory",
				onSelect = delegate
				{
					GameManager.instance.playerData.defeatedAntQueen = false;
				}
			},
			new SceneOption
			{
				displayName = "Crust King Khann",
				sceneName = "Memory_Coral_Tower",
				gateName = "door_wakeInMemory",
				onSelect = delegate
				{
					GameManager.instance.playerData.defeatedCoralKing = false;
				}
			},
			new SceneOption
			{
				displayName = "Nyleth",
				sceneName = "Shellwood_11b_Memory",
				gateName = "door_wakeInMemory",
				onSelect = delegate
				{
					GameManager.instance.playerData.defeatedFlowerQueen = false;
				}
			},
			new SceneOption
			{
				displayName = "Groal The Great",
				sceneName = "Shadow_18",
				gateName = "right1",
				onSelect = delegate
				{
					GameManager.instance.playerData.DefeatedSwampShaman = false;
				}
			},
			new SceneOption
			{
				displayName = "Chef Lugoli",
				sceneName = "Dust_Chef",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Broodmother",
				sceneName = "Slab_16b",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Giant Flea",
				sceneName = "Arborium_08",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Garmond and Zaza",
				sceneName = "Library_09",
				gateName = "left1",
				onSelect = delegate
				{
					GameManager.instance.playerData.garmondInLibrary = true;
				}
			},
			new SceneOption
			{
				displayName = "Watcher at the Edge",
				sceneName = "Coral_39",
				gateName = "right1",
				onSelect = delegate
				{
					GameManager.instance.playerData.wokeGreyWarrior = true;
				}
			},
			new SceneOption
			{
				displayName = "Palestag",
				sceneName = "Clover_19",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Forebrothers Signis and Gron",
				sceneName = "Dock_09",
				gateName = "right1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "The Unraveled",
				sceneName = "Ward_02",
				gateName = "right1",
				onSelect = delegate
				{
					GameManager.instance.playerData.wardBossEncountered = false;
					GameManager.instance.playerData.wardBossHatchOpened = false;
					GameManager.instance.playerData.collectedWardBossKey = true;
				}
			},
			new SceneOption
			{
				displayName = "Gurr the Outcast",
				sceneName = "Bone_East_18b",
				gateName = "top1",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredAntTrapper = true;
				}
			},
			new SceneOption
			{
				displayName = "Voltvyrm",
				sceneName = "Coral_29",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Shakra",
				sceneName = "Greymoor_08",
				gateName = "left2",
				onSelect = delegate
				{
					GameManager.instance.playerData.mapperSparIntro = true;
					GameManager.instance.playerData.mapperMentorConvo = true;
				}
			},
			new SceneOption
			{
				displayName = "Pinstress",
				sceneName = "Peak_07",
				gateName = "top2",
				onSelect = delegate
				{
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					Dictionary<string, Completion> runtimeData = ((SerializableNamedList<Completion, NamedCompletion>)(object)GameManager.instance.playerData.QuestCompletionData).RuntimeData;
					((SerializableNamedList<Completion, NamedCompletion>)(object)GameManager.instance.playerData.QuestCompletionData).SetData("Pinstress Battle", QuestCompletionData.Accepted);
					GameManager.instance.playerData.blackThreadWorld = true;
				}
			},
			new SceneOption
			{
				displayName = "Father of the Flame",
				sceneName = "Wisp_02",
				gateName = "left1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Bell Eater",
				sceneName = "Bellway_Centipede_Arena",
				gateName = "top1",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Lost Lace",
				sceneName = "Abyss_Cocoon",
				gateName = "door_entry",
				onSelect = delegate
				{
				}
			},
			new SceneOption
			{
				displayName = "Lost Garmond",
				sceneName = "Coral_33",
				gateName = "right1",
				onSelect = delegate
				{
					GameManager.instance.playerData.blackThreadWorld = true;
					GameManager.instance.playerData.garmondEncounters_act3 = 99;
				}
			},
			new SceneOption
			{
				displayName = "First Sinner",
				sceneName = "Slab_10b",
				gateName = "left1",
				onSelect = delegate
				{
					GameManager.instance.playerData.encounteredFirstWeaver = false;
					GameManager.instance.playerData.defeatedFirstWeaver = false;
					GameManager.instance.playerData.wokeLiftWeaver = false;
				}
			}
		};

		private void Awake()
		{
			CreateMenu();
			ToggleMenu(visible: false);
		}

		private void Update()
		{
			//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)
			KeyboardShortcut value = Godhome.ToggleMenuKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown() && (Object)(object)GameManager.instance.hero_ctrl != (Object)null)
			{
				menuVisible = !menuVisible;
				ToggleMenu(menuVisible);
				if (menuVisible)
				{
					UIManager.instance.inputModule.allowMouseInput = true;
				}
			}
			if (menuVisible)
			{
				RecalculateMenuLayout();
			}
		}

		private void RecalculateMenuLayout()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_0184: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)panelGO == (Object)null)
			{
				return;
			}
			float num = Screen.height;
			float num2 = Screen.width;
			float num3 = 10f;
			float num4 = 40f;
			float num5 = 200f;
			int num6 = Mathf.FloorToInt((num - num3) / (num4 + num3));
			RectTransform component = panelGO.GetComponent<RectTransform>();
			component.sizeDelta = Vector2.zero;
			int num7 = 0;
			int num8 = 0;
			for (int i = 0; i < panelGO.transform.childCount; i++)
			{
				GameObject gameObject = ((Component)panelGO.transform.GetChild(i)).gameObject;
				RectTransform component2 = gameObject.GetComponent<RectTransform>();
				float num9 = 0f - num3 - (float)num7 * (num5 + num3);
				float num10 = 0f - num3 - (float)num8 * (num4 + num3);
				component2.pivot = new Vector2(1f, 1f);
				component2.anchorMin = new Vector2(1f, 1f);
				component2.anchorMax = new Vector2(1f, 1f);
				component2.sizeDelta = new Vector2(num5, num4);
				component2.anchoredPosition = new Vector2(num9, num10);
				num8++;
				if (num8 >= num6)
				{
					num8 = 0;
					num7++;
				}
			}
			float num11 = (float)(num7 + 1) * (num5 + num3);
			float num12 = (float)Mathf.Min(num6, panelGO.transform.childCount) * (num4 + num3);
			component.sizeDelta = new Vector2(num11 + num3, num12 + num3);
		}

		private void CreateMenu()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00ca: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Expected O, but got Unknown
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			float num = 50f;
			float num2 = 10f;
			float num3 = 0f;
			float num4 = 260f;
			int num5 = Mathf.FloorToInt((float)(Screen.height - 40) / (num + num2));
			int num6 = 0;
			int num7 = 0;
			canvasGO = new GameObject("GodhomeMenuCanvas");
			Object.DontDestroyOnLoad((Object)(object)canvasGO);
			Canvas val = canvasGO.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			canvasGO.AddComponent<CanvasScaler>();
			canvasGO.AddComponent<GraphicRaycaster>();
			panelGO = new GameObject("Panel");
			panelGO.transform.SetParent(canvasGO.transform, false);
			Image val2 = panelGO.AddComponent<Image>();
			((Graphic)val2).color = new Color(0f, 0f, 0f, 0f);
			RectTransform component = panelGO.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(1f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(1f, 1f);
			component.anchoredPosition = new Vector2(-20f, -20f);
			int num8 = Mathf.CeilToInt((float)options.Count / (float)num5);
			component.sizeDelta = new Vector2((float)num8 * num4, (float)Screen.height - 40f);
			foreach (SceneOption opt in options)
			{
				GameObject val3 = new GameObject(opt.displayName + "_Button");
				val3.transform.SetParent(panelGO.transform, false);
				RectTransform val4 = val3.AddComponent<RectTransform>();
				val4.anchorMin = new Vector2(0f, 1f);
				val4.anchorMax = new Vector2(1f, 1f);
				val4.pivot = new Vector2(0.5f, 1f);
				val4.sizeDelta = new Vector2(0f, num);
				num7 = options.IndexOf(opt) % num5;
				num6 = options.IndexOf(opt) / num5;
				val4.anchoredPosition = new Vector2((float)(-num6) * num4, (float)(-num7) * (num + num2));
				num3 += num + num2;
				Image val5 = val3.AddComponent<Image>();
				((Graphic)val5).color = new Color(0.2f, 0.2f, 0.2f, 0.8f);
				Button val6 = val3.AddComponent<Button>();
				((UnityEvent)val6.onClick).AddListener((UnityAction)delegate
				{
					((MonoBehaviour)this).StartCoroutine(DoFancyTransition(opt.sceneName, opt.gateName));
					PlayerData instance = PlayerData.instance;
					Godhome.DisableAllBoolsExcept(instance, "hasDash", "hasChargeSlash", "HasBoundCrestUpgrader", "UnlockedExtraBlueSlot", "UnlockedExtraYellowSlot", "HasWhiteFlower", "hasWalljump", "hasDoubleJump", "hasBrolly", "hasSuperJump", "HasSeenEvaHeal", "hasHarpoonDash", "hasQuill", "UnlockedFastTravel", "UnlockedFastTravelTeleport", "hasNeedolinMemoryPowerup", "hasNeedolin", "mapAllRooms", "HasAllMaps");
					opt.onSelect?.Invoke();
				});
				GameObject val7 = new GameObject("Text");
				val7.transform.SetParent(val3.transform, false);
				Text val8 = val7.AddComponent<Text>();
				val8.text = opt.displayName;
				val8.alignment = (TextAnchor)4;
				val8.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				((Graphic)val8).color = Color.white;
				RectTransform component2 = val7.GetComponent<RectTransform>();
				component2.anchorMin = Vector2.zero;
				component2.anchorMax = Vector2.one;
				component2.offsetMin = Vector2.zero;
				component2.offsetMax = Vector2.zero;
				ColorBlock colors = ((Selectable)val6).colors;
				((ColorBlock)(ref colors)).normalColor = ((Graphic)val5).color;
				((ColorBlock)(ref colors)).highlightedColor = new Color(0.4f, 0.4f, 0.4f, 0.9f);
				((ColorBlock)(ref colors)).pressedColor = new Color(0.1f, 0.1f, 0.1f, 1f);
				((Selectable)val6).colors = colors;
			}
		}

		private void ToggleMenu(bool visible)
		{
			if ((Object)(object)panelGO != (Object)null)
			{
				panelGO.SetActive(visible);
			}
		}

		[IteratorStateMachine(typeof(<DoFancyTransition>d__10))]
		private IEnumerator DoFancyTransition(string targetScene, string targetGate)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DoFancyTransition>d__10(0)
			{
				<>4__this = this,
				targetScene = targetScene,
				targetGate = targetGate
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}