using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.NetworkInformation; using System.Net.Sockets; using System.Numerics; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; using BabyStepsMultiplayerClient; using BabyStepsMultiplayerClient.Audio; using BabyStepsMultiplayerClient.Components; using BabyStepsMultiplayerClient.Config; using BabyStepsMultiplayerClient.Extensions; using BabyStepsMultiplayerClient.Localization; using BabyStepsMultiplayerClient.Networking; using BabyStepsMultiplayerClient.Player; using BabyStepsMultiplayerClient.UI; using BabyStepsMultiplayerClient.UI.Elements; using Concentus.Enums; using Concentus.Structs; using HarmonyLib; using Il2Cpp; using Il2CppBabySteps.Core.Audio; using Il2CppCinemachine; using Il2CppFMOD; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppNWH.DWP2.WaterObjects; using Il2CppRewired; using Il2CppSteamworks; using Il2CppSystem; using Il2CppSystem.Collections; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using LiteNetLib; using LiteNetLib.Layers; using LiteNetLib.Utils; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Tomlet; using Tomlet.Models; using Unity.LiveCapture.ARKitFaceCapture; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "BabyStepsMultiplayerClient", "1.2.4", "Caleb Orchard", "https://github.com/caleborchard/Baby-Steps-Multiplayer-Mod-Client")] [assembly: MelonGame("DefaultCompany", "BabySteps")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Caleb Orchard")] [assembly: AssemblyConfiguration("Retail - Debug")] [assembly: AssemblyDescription("A MelonLoader mod for Baby Steps that adds multiplayer to the game.")] [assembly: AssemblyFileVersion("1.2.4")] [assembly: AssemblyInformationalVersion("1.2.4+931a551492ce62dccc6d631d92b57b4fb3a16b8c")] [assembly: AssemblyProduct("BabyStepsMultiplayerClient")] [assembly: AssemblyTitle("BabyStepsMultiplayerClient")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/caleborchard/Baby-Steps-Multiplayer-Mod-Client")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BabyStepsMultiplayerClient { public class Core : MelonMod { public const string SERVER_VERSION = "106"; public static string CLIENT_VERSION; public const string cloneText = "(Clone)"; public static Instance logger; public static UIManager uiManager; public static NetworkManager networkManager; public static Action OnConnectionStateChanged; public override void OnLateInitializeMelon() { CLIENT_VERSION = ((MelonBase)this).Info.Version; logger = ((MelonBase)this).LoggerInstance; try { ((MelonBase)this).HarmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception value) { logger.Error($"Harmony patching failed: {value}"); } ManagedEnumerator.Register(); uiManager = new UIManager(); networkManager = new NetworkManager(); MultiplayerMenu.Initialize(); logger.Msg("Initialized!"); VersionCheck.CheckForUpdate(); } public override void OnGUI() { if (uiManager != null) { uiManager.Draw(); } } public override void OnUpdate() { if (uiManager == null || networkManager == null) { return; } uiManager.Update(); networkManager.Update(); MultiplayerMenu.Update(); if (LocalPlayer.Instance != null) { LocalPlayer.Instance.Update(); } if (MelonDebug.IsEnabled()) { if (Input.GetKeyDown((KeyCode)284)) { networkManager.Connect(ModSettings.connection.Address.Value, ModSettings.connection.Port.Value, ModSettings.connection.Password.Value); } if (Input.GetKeyDown((KeyCode)285)) { networkManager.Disconnect(); } } } public override void OnLateUpdate() { if (networkManager != null) { if (LocalPlayer.Instance != null) { LocalPlayer.Instance.LateUpdate(); } networkManager.LateUpdate(); } } public override void OnApplicationQuit() { if (networkManager != null) { networkManager.Disconnect(); } } public static bool HasLoadedGame() { if ((Object)(object)Menu.me == (Object)null) { return false; } return Menu.me.gameInProgress; } public static void DebugMsg(string msg) { logger.Msg(msg); } public static bool RegisterComponent(params Type[] interfaces) where T : class { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0021: Expected O, but got Unknown try { RegisterTypeOptions val = new RegisterTypeOptions(); val.set_LogSuccess(true); val.set_Interfaces(Il2CppInterfaceCollection.op_Implicit(interfaces)); ClassInjector.RegisterTypeInIl2Cpp(val); } catch (Exception value) { logger.Error($"Exception while attempting to Register {typeof(T).Name}: {value}"); return false; } return true; } } public static class ModSettings { public static readonly ConnectionConfig connection = new ConnectionConfig(); public static readonly PlayerConfig player = new PlayerConfig(); public static readonly AudioConfig audio = new AudioConfig(); public static void Load() { connection.Load(); player.Load(); audio.Load(); } public static void Save() { connection.Save(); player.Save(); audio.Save(); } } } namespace BabyStepsMultiplayerClient.UI { internal static class InputBindingHelper { private static readonly bool CaptureLoggingEnabled = true; private const string RewiredActionPrefix = "RWACTION:"; private const string RewiredButtonPrefix = "RWBTN:"; private const string RewiredAxisPrefix = "RWAXIS:"; private const float AxisThreshold = 0.5f; private const int MaxRawRewiredButtonId = 1023; private static readonly Dictionary _previousState = new Dictionary(); private static readonly int[] _inputActionIds = BuildInputActionIdList(); private static readonly KeyCode[] _joystickButtonKeyCodes = BuildJoystickButtonKeyCodes(); public static bool IsInputHeldForCapture() { if (Input.anyKey) { return true; } for (int i = 0; i < _joystickButtonKeyCodes.Length; i++) { if (Input.GetKey(_joystickButtonKeyCodes[i])) { return true; } } return false; } public static bool TryCapturePressedBinding(out string binding, out string displayName) { //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) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _joystickButtonKeyCodes.Length; i++) { KeyCode val = _joystickButtonKeyCodes[i]; if (Input.GetKeyDown(val)) { binding = ((object)(KeyCode)(ref val)).ToString(); displayName = ((object)(KeyCode)(ref val)).ToString(); LogCapture("joystick-keycode", binding, displayName); return true; } } foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { KeyCode val2 = value; if ((int)val2 == 0 || IsJoystickKeyCode(val2) || !Input.GetKeyDown(val2)) { continue; } binding = ((object)(KeyCode)(ref val2)).ToString(); displayName = ((object)(KeyCode)(ref val2)).ToString(); LogCapture("keyboard", binding, displayName); return true; } Menu me = Menu.me; Player val3 = ((me != null) ? me.rwPlayer : null); if (val3 != null) { for (int j = 0; j < _inputActionIds.Length; j++) { int num = _inputActionIds[j]; if (val3.GetButtonDown(num)) { if (!TryGetInputActionName(num, out var actionName)) { actionName = "Action_" + num; } if (!IsAxisLikeAction(num, actionName)) { binding = "RWACTION:" + actionName; displayName = FormatActionDisplayName(actionName); LogCapture("rewired-action", binding, displayName); return true; } } } if (TryCaptureAxisDown(out binding, out displayName)) { return true; } for (int k = 0; k <= 1023; k++) { if (val3.GetButtonDown(k)) { binding = "RWBTN:" + k; displayName = GetRewiredButtonDisplayName(k); LogCapture("rewired-raw-button", binding, displayName); return true; } } } binding = null; displayName = null; return false; } public static bool IsPressed(string binding) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (TryParseKeyCode(binding, out var keyCode)) { return Input.GetKey(keyCode); } if (TryParseRewiredButton(binding, out var actionId)) { Menu me = Menu.me; int result; if (me == null) { result = 0; } else { Player rwPlayer = me.rwPlayer; result = (((rwPlayer != null) ? new bool?(rwPlayer.GetButton(actionId)) : null).GetValueOrDefault() ? 1 : 0); } return (byte)result != 0; } if (TryParseRewiredAction(binding, out var actionName) && TryGetInputActionId(actionName, out var actionId2)) { Menu me2 = Menu.me; int result2; if (me2 == null) { result2 = 0; } else { Player rwPlayer2 = me2.rwPlayer; result2 = (((rwPlayer2 != null) ? new bool?(rwPlayer2.GetButton(actionId2)) : null).GetValueOrDefault() ? 1 : 0); } return (byte)result2 != 0; } if (TryParseRewiredAxis(binding, out var axisId, out var direction)) { Menu me3 = Menu.me; Player val = ((me3 != null) ? me3.rwPlayer : null); if (val == null) { return false; } float axis = val.GetAxis(axisId); return (direction > 0) ? (axis > 0.5f) : (axis < -0.5f); } return false; } public static bool IsDown(string binding) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (TryParseKeyCode(binding, out var keyCode)) { return Input.GetKeyDown(keyCode); } if (TryParseRewiredButton(binding, out var actionId)) { Menu me = Menu.me; int result; if (me == null) { result = 0; } else { Player rwPlayer = me.rwPlayer; result = (((rwPlayer != null) ? new bool?(rwPlayer.GetButtonDown(actionId)) : null).GetValueOrDefault() ? 1 : 0); } return (byte)result != 0; } if (TryParseRewiredAction(binding, out var actionName) && TryGetInputActionId(actionName, out var actionId2)) { Menu me2 = Menu.me; int result2; if (me2 == null) { result2 = 0; } else { Player rwPlayer2 = me2.rwPlayer; result2 = (((rwPlayer2 != null) ? new bool?(rwPlayer2.GetButtonDown(actionId2)) : null).GetValueOrDefault() ? 1 : 0); } return (byte)result2 != 0; } if (TryParseRewiredAxis(binding, out var _, out var _)) { bool flag = IsPressed(binding); _previousState.TryGetValue(binding, out var value); _previousState[binding] = flag; return flag && !value; } return false; } public static bool IsControllerBinding(string binding) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(binding)) { return false; } if (TryParseKeyCode(binding, out var keyCode)) { return IsJoystickKeyCode(keyCode); } if (binding.StartsWith("RWACTION:", StringComparison.Ordinal) || binding.StartsWith("RWBTN:", StringComparison.Ordinal) || binding.StartsWith("RWAXIS:", StringComparison.Ordinal)) { return true; } return false; } public static string GetDisplayName(string binding) { if (TryParseRewiredAction(binding, out var actionName)) { return FormatActionDisplayName(actionName); } if (TryParseRewiredButton(binding, out var actionId)) { return GetRewiredButtonDisplayName(actionId); } if (TryParseRewiredAxis(binding, out var axisId, out var direction)) { switch (axisId) { case 13: return (direction > 0) ? "AXIS Up" : "AXIS Down"; case 12: return (direction > 0) ? "AXIS Right" : "AXIS Left"; } } return binding; } private static bool TryParseKeyCode(string binding, out KeyCode keyCode) { if (string.IsNullOrWhiteSpace(binding)) { keyCode = (KeyCode)0; return false; } if (!Enum.TryParse(binding, ignoreCase: true, out keyCode)) { return false; } return (int)keyCode != 0; } private static bool TryParseRewiredButton(string binding, out int actionId) { actionId = -1; if (string.IsNullOrWhiteSpace(binding) || !binding.StartsWith("RWBTN:", StringComparison.Ordinal)) { return false; } return int.TryParse(binding.Substring("RWBTN:".Length), out actionId); } private static bool TryParseRewiredAction(string binding, out string actionName) { actionName = null; if (string.IsNullOrWhiteSpace(binding) || !binding.StartsWith("RWACTION:", StringComparison.Ordinal)) { return false; } actionName = binding.Substring("RWACTION:".Length); return !string.IsNullOrWhiteSpace(actionName); } private static bool TryParseRewiredAxis(string binding, out int axisId, out int direction) { axisId = -1; direction = 0; if (string.IsNullOrWhiteSpace(binding) || !binding.StartsWith("RWAXIS:", StringComparison.Ordinal)) { return false; } string text = binding.Substring("RWAXIS:".Length); string[] array = text.Split(':'); if (array.Length != 2) { return false; } if (!int.TryParse(array[0], out axisId)) { return false; } if (array[1] == "+") { direction = 1; return true; } if (array[1] == "-") { direction = -1; return true; } return false; } private static bool TryCaptureAxisDown(out string binding, out string displayName) { Menu me = Menu.me; Player val = ((me != null) ? me.rwPlayer : null); if (val == null) { binding = null; displayName = null; return false; } float axis = val.GetAxis(12); float axisPrev = val.GetAxisPrev(12); float axis2 = val.GetAxis(13); float axisPrev2 = val.GetAxisPrev(13); if (axis2 > 0.5f && axisPrev2 <= 0.5f) { binding = "RWAXIS:" + 13 + ":+"; displayName = "AXIS Up"; LogCapture("rewired-axis", binding, displayName); return true; } if (axis2 < -0.5f && axisPrev2 >= -0.5f) { binding = "RWAXIS:" + 13 + ":-"; displayName = "AXIS Down"; LogCapture("rewired-axis", binding, displayName); return true; } if (axis > 0.5f && axisPrev <= 0.5f) { binding = "RWAXIS:" + 12 + ":+"; displayName = "AXIS Right"; LogCapture("rewired-axis", binding, displayName); return true; } if (axis < -0.5f && axisPrev >= -0.5f) { binding = "RWAXIS:" + 12 + ":-"; displayName = "AXIS Left"; LogCapture("rewired-axis", binding, displayName); return true; } binding = null; displayName = null; return false; } private static string GetRewiredButtonDisplayName(int actionId) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Enum.IsDefined(typeof(InputActions), actionId)) { InputActions val = (InputActions)actionId; return ((object)(InputActions)(ref val)).ToString(); } return "Controller Button " + actionId; } private static int[] BuildInputActionIdList() { Array values = Enum.GetValues(typeof(InputActions)); List list = new List(values.Length); HashSet hashSet = new HashSet(); for (int i = 0; i < values.Length; i++) { int item = (int)values.GetValue(i); if (hashSet.Add(item)) { list.Add(item); } } list.Sort(); return list.ToArray(); } private static bool TryGetInputActionName(int actionId, out string actionName) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) actionName = null; if (!Enum.IsDefined(typeof(InputActions), actionId)) { return false; } InputActions val = (InputActions)actionId; actionName = ((object)(InputActions)(ref val)).ToString(); return !string.IsNullOrWhiteSpace(actionName); } private static bool TryGetInputActionId(string actionName, out int actionId) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown actionId = -1; if (string.IsNullOrWhiteSpace(actionName)) { return false; } if (!Enum.TryParse(actionName, ignoreCase: true, out InputActions result)) { return false; } actionId = (int)result; return true; } private static bool IsAxisLikeAction(int actionId, string actionName) { if (actionId == 12 || actionId == 13) { return true; } if (string.IsNullOrWhiteSpace(actionName)) { return false; } return actionName.IndexOf("Horizontal", StringComparison.OrdinalIgnoreCase) >= 0 || actionName.IndexOf("Vertical", StringComparison.OrdinalIgnoreCase) >= 0; } private static KeyCode[] BuildJoystickButtonKeyCodes() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i <= 19; i++) { if (Enum.TryParse("JoystickButton" + i, out KeyCode result)) { list.Add(result); } } for (int j = 1; j <= 8; j++) { for (int k = 0; k <= 19; k++) { if (Enum.TryParse("Joystick" + j + "Button" + k, out KeyCode result2)) { list.Add(result2); } } } return list.ToArray(); } private static bool IsJoystickKeyCode(KeyCode keyCode) { string text = ((object)(KeyCode)(ref keyCode)).ToString(); return text.IndexOf("Joystick", StringComparison.OrdinalIgnoreCase) >= 0; } private static string FormatActionDisplayName(string actionName) { if (string.IsNullOrWhiteSpace(actionName)) { return actionName; } if (actionName.StartsWith("UI", StringComparison.OrdinalIgnoreCase)) { return "DPAD " + actionName.Substring(2); } return actionName; } private static void LogCapture(string source, string binding, string displayName) { if (CaptureLoggingEnabled) { Core.DebugMsg($"[BindCapture] source={source} binding={binding} display={displayName}"); } } } public static class MenuInjectionLibrary { public sealed class RuntimeTabMenu { private readonly string[] _tabNames; private readonly List[] _pageSelectables; private int _setTabFrame = -1; private Selectable[] _fixedItems; public RectTransform Root { get; internal set; } public RectTransform Header { get; internal set; } public Button[] Tabs { get; internal set; } public RectTransform[] Pages { get; internal set; } public int ActiveTab { get; private set; } public int TabCount { get { Button[] tabs = Tabs; return (tabs != null) ? tabs.Length : 0; } } internal MenuItemList ManagedItemList { get; set; } internal Color NativeHighlightedColor { get; set; } = TabHighlighted; internal void SetFixedMenuItems(params Selectable[] items) { _fixedItems = items; } internal RuntimeTabMenu(string[] tabNames) { //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) _tabNames = tabNames; _pageSelectables = new List[tabNames.Length]; for (int i = 0; i < tabNames.Length; i++) { _pageSelectables[i] = new List(); } } public RectTransform GetPage(int index) { return (Pages != null && index >= 0 && index < Pages.Length) ? Pages[index] : null; } public void OnShown() { SetActiveTab(ActiveTab); } internal void RegisterPageSelectable(int page, Selectable s) { if (!((Object)(object)s == (Object)null) && _pageSelectables != null && page >= 0 && page < _pageSelectables.Length) { _pageSelectables[page].Add(s); } } public void SetActiveTab(int index) { //IL_015f: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if (Tabs == null || Pages == null || index < 0 || index >= TabCount) { return; } int frameCount = Time.frameCount; if (frameCount == _setTabFrame) { return; } _setTabFrame = frameCount; ActiveTab = index; List[] pageSelectables = _pageSelectables; List list = ((pageSelectables != null) ? pageSelectables[index] : null); for (int i = 0; i < TabCount; i++) { bool flag = i == index; if ((Object)(object)Pages[i] != (Object)null) { CanvasGroup component = ((Component)Pages[i]).GetComponent(); if ((Object)(object)component != (Object)null) { component.alpha = (flag ? 1f : 0f); component.interactable = flag; component.blocksRaycasts = flag; } if (flag) { Il2CppArrayBase componentsInChildren = ((Component)Pages[i]).GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { if ((Object)(object)componentsInChildren[j] != (Object)null) { componentsInChildren[j].ForceMeshUpdate(false, false); } } } } if (!((Object)(object)Tabs[i] != (Object)null)) { continue; } Color val = (flag ? TabSelected : TabUnselected); Image component2 = ((Component)Tabs[i]).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = Color.white; ((Graphic)component2).CrossFadeColor(val, 0f, true, true); } TMP_Text componentInChildren = ((Component)Tabs[i]).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { if (_tabNames != null && i < _tabNames.Length) { componentInChildren.text = _tabNames[i]; } ((Graphic)componentInChildren).color = TabText; componentInChildren.ForceMeshUpdate(false, false); } ColorBlock colors = ((Selectable)Tabs[i]).colors; ((ColorBlock)(ref colors)).normalColor = val; ((ColorBlock)(ref colors)).selectedColor = NativeHighlightedColor; ((ColorBlock)(ref colors)).highlightedColor = NativeHighlightedColor; ((ColorBlock)(ref colors)).pressedColor = NativeHighlightedColor; ((ColorBlock)(ref colors)).disabledColor = val; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((Selectable)Tabs[i]).colors = colors; } int num = list?.Count ?? 0; Selectable[] fixedItems = _fixedItems; int num2 = ((fixedItems != null) ? fixedItems.Length : 0); List list2 = new List(num + num2); for (int k = 0; k < num; k++) { if ((Object)(object)list[k] != (Object)null) { list2.Add(list[k]); } } for (int l = 0; l < num2; l++) { if ((Object)(object)_fixedItems[l] != (Object)null) { list2.Add(_fixedItems[l]); } } if ((Object)(object)ManagedItemList != (Object)null) { GameObject[] array = (GameObject[])(object)new GameObject[list2.Count]; for (int m = 0; m < list2.Count; m++) { array[m] = ((Component)list2[m]).gameObject; } ManagedItemList.items = Il2CppReferenceArray.op_Implicit(array); } for (int n = 0; n < list2.Count; n++) { Selectable val2 = list2[n]; Navigation navigation = val2.navigation; navigation.mode = (Mode)4; navigation.selectOnUp = ((n > 0) ? list2[n - 1] : null); navigation.selectOnDown = ((n < list2.Count - 1) ? list2[n + 1] : null); navigation.selectOnLeft = null; navigation.selectOnRight = null; val2.navigation = navigation; } } } public sealed class TabBuilder { internal TabBuilder() { } public TMP_Text AddLabel(string text) { return MenuInjectionLibrary.AddLabel(text, (RectTransform)null); } public Button AddButton(string text, UnityAction onClick) { return MenuInjectionLibrary.AddButton(text, onClick, (RectTransform)null); } public Toggle AddToggle(string text, bool initial, UnityAction onChange) { return MenuInjectionLibrary.AddToggle(text, initial, onChange, (RectTransform)null); } public Slider AddSlider(string text, float min, float max, float value, UnityAction onChange, bool wholeNumbers = false) { return MenuInjectionLibrary.AddSlider(text, min, max, value, onChange, wholeNumbers, (RectTransform)null); } public Button AddInputField(string placeholder = "", UnityAction onChange = null, string initialValue = null) { return MenuInjectionLibrary.AddInputField(placeholder, onChange, initialValue, (RectTransform)null); } public Image AddImage(Color color, float height = 52f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return MenuInjectionLibrary.AddImage(color, height, (RectTransform)null); } } public sealed class MenuBuilder { internal readonly string _mainButtonLabel; internal readonly List<(string name, Action configure)> _tabs = new List<(string, Action)>(); internal readonly List<(string label, UnityAction action)> _fixed = new List<(string, UnityAction)>(); internal float _sideMargin; internal float _topMargin; internal MenuBuilder(string mainButtonLabel) { _mainButtonLabel = mainButtonLabel; } public MenuBuilder AddTab(string name, Action configure) { _tabs.Add((name, configure)); return this; } public MenuBuilder AddFixedButton(string label, UnityAction action = null) { _fixed.Add((label, action)); return this; } public MenuBuilder WithMargin(float sideMargin, float topMargin) { _sideMargin = sideMargin; _topMargin = topMargin; return this; } public InjectedMenu Build() { InjectedMenu injectedMenu = new InjectedMenu(this); if (!_registeredMenus.Contains(injectedMenu)) { _registeredMenus.Add(injectedMenu); } return injectedMenu; } } internal sealed class InputFieldInfo { public string Value = ""; public TMP_Text DisplayText; public UnityAction OnChanged; public string Placeholder = ""; public RectTransform Viewport; public Color ActiveColor = Color.white; public Color PlaceholderColor = new Color(1f, 1f, 1f, 0.45f); public Button OwnerButton; public Image CursorImage; } public sealed class InjectedMenu { [CompilerGenerated] private sealed class d__73 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public InjectedMenu <>4__this; private int 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__73(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; break; case 1: <>1__state = -1; 5__1++; break; } if (5__1 < 3) { <>4__this.ForceKeyboardFontSizes(); <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly string _mainButtonLabel; private readonly List<(string name, Action configure)> _tabDescs; private readonly List<(string label, UnityAction action)> _fixedDescs; private Menu _activeMenu; private RuntimeTabMenu _tabMenu; private bool _contentBuilt; private bool _hasAttemptedInitialDump; private GameObject _mainButtonObj; private Button _mainButton; private Transform _mainMenuRoot; private CanvasGroup _mainMenuCG; private MenuItemList _mainMenuItemList; private GameObject _submenuObj; private CanvasGroup _submenuCG; private MenuItemList _submenuItemList; private readonly List