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.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.1.3")] [assembly: AssemblyInformationalVersion("1.0.0+1c3cccb19d32c31034b7c6293f1b024625e498de")] [assembly: AssemblyProduct("MenuLib")] [assembly: AssemblyTitle("MenuLib")] [assembly: AssemblyVersion("2.1.3.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.1.3")] internal sealed class Entry : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action, MenuPageMain> <0>__MenuPageMain_StartHook; public static Action, MenuPageEsc> <1>__MenuPageEsc_StartHook; public static Action, MenuPageLobby> <2>__MenuPageLobby_StartHook; public static Manipulator <3>__SemiFunc_UIMouseHoverILHook; public static Manipulator <4>__MenuPage_StateClosingILHook; public static Manipulator <5>__MenuScrollBox_UpdateILHook; } private const string MOD_NAME = "Menu Lib"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("Menu Lib"); private static void MenuPageMain_StartHook(Action orig, MenuPageMain self) { orig(self); MenuAPI.mainMenuBuilderDelegates?.Invoke(((Component)self).transform); } private static void MenuPageEsc_StartHook(Action orig, MenuPageEsc self) { orig(self); MenuAPI.escapeMenuBuilderDelegates?.Invoke(((Component)self).transform); } private static void MenuPageLobby_StartHook(Action 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[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)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[1] { (Instruction instruction) => ILPatternMatchingExt.MatchLdfld(instruction, "stateStart") }); val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)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[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, "Destroy") }); val.Index -= 5; val.RemoveRange(6); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)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[2] { (Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0), (Instruction instruction) => ILPatternMatchingExt.MatchLdfld(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[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(OpCodes.Ldfld, "parentPage"); val.EmitDelegate>((Action)delegate(MenuScrollBox menuScrollBox, MenuPage menuPage) { //IL_0081: 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) float num = SemiFunc.InputMovementY(); float num2 = SemiFunc.InputScrollY(); float num5; if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value)) { float? scrollSpeed = value.scrollView.scrollSpeed; if (scrollSpeed.HasValue) { float valueOrDefault = scrollSpeed.GetValueOrDefault(); valueOrDefault *= 10f; float num3 = Mathf.Abs((float)REPOReflection.menuScrollBox_ScrollerEndPosition.GetValue(menuScrollBox) - (float)REPOReflection.menuScrollBox_ScrollerStartPosition.GetValue(menuScrollBox)); float num4 = (num + (float)Math.Sign(num2)) * valueOrDefault / num3; Rect rect = menuScrollBox.scrollBarBackground.rect; num5 = num4 * ((Rect)(ref rect)).height; goto IL_00c1; } } float num6 = (float)REPOReflection.menuScrollBox_ScrollHeight.GetValue(menuScrollBox); num5 = num * 20f / (num6 * 0.01f) + num2 / (num6 * 0.01f); goto IL_00c1; IL_00c1: float num7 = (float)REPOReflection.menuScrollBox_ScrollHandleTargetPosition.GetValue(menuScrollBox); REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(menuScrollBox, num7 + num5); }); val.GotoPrev(new Func[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputMovementY") }); ILLabel val5 = val.MarkLabel(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, "scrollBoxActive"); val.Emit(OpCodes.Brfalse_S, (object)val4); val.GotoPrev((MoveType)2, new Func[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, "GetMouseButton") }); val.Remove(); val.Emit(OpCodes.Brfalse, (object)val5); val.GotoNext((MoveType)2, new Func[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "UIMouseHover") }); val.Remove(); val.Emit(OpCodes.Brfalse, (object)val5); } 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //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 logger.LogDebug((object)"Hooking `MenuPageMain.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action, MenuPageMain>(MenuPageMain_StartHook)); logger.LogDebug((object)"Hooking `MenuPageEsc.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageEsc), "Start", (Type[])null, (Type[])null), (Delegate)new Action, MenuPageEsc>(MenuPageEsc_StartHook)); logger.LogDebug((object)"Hooking `MenuPageLobby.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageLobby), "Start", (Type[])null, (Type[])null), (Delegate)new Action, MenuPageLobby>(MenuPageLobby_StartHook)); logger.LogDebug((object)"Hooking `SemiFunc.UIMouseHover`"); MethodInfo methodInfo = AccessTools.Method(typeof(SemiFunc), "UIMouseHover", (Type[])null, (Type[])null); object obj = <>O.<3>__SemiFunc_UIMouseHoverILHook; if (obj == null) { Manipulator val = SemiFunc_UIMouseHoverILHook; <>O.<3>__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.<4>__MenuPage_StateClosingILHook; if (obj2 == null) { Manipulator val2 = MenuPage_StateClosingILHook; <>O.<4>__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.<5>__MenuScrollBox_UpdateILHook; if (obj3 == null) { Manipulator val3 = MenuScrollBox_UpdateILHook; <>O.<5>__MenuScrollBox_UpdateILHook = val3; obj3 = (object)val3; } new ILHook((MethodBase)methodInfo3, (Manipulator)obj3); } } public static class MenuAPI { public delegate void BuilderDelegate(Transform parent); internal static BuilderDelegate mainMenuBuilderDelegates; internal static BuilderDelegate lobbyMenuBuilderDelegate; internal static BuilderDelegate escapeMenuBuilderDelegates; internal static readonly Dictionary customMenuPages = new Dictionary(); private static MenuButtonPopUp menuButtonPopup; public static void AddElementToMainMenu(BuilderDelegate builderDelegate) { mainMenuBuilderDelegates = (BuilderDelegate)Delegate.Combine(mainMenuBuilderDelegates, builderDelegate); } public static void AddElementToLobbyMenu(BuilderDelegate builderDelegate) { lobbyMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(lobbyMenuBuilderDelegate, builderDelegate); } public static void AddElementToEscapeMenu(BuilderDelegate builderDelegate) { escapeMenuBuilderDelegates = (BuilderDelegate)Delegate.Combine(escapeMenuBuilderDelegates, 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.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(REPOTemplates.buttonTemplate, parent); ((Object)obj).name = "Menu Button - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOButton rEPOButton = ((Component)obj).gameObject.AddComponent(); ((TMP_Text)rEPOButton.labelTMP).text = text; rEPOButton.onClick = onClick; return rEPOButton; } public static REPOToggle CreateREPOToggle(string text, Action 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(REPOTemplates.toggleTemplate, parent); ((Object)obj).name = "Menu Toggle - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOToggle rEPOToggle = ((Component)obj).gameObject.AddComponent(); ((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 REPOSlider CreateREPOSlider(string text, string description, Action 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(REPOTemplates.sliderTemplate, parent); ((Object)obj).name = "Float Slider - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent(); ((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 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(REPOTemplates.sliderTemplate, parent); ((Object)obj).name = "Int Slider - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent(); ((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 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(REPOTemplates.sliderTemplate, parent); ((Object)val).name = "Option Slider - " + text; ((Transform)val).localPosition = Vector2.op_Implicit(localPosition); REPOSlider repoSlider = ((Component)val).gameObject.AddComponent(); ((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 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(REPOTemplates.sliderTemplate, parent); ((Object)obj).name = "Option Slider - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent(); ((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(REPOTemplates.labelTemplate, parent); ((Object)obj).name = "Label - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOLabel rEPOLabel = ((Component)obj).gameObject.AddComponent(); ((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(); ((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_0055: 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_005a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate(REPOTemplates.popupPageTemplate, ((Component)MenuHolder.instance).transform); ((Object)obj).name = "Menu Page " + headerText; REPOPopupPage rEPOPopupPage = ((Component)obj).gameObject.AddComponent(); ((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; customMenuPages.Add(rEPOPopupPage.menuPage, rEPOPopupPage); 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) Transform obj = Object.Instantiate(REPOTemplates.avatarPreviewTemplate, parent); ((Object)obj).name = "Player Avatar Preview"; REPOAvatarPreview rEPOAvatarPreview = ((Component)obj).gameObject.AddComponent(); ((Transform)rEPOAvatarPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition); rEPOAvatarPreview.enableBackgroundImage = enableBackgroundImage; rEPOAvatarPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white); return rEPOAvatarPreview; } 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 list = REPOReflection.menuManager_AddedPagesOnTop.GetValue(MenuManager.instance) as List; 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 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_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected I4, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown foreach (MenuPages menuPage in MenuManager.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; 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 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_004f: Unknown result type (might be due to invalid IL or missing references) base.rectTransform = ((Component)this).gameObject.AddComponent(); base.rectTransform.pivot = Vector2.right; RectTransform obj = base.rectTransform; Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero); obj.anchorMin = anchorMin; base.rectTransform.sizeDelta = new Vector2(184f, 345f); playerAvatarMenu = ((Component)this).GetComponentInChildren().playerAvatarMenu; playerAvatarVisuals = ((Component)playerAvatarMenu).GetComponentInChildren(); backgroundImage = ((Component)this).gameObject.AddComponent(); ((Behaviour)backgroundImage).enabled = false; } private void Start() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((Transform)base.rectTransform).GetChild(0).localPosition = Vector3.zero; } 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