Decompiled source of MenuLib v2.4.1

MenuLib.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MenuLib")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.4.1")]
[assembly: AssemblyInformationalVersion("1.0.0+3fe9421b2cc898cabadb88716488fa80d79ed880")]
[assembly: AssemblyProduct("MenuLib")]
[assembly: AssemblyTitle("MenuLib")]
[assembly: AssemblyVersion("2.4.1.0")]
[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 MenuLib
{
	[BepInPlugin("nickklmao.menulib", "Menu Lib", "2.4.1")]
	internal sealed class Entry : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<Action<MenuPageMain>, MenuPageMain> <0>__MenuPageMain_StartHook;

			public static Action<Action<MenuPageSettings>, MenuPageSettings> <1>__MenuPageSettings_StartHook;

			public static Action<Action<MenuPageColor>, MenuPageColor> <2>__MenuPageColor_StartHook;

			public static Action<Action<MenuPageEsc>, MenuPageEsc> <3>__MenuPageEsc_StartHook;

			public static Action<Action<MenuPageLobby>, MenuPageLobby> <4>__MenuPageLobby_StartHook;

			public static Manipulator <5>__SemiFunc_UIMouseHoverILHook;

			public static Manipulator <6>__MenuPage_StateClosingILHook;

			public static Manipulator <7>__MenuScrollBox_UpdateILHook;

			public static Manipulator <8>__ChatManager_StateInactiveILHook;
		}

		private const string MOD_NAME = "Menu Lib";

		internal static readonly ManualLogSource logger = Logger.CreateLogSource("Menu Lib");

		private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self)
		{
			orig(self);
			MenuAPI.mainMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageSettings_StartHook(Action<MenuPageSettings> orig, MenuPageSettings self)
		{
			orig(self);
			MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageColor_StartHook(Action<MenuPageColor> orig, MenuPageColor self)
		{
			orig(self);
			MenuAPI.colorMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageEsc_StartHook(Action<MenuPageEsc> orig, MenuPageEsc self)
		{
			orig(self);
			MenuAPI.escapeMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void MenuPageLobby_StartHook(Action<MenuPageLobby> orig, MenuPageLobby self)
		{
			orig(self);
			MenuAPI.lobbyMenuBuilderDelegate?.Invoke(((Component)self).transform);
		}

		private static void SemiFunc_UIMouseHoverILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val4 = default(ILLabel);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchBrfalse(instruction, ref val4) && val4.Target.OpCode == OpCodes.Ldarg_1
			});
			val.Index += 2;
			val.RemoveRange(27);
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Func<MenuScrollBox, Vector2, bool>>((Func<MenuScrollBox, Vector2, bool>)delegate(MenuScrollBox menuScrollBox, Vector2 vector)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				RectTransform val3 = (RectTransform)((Transform)menuScrollBox.scroller).parent;
				float y = ((Transform)val3).position.y;
				float num = y + val3.sizeDelta.y;
				return vector.y > y && vector.y < num;
			});
			ILLabel val2 = val.DefineLabel();
			val.Emit(OpCodes.Brtrue_S, (object)val2);
			val.Emit(OpCodes.Ldc_I4_0);
			val.Emit(OpCodes.Ret);
			val.MarkLabel(val2);
		}

		private static void MenuPage_StateClosingILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchLdfld<MenuPage>(instruction, "stateStart")
			});
			val.Index += 2;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<MenuPage>>((Action<MenuPage>)delegate(MenuPage menuPage)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value2))
				{
					RectTransform val2 = (RectTransform)((Component)menuPage).transform;
					Vector2 val3 = Vector2.op_Implicit(((Transform)val2).position);
					Rect rect = val2.rect;
					float num = 0f - ((Rect)(ref rect)).height;
					rect = value2.rectTransform.rect;
					val3.y = num - ((Rect)(ref rect)).height;
					REPOReflection.menuPage_AnimateAwayPosition.SetValue(menuPage, val3);
				}
			});
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall<Object>(instruction, "Destroy")
			});
			val.Index -= 5;
			val.RemoveRange(6);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<MenuPage>>((Action<MenuPage>)delegate(MenuPage menuPage)
			{
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value) && (value.isCachedPage || !value.pageWasActivatedOnce))
				{
					((Behaviour)menuPage).enabled = false;
				}
				else
				{
					MenuManager.instance.PageRemove(menuPage);
					Object.Destroy((Object)(object)((Component)menuPage).gameObject);
				}
			});
		}

		private static void MenuScrollBox_UpdateILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0),
				(Instruction instruction) => ILPatternMatchingExt.MatchLdfld<MenuScrollBox>(instruction, "scrollBoxActive")
			});
			val.RemoveRange(4);
			ILLabel val2 = val.MarkLabel();
			val.Index -= 2;
			val.Remove();
			val.Emit(OpCodes.Brtrue_S, (object)val2);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputScrollY")
			});
			int index = val.Index;
			val.Index = index - 1;
			val.Remove();
			ILLabel val3 = val.DefineLabel();
			val.Emit(OpCodes.Bne_Un_S, (object)val3);
			val.Index += 2;
			object operand = il.Instrs[val.Index].Operand;
			ILLabel val4 = (ILLabel)((operand is ILLabel) ? operand : null);
			index = val.Index;
			val.Index = index + 1;
			val.RemoveRange(24);
			val.MarkLabel(val3);
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_0);
			val.Emit<MenuScrollBox>(OpCodes.Ldfld, "parentPage");
			val.EmitDelegate<Action<MenuScrollBox, MenuPage>>((Action<MenuScrollBox, MenuPage>)delegate(MenuScrollBox menuScrollBox, MenuPage menuPage)
			{
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				float num3 = SemiFunc.InputMovementY() / 20f;
				float num4 = SemiFunc.InputScrollY();
				float num7;
				if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value))
				{
					float? scrollSpeed = value.scrollView.scrollSpeed;
					if (scrollSpeed.HasValue)
					{
						float valueOrDefault = scrollSpeed.GetValueOrDefault();
						valueOrDefault *= 10f;
						float num5 = Mathf.Abs((float)REPOReflection.menuScrollBox_ScrollerEndPosition.GetValue(menuScrollBox) - (float)REPOReflection.menuScrollBox_ScrollerStartPosition.GetValue(menuScrollBox));
						float num6 = (num3 + (float)Math.Sign(num4)) * valueOrDefault / num5;
						Rect rect2 = menuScrollBox.scrollBarBackground.rect;
						num7 = num6 * ((Rect)(ref rect2)).height;
						goto IL_00c1;
					}
				}
				float num8 = (float)REPOReflection.menuScrollBox_ScrollHeight.GetValue(menuScrollBox);
				num7 = num3 / (num8 * 0.01f) + num4 / (num8 * 0.01f);
				goto IL_00c1;
				IL_00c1:
				float num9 = (float)REPOReflection.menuScrollBox_ScrollHandleTargetPosition.GetValue(menuScrollBox);
				REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(menuScrollBox, num9 + num7);
			});
			val.GotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputMovementY")
			});
			ILLabel val5 = val.MarkLabel();
			val.Emit(OpCodes.Ldarg_0);
			val.Emit<MenuScrollBox>(OpCodes.Ldfld, "scrollBoxActive");
			val.Emit(OpCodes.Brfalse_S, (object)val4);
			val.GotoPrev((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall<Input>(instruction, "GetMouseButton")
			});
			val.Remove();
			val.Emit(OpCodes.Brfalse, (object)val5);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "UIMouseHover")
			});
			val.Remove();
			val.Emit(OpCodes.Brfalse, (object)val5);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchStfld<MenuScrollBox>(instruction, "scrollAmount")
			});
			val.Index -= 13;
			val.RemoveRange(14);
			val.EmitDelegate<Action<MenuScrollBox>>((Action<MenuScrollBox>)delegate(MenuScrollBox instance)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				Rect rect;
				float num2;
				if (MenuAPI.customMenuPages.ContainsKey((MenuPage)REPOReflection.menuScrollBox_ParentPage.GetValue(instance)))
				{
					float num = ((Transform)instance.scrollHandle).localPosition.y + instance.scrollHandle.sizeDelta.y / 2f;
					rect = instance.scrollBarBackground.rect;
					num2 = num / ((Rect)(ref rect)).height;
				}
				else
				{
					float y = ((Transform)instance.scrollHandle).localPosition.y;
					rect = instance.scrollBarBackground.rect;
					num2 = y / ((Rect)(ref rect)).height * 1.1f;
				}
				REPOReflection.menuScrollBox_ScrollAmount.SetValue(instance, num2);
			});
		}

		private static void ChatManager_StateInactiveILHook(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instruction) => ILPatternMatchingExt.MatchStfld<ChatManager>(instruction, "chatActive")
			});
			ILLabel val2 = val.DefineLabel();
			val.Emit<REPOInputStringSystem>(OpCodes.Ldsfld, "hasAnyFocus");
			val.Emit(OpCodes.Brfalse_S, (object)val2);
			val.Emit(OpCodes.Ret);
			val.MarkLabel(val2);
		}

		private void Awake()
		{
			//IL_0040: 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_00cc: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Expected O, but got Unknown
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			logger.LogDebug((object)"Hooking `MenuPageMain.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageMain>, MenuPageMain>(MenuPageMain_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageSettings.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageSettings), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageSettings>, MenuPageSettings>(MenuPageSettings_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageColor.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageColor), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageColor>, MenuPageColor>(MenuPageColor_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageEsc.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageEsc), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageEsc>, MenuPageEsc>(MenuPageEsc_StartHook));
			logger.LogDebug((object)"Hooking `MenuPageLobby.Start`");
			new Hook((MethodBase)AccessTools.Method(typeof(MenuPageLobby), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageLobby>, MenuPageLobby>(MenuPageLobby_StartHook));
			logger.LogDebug((object)"Hooking `SemiFunc.UIMouseHover`");
			MethodInfo methodInfo = AccessTools.Method(typeof(SemiFunc), "UIMouseHover", (Type[])null, (Type[])null);
			object obj = <>O.<5>__SemiFunc_UIMouseHoverILHook;
			if (obj == null)
			{
				Manipulator val = SemiFunc_UIMouseHoverILHook;
				<>O.<5>__SemiFunc_UIMouseHoverILHook = val;
				obj = (object)val;
			}
			new ILHook((MethodBase)methodInfo, (Manipulator)obj);
			logger.LogDebug((object)"Hooking `MenuPage.StateClosing`");
			MethodInfo methodInfo2 = AccessTools.Method(typeof(MenuPage), "StateClosing", (Type[])null, (Type[])null);
			object obj2 = <>O.<6>__MenuPage_StateClosingILHook;
			if (obj2 == null)
			{
				Manipulator val2 = MenuPage_StateClosingILHook;
				<>O.<6>__MenuPage_StateClosingILHook = val2;
				obj2 = (object)val2;
			}
			new ILHook((MethodBase)methodInfo2, (Manipulator)obj2);
			logger.LogDebug((object)"Hooking `MenuScrollBox.Update`");
			MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuScrollBox), "Update", (Type[])null, (Type[])null);
			object obj3 = <>O.<7>__MenuScrollBox_UpdateILHook;
			if (obj3 == null)
			{
				Manipulator val3 = MenuScrollBox_UpdateILHook;
				<>O.<7>__MenuScrollBox_UpdateILHook = val3;
				obj3 = (object)val3;
			}
			new ILHook((MethodBase)methodInfo3, (Manipulator)obj3);
			logger.LogDebug((object)"Hooking `ChatManager.StateInactive`");
			MethodInfo methodInfo4 = AccessTools.Method(typeof(ChatManager), "StateInactive", (Type[])null, (Type[])null);
			object obj4 = <>O.<8>__ChatManager_StateInactiveILHook;
			if (obj4 == null)
			{
				Manipulator val4 = ChatManager_StateInactiveILHook;
				<>O.<8>__ChatManager_StateInactiveILHook = val4;
				obj4 = (object)val4;
			}
			new ILHook((MethodBase)methodInfo4, (Manipulator)obj4);
		}
	}
	public static class MenuAPI
	{
		public delegate void BuilderDelegate(Transform parent);

		internal static BuilderDelegate mainMenuBuilderDelegate;

		internal static BuilderDelegate settingsMenuBuilderDelegate;

		internal static BuilderDelegate colorMenuBuilderDelegate;

		internal static BuilderDelegate lobbyMenuBuilderDelegate;

		internal static BuilderDelegate escapeMenuBuilderDelegate;

		internal static readonly Dictionary<MenuPage, REPOPopupPage> customMenuPages = new Dictionary<MenuPage, REPOPopupPage>();

		private static MenuButtonPopUp menuButtonPopup;

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

		public static void AddElementToSettingsMenu(BuilderDelegate builderDelegate)
		{
			settingsMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(settingsMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToColorMenu(BuilderDelegate builderDelegate)
		{
			colorMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(colorMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToLobbyMenu(BuilderDelegate builderDelegate)
		{
			lobbyMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(lobbyMenuBuilderDelegate, builderDelegate);
		}

		public static void AddElementToEscapeMenu(BuilderDelegate builderDelegate)
		{
			escapeMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(escapeMenuBuilderDelegate, builderDelegate);
		}

		public static void CloseAllPagesAddedOnTop()
		{
			MenuManager.instance.PageCloseAllAddedOnTop();
		}

		public static void OpenPopup(string header, Color headerColor, string content, Action onLeftClicked, Action onRightClicked = null)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0087: 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_007c: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)menuButtonPopup))
			{
				menuButtonPopup = ((Component)MenuManager.instance).gameObject.AddComponent<MenuButtonPopUp>();
			}
			menuButtonPopup.option1Event = new UnityEvent();
			menuButtonPopup.option2Event = new UnityEvent();
			if (onLeftClicked != null)
			{
				menuButtonPopup.option1Event.AddListener(new UnityAction(onLeftClicked.Invoke));
			}
			if (onRightClicked != null)
			{
				menuButtonPopup.option2Event.AddListener(new UnityAction(onRightClicked.Invoke));
			}
			MenuManager.instance.PagePopUpTwoOptions(menuButtonPopup, header, headerColor, content, "Yes", "No");
		}

		public static REPOButton CreateREPOButton(string text, Action onClick, Transform parent, Vector2 localPosition = default(Vector2))
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.buttonTemplate, parent);
			((Object)obj).name = "Button - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOButton rEPOButton = ((Component)obj).gameObject.AddComponent<REPOButton>();
			((TMP_Text)rEPOButton.labelTMP).text = text;
			rEPOButton.onClick = onClick;
			return rEPOButton;
		}

		public static REPOToggle CreateREPOToggle(string text, Action<bool> onToggle, Transform parent, Vector2 localPosition = default(Vector2), string leftButtonText = "ON", string rightButtonText = "OFF", bool defaultValue = false)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.toggleTemplate, parent);
			((Object)obj).name = "Toggle - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOToggle rEPOToggle = ((Component)obj).gameObject.AddComponent<REPOToggle>();
			((TMP_Text)rEPOToggle.labelTMP).text = text;
			((TMP_Text)rEPOToggle.leftButtonTMP).text = leftButtonText;
			((TMP_Text)rEPOToggle.rightButtonTMP).text = rightButtonText;
			rEPOToggle.onToggle = onToggle;
			rEPOToggle.SetState(defaultValue, invokeCallback: false);
			return rEPOToggle;
		}

		public static REPOInputField CreateREPOInputField(string labelText, Action<string> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), bool onlyNotifyOnSubmit = false, string placeholder = "", string defaultValue = "")
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.toggleTemplate, parent);
			((Object)obj).name = "Input Field - " + labelText;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOInputField rEPOInputField = ((Component)obj).gameObject.AddComponent<REPOInputField>();
			((TMP_Text)rEPOInputField.labelTMP).text = labelText;
			rEPOInputField.inputStringSystem.onValueChanged = onValueChanged;
			rEPOInputField.inputStringSystem.onlyNotifyOnSubmit = onlyNotifyOnSubmit;
			rEPOInputField.inputStringSystem.placeholder = placeholder;
			rEPOInputField.inputStringSystem.SetValue(defaultValue, notify: false);
			return rEPOInputField;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<float> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), float min = 0f, float max = 1f, int precision = 2, float defaultValue = 0f, string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)obj).name = "Float Slider - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)rEPOSlider.labelTMP).text = text;
			((TMP_Text)rEPOSlider.descriptionTMP).text = description;
			rEPOSlider.onValueChanged = onValueChanged;
			rEPOSlider.min = min;
			rEPOSlider.max = max;
			rEPOSlider.precision = precision;
			rEPOSlider.prefix = prefix;
			rEPOSlider.postfix = postfix;
			rEPOSlider.barBehavior = barBehavior;
			rEPOSlider.SetValue(defaultValue, invokeCallback: false);
			return rEPOSlider;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<int> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), int min = 0, int max = 1, int defaultValue = 0, string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_002a: 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)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)obj).name = "Int Slider - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)rEPOSlider.labelTMP).text = text;
			((TMP_Text)rEPOSlider.descriptionTMP).text = description;
			rEPOSlider.onValueChanged = delegate(float f)
			{
				onValueChanged(Convert.ToInt32(f));
			};
			rEPOSlider.min = min;
			rEPOSlider.max = max;
			rEPOSlider.precision = 0;
			rEPOSlider.prefix = prefix;
			rEPOSlider.postfix = postfix;
			rEPOSlider.barBehavior = barBehavior;
			rEPOSlider.SetValue(defaultValue, invokeCallback: false);
			return rEPOSlider;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<string> onOptionChanged, Transform parent, string[] stringOptions, string defaultOption, Vector2 localPosition = default(Vector2), string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)val).name = "Option Slider - " + text;
			((Transform)val).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider repoSlider = ((Component)val).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)repoSlider.labelTMP).text = text;
			((TMP_Text)repoSlider.descriptionTMP).text = description;
			repoSlider.onValueChanged = delegate(float f)
			{
				onOptionChanged(repoSlider.stringOptions.ElementAtOrDefault(Convert.ToInt32(f)) ?? repoSlider.stringOptions.FirstOrDefault());
			};
			repoSlider.stringOptions = stringOptions;
			repoSlider.prefix = prefix;
			repoSlider.postfix = postfix;
			repoSlider.barBehavior = barBehavior;
			int num = Array.IndexOf(stringOptions, defaultOption);
			if (num == -1)
			{
				num = 0;
			}
			repoSlider.SetValue(num, invokeCallback: false);
			return repoSlider;
		}

		public static REPOSlider CreateREPOSlider(string text, string description, Action<int> onOptionChanged, Transform parent, string[] stringOptions, string defaultOption, Vector2 localPosition = default(Vector2), string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue)
		{
			//IL_002a: 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)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent);
			((Object)obj).name = "Option Slider - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>();
			((TMP_Text)rEPOSlider.labelTMP).text = text;
			((TMP_Text)rEPOSlider.descriptionTMP).text = description;
			rEPOSlider.onValueChanged = delegate(float f)
			{
				onOptionChanged(Convert.ToInt32(f));
			};
			rEPOSlider.stringOptions = stringOptions;
			rEPOSlider.prefix = prefix;
			rEPOSlider.postfix = postfix;
			rEPOSlider.barBehavior = barBehavior;
			int num = Array.IndexOf(stringOptions, defaultOption);
			if (num == -1)
			{
				num = 0;
			}
			rEPOSlider.SetValue(num, invokeCallback: false);
			return rEPOSlider;
		}

		public static REPOLabel CreateREPOLabel(string text, Transform parent, Vector2 localPosition = default(Vector2))
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.labelTemplate, parent);
			((Object)obj).name = "Label - " + text;
			((Transform)obj).localPosition = Vector2.op_Implicit(localPosition);
			REPOLabel rEPOLabel = ((Component)obj).gameObject.AddComponent<REPOLabel>();
			((TMP_Text)rEPOLabel.labelTMP).text = text;
			return rEPOLabel;
		}

		public static REPOSpacer CreateREPOSpacer(Transform parent, Vector2 localPosition = default(Vector2), Vector2 size = default(Vector2))
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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)
			//IL_003b: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)new GameObject("Spacer", new Type[1] { typeof(RectTransform) }).transform;
			((Transform)val).SetParent(parent);
			REPOSpacer result = ((Component)val).gameObject.AddComponent<REPOSpacer>();
			((Transform)val).localPosition = Vector2.op_Implicit(localPosition);
			val.sizeDelta = size;
			return result;
		}

		[Obsolete("Switch to the overload with the 'shouldCachePage' argument!")]
		public static REPOPopupPage CreateREPOPopupPage(string headerText, REPOPopupPage.PresetSide presetSide, bool pageDimmerVisibility = false, float spacing = 0f)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return CreateREPOPopupPage(headerText, pageDimmerVisibility, spacing, (presetSide == REPOPopupPage.PresetSide.Left) ? null : new Vector2?(new Vector2(40f, 0f)));
		}

		[Obsolete("Switch to the overload with the 'shouldCachePage' argument!")]
		public static REPOPopupPage CreateREPOPopupPage(string headerText, bool pageDimmerVisibility = false, float spacing = 0f, Vector2? localPosition = null)
		{
			return CreateREPOPopupPage(headerText, shouldCachePage: false, pageDimmerVisibility, spacing, localPosition);
		}

		public static REPOPopupPage CreateREPOPopupPage(string headerText, REPOPopupPage.PresetSide presetSide, bool shouldCachePage, bool pageDimmerVisibility = false, float spacing = 0f)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return CreateREPOPopupPage(headerText, shouldCachePage, pageDimmerVisibility, spacing, (presetSide == REPOPopupPage.PresetSide.Left) ? null : new Vector2?(new Vector2(40f, 0f)));
		}

		public static REPOPopupPage CreateREPOPopupPage(string headerText, bool shouldCachePage, bool pageDimmerVisibility = false, float spacing = 0f, Vector2? localPosition = null)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.popupPageTemplate, ((Component)MenuHolder.instance).transform);
			((Object)obj).name = "Menu Page " + headerText;
			REPOPopupPage rEPOPopupPage = ((Component)obj).gameObject.AddComponent<REPOPopupPage>();
			((Transform)rEPOPopupPage.rectTransform).localPosition = Vector2.op_Implicit((Vector2)(((??)localPosition) ?? new Vector2(-280f, 0f)));
			((TMP_Text)rEPOPopupPage.headerTMP).text = headerText;
			rEPOPopupPage.isCachedPage = shouldCachePage;
			rEPOPopupPage.pageDimmerVisibility = pageDimmerVisibility;
			rEPOPopupPage.scrollView.spacing = spacing;
			return rEPOPopupPage;
		}

		public static REPOAvatarPreview CreateREPOAvatarPreview(Transform parent, Vector2 localPosition = default(Vector2), bool enableBackgroundImage = false, Color? backgroundImageColor = null)
		{
			//IL_0026: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = Object.Instantiate<Transform>(REPOTemplates.avatarPreviewTemplate, parent);
			((Object)obj).name = "Player Avatar Preview";
			REPOAvatarPreview rEPOAvatarPreview = ((Component)obj).gameObject.AddComponent<REPOAvatarPreview>();
			((Transform)rEPOAvatarPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition);
			rEPOAvatarPreview.enableBackgroundImage = enableBackgroundImage;
			rEPOAvatarPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white);
			rEPOAvatarPreview.previewSize = new Vector2(184f, 345f);
			return rEPOAvatarPreview;
		}

		public static REPOObjectPreview CreateREPOObjectPreview(Transform parent, GameObject previewObject, Vector2 localPosition = default(Vector2), bool enableBackgroundImage = false, Color? backgroundImageColor = null)
		{
			//IL_0026: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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)
			Transform obj = Object.Instantiate<Transform>(REPOTemplates.avatarPreviewTemplate, parent);
			((Object)obj).name = "Object Preview";
			REPOObjectPreview rEPOObjectPreview = ((Component)obj).gameObject.AddComponent<REPOObjectPreview>();
			((Transform)rEPOObjectPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition);
			rEPOObjectPreview.enableBackgroundImage = enableBackgroundImage;
			rEPOObjectPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white);
			rEPOObjectPreview.previewObject = previewObject;
			rEPOObjectPreview.previewSize = new Vector2(184f, 345f);
			return rEPOObjectPreview;
		}

		internal static void OpenMenuPage(MenuPage menuPage, bool pageOnTop)
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			object? value = REPOReflection.menuManager_CurrentMenuPage.GetValue(MenuManager.instance);
			MenuPage val = (MenuPage)((value is MenuPage) ? value : null);
			List<MenuPage> list = REPOReflection.menuManager_AddedPagesOnTop.GetValue(MenuManager.instance) as List<MenuPage>;
			if (pageOnTop && !Object.op_Implicit((Object)(object)val))
			{
				pageOnTop = false;
			}
			if (pageOnTop)
			{
				if (list == null || list.Contains(val))
				{
					return;
				}
			}
			else if (Object.op_Implicit((Object)(object)val))
			{
				REPOReflection.menuManager_PageInactiveAdd.Invoke(MenuManager.instance, new object[1] { val });
				val.PageStateSet((PageState)3);
			}
			((Component)menuPage).transform.SetAsLastSibling();
			((Behaviour)menuPage).enabled = true;
			menuPage.ResetPage();
			menuPage.PageStateSet((PageState)0);
			MenuManager.instance.PageAdd(menuPage);
			((MonoBehaviour)menuPage).StartCoroutine(REPOReflection.menuPage_LateStart.Invoke(menuPage, null) as IEnumerator);
			REPOReflection.menuPage_AddedPageOnTop.SetValue(menuPage, false);
			if (!pageOnTop)
			{
				MenuManager.instance.PageSetCurrent(menuPage.menuPageIndex, menuPage);
				REPOReflection.menuPage_PageIsOnTopOfOtherPage.SetValue(menuPage, true);
				REPOReflection.menuPage_PageUnderThisPage.SetValue(menuPage, val);
			}
			else
			{
				REPOReflection.menuPage_ParentPage.SetValue(menuPage, val);
				list.Add(menuPage);
			}
		}

		internal static void CloseMenuPage(MenuPage menuPage, bool closePagesAddedOnTop)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (closePagesAddedOnTop)
			{
				CloseAllPagesAddedOnTop();
			}
			menuPage.PageStateSet((PageState)2);
			object? value = REPOReflection.menuPage_PageUnderThisPage.GetValue(menuPage);
			MenuPage val = (MenuPage)((value is MenuPage) ? value : null);
			if (val != null)
			{
				MenuManager.instance.PageSetCurrent(val.menuPageIndex, val);
			}
		}
	}
	public static class REPOReflection
	{
		public static readonly FieldInfo menuManager_CurrentMenuPage = AccessTools.Field(typeof(MenuManager), "currentMenuPage");

		public static readonly FieldInfo menuManager_AddedPagesOnTop = AccessTools.Field(typeof(MenuManager), "addedPagesOnTop");

		public static readonly FieldInfo menuPage_AddedPageOnTop = AccessTools.Field(typeof(MenuPage), "addedPageOnTop");

		public static readonly FieldInfo menuPage_PageUnderThisPage = AccessTools.Field(typeof(MenuPage), "pageUnderThisPage");

		public static readonly FieldInfo menuPage_ParentPage = AccessTools.Field(typeof(MenuPage), "parentPage");

		public static readonly FieldInfo menuPage_PageIsOnTopOfOtherPage = AccessTools.Field(typeof(MenuPage), "pageIsOnTopOfOtherPage");

		public static readonly FieldInfo menuPage_ScrollBoxes = AccessTools.Field(typeof(MenuPage), "scrollBoxes");

		public static readonly FieldInfo menuPage_CurrentPageState = AccessTools.Field(typeof(MenuPage), "currentPageState");

		public static readonly FieldInfo menuPage_AnimateAwayPosition = AccessTools.Field(typeof(MenuPage), "animateAwayPosition");

		public static readonly FieldInfo menuButton_ParentPage = AccessTools.Field(typeof(MenuButton), "parentPage");

		public static readonly FieldInfo menuScrollBox_ScrollerEndPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollerEndPosition");

		public static readonly FieldInfo menuScrollBox_ScrollerStartPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollerStartPosition");

		public static readonly FieldInfo menuScrollBox_ScrollHandleTargetPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollHandleTargetPosition");

		public static readonly FieldInfo menuScrollBox_ScrollHeight = AccessTools.Field(typeof(MenuScrollBox), "scrollHeight");

		public static readonly FieldInfo menuScrollBox_ScrollAmount = AccessTools.Field(typeof(MenuScrollBox), "scrollAmount");

		public static readonly FieldInfo menuScrollBox_ParentPage = AccessTools.Field(typeof(MenuScrollBox), "parentPage");

		public static readonly FieldInfo menuSelectableElement_MenuID = AccessTools.Field(typeof(MenuSelectableElement), "menuID");

		public static readonly MethodInfo menuManager_PageInactiveAdd = AccessTools.Method(typeof(MenuManager), "PageInactiveAdd", (Type[])null, (Type[])null);

		public static readonly MethodInfo menuPage_LateStart = AccessTools.Method(typeof(MenuPage), "LateStart", (Type[])null, (Type[])null);
	}
	internal static class REPOTemplates
	{
		internal static readonly RectTransform pageDimmerTemplate;

		internal static readonly RectTransform simplePageTemplate;

		internal static readonly RectTransform buttonTemplate;

		internal static readonly RectTransform popupPageTemplate;

		internal static readonly RectTransform toggleTemplate;

		internal static readonly RectTransform sliderTemplate;

		internal static readonly RectTransform labelTemplate;

		internal static readonly Transform avatarPreviewTemplate;

		static REPOTemplates()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected I4, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			MenuManager instance = MenuManager.instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				throw new NullReferenceException("Error fetching templates... Ensure you're not creating UI elements too early, use \"MenuAPI.AddElementTo...\"");
			}
			foreach (MenuPages menuPage in instance.menuPages)
			{
				Transform transform = menuPage.menuPage.transform;
				MenuPageIndex menuPageIndex = menuPage.menuPageIndex;
				switch ((int)menuPageIndex)
				{
				case 0:
					simplePageTemplate = (RectTransform)transform;
					buttonTemplate = (RectTransform)((Transform)simplePageTemplate).Find("Menu Button - Quit game");
					break;
				case 2:
					pageDimmerTemplate = (RectTransform)transform.GetChild(0);
					break;
				case 4:
					popupPageTemplate = (RectTransform)transform;
					break;
				case 5:
				{
					Transform obj = transform.Find("Menu Scroll Box/Mask/Scroller");
					toggleTemplate = (RectTransform)obj.Find("Bool Setting - Push to Talk");
					sliderTemplate = (RectTransform)obj.Find("Slider - microphone");
					break;
				}
				case 6:
					labelTemplate = (RectTransform)transform.Find("Scroll Box/Mask/Scroller").Find("Header Movement");
					break;
				case 1:
					avatarPreviewTemplate = transform.Find("Menu Element Player Avatar");
					break;
				}
			}
		}
	}
}
namespace MenuLib.Structs
{
	public struct Padding
	{
		public float left;

		public float top;

		public float right;

		public float bottom;

		public Padding(float left, float top, float right, float bottom)
		{
			this.left = left;
			this.top = top;
			this.right = right;
			this.bottom = bottom;
		}
	}
}
namespace MenuLib.MonoBehaviors
{
	public sealed class REPOAvatarPreview : REPOElement
	{
		private PlayerAvatarMenu playerAvatarMenu;

		private Image backgroundImage;

		private RectTransform renderTextureRectTransform;

		public bool enableBackgroundImage
		{
			get
			{
				return ((Behaviour)backgroundImage).enabled;
			}
			set
			{
				((Behaviour)backgroundImage).enabled = value;
			}
		}

		public Color backgroundImageColor
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return ((Graphic)backgroundImage).color;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Graphic)backgroundImage).color = value;
			}
		}

		public Vector2 previewSize
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return base.rectTransform.sizeDelta;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: 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_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: 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_004c: 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_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val;
				if (value.x > value.y)
				{
					val = value;
					val.y = value.x / (8f / 15f);
					value = val;
				}
				else
				{
					val = value;
					val.x = value.y * (8f / 15f);
					value = val;
				}
				RectTransform obj = renderTextureRectTransform;
				val = (base.rectTransform.sizeDelta = value);
				obj.sizeDelta = val;
				((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			}
		}

		public PlayerAvatarVisuals playerAvatarVisuals { get; private set; }

		public Transform rigTransform => playerAvatarVisuals.meshParent.transform;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
			base.rectTransform.pivot = Vector2.right;
			RectTransform obj = base.rectTransform;
			Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero);
			obj.anchorMin = anchorMin;
			renderTextureRectTransform = (RectTransform)((Transform)base.rectTransform).GetChild(1);
			((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			playerAvatarMenu = ((Component)this).GetComponentInChildren<PlayerAvatarMenuHover>().playerAvatarMenu;
			playerAvatarVisuals = ((Component)playerAvatarMenu).GetComponentInChildren<PlayerAvatarVisuals>();
			backgroundImage = ((Component)this).gameObject.AddComponent<Image>();
			((Behaviour)backgroundImage).enabled = false;
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)playerAvatarMenu))
			{
				if (Object.op_Implicit((Object)(object)playerAvatarMenu.cameraAndStuff))
				{
					Object.Destroy((Object)(object)((Component)playerAvatarMenu.cameraAndStuff).gameObject);
				}
				Object.Destroy((Object)(object)((Component)playerAvatarMenu).gameObject);
			}
		}
	}
	public sealed class REPOButton : REPOElement
	{
		public MenuButton menuButton;

		public TextMeshProUGUI labelTMP;

		[Obsolete("Update the button clicked event using the 'onClick' field rather than through the button")]
		public Button button;

		public Action onClick;

		public Vector2? overrideButtonSize;

		private string previousText;

		private Vector2? previousOverrideButtonSize;

		public Vector2 GetLabelSize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((TMP_Text)labelTMP).GetPreferredValues();
		}

		private void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			Transform transform = ((Component)this).transform;
			base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			button = ((Component)this).GetComponent<Button>();
			menuButton = ((Component)this).GetComponent<MenuButton>();
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			button.onClick = new ButtonClickedEvent();
			((UnityEvent)button.onClick).AddListener((UnityAction)delegate
			{
				onClick?.Invoke();
			});
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuButtonPopUp>());
		}

		private void Update()
		{
			//IL_007b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (((TMP_Text)labelTMP).text == previousText)
			{
				Vector2? val = overrideButtonSize;
				Vector2? val2 = previousOverrideButtonSize;
				if (val.HasValue == val2.HasValue && (!val.HasValue || val.GetValueOrDefault() == val2.GetValueOrDefault()))
				{
					return;
				}
			}
			base.rectTransform.sizeDelta = (Vector2)(((??)overrideButtonSize) ?? GetLabelSize());
			previousText = ((TMP_Text)labelTMP).text;
			previousOverrideButtonSize = overrideButtonSize;
		}

		private void OnTransformParentChanged()
		{
			REPOReflection.menuButton_ParentPage.SetValue(menuButton, ((Component)this).GetComponentInParent<MenuPage>());
		}
	}
	public class REPOElement : MonoBehaviour
	{
		private REPOScrollViewElement _repoScrollViewElement;

		public RectTransform rectTransform { get; protected set; }

		public REPOScrollViewElement repoScrollViewElement
		{
			get
			{
				if (Object.op_Implicit((Object)(object)_repoScrollViewElement))
				{
					return _repoScrollViewElement;
				}
				return _repoScrollViewElement = ((Component)this).GetComponent<REPOScrollViewElement>();
			}
		}
	}
	public sealed class REPOInputField : REPOElement
	{
		public TextMeshProUGUI labelTMP;

		public REPOInputStringSystem inputStringSystem;

		private RectTransform inputAreaRectTransform;

		private MenuPage menuPage;

		private MenuSelectableElement menuSelectableElement;

		public Vector2 GetLabelSize()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((TMP_Text)labelTMP).GetPreferredValues();
		}

		private void Awake()
		{
			//IL_0041: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0085: 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_00a1: 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_00a7: 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_00c7: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)this).transform;
			base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			menuPage = ((Component)this).GetComponentInParent<MenuPage>();
			menuSelectableElement = ((Component)this).GetComponent<MenuSelectableElement>();
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			RectTransform obj = ((TMP_Text)labelTMP).rectTransform;
			obj.sizeDelta -= new Vector2(0f, 10f);
			Vector3 val = Vector3.right * 100f;
			Transform obj2 = ((Component)this).transform.Find("SliderBG");
			obj2.localPosition += val;
			Transform obj3 = ((Component)this).transform.Find("RawImage");
			obj3.localPosition += val;
			Transform obj4 = ((Component)this).transform.Find("RawImage (1)");
			obj4.localPosition += val;
			RectTransform obj5 = ((TMP_Text)labelTMP).rectTransform;
			((Transform)obj5).localPosition = ((Transform)obj5).localPosition + val;
			TextMeshProUGUI val2 = null;
			for (int i = 0; i < ((Component)this).transform.childCount; i++)
			{
				Transform child = ((Component)this).transform.GetChild(i);
				switch (((Object)child).name)
				{
				case "Option Box":
				case "Option Box Behind":
				case "RawImage (2)":
					Object.Destroy((Object)(object)((Component)child).gameObject);
					break;
				case "Button BUTTON":
					if (!Object.op_Implicit((Object)(object)val2))
					{
						val2 = ((Component)((Component)child).GetComponent<MenuButton>()).GetComponentInChildren<TextMeshProUGUI>();
						((TMP_Text)val2).transform.SetParent(child.parent);
					}
					Object.Destroy((Object)(object)((Component)child).gameObject);
					break;
				}
			}
			((TMP_Text)val2).rectTransform.pivot = Vector2.zero;
			((TMP_Text)val2).fontStyle = (FontStyles)0;
			((TMP_Text)val2).enableAutoSizing = false;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val2).margin = new Vector4(2f, 2f, 0f, 0f);
			TextMeshProUGUI obj6 = val2;
			TextMeshProUGUI obj7 = val2;
			float num2 = (((TMP_Text)val2).fontSize = 18f);
			float fontSizeMax = (((TMP_Text)obj7).fontSizeMin = num2);
			((TMP_Text)obj6).fontSizeMax = fontSizeMax;
			GameObject val3 = new GameObject("Input Area");
			val3.transform.parent = ((Component)this).transform;
			inputAreaRectTransform = val3.AddComponent<RectTransform>();
			inputAreaRectTransform.sizeDelta = new Vector2(146.5f, 20f);
			inputAreaRectTransform.pivot = Vector2.zero;
			((Transform)inputAreaRectTransform).localPosition = new Vector3(2f, 2.5f, 0f) + val;
			((Component)inputAreaRectTransform).gameObject.AddComponent<RectMask2D>();
			((TMP_Text)val2).transform.SetParent((Transform)(object)inputAreaRectTransform);
			Transform transform2 = ((TMP_Text)val2).transform;
			Vector2 val5 = (((TMP_Text)val2).rectTransform.sizeDelta = Vector2.op_Implicit(Vector3.zero));
			transform2.localPosition = Vector2.op_Implicit(val5);
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSettingElement>());
			Object.Destroy((Object)(object)((Component)this).GetComponent<AudioButtonPushToTalk>());
			inputStringSystem = ((Component)this).gameObject.AddComponent<REPOInputStringSystem>();
			inputStringSystem.inputTMP = (TMP_Text)(object)val2;
			inputStringSystem.maskRectTransform = inputAreaRectTransform;
		}

		private void Update()
		{
			inputStringSystem.SetHovering(SemiFunc.UIMouseHover(menuPage, inputAreaRectTransform, (string)REPOReflection.menuSelectableElement_MenuID.GetValue(menuSelectableElement), 2f, 2f));
			if (Mouse.current.leftButton.wasPressedThisFrame)
			{
				inputStringSystem.isFocused = inputStringSystem.isHovering;
			}
		}
	}
	public sealed class REPOInputStringSystem : MonoBehaviour
	{
		public struct Colors
		{
			public Color focusedColor;

			public Color hoverColor;

			public Color unfocusedColor;

			public Color placeholderColor;

			public Color characterAddedColor;

			public Color characterRemovedColor;

			public Colors()
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: 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)
				focusedColor = Color.white;
				hoverColor = Color.white;
				unfocusedColor = new Color(0.5f, 0.5f, 0.5f);
				placeholderColor = new Color(1f, 0.6f, 0.4f);
				characterAddedColor = new Color(0.5f, 1f, 0.5f);
				characterRemovedColor = new Color(1f, 0.5f, 0.5f);
			}
		}

		public static bool hasAnyFocus;

		public TMP_Text inputTMP;

		public RectTransform maskRectTransform;

		public Action<string> onValueChanged;

		public Colors colors = new Colors();

		public string placeholder = string.Empty;

		public bool onlyNotifyOnSubmit;

		public bool disableMovement = true;

		private string previousValue;

		private float timeSinceCharacterAdded = 1f;

		private float timeSinceCharacterRemoved = 1f;

		private bool pressedSubmit;

		private bool _isFocused;

		public string currentValue { get; private set; }

		public bool isHovering { get; private set; }

		public bool isFocused
		{
			get
			{
				return _isFocused;
			}
			set
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				if (!value)
				{
					if (_isFocused)
					{
						MoveTMP(reset: true);
					}
				}
				else if (!isFocused)
				{
					if (IsTMPInMask())
					{
						MoveTMP(reset: true);
					}
					else
					{
						float num = 0f - inputTMP.GetPreferredValues(currentValue + "<b>|</b>").x;
						Rect rect = maskRectTransform.rect;
						MoveTMP(reset: true, num + ((Rect)(ref rect)).width - 6f);
					}
					((SemiUI)ChatUI.instance).Hide();
				}
				hasAnyFocus = (_isFocused = value);
			}
		}

		private bool shouldUsePlaceholder => string.IsNullOrEmpty(currentValue);

		public void SetValue(string value, bool notify)
		{
			string text2 = (currentValue = value);
			previousValue = text2;
			if (notify)
			{
				onValueChanged?.Invoke(value);
			}
		}

		public void SetHovering(bool value)
		{
			if (value && !isHovering)
			{
				MenuManager.instance.MenuEffectHover(SemiFunc.MenuGetPitchFromYPos(inputTMP.rectTransform), -1f);
			}
			isHovering = value;
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)inputTMP))
			{
				return;
			}
			if (disableMovement && isFocused)
			{
				InputManager instance = InputManager.instance;
				if (instance != null)
				{
					instance.DisableMovement();
				}
			}
			HandleInput();
			UpdateColors();
			if (pressedSubmit)
			{
				isFocused = false;
				pressedSubmit = false;
				if (onlyNotifyOnSubmit)
				{
					onValueChanged?.Invoke(currentValue);
				}
			}
			if (!onlyNotifyOnSubmit && previousValue != currentValue)
			{
				onValueChanged?.Invoke(currentValue);
			}
			if (isFocused)
			{
				inputTMP.text = currentValue;
				if (timeSinceCharacterAdded < 0.5f || timeSinceCharacterRemoved < 0.5f || Mathf.Sin(Time.time * 10f) > 0f)
				{
					TMP_Text obj = inputTMP;
					obj.text += "<b>|</b>";
				}
			}
			else
			{
				inputTMP.text = (shouldUsePlaceholder ? placeholder : currentValue);
			}
			previousValue = currentValue;
		}

		private void OnDestroy()
		{
			hasAnyFocus = false;
		}

		private void HandleInput()
		{
			//IL_012b: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			if (timeSinceCharacterAdded < 1f)
			{
				timeSinceCharacterAdded += Time.deltaTime;
			}
			if (timeSinceCharacterRemoved < 1f)
			{
				timeSinceCharacterRemoved += Time.deltaTime;
			}
			if (!isFocused)
			{
				return;
			}
			string previousText = currentValue;
			if (Keyboard.current.ctrlKey.isPressed)
			{
				if (((ButtonControl)Keyboard.current.cKey).wasPressedThisFrame)
				{
					GUIUtility.systemCopyBuffer = currentValue;
				}
				else if (((ButtonControl)Keyboard.current.xKey).wasPressedThisFrame)
				{
					GUIUtility.systemCopyBuffer = currentValue;
					currentValue = null;
					timeSinceCharacterRemoved = 0f;
					MoveTMP(reset: true);
				}
				else if (((ButtonControl)Keyboard.current.vKey).wasPressedThisFrame)
				{
					currentValue += GUIUtility.systemCopyBuffer.Replace("\n", string.Empty);
					timeSinceCharacterAdded = 0f;
					if (IsTMPInMask())
					{
						MoveTMP(reset: true);
						return;
					}
					float num = 0f - inputTMP.GetPreferredValues(currentValue + "<b>|</b>").x;
					Rect rect = maskRectTransform.rect;
					MoveTMP(reset: true, num + ((Rect)(ref rect)).width - 6f);
				}
				return;
			}
			string inputString = Input.inputString;
			if (!(inputString == "\b"))
			{
				if (inputString == "\r")
				{
					pressedSubmit = true;
				}
				else if (!string.IsNullOrEmpty(inputString))
				{
					currentValue += inputString;
					timeSinceCharacterAdded = 0f;
					if (IsTMPInMask())
					{
						MoveTMP(reset: true);
					}
					else
					{
						MoveTMP(reset: false, 0f - CalculateTMPDifference(previousText, currentValue));
					}
				}
			}
			else if (currentValue.Length > 0)
			{
				currentValue = currentValue.Remove(currentValue.Length - 1, 1);
				timeSinceCharacterRemoved = 0f;
				if (IsTMPInMask())
				{
					MoveTMP(reset: true);
				}
				else
				{
					MoveTMP(reset: false, 0f - CalculateTMPDifference(previousText, currentValue));
				}
			}
		}

		private void UpdateColors()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (timeSinceCharacterAdded < 0.1f)
			{
				((Graphic)inputTMP).color = colors.characterAddedColor;
			}
			else if (timeSinceCharacterRemoved < 0.1f)
			{
				((Graphic)inputTMP).color = colors.characterRemovedColor;
			}
			else if (isHovering)
			{
				((Graphic)inputTMP).color = colors.hoverColor;
			}
			else if (isFocused)
			{
				((Graphic)inputTMP).color = colors.focusedColor;
			}
			else
			{
				((Graphic)inputTMP).color = (shouldUsePlaceholder ? colors.placeholderColor : colors.unfocusedColor);
			}
		}

		private void MoveTMP(bool reset, float moveBy = 0f)
		{
			//IL_000e: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (reset)
			{
				inputTMP.transform.localPosition = Vector3.zero;
			}
			if (moveBy != 0f)
			{
				Transform transform = inputTMP.transform;
				transform.localPosition += Vector3.right * moveBy;
			}
		}

		private float CalculateTMPDifference(string previousText, string newText)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return inputTMP.GetPreferredValues(newText).x - inputTMP.GetPreferredValues(previousText).x;
		}

		private bool IsTMPInMask()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float x = inputTMP.GetPreferredValues(currentValue).x;
			Rect rect = maskRectTransform.rect;
			return x < ((Rect)(ref rect)).width - 6f;
		}
	}
	public sealed class REPOLabel : REPOElement
	{
		public TextMeshProUGUI labelTMP;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = (RectTransform)((Component)this).transform;
			labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			Vector2 sizeDelta = (((TMP_Text)labelTMP).rectTransform.pivot = (base.rectTransform.pivot = Vector2.zero));
			RectTransform obj = ((TMP_Text)labelTMP).rectTransform;
			RectTransform obj2 = base.rectTransform;
			((Vector2)(ref sizeDelta))..ctor(200f, 30f);
			obj2.sizeDelta = sizeDelta;
			obj.sizeDelta = sizeDelta;
			((TMP_Text)labelTMP).fontSize = 30f;
			TextMeshProUGUI obj3 = labelTMP;
			bool enableWordWrapping = (((TMP_Text)labelTMP).enableAutoSizing = false);
			((TMP_Text)obj3).enableWordWrapping = enableWordWrapping;
			((TMP_Text)labelTMP).alignment = (TextAlignmentOptions)513;
			((TMP_Text)labelTMP).margin = Vector4.zero;
		}

		private void Start()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((Transform)((TMP_Text)labelTMP).rectTransform).localPosition = Vector2.op_Implicit(Vector2.zero);
		}
	}
	public sealed class REPOObjectPreview : REPOElement
	{
		private PlayerAvatarMenuHover playerAvatarMenuHover;

		private Image backgroundImage;

		private RectTransform renderTextureRectTransform;

		private GameObject _previewObject;

		public GameObject previewObject
		{
			get
			{
				return _previewObject;
			}
			set
			{
				if (!((Object)(object)_previewObject == (Object)(object)value))
				{
					UpdatePreviewGameObject(value);
					_previewObject = value;
				}
			}
		}

		public bool enableBackgroundImage
		{
			get
			{
				return ((Behaviour)backgroundImage).enabled;
			}
			set
			{
				((Behaviour)backgroundImage).enabled = value;
			}
		}

		public Color backgroundImageColor
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return ((Graphic)backgroundImage).color;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Graphic)backgroundImage).color = value;
			}
		}

		public Vector2 previewSize
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return base.rectTransform.sizeDelta;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: 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_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: 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_004c: 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_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val;
				if (value.x > value.y)
				{
					val = value;
					val.y = value.x / (8f / 15f);
					value = val;
				}
				else
				{
					val = value;
					val.x = value.y * (8f / 15f);
					value = val;
				}
				RectTransform obj = renderTextureRectTransform;
				val = (base.rectTransform.sizeDelta = value);
				obj.sizeDelta = val;
				((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			}
		}

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			base.rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
			base.rectTransform.pivot = Vector2.right;
			RectTransform obj = base.rectTransform;
			Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero);
			obj.anchorMin = anchorMin;
			renderTextureRectTransform = (RectTransform)((Transform)base.rectTransform).GetChild(1);
			((Transform)renderTextureRectTransform).localPosition = Vector3.zero;
			playerAvatarMenuHover = ((Component)this).GetComponentInChildren<PlayerAvatarMenuHover>();
			((Component)playerAvatarMenuHover.playerAvatarMenu.cameraAndStuff).GetComponentInChildren<Camera>().farClipPlane = 100f;
			backgroundImage = ((Component)this).gameObject.AddComponent<Image>();
			((Behaviour)backgroundImage).enabled = false;
		}

		private void Start()
		{
			Transform transform = ((Component)playerAvatarMenuHover.playerAvatarMenu).transform;
			for (int i = 0; i < 3; i++)
			{
				Object.Destroy((Object)(object)((Component)transform.GetChild(i)).gameObject);
			}
		}

		private void OnDestroy()
		{
			if (!Object.op_Implicit((Object)(object)playerAvatarMenuHover) || !Object.op_Implicit((Object)(object)playerAvatarMenuHover.playerAvatarMenu))
			{
				return;
			}
			PlayerAvatarMenu playerAvatarMenu = playerAvatarMenuHover.playerAvatarMenu;
			if (Object.op_Implicit((Object)(object)playerAvatarMenu))
			{
				Transform cameraAndStuff = playerAvatarMenu.cameraAndStuff;
				if (Object.op_Implicit((Object)(object)cameraAndStuff))
				{
					Object.Destroy((Object)(object)((Component)cameraAndStuff).gameObject);
				}
				Object.Destroy((Object)(object)((Component)playerAvatarMenu).gameObject);
			}
		}

		private void UpdatePreviewGameObject(GameObject previewGameObject)
		{
			if (Object.op_Implicit((Object)(object)previewObject))
			{
				Object.Destroy((Object)(object)previewObject);
			}
			previewGameObject.transform.SetParent(((Component)playerAvatarMenuHover.playerAvatarMenu).transform, false);
			Rigidbody component = previewGameObject.GetComponent<Rigidbody>();
			if (component != null)
			{
				component.automaticInertiaTensor = false;
			}
		}
	}
	public sealed class REPOPopupPage : MonoBehaviour
	{
		public enum PresetSide
		{
			Left,
			Right
		}

		public delegate RectTransform ScrollViewBuilderDelegate(Transform scrollView);

		public delegate bool ShouldCloseMenuDelegate();

		public RectTransform rectTransform;

		public RectTransform maskRectTransform;

		public RectTransform scrollBarRectTransform;

		public MenuPage menuPage;

		public TextMeshProUGUI headerTMP;

		public MenuScrollBox menuScrollBox;

		public REPOScrollView scrollView;

		[Obsolete("Use onEscapePressed instead.")]
		public bool closeMenuOnEscape = true;

		public ShouldCloseMenuDelegate onEscapePressed;

		internal bool pageWasActivatedOnce;

		private GameObject pageDimmerGameObject;

		private RawImage pageDimmerRawImage;

		private RectTransform scrollBarFillRectTransform;

		private RectTransform scrollBarOutlineRectTransform;

		private Vector2 defaultMaskSizeDelta;

		private Vector2 defaultMaskPosition;

		private Padding _maskPadding;

		public bool pageDimmerVisibility
		{
			get
			{
				return pageDimmerGameObject.gameObject.activeSelf;
			}
			set
			{
				pageDimmerGameObject.gameObject.SetActive(value);
			}
		}

		public bool isCachedPage { get; internal set; }

		public float pageDimmerOpacity
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return ((Graphic)pageDimmerRawImage).color.a;
			}
			set
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				RawImage obj = pageDimmerRawImage;
				Color color = ((Graphic)pageDimmerRawImage).color;
				color.a = value;
				((Graphic)obj).color = color;
			}
		}

		public Padding maskPadding
		{
			get
			{
				return _maskPadding;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				Vector2 sizeDelta = defaultMaskSizeDelta;
				Vector2 val = defaultMaskPosition;
				sizeDelta.x -= value.left + value.right;
				sizeDelta.y -= value.top + value.bottom;
				if (value.left != 0f)
				{
					val.x += value.left;
				}
				if (value.bottom != 0f)
				{
					val.y += value.bottom;
				}
				maskRectTransform.sizeDelta = sizeDelta;
				((Transform)maskRectTransform).localPosition = Vector2.op_Implicit(val);
				_maskPadding = value;
				UpdateScrollBarPosition();
			}
		}

		public void OpenPage(bool openOnTop)
		{
			MenuAPI.OpenMenuPage(menuPage, openOnTop);
			pageWasActivatedOnce = true;
			scrollView.UpdateElements();
		}

		public void ClosePage(bool closePagesAddedOnTop)
		{
			MenuAPI.CloseMenuPage(menuPage, closePagesAddedOnTop);
		}

		public void AddElement(MenuAPI.BuilderDelegate builderDelegate)
		{
			builderDelegate?.Invoke(((Component)this).transform);
		}

		public void AddElement(RectTransform elementRectTransform, Vector2 localPosition = default(Vector2))
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			((Transform)elementRectTransform).SetParent(((Component)this).transform);
			((Transform)elementRectTransform).localPosition = Vector2.op_Implicit(localPosition);
		}

		public void AddElementToScrollView(ScrollViewBuilderDelegate scrollViewBuilderDelegate, float topPadding = 0f, float bottomPadding = 0f)
		{
			object obj;
			if (scrollViewBuilderDelegate == null)
			{
				obj = null;
			}
			else
			{
				RectTransform obj2 = scrollViewBuilderDelegate((Transform)(object)menuScrollBox.scroller);
				obj = ((obj2 != null) ? ((Component)obj2).gameObject.AddComponent<REPOScrollViewElement>() : null);
			}
			REPOScrollViewElement rEPOScrollViewElement = (REPOScrollViewElement)obj;
			if (rEPOScrollViewElement != null)
			{
				rEPOScrollViewElement.onSettingChanged = scrollView.UpdateElements;
				rEPOScrollViewElement.topPadding = topPadding;
				rEPOScrollViewElement.bottomPadding = bottomPadding;
			}
		}

		public void AddElementToScrollView(RectTransform elementRectTransform, Vector2 localPosition = default(Vector2), float topPadding = 0f, float bottomPadding = 0f)
		{
			//IL_0039: 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)
			REPOScrollViewElement rEPOScrollViewElement = ((Component)elementRectTransform).gameObject.AddComponent<REPOScrollViewElement>();
			if (rEPOScrollViewElement != null)
			{
				rEPOScrollViewElement.onSettingChanged = scrollView.UpdateElements;
				((Transform)elementRectTransform).SetParent((Transform)(object)menuScrollBox.scroller);
				((Transform)elementRectTransform).localPosition = Vector2.op_Implicit(localPosition);
				rEPOScrollViewElement.topPadding = topPadding;
				rEPOScrollViewElement.bottomPadding = bottomPadding;
			}
		}

		private void Awake()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0159: 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_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			menuPage = ((Component)this).GetComponent<MenuPage>();
			headerTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>();
			menuScrollBox = ((Component)this).GetComponentInChildren<MenuScrollBox>();
			rectTransform = (RectTransform)new GameObject("Page Content", new Type[1] { typeof(RectTransform) }).transform;
			((Transform)rectTransform).SetParent(((Component)this).transform);
			((Component)this).transform.Find("Panel").SetParent((Transform)(object)rectTransform);
			((TMP_Text)headerTMP).transform.parent.SetParent((Transform)(object)rectTransform);
			((Component)menuScrollBox).transform.SetParent((Transform)(object)rectTransform);
			pageDimmerGameObject = ((Component)Object.Instantiate<RectTransform>(REPOTemplates.pageDimmerTemplate, ((Component)this).transform)).gameObject;
			pageDimmerGameObject.transform.SetAsFirstSibling();
			pageDimmerRawImage = pageDimmerGameObject.GetComponentInChildren<RawImage>();
			menuPage.menuPageIndex = (MenuPageIndex)(-1);
			RectTransform scroller = menuScrollBox.scroller;
			for (int i = 2; i < ((Transform)scroller).childCount; i++)
			{
				Object.Destroy((Object)(object)((Component)((Transform)scroller).GetChild(i)).gameObject);
			}
			scrollView = ((Component)scroller).gameObject.AddComponent<REPOScrollView>();
			scrollView.popupPage = this;
			maskRectTransform = (RectTransform)((Transform)scroller).parent;
			defaultMaskSizeDelta = maskRectTransform.sizeDelta;
			defaultMaskPosition = Vector2.op_Implicit(((Transform)maskRectTransform).localPosition);
			menuScrollBox.scroller.sizeDelta = maskRectTransform.sizeDelta;
			scrollBarRectTransform = (RectTransform)menuScrollBox.scrollBar.transform;
			scrollBarFillRectTransform = (RectTransform)((Transform)scrollBarRectTransform).Find("Scroll Bar Bg (2)");
			scrollBarOutlineRectTransform = (RectTransform)((Transform)scrollBarRectTransform).Find("Scroll Bar Bg (1)");
			maskPadding = new Padding(0f, 0f, 0f, 25f);
			Object.Destroy((Object)(object)((Component)this).GetComponent<MenuPageSettingsPage>());
			MenuAPI.customMenuPages.Add(menuPage, this);
		}

		private void Start()
		{
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			REPOReflection.menuScrollBox_ScrollerEndPosition.SetValue(menuScrollBox, 0);
			RectTransform scroller = menuScrollBox.scroller;
			Vector3 localPosition = ((Transform)menuScrollBox.scroller).localPosition;
			localPosition.y = 0f;
			((Transform)scroller).localPosition = localPosition;
			REPOReflection.menuPage_ScrollBoxes.SetValue(menuPage, 2);
			if (!pageWasActivatedOnce)
			{
				menuPage.PageStateSet((PageState)2);
			}
			scrollView.SetScrollPosition(0f);
		}

		private void Update()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_002a: Invalid comparison between Unknown and I4
			if (closeMenuOnEscape)
			{
				PageState val = (PageState)REPOReflection.menuPage_CurrentPageState.GetValue(menuPage);
				if (SemiFunc.InputDown((InputKey)18) && (int)val != 2 && (onEscapePressed == null || onEscapePressed()))
				{
					ClosePage(closePagesAddedOnTop: false);
				}
			}
		}

		private void OnDestroy()
		{
			MenuAPI.customMenuPages.Remove(menuPage);
		}

		private void UpdateScrollBarPosition()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0051: 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_0078: 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_007f: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)scrollBarRectTransform))
			{
				RectTransform obj = scrollBarRectTransform;
				Vector3 localPosition = ((Transform)scrollBarRectTransform).localPosition;
				localPosition.y = ((Transform)maskRectTransform).localPosition.y;
				((Transform)obj).localPosition = localPosition;
				Vector2 sizeDelta = scrollBarRectTransform.sizeDelta;
				sizeDelta.y = maskRectTransform.sizeDelta.y;
				RectTransform scrollBarBackground = menuScrollBox.scrollBarBackground;
				RectTransform obj2 = scrollBarFillRectTransform;
				Vector2 val2 = (scrollBarRectTransform.sizeDelta = sizeDelta);
				Vector2 sizeDelta2 = (obj2.sizeDelta = val2);
				scrollBarBackground.sizeDelta = sizeDelta2;
				scrollBarOutlineRectTransform.sizeDelta = sizeDelta + new Vector2(4f, 4f);
			}
		}
	}
	public sealed class REPOScrollView : MonoBehaviour
	{
		public REPOPopupPage popupPage;

		public float? scrollSpeed;

		private REPOScrollViewElement[] scrollViewElements = Array.Empty<REPOScrollViewElement>();

		private float _spacing;

		public float spacing
		{
			get
			{
				return _spacing;
			}
			set
			{
				if (!(Math.Abs(_spacing - value) < float.Epsilon))
				{
					_spacing = value;
					UpdateElements();
				}
			}
		}

		public void UpdateElements()
		{
			//IL_001e: 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)
			//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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			scrollViewElements = ((Component)this).GetComponentsInChildren<REPOScrollViewElement>(true);
			float num = 0f;
			float num2 = popupPage.maskRectTransform.sizeDelta.y;
			REPOScrollViewElement[] array = scrollViewElements;
			Rect rect;
			foreach (REPOScrollViewElement rEPOScrollViewElement in array)
			{
				if (rEPOScrollViewElement.visibility)
				{
					Vector3 localPosition = ((Transform)rEPOScrollViewElement.rectTransform).localPosition;
					num2 -= rEPOScrollViewElement.topPadding;
					float num3 = num2;
					rect = rEPOScrollViewElement.rectTransform.rect;
					num2 = num3 - ((Rect)(ref rect)).height;
					num = (localPosition.y = num2);
					num2 -= rEPOScrollViewElement.bottomPadding;
					num2 -= spacing;
					((Transform)rEPOScrollViewElement.rectTransform).localPosition = localPosition;
				}
			}
			GameObject gameObject = ((Component)popupPage.scrollBarRectTransform).gameObject;
			MenuScrollBox menuScrollBox = popupPage.menuScrollBox;
			RectTransform scroller = menuScrollBox.scroller;
			float num4 = num;
			if (!(num4 < 0f))
			{
				if (num4 >= 0f && gameObject.activeSelf)
				{
					((Component)popupPage.scrollBarRectTransform).gameObject.SetActive(false);
					Vector3 localPosition2 = ((Transform)scroller).localPosition;
					localPosition2.y = 0f;
					((Transform)scroller).localPosition = localPosition2;
				}
			}
			else if (!gameObject.activeSelf)
			{
				((Component)popupPage.scrollBarRectTransform).gameObject.SetActive(true);
			}
			FieldInfo menuScrollBox_ScrollerStartPosition = REPOReflection.menuScrollBox_ScrollerStartPosition;
			float num5 = num;
			rect = menuScrollBox.scrollHandle.rect;
			float height = ((Rect)(ref rect)).height;
			rect = menuScrollBox.scrollBarBackground.rect;
			menuScrollBox_ScrollerStartPosition.SetValue(menuScrollBox, Math.Abs(num5 / (1f - height / ((Rect)(ref rect)).height)));
		}

		public void SetScrollPosition(float normalizedPosition)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			normalizedPosition = Mathf.Clamp(1f - normalizedPosition, 0f, 1f);
			Rect rect = popupPage.menuScrollBox.scrollBarBackground.rect;
			float height = ((Rect)(ref rect)).height;
			float num = normalizedPosition * height;
			float num2 = popupPage.menuScrollBox.scrollHandle.sizeDelta.y / 2f;
			if (num < num2)
			{
				num = num2;
			}
			else if (num > height - num2)
			{
				num = height - num2;
			}
			REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(popupPage.menuScrollBox, num);
		}

		private void OnTransformChildrenChanged()
		{
			UpdateElements();
		}

		private void Update()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			RectTransform maskRectTransform = popupPage.maskRectTransform;
			REPOScrollViewElement[] array = scrollViewElements;
			foreach (REPOScrollViewElement rEPOScrollViewElement in array)
			{
				if (!rEPOScrollViewElement.visibility)
				{
					continue;
				}
				Vector3 position = ((Component)rEPOScrollViewElement).transform.position;
				bool num = position.y <= ((Transform)maskRectTransform).position.y + maskRectTransform.sizeDelta.y + 50f && position.y >= ((Transform)maskRectTransform).position.y - 50f;
				GameObject gameObject = ((Component)rEPOScrollViewElement).gameObject;
				if (!num)
				{
					if (gameObject.activeSelf)
					{
						gameObject.SetActive(false);
					}
				}
				else if (!gameObject.activeSelf)
				{
					gameObject.SetActive(true);
				}
			}
		}
	}
	public sealed class REPOScrollViewElement : MonoBehaviour
	{
		public RectTransform rectTransform;

		internal Action onSettingChanged;

		private bool _visibility = true;

		private float _topPadding;

		private float _bottomPadding;

		public float topPadding
		{
			get
			{
				return _topPadding;
			}
			set
			{
				if (!(Math.Abs(_topPadding - value) < float.Epsilon))
				{
					_topPadding = value;
					onSettingChanged?.Invoke();
				}
			}
		}

		public float bottomPadding
		{
			get
			{
				return _bottomPadding;
			}
			set
			{
				if (!(Math.Abs(_bottomPadding - value) < float.Epsilon))
				{
					_bottomPadding = value;
					onSettingChanged?.Invoke();
				}
			}
		}

		public bool visibility
		{
			get
			{
				return _visibility;
			}
			set
			{
				if (_visibility != value)
				{
					_visibility = value;
					((Component)this).gameObject.SetActive(value);
					onSettingChanged?.Invoke();
				}
			}
		}

		private void Awake()
		{
			ref RectTransform reference = ref rectTransform;
			Transform transform = ((Component)this).transform;
			reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		private void OnRectTransformDimensionsChange()
		{
			onSettingChanged?.Invoke();
		}
	}
	public sealed class REPOSlider : REPOElement
	{
		public enum BarBehavior
		{
			UpdateWithValue,
			StaticAtMinimum,
			StaticAtMaximum
		}

		public TextMeshProUGUI labelTMP;

		public TextMeshProUGUI descriptionTMP;

		public REPOTextScroller repoTextScroller;

		public Action<float> onValueChanged;

		public BarBehavior barBehavior;

		public float value;

		public string prefix;

		public string postfix;

		private RectTransform barRectTransform;

		private RectTransform barSizeRectTransform;

		private RectTransform barPointerRectTransform;

		private RectTransform barMaskRectTransform;

		private RectTransform sliderBackgroundRectTransform;

		private RectTransform backgroundFillRectTransform;

		private RectTransform backgroundOutlineRectTransform;

		private TextMeshProUGUI valueTMP;

		private TextMeshProUGUI maskedValueTMP;

		private MenuPage menuPage;

		private MenuSelectableElement menuSelectableElement;

		private float _min;

		private float _max = 1f;

		private float previousValue;

		private float _precisionDecimal = 0.01f;

		private int _precision = 2;

		private string[] _stringOptions = Array.Empty<string>();

		private string currentDescription;

		private bool isHovering;

		public float min
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _min;
				}
				return 0f;
			}
			set
			{
				_min = value;
			}
		}

		public float max
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _max;
				}
				return stringOptions.Length - 1;
			}
			set
			{
				_max = value;
			}
		}

		public string[] stringOptions
		{
			get
			{
				return _stringOptions;
			}
			set
			{
				_stringOptions = value;
				UpdateBarText();
			}
		}

		public int precision
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _precision;
				}
				return 0;
			}
			set
			{
				precisionDecimal = ((value == 0) ? 1f : Mathf.Pow(10f, (float)(-value)));
				_precision = value;
			}
		}

		public float precisionDecimal
		{
			get
			{
				string[] array = stringOptions;
				if (array == null || array.Length == 0)
				{
					return _precisionDecimal;
				}
				return 1f;
			}
			set
			{
				_precisionDecimal = value;
			}
		}

		private float normalizedValue => (value - min) / (max - min);

		private bool hasValueChanged => Math.Abs(value - previousValue) > float.Epsilon;

		public void SetValue(float newValue, bool invokeCallback)
		{
			newValue = Mathf.Clamp(newValue, min, max);
			if (invokeCallback && Math.Abs(value - newValue) > float.Epsilon)
			{
				onValueChanged(newValue);
			}
			previousValue = (value = newValue);
			UpdateBarVisual();
			UpdateBarText();
		}

		public void Decrement()
		{
			float num = value - precisionDecimal;
			if (Math.Abs(value - min) < float.Epsilon)
			{
				num = max;
			}
			else if (num < min)
			{
				num = min;
			}
			SetValue(num, invokeCallback: true);
		}

		public void Increment()
		{
			float num = value + precisionDecimal;
			if (Math.Abs(max - value) < float.Epsilon)
			{
				num = min;
			}
			else if (num > max)
			{
				num = max;
			}
			SetValue(num, invokeCallback: true);
		}

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Expected O, but got Unknown
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown resul