Decompiled source of InfoSkull v2.0.0

InfoSkull.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using Febucci.UI;
using Febucci.UI.Core;
using Febucci.UI.Effects;
using HarmonyLib;
using InfoSkull.builtin;
using InfoSkull.builtin.handlers;
using InfoSkull.config;
using InfoSkull.config.conversions;
using InfoSkull.config.profiles;
using InfoSkull.config.profiles.elements;
using InfoSkull.core;
using InfoSkull.core.components;
using InfoSkull.core.menu;
using InfoSkull.patches;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("InfoSkull")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+6a1d1e36f1e25aed0dadd9f275d97ed81a36062d")]
[assembly: AssemblyProduct("InfoSkull")]
[assembly: AssemblyTitle("InfoSkull")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace InfoSkull
{
	public class Formatter
	{
		public const string LEVEL = "{level}";

		public const string LEVEL_TIME = "{level_time}";

		public const string HEIGHT = "{height}";

		public const string BEST_LEVEL_TIME = "{best_level_time}";

		public const string ASCENT_RATE = "{ascent_rate}";

		public const string GAME_TIME = "{game_time}";

		public const string CLOCK = "{clock}";

		public const string LEFT_STAMINA = "{left_stamina}";

		public const string RIGHT_STAMINA = "{right_stamina}";

		public const string MASS_HEIGHT = "{mass_height}";

		public const string MASS_SPEED = "{mass_speed}";

		public const string MASS_ACC_MULT = "{mass_acc_mult}";

		public const string MASS_DISTANCE = "{mass_distance}";

		public const string SCORE = "{score}";

		public const string HIGH_SCORE = "{high_score}";

		public const string ASCENT = "{ascent}";

		public const string VELOCITY = "{velocity}";

		public const string HEALTH = "{health}";

		public const string EXTRA_JUMPS = "{extra_jumps}";

		public const string EMPTY = "{empty}";

		public static Dictionary<string, Func<string>> replacements = new Dictionary<string, Func<string>>
		{
			{
				"{level}",
				() => WorldLoader.instance.GetCurrentLevel().level.levelName
			},
			{
				"{level_time}",
				() => Math.Round(Timer.currentLevelTime(), 2).ToString()
			},
			{
				"{height}",
				() => Math.Round(((Component)ENT_Player.playerObject).transform.position.y, 0).ToString()
			},
			{
				"{best_level_time}",
				() => Math.Round(Timer.bestLevelTime(WorldLoader.instance.GetCurrentLevel().level), 2).ToString()
			},
			{
				"{ascent_rate}",
				() => Math.Round(CL_GameManager.gMan.GetPlayerAscentRate(), 2).ToString()
			},
			{
				"{game_time}",
				delegate
				{
					TimeSpan timeSpan = TimeSpan.FromSeconds(CL_GameManager.gMan.GetGameTime());
					return (!(timeSpan.TotalHours >= 1.0)) ? timeSpan.ToString("mm\\:ss\\:ff") : timeSpan.ToString("hh\\:mm\\:ss\\:ff");
				}
			},
			{
				"{clock}",
				() => DateTime.Now.ToString("HH:mm")
			},
			{
				"{left_stamina}",
				() => Math.Round(ENT_Player.playerObject.hands[0].gripStrength, 0).ToString()
			},
			{
				"{right_stamina}",
				() => Math.Round(ENT_Player.playerObject.hands[1].gripStrength, 0).ToString()
			},
			{
				"{mass_height}",
				() => Math.Round(((Component)DEN_DeathFloor.instance).transform.position.y, 0).ToString()
			},
			{
				"{mass_speed}",
				delegate
				{
					DEN_DeathFloor instance = DEN_DeathFloor.instance;
					Traverse val = Traverse.Create((object)instance);
					float num = (Object.op_Implicit((Object)(object)CL_GameManager.gamemode) ? CL_GameManager.gamemode.gooSpeedMult : 1f);
					if (SettingsManager.settings.g_hard)
					{
						num *= 2f;
					}
					float num2 = val.Field("speedMult").GetValue<float>() * num * val.Field("speedMultFrame").GetValue<float>();
					if (WorldLoader.initialized && WorldLoader.isLoaded && WorldLoader.instance.GetCurrentLevel() != null)
					{
						num2 *= WorldLoader.instance.GetCurrentLevel().level.massSpeedMult;
						if ((Object)(object)WorldLoader.instance.GetCurrentLevel().level.subRegion != (Object)null)
						{
							num2 *= WorldLoader.instance.GetCurrentLevel().level.subRegion.massSpeedMult;
						}
					}
					return Math.Round(instance.speed * num2, 2).ToString();
				}
			},
			{
				"{mass_acc_mult}",
				() => Math.Round(CL_GameManager.gamemode.gooSpeedIncreaseMult).ToString()
			},
			{
				"{mass_distance}",
				() => Math.Round(((Component)ENT_Player.playerObject).transform.position.y - ((Component)DEN_DeathFloor.instance).transform.position.y, 0).ToString()
			},
			{
				"{score}",
				() => Math.Round(CL_GameManager.gMan.GetPlayerAscent() * CL_GameManager.gMan.GetPlayerAscentRate(), 0).ToString()
			},
			{
				"{high_score}",
				() => Math.Round(Traverse.Create((object)CL_GameManager.gMan).Field("previousHighScore").GetValue<float>(), 0).ToString()
			},
			{
				"{ascent}",
				() => Math.Round(Traverse.Create((object)CL_GameManager.gMan).Field("playerAscent").GetValue<float>(), 0).ToString()
			},
			{
				"{velocity}",
				delegate
				{
					//IL_0014: 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)
					Vector3 value = Traverse.Create((object)ENT_Player.playerObject).Field("lastVel").GetValue<Vector3>();
					return Math.Round(((Vector3)(ref value)).magnitude, 2).ToString();
				}
			},
			{
				"{health}",
				() => Math.Round(((GameEntity)ENT_Player.playerObject).health, 1).ToString()
			},
			{
				"{extra_jumps}",
				() => Traverse.Create((object)ENT_Player.playerObject).Field("extraJumpsRemaining").GetValue<int>()
					.ToString()
			},
			{
				"{empty}",
				() => ""
			}
		};

		public static List<string> LEADERBOARD_ILLEGAL = new List<string>(7) { "{left_stamina}", "{right_stamina}", "{mass_distance}", "{mass_height}", "{mass_speed}", "{health}", "{extra_jumps}" };

		public static string format(string format, Dictionary<string, string> overrides = null)
		{
			if (overrides != null)
			{
				foreach (KeyValuePair<string, string> @override in overrides)
				{
					format = format.Replace(@override.Key, @override.Value);
				}
			}
			return Regex.Replace(format.Replace("\\n", "\n"), "{[^}]+}", delegate(Match match)
			{
				try
				{
					if (replacements.TryGetValue(match.Value, out var value))
					{
						return value();
					}
				}
				catch (Exception)
				{
					return "ERR";
				}
				return match.Value;
			});
		}
	}
	public class Timer
	{
		public static float levelEnterTime;

		public static void completeRoom(M_Level level)
		{
			float num = currentLevelTime();
			string text = "info-skull-" + level.levelName + "-best-time";
			StatManager.sessionStats.UpdateStatistic(text, (object)num, (DataType)2, (ModType)3, (DisplayType)4, (ModType)3);
			levelEnterTime = CL_GameManager.gMan.GetGameTime();
		}

		public static float currentLevelTime()
		{
			return CL_GameManager.gMan.GetGameTime() - levelEnterTime;
		}

		public static float bestLevelTime(M_Level level)
		{
			string text = "info-skull-" + level.levelName + "-best-time";
			Statistic statistic = StatManager.saveData.gameStats.GetStatistic(text);
			if (!(statistic.value == ""))
			{
				return float.Parse(statistic.value);
			}
			return 0f;
		}
	}
	[BepInPlugin("de.tamion.infoskull", "InfoSkull", "2.0.0")]
	public class InfoSkullPlugin : BaseUnityPlugin
	{
		private const string GUID = "de.tamion.infoskull";

		private const string NAME = "InfoSkull";

		public const string VERSION = "2.0.0";

		public static InfoSkullPlugin instance;

		internal static ManualLogSource logger;

		private static Harmony harmony;

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			instance = this;
			logger = ((BaseUnityPlugin)this).Logger;
			harmony = new Harmony("de.tamion.infoskull");
			harmony.PatchAll();
			InfoSkull.core.InfoSkull.init();
			InfoSkullBuiltins.init();
			logger.LogInfo((object)"InfoSkull has been loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "InfoSkull";

		public const string PLUGIN_NAME = "InfoSkull";

		public const string PLUGIN_VERSION = "2.0.0";
	}
}
namespace InfoSkull.core
{
	public abstract class ElementHandler : MonoBehaviour
	{
		public abstract void init(ElementController controller);

		public virtual void openAdjustUI()
		{
		}

		public virtual void closeAdjustUI()
		{
		}

		public virtual bool isLeaderboardLegal()
		{
			return true;
		}
	}
	public class ElementType
	{
		internal string name;

		internal Action<ElementController> onInstantiateAction;

		internal Func<ElementConfig, GameObject> creator;

		internal bool _allowCreation = true;

		public static ElementType create(string name)
		{
			return new ElementType
			{
				name = name
			};
		}

		public ElementType onInstantiate(Action<ElementController> onInstantiate)
		{
			onInstantiateAction = (Action<ElementController>)Delegate.Combine(onInstantiateAction, onInstantiate);
			return this;
		}

		public ElementType objectCreator(Func<ElementConfig, GameObject> creator)
		{
			this.creator = creator;
			return this;
		}

		public ElementType allowCreationByMenu(bool allowCreation)
		{
			_allowCreation = allowCreation;
			return this;
		}

		public ElementType register()
		{
			InfoSkull.registerType(this);
			return this;
		}
	}
	public class InfoSkull
	{
		[CompilerGenerated]
		private sealed class <initElements>d__7 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					elements.Clear();
					RadialMenu.init();
					onInitElements();
					Config.instance.profiles[Config.instance.selectedProfile].elements.ForEach(delegate(ElementConfig element)
					{
						try
						{
							instantiateType(registeredTypes[element.type], element, save: false);
						}
						catch (Exception)
						{
						}
					});
					Config.instance.save();
					checkLeaderboard();
					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();
			}
		}

		internal static Dictionary<string, ElementType> registeredTypes = new Dictionary<string, ElementType>();

		public static List<ElementController> elements = new List<ElementController>();

		public static Action onInitElements;

		public static bool isAdjustingUI;

		internal static void init()
		{
			Config.init();
			callbacks();
		}

		private static void callbacks()
		{
			SceneManager.sceneLoaded += delegate
			{
				GameObject val = GameObject.Find("Canvas");
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)GameObject.Find("GameManager")))
				{
					((MonoBehaviour)val.GetComponent<UI_CanvasScaler>()).StartCoroutine(initElements());
				}
			};
		}

		public static void selectProfile(int index)
		{
			if (index < 0 || index >= Config.instance.profiles.Count)
			{
				throw new Exception($"Profile index {index} is out of range");
			}
			for (int num = elements.Count - 1; num >= 0; num--)
			{
				elements[num].liveUnload();
			}
			Config.instance.selectedProfile = index;
			GameObject val = GameObject.Find("Canvas");
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)GameObject.Find("GameManager")))
			{
				((MonoBehaviour)val.GetComponent<UI_CanvasScaler>()).StartCoroutine(initElements());
			}
		}

		[IteratorStateMachine(typeof(<initElements>d__7))]
		public static IEnumerator initElements()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <initElements>d__7(0);
		}

		public static void checkLeaderboard()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			CL_GameManager.gamemode.allowLeaderboardScoring = elements.All((ElementController element) => element.handlers.All((ElementHandler handler) => handler.isLeaderboardLegal())) && !CL_GameManager.HasActiveFlag("leaderboardIllegal") && CL_GameManager.gamemode.allowLeaderboardScoring;
			if (!CL_GameManager.gamemode.allowLeaderboardScoring)
			{
				Scene sceneByName = SceneManager.GetSceneByName("Main-Menu");
				if (!((Scene)(ref sceneByName)).isLoaded)
				{
					GameManagerPatchBuiltin.highScoreQueue = "SESSION IS LEADERBOARD ILLEGAL";
					CL_GameManager.SetGameFlag("leaderboardIllegal", true, "", false, false);
				}
			}
		}

		internal static void openAdjustUI()
		{
			GameObject.Find("Pause Menu").SetActive(false);
			isAdjustingUI = true;
			foreach (ElementController element in elements)
			{
				try
				{
					element.openAdjustUI();
				}
				catch (Exception)
				{
				}
			}
		}

		internal static void disableAdjustUI()
		{
			foreach (ElementController element in elements)
			{
				try
				{
					element.closeAdjustUI();
				}
				catch (Exception)
				{
				}
			}
			isAdjustingUI = false;
			Config.instance.save();
			RadialMenu.instance.hideMenu();
			checkLeaderboard();
		}

		public static void registerType(ElementType type)
		{
			if (registeredTypes.ContainsKey(type.name))
			{
				throw new Exception("Type " + type.name + " is already registered");
			}
			registeredTypes[type.name] = type;
		}

		public static ElementController instantiateType(ElementType type, ElementConfig config = null, bool save = true)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if (!registeredTypes.ContainsKey(type.name))
			{
				throw new Exception("Type " + type.name + " is not registered");
			}
			if (config == null)
			{
				config = ElementConfig.create(type.name, new Dictionary<string, object>());
				if (save)
				{
					Config.instance.profiles[Config.instance.selectedProfile].elements.Add(config);
				}
			}
			object obj = ((type.creator != null) ? ((object)type.creator(config)) : ((object)new GameObject(type.name)));
			((GameObject)obj).transform.parent = GameObject.Find("Game UI").transform;
			ElementController elementController = ((GameObject)obj).AddComponent<ElementController>();
			elementController.init(type, config);
			type.onInstantiateAction(elementController);
			elements.Add(elementController);
			if (isAdjustingUI)
			{
				elementController.openAdjustUI();
			}
			return elementController;
		}
	}
}
namespace InfoSkull.core.menu
{
	public class ElementMenuSettings
	{
		public bool allowDeletion = true;

		public Action<List<MenuButton>> menuButtonCallback;
	}
	public class MenuButton
	{
		public string label;

		public Action<RadialMenu> onClick;

		public MenuButton(string label, Action<RadialMenu> onClick)
		{
			this.label = label;
			this.onClick = onClick;
		}

		public static MenuButton create(string label, Action<RadialMenu> onClick)
		{
			return new MenuButton(label, onClick);
		}
	}
}
namespace InfoSkull.core.components
{
	public class ElementController : MonoBehaviour
	{
		private ElementType _type;

		private ElementConfig _config;

		public List<ElementHandler> handlers = new List<ElementHandler>();

		private ElementMenuSettings _menuSettings;

		public Action liveUnload;

		public void defaultLiveUnload()
		{
			InfoSkull.elements.Remove(this);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		internal void init(ElementType type, ElementConfig config = null)
		{
			_type = type;
			_config = config;
			_menuSettings = new ElementMenuSettings();
			liveUnload = defaultLiveUnload;
		}

		public void registerHandler(ElementHandler handler)
		{
			handlers.Add(handler);
			handler.init(this);
		}

		public ElementType type()
		{
			return _type;
		}

		public ElementConfig config()
		{
			return _config;
		}

		public ElementMenuSettings menuSettings()
		{
			return _menuSettings;
		}

		public void openAdjustUI()
		{
			foreach (ElementHandler handler in handlers)
			{
				handler.openAdjustUI();
			}
		}

		public void delete()
		{
			Config.instance.profiles[Config.instance.selectedProfile].elements.Remove(_config);
			liveUnload();
		}

		public void closeAdjustUI()
		{
			foreach (ElementHandler handler in handlers)
			{
				handler.closeAdjustUI();
			}
		}
	}
	public class RadialMenu : MonoBehaviour
	{
		internal float radius = 80f;

		internal float buttonSize = 60f;

		public Action<List<MenuButton>> buttonProvider = delegate(List<MenuButton> list)
		{
			GameObject uIObjectUnderCursor = getUIObjectUnderCursor();
			if (Object.op_Implicit((Object)(object)uIObjectUnderCursor))
			{
				ElementController controller = uIObjectUnderCursor.GetComponent<ElementController>();
				if (Object.op_Implicit((Object)(object)controller) && controller.menuSettings() != null)
				{
					if (controller.menuSettings().allowDeletion)
					{
						list.Add(new MenuButton("Delete", delegate(RadialMenu menu)
						{
							controller.delete();
							menu.hideMenu();
						}));
					}
					if (controller.menuSettings().menuButtonCallback != null)
					{
						controller.menuSettings().menuButtonCallback(list);
					}
				}
			}
			list.Add(new MenuButton("New", delegate(RadialMenu menu)
			{
				List<MenuButton> list3 = new List<MenuButton>();
				foreach (KeyValuePair<string, ElementType> type in InfoSkull.registeredTypes)
				{
					if (type.Value._allowCreation)
					{
						list3.Add(new MenuButton(type.Key ?? "", delegate
						{
							//IL_0017: Unknown result type (might be due to invalid IL or missing references)
							((Component)InfoSkull.instantiateType(type.Value)).transform.position = Input.mousePosition;
							menu.hideMenu();
						}));
					}
				}
				menu.updateMenu(list3);
			}));
			list.Add(new MenuButton("Profiles", delegate(RadialMenu menu)
			{
				List<MenuButton> list2 = new List<MenuButton>();
				for (int i = 0; i < Config.instance.profiles.Count; i++)
				{
					int s = i;
					list2.Add(new MenuButton($"{i}", delegate
					{
						InfoSkull.selectProfile(s);
						menu.hideMenu();
					}));
				}
				list2.Add(new MenuButton("New", delegate
				{
					ProfileConfig profileConfig = ProfileConfig.create();
					Config.defaultProfile(profileConfig);
					Config.instance.profiles.Add(profileConfig);
					InfoSkull.selectProfile(Config.instance.profiles.Count - 1);
					menu.hideMenu();
				}));
				list2.Add(new MenuButton("Delete Current", delegate
				{
					if (Config.instance.profiles.Count > 1)
					{
						Config.instance.profiles.RemoveAt(Config.instance.selectedProfile);
						InfoSkull.selectProfile(Math.Max(0, Config.instance.selectedProfile - 1));
						menu.hideMenu();
					}
				}));
				list2.Add(new MenuButton("Export", delegate
				{
					GUIUtility.systemCopyBuffer = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject((object)Config.currentProfile())));
					menu.hideMenu();
				}));
				list2.Add(new MenuButton("Import", delegate
				{
					try
					{
						ProfileConfig item = JsonConvert.DeserializeObject<ProfileConfig>(Encoding.UTF8.GetString(Convert.FromBase64String(GUIUtility.systemCopyBuffer)));
						Config.instance.profiles.Add(item);
						InfoSkull.selectProfile(Config.instance.profiles.Count - 1);
						menu.hideMenu();
					}
					catch (Exception)
					{
					}
				}));
				menu.updateMenu(list2);
			}));
		};

		internal static RadialMenu instance;

		private RectTransform rect;

		private CanvasGroup canvasGroup;

		internal static void init()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			if (!((Object)(object)instance != (Object)null))
			{
				GameObject val = new GameObject("RadialMenu");
				Transform transform = val.transform;
				GameObject obj = GameObject.Find("Game UI");
				transform.SetParent((obj != null) ? obj.transform : null, false);
				instance = val.AddComponent<RadialMenu>();
				instance.canvasGroup = val.GetComponent<CanvasGroup>() ?? val.AddComponent<CanvasGroup>();
			}
		}

		public static GameObject getUIObjectUnderCursor()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//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_004d: 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)
			GameObject obj = GameObject.Find("Canvas");
			GraphicRaycaster component = ((Component)((obj != null) ? obj.GetComponent<Canvas>() : null)).GetComponent<GraphicRaycaster>();
			PointerEventData val = new PointerEventData(EventSystem.current);
			val.position = Vector2.op_Implicit(Input.mousePosition);
			List<RaycastResult> list = new List<RaycastResult>();
			((BaseRaycaster)component).Raycast(val, list);
			if (list.Count != 0)
			{
				RaycastResult val2 = list[0];
				return ((RaycastResult)(ref val2)).gameObject;
			}
			return null;
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)308) && InfoSkull.isAdjustingUI)
			{
				createMenu();
			}
			if (Input.GetMouseButtonDown(0) && InfoSkull.isAdjustingUI)
			{
				GameObject uIObjectUnderCursor = getUIObjectUnderCursor();
				if (!Object.op_Implicit((Object)(object)uIObjectUnderCursor) || (Object)(object)uIObjectUnderCursor.transform.parent.parent != (Object)(object)((Component)this).transform)
				{
					hideMenu();
				}
			}
		}

		private void createMenu()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			rect = ((Component)this).gameObject.GetComponent<RectTransform>() ?? ((Component)this).gameObject.AddComponent<RectTransform>();
			((Transform)rect).position = Vector2.op_Implicit(new Vector2(Math.Max(radius + buttonSize / 2f, Math.Min(Input.mousePosition.x, (float)Screen.width - radius - buttonSize / 2f)), Math.Max(radius + buttonSize / 2f, Math.Min(Input.mousePosition.y, (float)Screen.height - radius - buttonSize / 2f))));
			List<MenuButton> list = new List<MenuButton>();
			buttonProvider(list);
			updateMenu(list);
		}

		private void updateMenu(List<MenuButton> buttons)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00b7: 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_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_00ef: 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)
			//IL_0115: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0229: 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_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			hideMenu();
			int count = buttons.Count;
			float num = ((count == 1) ? 0f : radius);
			float num2 = 360f / (float)count;
			for (int i = 0; i < count; i++)
			{
				GameObject val = new GameObject($"Button_{i}", new Type[2]
				{
					typeof(RectTransform),
					typeof(Button)
				});
				val.transform.SetParent(((Component)this).transform, false);
				RectTransform component = val.GetComponent<RectTransform>();
				component.sizeDelta = new Vector2(buttonSize, buttonSize);
				float num3 = (num2 * (float)i - 90f) * ((float)Math.PI / 180f);
				Vector2 anchoredPosition = new Vector2(Mathf.Cos(num3), Mathf.Sin(num3)) * num;
				component.anchoredPosition = anchoredPosition;
				GameObject val2 = new GameObject("Label", new Type[1] { typeof(RectTransform) });
				val2.transform.SetParent(val.transform, false);
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = Vector2.zero;
				component2.anchorMax = Vector2.one;
				component2.offsetMin = Vector2.zero;
				component2.offsetMax = Vector2.zero;
				ContentSizeFitter obj = val2.AddComponent<ContentSizeFitter>();
				obj.horizontalFit = (FitMode)2;
				obj.verticalFit = (FitMode)2;
				TextMeshProUGUI text = val2.AddComponent<TextMeshProUGUI>();
				((TMP_Text)text).text = buttons[i].label;
				((Graphic)text).color = Color.white;
				((TMP_Text)text).alignment = (TextAlignmentOptions)514;
				((TMP_Text)text).fontSize = 24f;
				Button component3 = val.GetComponent<Button>();
				int t = i;
				((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
				{
					buttons[t].onClick(this);
				});
				EventTrigger obj2 = val.AddComponent<EventTrigger>();
				Entry val3 = new Entry
				{
					eventID = (EventTriggerType)0
				};
				((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					((TMP_Text)text).alpha = 0.5f;
				});
				Entry val4 = new Entry
				{
					eventID = (EventTriggerType)1
				};
				((UnityEvent<BaseEventData>)(object)val4.callback).AddListener((UnityAction<BaseEventData>)delegate
				{
					((TMP_Text)text).alpha = 1f;
				});
				obj2.triggers.Add(val3);
				obj2.triggers.Add(val4);
			}
		}

		public void hideMenu()
		{
			for (int num = ((Component)this).transform.childCount - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)((Component)((Component)this).transform.GetChild(num)).gameObject);
			}
		}
	}
}
namespace InfoSkull.config
{
	public class Config
	{
		private const string CONFIG_PATH = "./BepInEx/config/InfoSkull.json";

		public static Config instance;

		public string version = "2.0.0";

		public int selectedProfile;

		public List<ProfileConfig> profiles = new List<ProfileConfig>();

		public static ProfileConfig currentProfile()
		{
			return instance.profiles[instance.selectedProfile];
		}

		public static void init()
		{
			if (instance == null)
			{
				if (File.Exists("./BepInEx/config/InfoSkull.json"))
				{
					JObject obj = JObject.Parse(File.ReadAllText("./BepInEx/config/InfoSkull.json"));
					upgrade(obj);
					instance = JsonConvert.DeserializeObject<Config>(((object)obj).ToString());
				}
				else
				{
					instance = new Config();
					instance.defaultConfig();
					instance.save();
				}
			}
		}

		private static void upgrade(JObject config)
		{
		}

		public void save()
		{
			File.WriteAllText("./BepInEx/config/InfoSkull.json", JsonConvert.SerializeObject((object)this));
		}

		private void defaultConfig()
		{
			ProfileConfig profileConfig = ProfileConfig.create();
			defaultProfile(profileConfig);
			profiles.Add(profileConfig);
		}

		public static void defaultProfile(ProfileConfig profile)
		{
			profile.elements.Add(ElementConfig.create("text_display", new Dictionary<string, object>
			{
				{ "format", "{game_time}" },
				{
					"position",
					new ConfigVector2(0.5f, 0.98f)
				}
			}));
			foreach (string bASE_GAME_PO in InfoSkullBuiltins.BASE_GAME_POS)
			{
				profile.elements.Add(ElementConfig.create("base_game_text", new Dictionary<string, object> { { "elementName", bASE_GAME_PO } }));
			}
		}
	}
}
namespace InfoSkull.config.profiles
{
	public class ProfileConfig
	{
		public List<ElementConfig> elements = new List<ElementConfig>();

		public static ProfileConfig create()
		{
			return new ProfileConfig();
		}
	}
}
namespace InfoSkull.config.profiles.elements
{
	public class ElementConfig
	{
		[JsonProperty]
		internal string type;

		public Dictionary<string, object> data;

		internal static ElementConfig create(string type, Dictionary<string, object> data)
		{
			return new ElementConfig
			{
				type = type,
				data = data
			};
		}
	}
}
namespace InfoSkull.config.conversions
{
	public class ConfigVector2
	{
		public float x;

		public float y;

		public ConfigVector2(float x, float y)
		{
			this.x = x;
			this.y = y;
		}

		public Vector2 toVector2()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(x, y);
		}

		public static Vector2 fromDict(object dicto)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_003a: 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)
			if (dicto is ConfigVector2 configVector)
			{
				return configVector.toVector2();
			}
			JObject val = (JObject)dicto;
			return new Vector2((float)val["x"], (float)val["y"]);
		}
	}
}
namespace InfoSkull.patches
{
	[HarmonyPatch(typeof(CL_GameManager))]
	public class GameManagerPatchBuiltin
	{
		public static string highScoreQueue;

		[HarmonyPatch("SetGameTime")]
		[HarmonyPostfix]
		public static void postfixSetGameTime(CL_GameManager __instance)
		{
			Timer.levelEnterTime = __instance.GetGameTime();
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void postfixStart(CL_GameManager __instance)
		{
			Timer.levelEnterTime = __instance.GetGameTime();
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void postfixUpdate(CL_GameManager __instance)
		{
			if (highScoreQueue != null && !Traverse.Create((object)__instance).Field("loading").GetValue<bool>() && Object.op_Implicit((Object)(object)__instance.uiMan))
			{
				__instance.uiMan.highscoreHeader.ShowText(highScoreQueue);
				highScoreQueue = null;
			}
		}
	}
	[HarmonyPatch(typeof(M_Level))]
	public class LevelPatch
	{
		[HarmonyPatch("OnExit")]
		[HarmonyPostfix]
		public static void prefixOnExit(M_Level __instance)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (!WorldLoader.GetClosestLevelToPosition(((Component)ENT_Player.playerObject).transform.position).level.HasEntered())
			{
				Timer.completeRoom(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(CL_GameManager))]
	public class GameManagerPatch
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__0_0;

			internal void <postfixPause>b__0_0()
			{
				InfoSkull.core.InfoSkull.openAdjustUI();
			}
		}

		[HarmonyPatch("Pause")]
		[HarmonyPostfix]
		public static void postfixPause(CL_GameManager __instance)
		{
			//IL_0037: 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_0057: 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_00bd: 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_00c8: Expected O, but got Unknown
			GameObject val = GameObject.Find("Report Bug");
			if (!Object.op_Implicit((Object)(object)val) || Object.op_Implicit((Object)(object)GameObject.Find("Adjust UI")))
			{
				return;
			}
			GameObject obj = Object.Instantiate<GameObject>(val, new Vector3((float)Screen.width - val.transform.position.x, val.transform.position.y, 0f), Quaternion.identity, GameObject.Find("Pause Buttons").transform);
			((Object)obj).name = "Adjust UI";
			Button component = obj.GetComponent<Button>();
			((Object)component).name = "Adjust UI";
			((TMP_Text)obj.GetComponentInChildren<TextMeshProUGUI>()).SetText("Adjust UI", true);
			ButtonClickedEvent onClick = component.onClick;
			object obj2 = <>c.<>9__0_0;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					InfoSkull.core.InfoSkull.openAdjustUI();
				};
				<>c.<>9__0_0 = val2;
				obj2 = (object)val2;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj2);
			((Behaviour)component).enabled = true;
			((Behaviour)obj.GetComponent<UI_AnimateOnSelect>()).enabled = true;
			((Behaviour)obj.GetComponent<UI_MenuButton>()).enabled = true;
		}

		[HarmonyPatch("UnPause")]
		[HarmonyPostfix]
		public static void postfixUnPause(CL_GameManager __instance)
		{
			if (InfoSkull.core.InfoSkull.isAdjustingUI)
			{
				InfoSkull.core.InfoSkull.disableAdjustUI();
			}
		}
	}
}
namespace InfoSkull.builtin
{
	public class InfoSkullBuiltins
	{
		internal static readonly List<string> BASE_GAME_POS = new List<string>(4) { "High Score", "Ascent Header", "Tip Header", "Header Text" };

		private static GameObject textDisplayPrefab;

		public static void init()
		{
			InfoSkull.core.InfoSkull.onInitElements = (Action)Delegate.Combine(InfoSkull.core.InfoSkull.onInitElements, (Action)delegate
			{
				if (!Object.op_Implicit((Object)(object)textDisplayPrefab))
				{
					textDisplayPrefab = Object.Instantiate<GameObject>(GameObject.Find("High Score"));
					((Object)textDisplayPrefab).name = "TextDisplay Prefab";
					Object.DontDestroyOnLoad((Object)(object)textDisplayPrefab);
				}
			});
			ElementType.create("text_display").objectCreator(delegate
			{
				GameObject obj = Object.Instantiate<GameObject>(textDisplayPrefab, GameObject.Find("Game UI").transform);
				((Object)obj).name = "TextDisplay";
				return obj;
			}).onInstantiate(delegate(ElementController controller)
			{
				((Component)controller).gameObject.GetComponent<BaseGameHandler>();
				FormatHandler handler3 = ((Component)controller).gameObject.AddComponent<FormatHandler>();
				controller.registerHandler(handler3);
				PositionHandler handler4 = ((Component)controller).gameObject.AddComponent<PositionHandler>();
				controller.registerHandler(handler4);
				TextDisplayHandler handler5 = ((Component)controller).gameObject.AddComponent<TextDisplayHandler>();
				controller.registerHandler(handler5);
			})
				.register();
			ElementType.create("base_game_text").objectCreator((ElementConfig config) => GameObject.Find(config.data["elementName"] as string)).onInstantiate(delegate(ElementController controller)
			{
				controller.menuSettings().allowDeletion = false;
				BaseGameHandler handler = ((Component)controller).gameObject.AddComponent<BaseGameHandler>();
				controller.registerHandler(handler);
				PositionHandler handler2 = ((Component)controller).gameObject.AddComponent<PositionHandler>();
				controller.registerHandler(handler2);
			})
				.allowCreationByMenu(allowCreation: false)
				.register();
		}
	}
}
namespace InfoSkull.builtin.handlers
{
	public class BaseGameHandler : ElementHandler
	{
		private ElementController controller;

		public override void init(ElementController controller)
		{
			((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).alpha = (((bool)controller.config().data["disabled"]) ? 0f : 1f);
			controller.liveUnload = delegate
			{
				((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).SetText("", true);
				((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).alpha = 1f;
				foreach (ElementHandler handler in controller.handlers)
				{
					Object.Destroy((Object)(object)handler);
				}
				Object.Destroy((Object)(object)((Component)this).GetComponent<ContentSizeFitter>());
				InfoSkull.core.InfoSkull.elements.Remove(controller);
				Object.Destroy((Object)(object)controller);
			};
			this.controller = controller;
			if (!controller.config().data.ContainsKey("disabled"))
			{
				controller.config().data["disabled"] = false;
			}
			ElementMenuSettings elementMenuSettings = controller.menuSettings();
			elementMenuSettings.menuButtonCallback = (Action<List<MenuButton>>)Delegate.Combine(elementMenuSettings.menuButtonCallback, (Action<List<MenuButton>>)delegate(List<MenuButton> buttons)
			{
				buttons.Add(new MenuButton(((bool)controller.config().data["disabled"]) ? "Enable" : "Disable", delegate(RadialMenu menu)
				{
					controller.config().data["disabled"] = !(bool)controller.config().data["disabled"];
					menu.hideMenu();
				}));
			});
			controller.config().data["elementName"] = ((Object)((Component)this).gameObject).name;
			ContentSizeFitter obj = ((Component)this).gameObject.AddComponent<ContentSizeFitter>();
			obj.horizontalFit = (FitMode)2;
			obj.verticalFit = (FitMode)2;
		}

		public override void openAdjustUI()
		{
			((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).SetText(((Object)((Component)this).gameObject).name, true);
			((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).alpha = 1f;
		}

		public override void closeAdjustUI()
		{
			((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).SetText("", true);
			((TMP_Text)((Component)this).gameObject.GetComponent<TextMeshProUGUI>()).alpha = (((bool)controller.config().data["disabled"]) ? 0f : 1f);
		}
	}
	public class FormatHandler : ElementHandler
	{
		private ElementController controller;

		private TMP_InputField inputField;

		public string lastCommittedText = "";

		private TextMeshProUGUI text;

		public override bool isLeaderboardLegal()
		{
			if (!controller.config().data.ContainsKey("format"))
			{
				return true;
			}
			foreach (string item in Formatter.LEADERBOARD_ILLEGAL)
			{
				if (((string)controller.config().data["format"]).Contains(item))
				{
					return false;
				}
			}
			return true;
		}

		public override void init(ElementController controller)
		{
			this.controller = controller;
			text = ((Component)this).GetComponent<TextMeshProUGUI>();
			((Graphic)text).raycastTarget = true;
			inputField = ((Component)this).gameObject.AddComponent<TMP_InputField>();
			inputField.textComponent = (TMP_Text)(object)text;
			inputField.contentType = (ContentType)0;
			inputField.lineType = (LineType)2;
			((UnityEvent<string>)(object)inputField.onEndEdit).AddListener((UnityAction<string>)delegate(string text)
			{
				if (string.IsNullOrWhiteSpace(text))
				{
					inputField.text = "{empty}";
				}
			});
			((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)delegate(string text)
			{
				if (!Input.GetKeyDown((KeyCode)27))
				{
					lastCommittedText = (string.IsNullOrWhiteSpace(text) ? "{empty}" : text);
				}
			});
			((Behaviour)inputField).enabled = true;
			((Behaviour)inputField).enabled = false;
			ContentSizeFitter obj = ((Component)this).gameObject.AddComponent<ContentSizeFitter>();
			obj.horizontalFit = (FitMode)2;
			obj.verticalFit = (FitMode)2;
			controller.config().data["format"] = (controller.config().data.ContainsKey("format") ? ((string)controller.config().data["format"]) : "{empty}");
		}

		public override void openAdjustUI()
		{
			inputField.richText = false;
			((TMP_Text)text).richText = false;
			if (Object.op_Implicit((Object)(object)inputField))
			{
				inputField.text = (controller.config().data.ContainsKey("format") ? ((string)controller.config().data["format"]) : "{empty}");
				((Behaviour)inputField).enabled = true;
			}
		}

		public override void closeAdjustUI()
		{
			inputField.richText = true;
			((TMP_Text)text).richText = true;
			if (Object.op_Implicit((Object)(object)inputField))
			{
				inputField.text = "";
				((Behaviour)inputField).enabled = false;
				controller.config().data["format"] = lastCommittedText;
			}
		}
	}
	public class PositionHandler : ElementHandler, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler
	{
		private ElementController controller;

		private readonly float snapThreshold = 20f;

		private Canvas canvas;

		private CanvasGroup canvasGroup;

		private TMP_InputField inputField;

		private Vector2 pointerOffset;

		private RectTransform rectTransform;

		public override void init(ElementController controller)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//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_00aa: 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)
			canvas = ((Component)this).GetComponentInParent<Canvas>();
			canvasGroup = ((Component)this).GetComponent<CanvasGroup>() ?? ((Component)this).gameObject.AddComponent<CanvasGroup>();
			((Graphic)((Component)this).GetComponent<TextMeshProUGUI>()).raycastTarget = true;
			rectTransform = ((Component)this).GetComponent<RectTransform>();
			inputField = ((Component)this).GetComponent<TMP_InputField>();
			if (controller.config().data.ContainsKey("position"))
			{
				Vector2 val = ConfigVector2.fromDict(controller.config().data["position"]);
				val.x *= Screen.width;
				val.y *= Screen.height;
				((Component)controller).gameObject.transform.position = Vector2.op_Implicit(val);
			}
			else
			{
				Vector3 position = ((Component)controller).gameObject.transform.position;
				controller.config().data["position"] = new ConfigVector2(position.x / (float)Screen.width, position.y / (float)Screen.height);
			}
			this.controller = controller;
		}

		public override void openAdjustUI()
		{
		}

		public override void closeAdjustUI()
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)controller).gameObject.transform.position;
			controller.config().data["position"] = new ConfigVector2(position.x / (float)Screen.width, position.y / (float)Screen.height);
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//IL_0036: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)inputField))
			{
				((Behaviour)inputField).enabled = false;
			}
			canvasGroup.blocksRaycasts = false;
			Transform parent = ((Transform)rectTransform).parent;
			Vector2 val = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((parent is RectTransform) ? parent : null), eventData.position, eventData.pressEventCamera, ref val);
			pointerOffset = val - rectTransform.anchoredPosition;
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0011: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Transform)rectTransform).parent;
			Vector2 val = default(Vector2);
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((parent is RectTransform) ? parent : null), eventData.position, eventData.pressEventCamera, ref val))
			{
				return;
			}
			Vector2 val2 = val - pointerOffset;
			if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
			{
				if (Mathf.Abs(val2.x) <= snapThreshold)
				{
					val2.x = 0f;
				}
				if (Mathf.Abs(val2.y) <= snapThreshold)
				{
					val2.y = 0f;
				}
			}
			rectTransform.anchoredPosition = val2;
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)inputField))
			{
				((Behaviour)inputField).enabled = true;
				inputField.ActivateInputField();
				Traverse.Create((object)inputField).Field("caretRectTrans").GetValue<RectTransform>()
					.anchoredPosition = rectTransform.anchoredPosition;
			}
			Vector3 position = ((Component)controller).gameObject.transform.position;
			controller.config().data["position"] = new ConfigVector2(position.x / (float)Screen.width, position.y / (float)Screen.height);
			canvasGroup.blocksRaycasts = true;
		}
	}
	public class TextDisplayHandler : ElementHandler
	{
		private ElementController controller;

		private TextAnimator_TMP animator;

		private bool animatorConfigured;

		private bool lastFrameSet;

		private TextMeshProUGUI text;

		public override void init(ElementController controller)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			this.controller = controller;
			text = ((Component)this).GetComponent<TextMeshProUGUI>();
			((Graphic)text).color = new Color(1f, 1f, 1f, 1f);
			animator = ((Component)this).GetComponent<TextAnimator_TMP>();
		}

		private void Update()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (lastFrameSet || InfoSkull.core.InfoSkull.isAdjustingUI)
			{
				lastFrameSet = false;
				return;
			}
			lastFrameSet = true;
			if (Object.op_Implicit((Object)(object)text))
			{
				((TMP_Text)text).SetText(Formatter.format((controller.config().data["format"] as string) ?? "{empty}"), true);
			}
			if (!animatorConfigured && Object.op_Implicit((Object)(object)animator) && ((TAnimCore)animator).Behaviors.Length == 2)
			{
				((ShakeBehavior)((TAnimCore)animator).Behaviors[0].animation).baseAmplitude = 0.5f;
				((SizeBehavior)((TAnimCore)animator).Behaviors[1].animation).baseAmplitude = 1f;
				animatorConfigured = true;
			}
		}
	}
}