Decompiled source of PEAKLib UI v1.1.1

plugins/com.github.PEAKModding.PEAKLib.UI.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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.Logging;
using Microsoft.CodeAnalysis;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using On.MenuWindow;
using On.PauseOptionsMenu;
using PEAKLib.Core;
using PEAKLib.UI.Elements;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.TextCore;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Settings;
using Zorro.Settings.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PEAKModding, Rafa")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("UI module of the PEAKLib community API for the game PEAK.")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+1a572c3ab4c77cd913e31cd8ecaf4677dc486e2d")]
[assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.UI")]
[assembly: AssemblyTitle("PEAKLib.UI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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 On.PauseOptionsMenu
{
	internal static class Initialize
	{
		public delegate void PrefixSignature(PauseOptionsMenu self);

		public delegate void PostfixSignature(PauseOptionsMenu self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(PauseOptionsMenu);
			MethodInfo method = typeFromHandle.GetMethod("Initialize", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("PauseOptionsMenu", "Initialize");
			}
			return method;
		}
	}
	internal static class get_openOnStart
	{
	}
	internal static class get_selectOnOpen
	{
	}
	internal static class get_objectToSelectOnOpen
	{
	}
	internal static class get_closeOnPause
	{
	}
	internal static class get_closeOnUICancel
	{
	}
	internal static class InviteFriends
	{
	}
	internal static class OnOpen
	{
	}
	internal static class OnClose
	{
	}
	internal static class OpenBadgeMenu
	{
	}
	internal static class OpenSettingsMenu
	{
	}
	internal static class OpenControlsMenu
	{
	}
	internal static class _ctor
	{
	}
}
namespace On.MenuWindow
{
	internal static class Start
	{
		public delegate void PrefixSignature(MenuWindow self);

		public delegate void PostfixSignature(MenuWindow self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(MenuWindow);
			MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("MenuWindow", "Start");
			}
			return method;
		}
	}
	internal static class Initialize
	{
		public delegate void PrefixSignature(MenuWindow self);

		public delegate void PostfixSignature(MenuWindow self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(MenuWindow);
			MethodInfo method = typeFromHandle.GetMethod("Initialize", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("MenuWindow", "Initialize");
			}
			return method;
		}
	}
	internal static class get_openOnStart
	{
	}
	internal static class get_selectOnOpen
	{
	}
	internal static class get_objectToSelectOnOpen
	{
	}
	internal static class get_closeOnPause
	{
	}
	internal static class get_closeOnUICancel
	{
	}
	internal static class get_blocksPlayerInput
	{
	}
	internal static class get_showCursorWhileOpen
	{
	}
	internal static class get_autoHideOnClose
	{
	}
	internal static class get_isOpen
	{
	}
	internal static class set_isOpen
	{
	}
	internal static class get_inputActive
	{
	}
	internal static class set_inputActive
	{
	}
	internal static class get_initialized
	{
	}
	internal static class set_initialized
	{
	}
	internal static class get_panel
	{
	}
	internal static class Update
	{
	}
	internal static class TestCloseViaInput
	{
	}
	internal static class Open
	{
	}
	internal static class OnOpen
	{
	}
	internal static class OnDestroy
	{
	}
	internal static class CloseAllWindows
	{
	}
	internal static class StartClosed
	{
	}
	internal static class Close
	{
	}
	internal static class ForceClose
	{
	}
	internal static class OnClose
	{
	}
	internal static class Show
	{
	}
	internal static class Hide
	{
	}
	internal static class SetInputActive
	{
	}
	internal static class SelectStartingElement
	{
	}
	internal static class _ctor
	{
	}
	internal static class _cctor
	{
	}
}
namespace MonoDetour.HookGen
{
	internal static class DefaultMonoDetourManager
	{
		internal static MonoDetourManager Instance { get; } = New();


		internal static MonoDetourManager New()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
	internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets
	{
		public Type? TargetType { get; }

		public bool IncludeNestedTypes { get; set; }

		public bool DistinguishOverloadsByName { get; set; }

		public string[]? Members { get; set; }

		public string[]? MemberNamePrefixes { get; set; }

		public string[]? MemberNameSuffixes { get; set; }

		public bool GenerateControlFlowVariants { get; set; }

		public MonoDetourTargetsAttribute(Type? targetType = null)
		{
			TargetType = targetType;
			IncludeNestedTypes = true;
			base..ctor();
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace PEAKLib.UI
{
	public static class ElementExtensions
	{
		public static T ParentTo<T>(this T instance, Transform transform) where T : PeakElement
		{
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			ThrowHelper.ThrowIfArgumentNull<Transform>(transform, "transform");
			((Component)instance).transform.SetParent(transform, false);
			return instance;
		}

		public static GameObject ParentTo(this GameObject instance, Transform transform)
		{
			ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance");
			ThrowHelper.ThrowIfArgumentNull<Transform>(transform, "transform");
			instance.transform.SetParent(transform, false);
			return instance;
		}

		public static T SetSiblingIndex<T>(this T instance, int index) where T : PeakElement
		{
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			((Component)instance).transform.SetSiblingIndex(index);
			return instance;
		}

		public static GameObject SetSiblingIndex(this GameObject instance, int index)
		{
			ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance");
			instance.transform.SetSiblingIndex(index);
			return instance;
		}

		public static T SetPosition<T>(this T instance, Vector2 position) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.anchoredPosition = position;
			return instance;
		}

		public static T SetSize<T>(this T instance, Vector2 size) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.sizeDelta = size;
			return instance;
		}

		public static T SetOffsetMin<T>(this T instance, Vector2 offsetMin) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.offsetMin = offsetMin;
			return instance;
		}

		public static T SetOffsetMax<T>(this T instance, Vector2 offsetMax) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.offsetMax = offsetMax;
			return instance;
		}

		public static T SetAnchorMin<T>(this T instance, Vector2 anchorMin) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.anchorMin = anchorMin;
			return instance;
		}

		public static T SetAnchorMax<T>(this T instance, Vector2 anchorMax) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.anchorMax = anchorMax;
			return instance;
		}

		public static T SetAnchorMinMax<T>(this T instance, Vector2 anchorValue) where T : PeakElement
		{
			//IL_0017: 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)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.anchorMin = anchorValue;
			instance.RectTransform.anchorMax = anchorValue;
			return instance;
		}

		public static T SetPivot<T>(this T instance, Vector2 pivot) where T : PeakElement
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			instance.RectTransform.pivot = pivot;
			return instance;
		}

		public static T AlignToParent<T>(this T instance, UIAlignment alignment) where T : PeakElement
		{
			//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_0066: 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_007b: 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_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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			ThrowHelper.ThrowIfArgumentNull<UIAlignment>(alignment, "alignment");
			Vector2 val = (Vector2)(alignment switch
			{
				UIAlignment.TopLeft => new Vector2(0f, 1f), 
				UIAlignment.TopCenter => new Vector2(0.5f, 1f), 
				UIAlignment.TopRight => new Vector2(1f, 1f), 
				UIAlignment.MiddleLeft => new Vector2(0f, 0.5f), 
				UIAlignment.MiddleCenter => new Vector2(0.5f, 0.5f), 
				UIAlignment.MiddleRight => new Vector2(1f, 0.5f), 
				UIAlignment.BottomLeft => new Vector2(0f, 0f), 
				UIAlignment.BottomCenter => new Vector2(0.5f, 0f), 
				UIAlignment.BottomRight => new Vector2(1f, 0f), 
				_ => Vector2.zero, 
			});
			RectTransform rectTransform = instance.RectTransform;
			rectTransform.anchorMin = val;
			rectTransform.anchorMax = val;
			rectTransform.pivot = val;
			rectTransform.anchoredPosition = Vector2.zero;
			return instance;
		}

		public static T ExpandToParent<T>(this T instance) where T : PeakElement
		{
			//IL_0019: 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_002f: 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)
			ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance");
			RectTransform rectTransform = instance.RectTransform;
			rectTransform.anchorMin = Vector2.zero;
			rectTransform.anchorMax = Vector2.one;
			rectTransform.offsetMin = Vector2.zero;
			rectTransform.offsetMax = Vector2.zero;
			return instance;
		}

		public static GameObject ExpandToParent(this GameObject instance)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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)
			ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance");
			Transform transform = instance.transform;
			RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			if (val == null)
			{
				throw new Exception("[" + ((Object)instance).name + "] does not contain a RectTransform");
			}
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = Vector2.zero;
			val.offsetMax = Vector2.zero;
			return instance;
		}
	}
	public static class MenuAPI
	{
		public delegate void BuilderDelegate(Transform transform);

		internal static BuilderDelegate? pauseMenuBuilderDelegate;

		internal static BuilderDelegate? mainMenuBuilderDelegate;

		public const float OPTIONS_WIDTH = 277f;

		public static void AddToMainMenu(BuilderDelegate builderDelegate)
		{
			mainMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(mainMenuBuilderDelegate, builderDelegate);
		}

		public static void AddToPauseMenu(BuilderDelegate builderDelegate)
		{
			pauseMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(pauseMenuBuilderDelegate, builderDelegate);
		}

		public static PeakCustomPage CreatePage(string pageName)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(pageName, "pageName");
			return new GameObject(pageName).AddComponent<PeakCustomPage>();
		}

		public static PeakCustomPage CreatePageWithBackground(string pageName)
		{
			return CreatePage(pageName).CreateBackground();
		}

		public static PeakMenuButton CreateMenuButton(string buttonName)
		{
			ThrowHelper.ThrowIfFieldNull<string>(buttonName, "buttonName");
			if ((Object)(object)Templates.ButtonTemplate == (Object)null)
			{
				throw new Exception("You're creating MenuButton too early! Prefab hasn't been loaded yet.");
			}
			GameObject val = Object.Instantiate<GameObject>(Templates.ButtonTemplate);
			((Object)val).name = "UI_MainMenuButton_" + buttonName;
			PeakMenuButton peakMenuButton = val.AddComponent<PeakMenuButton>();
			return peakMenuButton.SetText(buttonName);
		}

		public static PeakMenuButton CreatePauseMenuButton(string buttonName)
		{
			return CreateMenuButton(buttonName).SetWidth(277f);
		}

		public static PeakText CreateText(string displayText)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			GameObject val = new GameObject("UI_PeakText", new Type[1] { typeof(PeakText) });
			return val.GetComponent<PeakText>().SetText(displayText);
		}

		public static PeakText CreateText(string displayText, string objectName = "UI_PeakText")
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			ThrowHelper.ThrowIfArgumentNull<string>(displayText, "displayText");
			ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(objectName, "objectName");
			GameObject val = new GameObject(objectName, new Type[1] { typeof(PeakText) });
			return val.GetComponent<PeakText>().SetText(displayText);
		}

		public static PeakButton CreateButton(string buttonName)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			ThrowHelper.ThrowIfFieldNullOrWhiteSpace(buttonName, "buttonName");
			GameObject val = new GameObject(buttonName);
			return val.AddComponent<PeakButton>();
		}

		public static PeakScrollableContent CreateScrollableContent(string scrollableName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return new GameObject(scrollableName).AddComponent<PeakScrollableContent>();
		}

		public static PeakTextInput CreateTextInput(string inputName)
		{
			PeakTextInput peakTextInput = PeakTextInput.Create();
			((Object)peakTextInput).name = inputName;
			return peakTextInput;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.github.PEAKModding.PEAKLib.UI", "PEAKLib.UI", "1.1.1")]
	public class UIPlugin : BaseUnityPlugin
	{
		public const string Id = "com.github.PEAKModding.PEAKLib.UI";

		internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name);


		public static string Name => "PEAKLib.UI";

		public static string Version => "1.1.1";

		private void Awake()
		{
			MonoDetourManager.InvokeHookInitializers(typeof(UIPlugin).Assembly);
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}
	}
	public enum UIAlignment
	{
		TopLeft,
		TopCenter,
		TopRight,
		MiddleLeft,
		MiddleCenter,
		MiddleRight,
		BottomLeft,
		BottomCenter,
		BottomRight
	}
	public static class Utilities
	{
		public static Color GetContrastingColor(Color input, float shiftAmount = 0.2f)
		{
			//IL_0000: 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)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			Color.RGBToHSV(input, ref num, ref num2, ref num3);
			num3 = ((!(num3 > 0.5f)) ? Mathf.Clamp01(num3 + shiftAmount) : Mathf.Clamp01(num3 - shiftAmount));
			return Color.HSVToRGB(num, num2, num3);
		}

		public static void ExpandToParent(RectTransform target)
		{
			//IL_0026: 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_003c: 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)
			ThrowHelper.ThrowIfArgumentNull<RectTransform>(target, "target");
			if ((Object)(object)((Transform)target).parent == (Object)null)
			{
				throw new NullReferenceException("field target.parent is null!");
			}
			target.anchorMin = Vector2.zero;
			target.anchorMax = Vector2.one;
			target.offsetMin = Vector2.zero;
			target.offsetMax = Vector2.zero;
		}
	}
}
namespace PEAKLib.UI.Hooks
{
	[MonoDetourTargets(typeof(MenuWindow))]
	internal static class MenuWindowHooks
	{
		[MonoDetourHookInitialize]
		private static void Init()
		{
			Start.Prefix(Prefix_Start);
		}

		private static void Prefix_Start(MenuWindow self)
		{
			MainMenu val = (MainMenu)(object)((self is MainMenu) ? self : null);
			if (val == null)
			{
				return;
			}
			MenuWindow settingsMenu = val.settingsMenu;
			PauseMainMenu val2 = (PauseMainMenu)(object)((settingsMenu is PauseMainMenu) ? settingsMenu : null);
			if (val2 == null)
			{
				return;
			}
			SharedSettingsMenu componentInChildren = ((Component)val2).GetComponentInChildren<SharedSettingsMenu>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				Templates.SettingsCellPrefab = componentInChildren.m_settingsCellPrefab;
			}
			else
			{
				UIPlugin.Log.LogError((object)"Failed to find SharedSettingsMenu in MenuWindowHooks.Prefix_Start. This should not occur, please report it on PeakLib GitHub.");
			}
			if ((Object)(object)Templates.ButtonTemplate == (Object)null)
			{
				Templates.ButtonTemplate = Object.Instantiate<GameObject>(((Component)val2.backButton).gameObject);
				((Object)Templates.ButtonTemplate).name = "PeakUIButton";
				LocalizedText componentInChildren2 = Templates.ButtonTemplate.GetComponentInChildren<LocalizedText>();
				if ((Object)(object)componentInChildren2 != (Object)null)
				{
					((Behaviour)componentInChildren2).enabled = false;
				}
				Object.DontDestroyOnLoad((Object)(object)Templates.ButtonTemplate);
			}
			MenuAPI.mainMenuBuilderDelegate?.Invoke(((Component)val.playWithFriendsButton).transform.parent);
		}
	}
	[MonoDetourTargets(typeof(PauseOptionsMenu))]
	internal static class PauseMenuHooks
	{
		[MonoDetourHookInitialize]
		private static void Init()
		{
			On.PauseOptionsMenu.Initialize.Prefix(Prefix_Initialize);
		}

		private static void Prefix_Initialize(PauseOptionsMenu self)
		{
			Transform val = ((Component)self).transform.Find("MainPage/Options");
			if ((Object)(object)val != (Object)null)
			{
				MenuAPI.pauseMenuBuilderDelegate?.Invoke(val);
			}
			else
			{
				UIPlugin.Log.LogError((object)"Failed to find \"MainPage/Options\" in PauseMenuHooks.Prefix_Initialize. This should not occur, please report it on PeakLib GitHub.");
			}
		}
	}
}
namespace PEAKLib.UI.Elements
{
	[RequireComponent(typeof(Button))]
	public class PeakButton : PeakElement
	{
		public Button Button { get; set; }

		public PeakText Text { get; set; }

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0054: 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)
			base.RectTransform = ((Component)this).GetComponent<RectTransform>();
			Image component = ElementExtensions.ParentTo(new GameObject("Image", new Type[1] { typeof(Image) }), ((Component)this).transform).ExpandToParent().GetComponent<Image>();
			((Graphic)component).color = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f);
			Text = MenuAPI.CreateText(((Object)this).name, "Text (TMP)").ParentTo(((Component)this).transform).ExpandToParent()
				.SetPosition(Vector2.zero);
			Button = ((Component)this).GetComponent<Button>();
			((Selectable)Button).image = component;
			TextMeshProUGUI textMesh = Text.TextMesh;
			((TMP_Text)textMesh).enableAutoSizing = true;
			((TMP_Text)textMesh).fontSizeMin = 18f;
			((TMP_Text)textMesh).fontSizeMax = 22f;
			((TMP_Text)textMesh).fontSize = 22f;
			((TMP_Text)textMesh).fontStyle = (FontStyles)16;
			((TMP_Text)textMesh).alignment = (TextAlignmentOptions)514;
		}

		public PeakButton SetWidth(float width)
		{
			//IL_001e: 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)
			ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform");
			base.RectTransform.sizeDelta = new Vector2(width, base.RectTransform.sizeDelta.y);
			return this;
		}

		public PeakButton SetHeight(float height)
		{
			//IL_001d: 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)
			ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform");
			base.RectTransform.sizeDelta = new Vector2(base.RectTransform.sizeDelta.x, height);
			return this;
		}

		public PeakButton OnClick(UnityAction onClickEvent)
		{
			ThrowHelper.ThrowIfArgumentNull<UnityAction>(onClickEvent, "onClickEvent");
			((UnityEvent)Button.onClick).AddListener(onClickEvent);
			return this;
		}
	}
	[RequireComponent(typeof(RectTransform))]
	[RequireComponent(typeof(Canvas))]
	[RequireComponent(typeof(CanvasScaler))]
	[RequireComponent(typeof(GraphicRaycaster))]
	public class PeakCustomPage : MenuWindow
	{
		public static readonly Color DEFAULT_BACKGROUND_COLOR = new Color(0f, 0f, 0f, 0.9569f);

		private Canvas Canvas { get; set; }

		private CanvasScaler Scaler { get; set; }

		private Image? Background { get; set; }

		public override bool openOnStart => OpenOnStart;

		public override bool selectOnOpen => SelectOnOpen;

		public override bool closeOnPause => CloseOnPause;

		public override bool closeOnUICancel => CloseOnUICancel;

		public override bool autoHideOnClose => AutoHideOnClose;

		public override bool blocksPlayerInput => BlocksPlayerInput;

		public override bool showCursorWhileOpen => ShowCursorWhileOpen;

		public bool OpenOnStart { get; set; }

		public bool SelectOnOpen { get; set; } = true;


		public bool CloseOnPause { get; set; } = true;


		public bool CloseOnUICancel { get; set; } = true;


		public bool AutoHideOnClose { get; set; } = true;


		public bool BlocksPlayerInput { get; set; } = true;


		public bool ShowCursorWhileOpen { get; set; } = true;


		private void Awake()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Canvas = ((Component)this).GetComponent<Canvas>();
			Canvas.renderMode = (RenderMode)0;
			Canvas.additionalShaderChannels = (AdditionalCanvasShaderChannels)31;
			Canvas.sortingOrder = 1;
			Scaler = ((Component)this).GetComponent<CanvasScaler>();
			Scaler.uiScaleMode = (ScaleMode)1;
			Scaler.referenceResolution = new Vector2(1920f, 1080f);
			Scaler.matchWidthOrHeight = 1f;
		}

		public PeakCustomPage CreateBackground(Color? backgroundColor = null)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0067: 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_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_0084: 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_00ad: 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)
			if ((Object)(object)Background == (Object)null)
			{
				GameObject val = new GameObject("Background", new Type[2]
				{
					typeof(CanvasRenderer),
					typeof(Image)
				});
				val.transform.SetParent(((Component)this).transform, false);
				Background = val.GetComponent<Image>();
				RectTransform rectTransform = ((Graphic)Background).rectTransform;
				rectTransform.anchorMin = Vector2.zero;
				rectTransform.anchorMax = Vector2.one;
				Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero);
				rectTransform.offsetMin = offsetMin;
				if (!backgroundColor.HasValue)
				{
					backgroundColor = DEFAULT_BACKGROUND_COLOR;
				}
				((Graphic)Background).color = backgroundColor.Value;
			}
			return this;
		}
	}
	[RequireComponent(typeof(RectTransform))]
	public class PeakElement : MonoBehaviour
	{
		public RectTransform RectTransform { get; internal set; }

		private void Awake()
		{
			RectTransform = ((Component)this).GetComponent<RectTransform>();
		}
	}
	[RequireComponent(typeof(ScrollRect))]
	[RequireComponent(typeof(RectMask2D))]
	public class PeakHorizontalTabs : PeakElement
	{
		private RectTransform Content { get; set; }

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0084: 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_00cd: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			base.RectTransform = ((Component)this).GetComponent<RectTransform>();
			base.RectTransform.anchoredPosition = new Vector2(0f, 0f);
			base.RectTransform.sizeDelta = new Vector2(0f, 40f);
			base.RectTransform.pivot = new Vector2(0.5f, 1f);
			base.RectTransform.anchorMin = new Vector2(0f, 1f);
			base.RectTransform.anchorMax = new Vector2(1f, 1f);
			ScrollRect component = ((Component)this).GetComponent<ScrollRect>();
			GameObject val = new GameObject("Content", new Type[3]
			{
				typeof(RectTransform),
				typeof(HorizontalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			Content = val.GetComponent<RectTransform>();
			((Transform)Content).SetParent(((Component)this).transform, false);
			Content.pivot = Vector2.zero;
			Utilities.ExpandToParent(Content);
			component.content = Content;
			component.scrollSensitivity = 50f;
			component.elasticity = 0f;
			component.vertical = false;
			component.horizontal = true;
			component.movementType = (MovementType)2;
			HorizontalLayoutGroup component2 = ((Component)Content).GetComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component2).spacing = 20f;
			((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = true;
			((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true;
			ContentSizeFitter component3 = ((Component)Content).GetComponent<ContentSizeFitter>();
			component3.horizontalFit = (FitMode)2;
		}

		public GameObject AddTab(string tabName)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(tabName, new Type[3]
			{
				typeof(RectTransform),
				typeof(Button),
				typeof(LayoutElement)
			});
			val.transform.SetParent((Transform)(object)Content, false);
			LayoutElement component = val.GetComponent<LayoutElement>();
			component.minWidth = 220f;
			component.flexibleWidth = 1f;
			component.preferredHeight = 40f;
			RectTransform component2 = ElementExtensions.ParentTo(new GameObject("Image", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			}), val.transform).GetComponent<RectTransform>();
			Utilities.ExpandToParent(component2);
			Image component3 = ((Component)component2).GetComponent<Image>();
			((Graphic)component3).color = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f);
			RectTransform component4 = ElementExtensions.ParentTo(new GameObject("Selected", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			}), val.transform).GetComponent<RectTransform>();
			Utilities.ExpandToParent(component4);
			PeakText peakText = new GameObject("Text (TMP)", new Type[1] { typeof(PeakText) }).GetComponent<PeakText>().ParentTo(val.transform);
			RectTransform component5 = ((Component)peakText).GetComponent<RectTransform>();
			component5.anchorMin = Vector2.zero;
			component5.anchorMax = Vector2.one;
			component5.pivot = Vector2.zero;
			component5.anchoredPosition = Vector2.zero;
			((TMP_Text)peakText.TextMesh).enableAutoSizing = true;
			((TMP_Text)peakText.TextMesh).fontSizeMin = 18f;
			((TMP_Text)peakText.TextMesh).fontSizeMax = 22f;
			((TMP_Text)peakText.TextMesh).fontSize = 22f;
			((TMP_Text)peakText.TextMesh).fontStyle = (FontStyles)16;
			((TMP_Text)peakText.TextMesh).alignment = (TextAlignmentOptions)514;
			((TMP_Text)peakText.TextMesh).text = tabName;
			return val;
		}
	}
	public class PeakMenuButton : PeakElement
	{
		public Button Button { get; private set; }

		public Image Panel { get; private set; }

		public Image BorderTop { get; private set; }

		public Image BorderBottom { get; private set; }

		public TextMeshProUGUI Text { get; private set; }

		private void Awake()
		{
			base.RectTransform = ((Component)this).GetComponent<RectTransform>();
			Button = ((Component)this).GetComponent<Button>();
			Panel = ((Component)((Component)this).transform.Find("Panel")).GetComponent<Image>();
			Text = ((Component)((Component)this).transform.Find("Text")).GetComponent<TextMeshProUGUI>();
			BorderTop = ((Component)((Component)this).transform.Find("Border")).GetComponent<Image>();
			BorderBottom = ((Component)((Component)this).transform.GetChild(((Component)BorderTop).transform.GetSiblingIndex() + 1)).GetComponent<Image>();
		}

		public PeakMenuButton SetText(string text)
		{
			((TMP_Text)Text).text = text;
			return this;
		}

		public PeakMenuButton SetColor(Color color, bool automaticBorderColor = true)
		{
			//IL_0010: 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)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(Panel, "Panel")).color = color;
			if (automaticBorderColor)
			{
				SetBorderColor(Utilities.GetContrastingColor(color));
			}
			return this;
		}

		public PeakMenuButton SetBorderColor(Color color)
		{
			//IL_0010: 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)
			((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(BorderTop, "BorderTop")).color = color;
			((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(BorderBottom, "BorderBottom")).color = color;
			return this;
		}

		public PeakMenuButton SetWidth(float width)
		{
			//IL_001e: 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)
			ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform");
			base.RectTransform.sizeDelta = new Vector2(width, base.RectTransform.sizeDelta.y);
			return this;
		}

		public PeakMenuButton OnClick(UnityAction onClickEvent)
		{
			ThrowHelper.ThrowIfArgumentNull<UnityAction>(onClickEvent, "onClickEvent");
			((UnityEvent)Button.onClick).AddListener(onClickEvent);
			return this;
		}
	}
	[RequireComponent(typeof(RectTransform))]
	[RequireComponent(typeof(RectMask2D))]
	[RequireComponent(typeof(ScrollRect))]
	public class PeakScrollableContent : PeakElement
	{
		public RectTransform Content { get; private set; }

		private void Awake()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			base.RectTransform = ((Component)this).GetComponent<RectTransform>();
			ScrollRect component = ((Component)this).GetComponent<ScrollRect>();
			component.scrollSensitivity = 50f;
			component.elasticity = 0f;
			component.vertical = true;
			component.horizontal = false;
			component.movementType = (MovementType)2;
			GameObject val = new GameObject("Content", new Type[3]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			Content = val.GetComponent<RectTransform>();
			((Transform)Content).SetParent(((Component)this).transform, false);
			Content.pivot = new Vector2(0.5f, 1f);
			VerticalLayoutGroup component2 = val.GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false;
			Utilities.ExpandToParent(Content);
			ContentSizeFitter component3 = val.GetComponent<ContentSizeFitter>();
			component3.verticalFit = (FitMode)2;
			component.content = Content;
		}
	}
	[RequireComponent(typeof(CanvasRenderer))]
	[RequireComponent(typeof(TextMeshProUGUI))]
	public class PeakText : PeakElement
	{
		private static TMP_FontAsset? _darumaFontAsset;

		private static TMP_FontAsset DarumaDropOne
		{
			get
			{
				if ((Object)(object)_darumaFontAsset == (Object)null)
				{
					TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
					_darumaFontAsset = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)delegate(TMP_FontAsset fontAsset)
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						FaceInfo faceInfo = ((TMP_Asset)fontAsset).faceInfo;
						return ((FaceInfo)(ref faceInfo)).familyName == "Daruma Drop One";
					});
				}
				return _darumaFontAsset;
			}
		}

		public TextMeshProUGUI TextMesh { get; private set; }

		private void Awake()
		{
			//IL_0035: 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_0051: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			base.RectTransform = ((Component)this).GetComponent<RectTransform>();
			TextMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			RectTransform rectTransform = base.RectTransform;
			RectTransform rectTransform2 = base.RectTransform;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, 1f);
			rectTransform2.anchorMax = val;
			rectTransform.anchorMin = val;
			base.RectTransform.pivot = new Vector2(0f, 1f);
			((TMP_Text)TextMesh).font = DarumaDropOne;
			((Graphic)TextMesh).color = Color.white;
			base.RectTransform.sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues();
		}

		public PeakText SetText(string text)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).text = text;
			ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform").sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues();
			return this;
		}

		public PeakText SetFontSize(float size)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).fontSize = size;
			ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform").sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues();
			return this;
		}

		public PeakText SetColor(Color color)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).color = color;
			return this;
		}
	}
	public class PeakTextInput : PeakElement
	{
		private static GameObject? _textInputPrefab;

		internal static GameObject TextInputPrefab
		{
			get
			{
				//IL_011b: 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_0090: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_textInputPrefab == (Object)null)
				{
					if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null)
					{
						throw new Exception("Tried to create a TextInput but prefab was not found. Please wait until the game fully loads to create UI elements.");
					}
					_textInputPrefab = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell);
					((Object)_textInputPrefab).name = "PeakTextInput";
					Transform transform = _textInputPrefab.transform;
					RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
					if (val != null)
					{
						val.anchorMin = new Vector2(0f, 1f);
						val.anchorMax = new Vector2(0f, 1f);
						val.offsetMin = Vector2.zero;
						val.offsetMax = Vector2.zero;
						val.pivot = new Vector2(0.5f, 0.5f);
						val.sizeDelta = new Vector2(200f, 80f);
					}
					FloatSettingUI component = _textInputPrefab.GetComponent<FloatSettingUI>();
					TMP_InputField inputField = component.inputField;
					Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject);
					Object.DestroyImmediate((Object)(object)component);
					inputField.characterValidation = (CharacterValidation)0;
					RectTransform component2 = ((Component)inputField).GetComponent<RectTransform>();
					component2.pivot = new Vector2(0.5f, 0.5f);
					Utilities.ExpandToParent(component2);
					TextMeshProUGUI[] componentsInChildren = ((Component)inputField).GetComponentsInChildren<TextMeshProUGUI>();
					TextMeshProUGUI[] array = componentsInChildren;
					foreach (TextMeshProUGUI val2 in array)
					{
						float num2 = (((TMP_Text)val2).fontSizeMax = 22f);
						float fontSize = (((TMP_Text)val2).fontSizeMin = num2);
						((TMP_Text)val2).fontSize = fontSize;
						((TMP_Text)val2).alignment = (TextAlignmentOptions)4097;
					}
					Object.DontDestroyOnLoad((Object)(object)_textInputPrefab);
				}
				return _textInputPrefab;
			}
		}

		public TMP_InputField InputField { get; private set; }

		private TextMeshProUGUI Placeholder { get; set; }

		internal static PeakTextInput Create()
		{
			return Object.Instantiate<GameObject>(TextInputPrefab).AddComponent<PeakTextInput>();
		}

		private void Awake()
		{
			base.RectTransform = ((Component)this).GetComponent<RectTransform>();
			InputField = ((Component)this).GetComponentInChildren<TMP_InputField>();
			Placeholder = ((Component)InputField.placeholder).GetComponent<TextMeshProUGUI>();
			((TMP_Text)Placeholder).text = "";
		}

		public PeakTextInput OnValueChanged(UnityAction<string> onValueChanged)
		{
			ThrowHelper.ThrowIfArgumentNull<UnityAction<string>>(onValueChanged, "onValueChanged");
			((UnityEvent<string>)(object)InputField.onValueChanged).AddListener(onValueChanged);
			return this;
		}

		public PeakTextInput SetPlaceholder(string placeholder)
		{
			((TMP_Text)Placeholder).text = placeholder;
			return this;
		}
	}
	internal static class Templates
	{
		internal static GameObject? ButtonTemplate { get; set; }

		internal static GameObject? SettingsCellPrefab { get; set; }
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}