using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; 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("WhiteKnuckleTrainer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WhiteKnuckleTrainer")] [assembly: AssemblyTitle("WhiteKnuckleTrainer")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 WhiteKnuckleTrainer { internal sealed class EspOverlay : MonoBehaviour { private readonly List _targets = new List(); private float _nextRefresh; private GUIStyle? _style; private void Update() { if (!(Time.unscaledTime < _nextRefresh)) { _nextRefresh = Time.unscaledTime + 1f; _targets.Clear(); _targets.AddRange(from item in Object.FindObjectsOfType() where (Object)(object)item != (Object)null && item.itemData != null select item); } } private void OnGUI() { //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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0096: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) WhiteKnuckleTrainerPlugin instance = WhiteKnuckleTrainerPlugin.Instance; if (instance == null || !instance.Features.EspEnabled || NativePauseMenuPatch.IsOpen) { return; } ENT_Player player = ENT_Player.GetPlayer(); Camera main = Camera.main; if ((Object)(object)player == (Object)null || (Object)(object)main == (Object)null) { return; } if (_style == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 12, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; _style = val; } TrainerFeatures features = instance.Features; int num = 0; RaycastHit val2 = default(RaycastHit); foreach (Item_Object item in from target in _targets where (Object)(object)target != (Object)null orderby Vector3.SqrMagnitude(((Component)target).transform.position - ((Component)player).transform.position) select target) { if (num >= features.EspMaximumLabels) { break; } Vector3 position = ((Component)item).transform.position; float num2 = Vector3.Distance(((Component)player).transform.position, position); if (!(num2 > features.EspMaximumDistance) && (!features.EspOcclusionCheck || !Physics.Linecast(((Component)main).transform.position, position, ref val2) || !((Object)(object)((RaycastHit)(ref val2)).transform != (Object)(object)((Component)item).transform) || ((RaycastHit)(ref val2)).transform.IsChildOf(((Component)item).transform))) { Vector3 val3 = main.WorldToScreenPoint(position); bool flag = val3.z > 0f && val3.x >= 0f && val3.x <= (float)Screen.width && val3.y >= 0f && val3.y <= (float)Screen.height; if ((!features.EspOnlyOnScreen || flag) && flag) { string text = (string.IsNullOrWhiteSpace(item.itemData.itemName) ? ((Object)item).name : item.itemData.itemName); GUI.Label(new Rect(val3.x - 90f, (float)Screen.height - val3.y - 15f, 180f, 30f), "[" + text + "]\n" + num2.ToString("0") + " m", _style); num++; } } } } } [HarmonyPatch(typeof(CL_GameManager), "Pause")] internal static class NativePauseMenuPatch { private const string ModMenuButtonName = "WhiteKnuckleTrainer_ModMenu"; private const string ModMenuGapName = "WhiteKnuckleTrainer_ModMenuGap"; private const string GeneratedPrefix = "WhiteKnuckleTrainer_Generated_"; private const int PageSize = 6; private static bool _reportedMissingTemplate; private static Transform? _layout; private static Transform? _settingsTemplate; private static readonly List<(GameObject Object, bool WasActive)> OriginalEntries = new List<(GameObject, bool)>(); private static readonly List GeneratedEntries = new List(); internal static bool IsOpen { get; private set; } private static void Postfix(CL_GameManager __instance) { try { EnsureInjected(__instance); } catch (Exception arg) { WhiteKnuckleTrainerPlugin.Instance?.LogNativeError($"[Trainer] Native pause-menu injection failed: {arg}"); } } internal static void ResetSceneState() { Close(); _reportedMissingTemplate = false; _layout = null; _settingsTemplate = null; } internal static bool TryOpen(CL_GameManager gameManager) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown WhiteKnuckleTrainerPlugin instance = WhiteKnuckleTrainerPlugin.Instance; if ((Object)(object)instance == (Object)null || !EnsureInjected(gameManager) || (Object)(object)_layout == (Object)null || (Object)(object)_settingsTemplate == (Object)null) { return false; } if (IsOpen) { return true; } OriginalEntries.Clear(); foreach (Transform item in _layout) { Transform val = item; OriginalEntries.Add((((Component)val).gameObject, ((Component)val).gameObject.activeSelf)); ((Component)val).gameObject.SetActive(false); } IsOpen = true; ShowHome(instance); instance.LogNativeInfo("[Trainer] Native trainer menu opened."); return true; } internal static void Close() { if (!IsOpen) { return; } ClearGeneratedEntries(); foreach (var (val, active) in OriginalEntries) { if ((Object)(object)val != (Object)null) { val.SetActive(active); } } OriginalEntries.Clear(); IsOpen = false; RebuildLayout(); WhiteKnuckleTrainerPlugin.Instance?.LogNativeInfo("[Trainer] Returned to the native pause menu."); } private static bool EnsureInjected(CL_GameManager gameManager) { WhiteKnuckleTrainerPlugin instance = WhiteKnuckleTrainerPlugin.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)gameManager.pauseMenu == (Object)null) { return false; } Transform val = FindPauseLayout(gameManager.pauseMenu.transform); if ((Object)(object)val == (Object)null) { ReportMissingTemplate(instance, "Pause Layout"); return false; } _layout = val; _settingsTemplate = val.Find("Settings"); Transform val2 = val.Find("Gap.01"); if ((Object)(object)_settingsTemplate == (Object)null || (Object)(object)val2 == (Object)null) { ReportMissingTemplate(instance, "Settings button or Gap.01 layout entry"); return false; } if ((Object)(object)val.Find("WhiteKnuckleTrainer_ModMenu") != (Object)null) { return true; } GameObject obj = Object.Instantiate(((Component)val2).gameObject, val); ((Object)obj).name = "WhiteKnuckleTrainer_ModMenuGap"; obj.SetActive(true); obj.transform.SetSiblingIndex(val.childCount - 1); GameObject obj2 = Object.Instantiate(((Component)_settingsTemplate).gameObject, val); ((Object)obj2).name = "WhiteKnuckleTrainer_ModMenu"; obj2.SetActive(true); obj2.transform.SetSiblingIndex(val.childCount - 1); ConfigureNativeButton(obj2, "MOD MENU", delegate { TryOpen(gameManager); }, enabled: true); RebuildLayout(); instance.LogNativeInfo("[Trainer] Native MOD MENU button injected successfully."); return true; } private static void ShowHome(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("WHITE KNUCKLE TRAINER", null, enabled: false); if (CommandConsole.hasCheated) { AddButton("CHEAT MODE ACTIVE — LEADERBOARDS DISABLED", null, enabled: false); } AddButton("PLAYER", delegate { ShowPlayer(plugin); }); AddButton("MOVEMENT", delegate { ShowMovement(plugin); }); AddButton("ITEMS", delegate { ShowItemCategories(plugin, 0); }); AddButton("PERKS", delegate { ShowPerks(plugin, 0); }); AddButton("ESP / ITEM RADAR", delegate { ShowEsp(plugin); }); AddButton("COSMETICS", delegate { ShowCosmetics(plugin); }); AddButton("TOOLS", delegate { ShowTools(plugin); }); AddButton("BACK TO PAUSE MENU", Close); FinishPage(); } private static void ShowPlayer(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("PLAYER", null, enabled: false); AddButton("GOD MODE: " + OnOff(plugin.Features.GodMode), delegate { plugin.Features.ToggleGodMode(); ShowPlayer(plugin); }); AddButton("NO FALL DAMAGE: " + OnOff(plugin.Features.NoFallDamage), delegate { plugin.Features.ToggleNoFallDamage(); ShowPlayer(plugin); }); AddButton("INFINITE STAMINA: " + OnOff(plugin.InfiniteStamina), delegate { plugin.ToggleInfiniteStamina(); ShowPlayer(plugin); }); AddButton("INFINITE AMMO / PITONS: " + OnOff(plugin.InfiniteAmmoAndThrowables), delegate { plugin.ToggleInfiniteAmmoAndThrowables(); ShowPlayer(plugin); }); AddButton("NO ENCUMBRANCE: " + OnOff(plugin.Features.NoEncumbrance), delegate { plugin.Features.ToggleNoEncumbrance(); ShowPlayer(plugin); }); AddButton("BACK", delegate { ShowHome(plugin); }); FinishPage(); } private static void ShowMovement(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("MOVEMENT", null, enabled: false); AddButton("INFINITE JUMPS: " + OnOff(plugin.InfiniteJumps), delegate { plugin.ToggleInfiniteJumps(); ShowMovement(plugin); }); AddButton("MULTI-JUMP COUNT: " + plugin.Features.MultiJumpCount, delegate { ShowMultiJump(plugin); }); AddButton("MOVEMENT SPEED: " + plugin.Features.MovementMultiplier.ToString("0.00") + "x", delegate { ShowMovementTuning(plugin); }); AddButton("JUMP HEIGHT: " + plugin.Features.JumpHeightMultiplier.ToString("0.00") + "x", delegate { ShowMovementTuning(plugin); }); AddButton("GRAVITY: " + plugin.Features.GravityMultiplier.ToString("0.00") + "x", delegate { ShowMovementTuning(plugin); }); AddButton("TIME SCALE: " + plugin.Features.TimeScaleMultiplier.ToString("0.00") + "x", delegate { ShowTime(plugin); }); AddButton("MODE CONTROLS", delegate { ShowMovementModes(plugin); }); AddButton("BACK", delegate { ShowHome(plugin); }); FinishPage(); } private static void ShowMultiJump(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("MULTI-JUMP COUNT: " + plugin.Features.MultiJumpCount, null, enabled: false); AddButton("DECREASE", delegate { plugin.Features.AdjustMultiJump(-1); ShowMultiJump(plugin); }); AddButton("INCREASE", delegate { plugin.Features.AdjustMultiJump(1); ShowMultiJump(plugin); }); AddButton("1 = VANILLA AIR JUMP ALLOWANCE", null, enabled: false); AddButton("INFINITE JUMPS OVERRIDES THIS VALUE", null, enabled: false); AddButton("BACK", delegate { ShowMovement(plugin); }); FinishPage(); } private static void ShowMovementTuning(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("MOVEMENT SPEED: " + plugin.Features.MovementMultiplier.ToString("0.00") + "x", delegate { plugin.Features.AdjustMovement(0.25f); ShowMovementTuning(plugin); }); AddButton("JUMP HEIGHT: " + plugin.Features.JumpHeightMultiplier.ToString("0.00") + "x", delegate { plugin.Features.AdjustJumpHeight(0.25f); ShowMovementTuning(plugin); }); AddButton("GRAVITY: " + plugin.Features.GravityMultiplier.ToString("0.00") + "x", delegate { plugin.Features.AdjustGravity(-0.25f); ShowMovementTuning(plugin); }); AddButton("RESET MOVEMENT SPEED", delegate { plugin.Features.AdjustMovement(1f - plugin.Features.MovementMultiplier); ShowMovementTuning(plugin); }); AddButton("RESET JUMP HEIGHT", delegate { plugin.Features.AdjustJumpHeight(1f - plugin.Features.JumpHeightMultiplier); ShowMovementTuning(plugin); }); AddButton("RESET GRAVITY", delegate { plugin.Features.AdjustGravity(1f - plugin.Features.GravityMultiplier); ShowMovementTuning(plugin); }); AddButton("BACK", delegate { ShowMovement(plugin); }); FinishPage(); } private static void ShowTime(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("TIME SCALE: " + plugin.Features.TimeScaleMultiplier.ToString("0.00") + "x", null, enabled: false); AddButton("SLOWER", delegate { plugin.Features.AdjustTimeScale(-0.1f); ShowTime(plugin); }); AddButton("FASTER", delegate { plugin.Features.AdjustTimeScale(0.1f); ShowTime(plugin); }); AddButton("RESET TO 1.00x", delegate { plugin.Features.AdjustTimeScale(1f - plugin.Features.TimeScaleMultiplier); ShowTime(plugin); }); AddButton("BACK", delegate { ShowMovement(plugin); }); FinishPage(); } private static void ShowMovementModes(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("FLY MODE: " + OnOff(plugin.Features.Fly), delegate { plugin.Features.ToggleFly(); ShowMovementModes(plugin); }); AddButton("NOCLIP: " + OnOff(plugin.Features.Noclip), delegate { plugin.Features.ToggleNoclip(); ShowMovementModes(plugin); }); AddButton("CLIMB ANYWHERE: " + OnOff(plugin.Features.ClimbAnywhere), delegate { plugin.Features.ToggleClimbAnywhere(); ShowMovementModes(plugin); }); AddButton("FLY: JUMP ASCENDS, CROUCH DESCENDS", null, enabled: false); AddButton("BACK", delegate { ShowMovement(plugin); }); FinishPage(); } private static void ShowItemCategories(WhiteKnuckleTrainerPlugin plugin, int page) { ShowPagedButtons(new List { "Consumables", "Tools & weapons", "Miscellaneous", "Artifacts", "Trinkets", "Cheats / unused", "All discovered" }, page, (string category) => "SPAWN — " + category.ToUpperInvariant(), delegate(string category) { ShowItems(plugin, category, 0); }, delegate(int previous) { ShowItemCategories(plugin, previous); }, delegate { ShowHome(plugin); }); } private static void ShowItems(WhiteKnuckleTrainerPlugin plugin, string category, int page) { List list = (from item in plugin.GetItemsForNativeMenu().Where(WhiteKnuckleTrainerPlugin.ShouldListNativeItem) where category == "All discovered" || item.Category == category orderby item.DisplayName select item).ToList(); if (list.Count == 0) { BeginPage(); AddButton("NO ITEMS AVAILABLE YET", null, enabled: false); AddButton("ENTER A RUN, THEN OPEN THIS MENU", null, enabled: false); AddButton("BACK", delegate { ShowItemCategories(plugin, 0); }); FinishPage(); return; } ShowPagedButtons(list, page, (WhiteKnuckleTrainerPlugin.ItemEntry item) => "SPAWN: " + item.DisplayName.ToUpperInvariant(), delegate(WhiteKnuckleTrainerPlugin.ItemEntry item) { plugin.Spawn(item); ShowItems(plugin, category, page); }, delegate(int previous) { ShowItems(plugin, category, previous); }, delegate { ShowItemCategories(plugin, 0); }); } private static void ShowCosmetics(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("COSMETICS", null, enabled: false); AddButton("HANDS", delegate { ShowCosmeticList(plugin, hands: true, 0); }); AddButton("HAMMERS", delegate { ShowCosmeticList(plugin, hands: false, 0); }); AddButton("BACK", delegate { ShowHome(plugin); }); FinishPage(); } private static void ShowPerks(WhiteKnuckleTrainerPlugin plugin, int page) { List list = plugin.GetPerksForNativeMenu().ToList(); if (list.Count == 0) { BeginPage(); AddButton("NO PERKS AVAILABLE YET", null, enabled: false); AddButton("ENTER A RUN, THEN OPEN THIS MENU", null, enabled: false); AddButton("BACK", delegate { ShowHome(plugin); }); FinishPage(); return; } ShowPagedButtons(list, page, (Perk perk) => (plugin.IsPerkActive(perk) ? "REMOVE: " : "ADD: ") + PerkLabel(perk).ToUpperInvariant(), delegate(Perk perk) { if (plugin.IsPerkActive(perk)) { plugin.RemovePerkFromNativeMenu(perk); } else { plugin.AddPerkFromNativeMenu(perk); } ShowPerks(plugin, page); }, delegate(int previous) { ShowPerks(plugin, previous); }, delegate { ShowHome(plugin); }); } private static void ShowTools(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("TOOLS", null, enabled: false); AddButton("EXPORT DIAGNOSTICS", delegate { TrainerTools.ExportDiagnostics(plugin); }); AddButton("EXPORT LEVEL DATA", delegate { TrainerTools.ExportLevelData(plugin); }); AddButton("EXPORTS: BEPINEX/CONFIG/WHITEKNUCKLETRAINER", null, enabled: false); AddButton("LEVEL EXPORT ENABLES NATIVE CHEAT MODE", null, enabled: false); AddButton("BACK", delegate { ShowHome(plugin); }); FinishPage(); } private static void ShowEsp(WhiteKnuckleTrainerPlugin plugin) { TrainerFeatures features = plugin.Features; BeginPage(); AddButton("ESP / ITEM RADAR", null, enabled: false); AddButton("ENABLE ESP: " + OnOff(features.EspEnabled), delegate { features.ToggleEsp(); ShowEsp(plugin); }); AddButton("MAX DISTANCE: " + features.EspMaximumDistance.ToString("0") + "m", delegate { ShowEspDistance(plugin); }); AddButton("MAX LABELS: " + features.EspMaximumLabels, delegate { ShowEspLabels(plugin); }); AddButton("ONLY ON SCREEN: " + OnOff(features.EspOnlyOnScreen), delegate { features.ToggleEspOnlyOnScreen(); ShowEsp(plugin); }); AddButton("OCCLUSION CHECK: " + OnOff(features.EspOcclusionCheck), delegate { features.ToggleEspOcclusionCheck(); ShowEsp(plugin); }); AddButton("NEAREST DISCOVERED ITEMS — 1s REFRESH", null, enabled: false); AddButton("BACK", delegate { ShowHome(plugin); }); FinishPage(); } private static void ShowEspDistance(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("MAX ESP DISTANCE: " + plugin.Features.EspMaximumDistance.ToString("0") + "m", null, enabled: false); AddButton("DECREASE BY 15m", delegate { plugin.Features.AdjustEspDistance(-15f); ShowEspDistance(plugin); }); AddButton("INCREASE BY 15m", delegate { plugin.Features.AdjustEspDistance(15f); ShowEspDistance(plugin); }); AddButton("BACK", delegate { ShowEsp(plugin); }); FinishPage(); } private static void ShowEspLabels(WhiteKnuckleTrainerPlugin plugin) { BeginPage(); AddButton("MAX ESP LABELS: " + plugin.Features.EspMaximumLabels, null, enabled: false); AddButton("DECREASE", delegate { plugin.Features.AdjustEspLabels(-3); ShowEspLabels(plugin); }); AddButton("INCREASE", delegate { plugin.Features.AdjustEspLabels(3); ShowEspLabels(plugin); }); AddButton("BACK", delegate { ShowEsp(plugin); }); FinishPage(); } private static void ShowCosmeticList(WhiteKnuckleTrainerPlugin plugin, bool hands, int page) { List list = (hands ? plugin.GetHandCosmeticsForNativeMenu() : plugin.GetHammerCosmeticsForNativeMenu()).OrderBy(WhiteKnuckleTrainerPlugin.GetNativeCosmeticName).ToList(); if (list.Count == 0) { BeginPage(); AddButton("NO " + (hands ? "HAND" : "HAMMER") + " COSMETICS FOUND", null, enabled: false); AddButton("BACK", delegate { ShowCosmetics(plugin); }); FinishPage(); return; } ShowPagedButtons(list, page, (Cosmetic_Base cosmetic) => "EQUIP: " + WhiteKnuckleTrainerPlugin.GetNativeCosmeticName(cosmetic).ToUpperInvariant(), delegate(Cosmetic_Base cosmetic) { plugin.EquipCosmeticFromNativeMenu(cosmetic, hands); plugin.LogNativeInfo("[Trainer] Equipped cosmetic: " + WhiteKnuckleTrainerPlugin.GetNativeCosmeticName(cosmetic)); ShowCosmeticList(plugin, hands, page); }, delegate(int previous) { ShowCosmeticList(plugin, hands, previous); }, delegate { ShowCosmetics(plugin); }); } private static void ShowPagedButtons(IReadOnlyList entries, int requestedPage, Func label, Action selected, Action showPage, Action back) { int num = Mathf.Max(1, Mathf.CeilToInt((float)entries.Count / 6f)); int page = Mathf.Clamp(requestedPage, 0, num - 1); int num2 = page * 6; int num3 = Mathf.Min(num2 + 6, entries.Count); BeginPage(); for (int i = num2; i < num3; i++) { T entry = entries[i]; AddButton(label(entry), delegate { selected(entry); }); } if (page > 0) { AddButton("PREVIOUS PAGE (" + page + "/" + num + ")", delegate { showPage(page - 1); }); } if (page + 1 < num) { AddButton("NEXT PAGE (" + (page + 2) + "/" + num + ")", delegate { showPage(page + 1); }); } AddButton("BACK", back); FinishPage(); } private static void BeginPage() { ClearGeneratedEntries(); } private static void FinishPage() { ConfigureGeneratedNavigation(); RebuildLayout(); } private static void AddButton(string label, Action? action, bool enabled = true) { if (!((Object)(object)_layout == (Object)null) && !((Object)(object)_settingsTemplate == (Object)null)) { GameObject val = Object.Instantiate(((Component)_settingsTemplate).gameObject, _layout); ((Object)val).name = "WhiteKnuckleTrainer_Generated_" + GeneratedEntries.Count; val.SetActive(true); ConfigureNativeButton(val, label, action, enabled); GeneratedEntries.Add(val); } } private static void ConfigureNativeButton(GameObject buttonObject, string label, Action? action, bool enabled) { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown UI_MenuButton component = buttonObject.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Button component2 = buttonObject.GetComponent