The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of PEAKLib UI v1.5.0
plugins/com.github.PEAKModding.PEAKLib.UI.dll
Decompiled 5 days agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using On.MainMenu; using On.MainMenuSettingsPage; using On.PauseMenuSettingsMenuPage; using PEAKLib.Core; using PEAKLib.UI.Elements; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.TextCore; using UnityEngine.UI; using Zorro.Core; using Zorro.Settings; using Zorro.Settings.UI; using Zorro.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKModding, Rafa")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("UI module of the PEAKLib community API for the game PEAK.")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0+70e89e13586650bcff4fd01a51d837865c148030")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.UI")] [assembly: AssemblyTitle("PEAKLib.UI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace On.MainMenu { internal static class Start { public delegate void PrefixSignature(MainMenu self); public delegate void PostfixSignature(MainMenu self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MainMenu); MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MainMenu", "Start"); } return method; } } internal static class ToggleCredits { } internal static class OpenDiscord { } internal static class OpenLandfallWebsite { } internal static class OpenAggrocrabWebsite { } internal static class RandomizeMainGuys { } internal static class Quit { } internal static class PlaySoloClicked { } internal static class StartOfflineModeRoutine { } internal static class _ctor { } internal static class _StartOfflineModeRoutine_d__16 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } } namespace On.PauseMenuSettingsMenuPage { internal static class BackClicked { public delegate void PrefixSignature(PauseMenuSettingsMenuPage self); public delegate void PostfixSignature(PauseMenuSettingsMenuPage self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PauseMenuSettingsMenuPage); MethodInfo method = typeFromHandle.GetMethod("BackClicked", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("PauseMenuSettingsMenuPage", "BackClicked"); } return method; } } internal static class GetParentPage { public delegate void PrefixSignature(PauseMenuSettingsMenuPage self); public delegate void PostfixSignature(PauseMenuSettingsMenuPage self, ref (UIPage, PageTransistion) returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PauseMenuSettingsMenuPage); MethodInfo method = typeFromHandle.GetMethod("GetParentPage", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("PauseMenuSettingsMenuPage", "GetParentPage"); } return method; } } internal static class Start { public delegate void PrefixSignature(PauseMenuSettingsMenuPage self); public delegate void PostfixSignature(PauseMenuSettingsMenuPage self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(PauseMenuSettingsMenuPage); MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("PauseMenuSettingsMenuPage", "Start"); } return method; } } internal static class GetFirstSelectedGameObject { } internal static class _ctor { } } namespace On.MainMenuSettingsPage { internal static class BackClicked { public delegate void PrefixSignature(MainMenuSettingsPage self); public delegate void PostfixSignature(MainMenuSettingsPage self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MainMenuSettingsPage); MethodInfo method = typeFromHandle.GetMethod("BackClicked", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MainMenuSettingsPage", "BackClicked"); } return method; } } internal static class GetParentPage { public delegate void PrefixSignature(MainMenuSettingsPage self); public delegate void PostfixSignature(MainMenuSettingsPage self, ref (UIPage, PageTransistion) returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MainMenuSettingsPage); MethodInfo method = typeFromHandle.GetMethod("GetParentPage", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MainMenuSettingsPage", "GetParentPage"); } return method; } } internal static class Start { public delegate void PrefixSignature(MainMenuSettingsPage self); public delegate void PostfixSignature(MainMenuSettingsPage self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(MainMenuSettingsPage); MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("MainMenuSettingsPage", "Start"); } return method; } } internal static class GetFirstSelectedGameObject { } internal static class _ctor { } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKLib.UI { public static class ElementExtensions { public static T ParentTo<T>(this T instance, Transform transform) where T : PeakElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Transform>(transform, "transform"); ((Component)instance).transform.SetParent(transform, false); return instance; } public static T ParentTo<T>(this T instance, Component component) where T : PeakElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Component>(component, "component"); Transform val = ThrowHelper.ThrowIfFieldNull<Transform>(component.transform, "component.transform"); ((Component)instance).transform.SetParent(val, false); return instance; } public static GameObject ParentTo(this GameObject instance, Transform transform) { ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Transform>(transform, "transform"); instance.transform.SetParent(transform, false); return instance; } public static GameObject ParentTo(this GameObject instance, Component component) { ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<Component>(component, "component"); Transform val = ThrowHelper.ThrowIfFieldNull<Transform>(component.transform, "component.transform"); instance.transform.SetParent(val, false); return instance; } public static T SetSiblingIndex<T>(this T instance, int index) where T : PeakElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ((Component)instance).transform.SetSiblingIndex(index); return instance; } public static GameObject SetSiblingIndex(this GameObject instance, int index) { ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); instance.transform.SetSiblingIndex(index); return instance; } public static T SetPosition<T>(this T instance, Vector2 position) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchoredPosition = position; return instance; } public static T SetSize<T>(this T instance, Vector2 size) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.sizeDelta = size; return instance; } public static T SetOffsetMin<T>(this T instance, Vector2 offsetMin) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.offsetMin = offsetMin; return instance; } public static T SetOffsetMax<T>(this T instance, Vector2 offsetMax) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.offsetMax = offsetMax; return instance; } public static T SetAnchorMin<T>(this T instance, Vector2 anchorMin) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchorMin = anchorMin; return instance; } public static T SetAnchorMax<T>(this T instance, Vector2 anchorMax) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchorMax = anchorMax; return instance; } public static T SetAnchorMinMax<T>(this T instance, Vector2 anchorValue) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.anchorMin = anchorValue; instance.RectTransform.anchorMax = anchorValue; return instance; } public static T SetPivot<T>(this T instance, Vector2 pivot) where T : PeakElement { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); instance.RectTransform.pivot = pivot; return instance; } public static T AlignToParent<T>(this T instance, UIAlignment alignment) where T : PeakElement { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<UIAlignment>(alignment, "alignment"); Vector2 val = (Vector2)(alignment switch { UIAlignment.TopLeft => new Vector2(0f, 1f), UIAlignment.TopCenter => new Vector2(0.5f, 1f), UIAlignment.TopRight => new Vector2(1f, 1f), UIAlignment.MiddleLeft => new Vector2(0f, 0.5f), UIAlignment.MiddleCenter => new Vector2(0.5f, 0.5f), UIAlignment.MiddleRight => new Vector2(1f, 0.5f), UIAlignment.BottomLeft => new Vector2(0f, 0f), UIAlignment.BottomCenter => new Vector2(0.5f, 0f), UIAlignment.BottomRight => new Vector2(1f, 0f), _ => Vector2.zero, }); RectTransform rectTransform = instance.RectTransform; rectTransform.anchorMin = val; rectTransform.anchorMax = val; rectTransform.pivot = val; rectTransform.anchoredPosition = Vector2.zero; return instance; } public static T ExpandToParent<T>(this T instance) where T : PeakElement { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); RectTransform rectTransform = instance.RectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; return instance; } public static GameObject ExpandToParent(this GameObject instance) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<GameObject>(instance, "instance"); Transform transform = instance.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val == null) { throw new Exception("[" + ((Object)instance).name + "] does not contain a RectTransform"); } val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; return instance; } public static T AddLocalization<T>(this T instance, string text, Language language) where T : PeakLocalizableElement { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); if (((Object)instance).name == "UI_PeakText") { throw new Exception("You need to use a unique name to use localization. E.g. MenuAPI.CreateText(\"my cool text\", \"mymod_my_unique_name\")"); } TMP_Text val = ThrowHelper.ThrowIfFieldNull<TMP_Text>(instance.Text, "instance.Text"); string index = ((Object)instance).name.ToUpperInvariant(); LocalizedText val2 = instance.localizedText; if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent<LocalizedText>(); val2.index = index; val2.tmp = instance.Text; instance.localizedText = val2; } if (string.IsNullOrEmpty(instance.unlocalizedText)) { instance.unlocalizedText = text; } MenuAPI.CreateLocalizationInternal(index, text, language); val.text = val2.GetText(); return instance; } public static T SetLocalizationIndex<T>(this T instance, string index) where T : PeakLocalizableElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); TMP_Text val = ThrowHelper.ThrowIfFieldNull<TMP_Text>(instance.Text, "instance.Text"); LocalizedText val2 = instance.localizedText; if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).gameObject.AddComponent<LocalizedText>(); val2.tmp = instance.Text; instance.localizedText = val2; } val2.index = index; val.text = val2.GetText(); return instance; } public static T SetLocalizationIndex<T>(this T instance, TranslationKey translationKey) where T : PeakLocalizableElement { ThrowHelper.ThrowIfArgumentNull<T>(instance, "instance"); ThrowHelper.ThrowIfArgumentNull<TranslationKey>(translationKey, "translationKey"); instance.SetLocalizationIndex(translationKey.Index); return instance; } } public static class MenuAPI { public delegate void BuilderDelegate(Transform transform); internal static BuilderDelegate? pauseMenuBuilderDelegate; internal static BuilderDelegate? mainMenuBuilderDelegate; internal static BuilderDelegate? settingsMenuBuilderDelegate; public const float OPTIONS_WIDTH = 277f; public static void AddToMainMenu(BuilderDelegate builderDelegate) { mainMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(mainMenuBuilderDelegate, builderDelegate); } public static void AddToPauseMenu(BuilderDelegate builderDelegate) { pauseMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(pauseMenuBuilderDelegate, builderDelegate); } public static void AddToSettingsMenu(BuilderDelegate builderDelegate) { settingsMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(settingsMenuBuilderDelegate, builderDelegate); } public static PeakCustomPage CreatePage(string pageName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(pageName, "pageName"); return new GameObject(pageName).AddComponent<PeakCustomPage>(); } public static PeakChildPage CreateChildPage(string pageName, UIPage parentPage) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(pageName, "pageName"); return ElementExtensions.ParentTo(new GameObject(pageName), ((Component)parentPage).transform.parent).AddComponent<PeakChildPage>().SetParentPage(parentPage); } public static PeakCustomPage CreatePageWithBackground(string pageName) { return CreatePage(pageName).CreateBackground(); } public static PeakMenuButton CreateMenuButton(string buttonName) { ThrowHelper.ThrowIfFieldNull<string>(buttonName, "buttonName"); if ((Object)(object)Templates.ButtonTemplate == (Object)null) { throw new Exception("You're creating MenuButton too early! Prefab hasn't been loaded yet."); } GameObject val = Object.Instantiate<GameObject>(Templates.ButtonTemplate); ((Object)val).name = "UI_MainMenuButton_" + buttonName; PeakMenuButton peakMenuButton = val.AddComponent<PeakMenuButton>(); return peakMenuButton.SetText(buttonName); } public static PeakMenuButton CreatePauseMenuButton(string buttonName) { return CreateMenuButton(buttonName).SetWidth(277f); } public static PeakText CreateText(string displayText) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown GameObject val = new GameObject("UI_PeakText", new Type[1] { typeof(PeakText) }); return val.GetComponent<PeakText>().SetText(displayText); } public static PeakText CreateText(string displayText, string objectName = "UI_PeakText") { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown ThrowHelper.ThrowIfArgumentNull<string>(displayText, "displayText"); ThrowHelper.ThrowIfArgumentNullOrWhiteSpace(objectName, "objectName"); GameObject val = new GameObject(objectName, new Type[1] { typeof(PeakText) }); return val.GetComponent<PeakText>().SetText(displayText); } public static PeakButton CreateButton(string buttonName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown ThrowHelper.ThrowIfFieldNullOrWhiteSpace(buttonName, "buttonName"); GameObject val = new GameObject(buttonName); return val.AddComponent<PeakButton>(); } public static PeakScrollableContent CreateScrollableContent(string scrollableName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return new GameObject(scrollableName).AddComponent<PeakScrollableContent>(); } public static PeakTextInput CreateTextInput(string inputName) { PeakTextInput peakTextInput = PeakTextInput.Create(); ((Object)peakTextInput).name = inputName; return peakTextInput; } internal static void CreateLocalizationInternal(string index, string translation, Language language) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected I4, but got Unknown string translation2 = translation; index = index.ToUpperInvariant(); if (!LocalizedText.MAIN_TABLE.TryGetValue(index, out var value)) { value = new List<string>(); value.AddRange(from Language _ in Enum.GetValues(typeof(Language)) select translation2); LocalizedText.MAIN_TABLE.Add(index, value); } else { value[(int)language] = translation2; } } public static TranslationKey CreateLocalization(string index) { if (string.IsNullOrEmpty(index)) { throw new ArgumentNullException("index"); } return new TranslationKey(index); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.PEAKModding.PEAKLib.UI", "PEAKLib.UI", "1.5.0")] public class UIPlugin : BaseUnityPlugin { public const string Id = "com.github.PEAKModding.PEAKLib.UI"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); public static string Name => "PEAKLib.UI"; public static string Version => "1.5.0"; private void Awake() { MonoDetourManager.InvokeHookInitializers(typeof(UIPlugin).Assembly); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } public record TranslationKey(string Index) { public TranslationKey AddLocalization(string text, Language language) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateLocalizationInternal(Index, text, language); return this; } } public enum UIAlignment { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight } public static class Utilities { public static Color GetContrastingColor(Color input, float shiftAmount = 0.2f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(input, ref num, ref num2, ref num3); num3 = ((!(num3 > 0.5f)) ? Mathf.Clamp01(num3 + shiftAmount) : Mathf.Clamp01(num3 - shiftAmount)); return Color.HSVToRGB(num, num2, num3); } public static void ExpandToParent(RectTransform target) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfArgumentNull<RectTransform>(target, "target"); if ((Object)(object)((Transform)target).parent == (Object)null) { throw new NullReferenceException("field target.parent is null!"); } target.anchorMin = Vector2.zero; target.anchorMax = Vector2.one; target.offsetMin = Vector2.zero; target.offsetMax = Vector2.zero; } } } namespace PEAKLib.UI.Hooks { [MonoDetourTargets(typeof(MainMenu))] internal static class PauseMenuHooks { [MonoDetourHookInitialize] private static void Init() { On.MainMenu.Start.Postfix(Postfix_Start); } private static void Postfix_Start(MainMenu self) { GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>(); Templates.SettingsCellPrefab = source.First((GameObject n) => ((Object)n).name == "SettingsCell"); UIPlugin.Log.LogInfo((object)$"SettingsCellPrefab is null - {(Object)(object)Templates.SettingsCellPrefab == (Object)null}"); GameObject val = source.First((GameObject n) => ((Object)n).name == "UI_MainMenuButton_LeaveGame (2)"); UIPlugin.Log.LogInfo((object)$"button is null - {(Object)(object)val == (Object)null}"); if ((Object)(object)Templates.SettingsCellPrefab == (Object)null || (Object)(object)val == (Object)null) { ThrowHelper.ThrowIfArgumentNull<GameObject>(val, "ButtonTemplate prefab is null! Report as issue to PEAKLib github"); ThrowHelper.ThrowIfArgumentNull<GameObject>(Templates.SettingsCellPrefab, "SettingsCellPrefab is null! Report as issue to PEAKLib github"); return; } Templates.ButtonTemplate = Object.Instantiate<GameObject>(val); ((Object)Templates.ButtonTemplate).name = "PeakUIButton"; LocalizedText componentInChildren = Templates.ButtonTemplate.GetComponentInChildren<LocalizedText>(); if ((Object)(object)componentInChildren != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren); } Object.DontDestroyOnLoad((Object)(object)Templates.ButtonTemplate); } } [MonoDetourTargets(typeof(MainMenuSettingsPage))] internal static class MainMenuSettingsPageHooks { [MonoDetourHookInitialize] private static void Init() { On.MainMenuSettingsPage.Start.Prefix(Prefix_Start); } private static void Prefix_Start(MainMenuSettingsPage self) { MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)self).transform); MainMenuPageSelector componentInParent = ((Component)self).GetComponentInParent<MainMenuPageSelector>(); if ((Object)(object)componentInParent != (Object)null) { MenuAPI.mainMenuBuilderDelegate?.Invoke(((Component)componentInParent.mainPage.m_playButton).transform.parent); } } } [MonoDetourTargets(typeof(PauseMenuSettingsMenuPage))] internal static class PauseMenuSettingsMenuPageHooks { [MonoDetourHookInitialize] private static void Init() { On.PauseMenuSettingsMenuPage.Start.Prefix(Prefix_Start); } private static void Prefix_Start(PauseMenuSettingsMenuPage self) { MenuAPI.pauseMenuBuilderDelegate?.Invoke(((Component)self.backButton).transform); MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)self).gameObject.transform); } } } namespace PEAKLib.UI.Elements { [RequireComponent(typeof(Button))] public class PeakButton : PeakElement { public Button Button { get; set; } public PeakText Text { get; set; } private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); Image component = ElementExtensions.ParentTo(new GameObject("Image", new Type[1] { typeof(Image) }), ((Component)this).transform).ExpandToParent().GetComponent<Image>(); ((Graphic)component).color = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f); Text = MenuAPI.CreateText(((Object)this).name, "Text (TMP)").ParentTo(((Component)this).transform).ExpandToParent() .SetPosition(Vector2.zero); Button = ((Component)this).GetComponent<Button>(); ((Selectable)Button).image = component; TextMeshProUGUI textMesh = Text.TextMesh; ((TMP_Text)textMesh).enableAutoSizing = true; ((TMP_Text)textMesh).fontSizeMin = 18f; ((TMP_Text)textMesh).fontSizeMax = 22f; ((TMP_Text)textMesh).fontSize = 22f; ((TMP_Text)textMesh).fontStyle = (FontStyles)16; ((TMP_Text)textMesh).alignment = (TextAlignmentOptions)514; } public PeakButton SetWidth(float width) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform"); base.RectTransform.sizeDelta = new Vector2(width, base.RectTransform.sizeDelta.y); return this; } public PeakButton SetHeight(float height) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform"); base.RectTransform.sizeDelta = new Vector2(base.RectTransform.sizeDelta.x, height); return this; } public PeakButton OnClick(UnityAction onClickEvent) { ThrowHelper.ThrowIfArgumentNull<UnityAction>(onClickEvent, "onClickEvent"); ((UnityEvent)Button.onClick).AddListener(onClickEvent); return this; } } [RequireComponent(typeof(RectTransform))] public class PeakChildPage : UIPage, IHaveParentPage { public static readonly Color DEFAULT_BACKGROUND_COLOR = new Color(0f, 0f, 0f, 0.9569f); private UnityAction? onCloseAction; private UnityAction? onOpenAction; public Button? BackButton { get; set; } public UIPage? ParentPage { get; set; } private Image? Background { get; set; } private void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Button? backButton = BackButton; if (backButton != null) { ((UnityEvent)backButton.onClick).AddListener(new UnityAction(BackClicked)); } } private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) //IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) RectTransform component = ((Component)this).GetComponent<RectTransform>(); component.anchorMax = Vector2.one; Vector2 val = (component.offsetMax = Vector2.zero); Vector2 anchorMin = (component.offsetMin = val); component.anchorMin = anchorMin; UIPageHandler pageHandler = ((Component)this).gameObject.GetComponentInParent<UIPageHandler>(true) ?? throw new Exception("UIPageHandler not found in the object parent. Make sure to put your page object inside a UIPageHandler. (e.g. MainMenuPageHandler or PauseMenuHandler)"); base.pageHandler = pageHandler; } public PeakChildPage SetParentPage(UIPage parent) { ParentPage = parent; return this; } public PeakChildPage SetBackButton(Button button) { BackButton = button; return this; } public (UIPage, PageTransistion) GetParentPage() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if ((Object)(object)ParentPage == (Object)null) { throw new Exception("You haven't set a parent page. Please set a parent page or the back button will not work properly. | myPage.SetParentPage(parentPage)"); } return (ParentPage, (PageTransistion)new SetActivePageTransistion()); } private void BackClicked() { (UIPage, PageTransistion) parentPage = GetParentPage(); base.pageHandler.TransistionToPage(parentPage.Item1, parentPage.Item2); } public PeakChildPage CreateBackground(Color? backgroundColor = null) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Background == (Object)null) { GameObject val = new GameObject("Background", new Type[2] { typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(((Component)this).transform, false); Background = val.GetComponent<Image>(); RectTransform rectTransform = ((Graphic)Background).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = offsetMin; if (!backgroundColor.HasValue) { backgroundColor = DEFAULT_BACKGROUND_COLOR; } ((Graphic)Background).color = backgroundColor.Value; } return this; } private void OnDisable() { UnityAction? obj = onCloseAction; if (obj != null) { obj.Invoke(); } } private void OnEnable() { UnityAction? obj = onOpenAction; if (obj != null) { obj.Invoke(); } } public PeakChildPage SetOnClose(UnityAction onCloseEvent) { onCloseAction = onCloseEvent; return this; } public PeakChildPage SetOnOpen(UnityAction onOpenEvent) { onOpenAction = onOpenEvent; return this; } } [RequireComponent(typeof(RectTransform))] [RequireComponent(typeof(Canvas))] [RequireComponent(typeof(CanvasScaler))] [RequireComponent(typeof(GraphicRaycaster))] public class PeakCustomPage : MenuWindow { public static readonly Color DEFAULT_BACKGROUND_COLOR = new Color(0f, 0f, 0f, 0.9569f); private UnityAction? onCloseAction; private UnityAction? onOpenAction; private Canvas Canvas { get; set; } private CanvasScaler Scaler { get; set; } private Image? Background { get; set; } public override bool openOnStart => OpenOnStart; public override bool selectOnOpen => SelectOnOpen; public override bool closeOnPause => CloseOnPause; public override bool closeOnUICancel => CloseOnUICancel; public override bool autoHideOnClose => AutoHideOnClose; public override bool blocksPlayerInput => BlocksPlayerInput; public override bool showCursorWhileOpen => ShowCursorWhileOpen; public bool OpenOnStart { get; set; } public bool SelectOnOpen { get; set; } = true; public bool CloseOnPause { get; set; } = true; public bool CloseOnUICancel { get; set; } = true; public bool AutoHideOnClose { get; set; } = true; public bool BlocksPlayerInput { get; set; } = true; public bool ShowCursorWhileOpen { get; set; } = true; private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) Canvas = ((Component)this).GetComponent<Canvas>(); Canvas.renderMode = (RenderMode)0; Canvas.additionalShaderChannels = (AdditionalCanvasShaderChannels)31; Canvas.sortingOrder = 1; Scaler = ((Component)this).GetComponent<CanvasScaler>(); Scaler.uiScaleMode = (ScaleMode)1; Scaler.referenceResolution = new Vector2(1920f, 1080f); Scaler.matchWidthOrHeight = 1f; } public PeakCustomPage CreateBackground(Color? backgroundColor = null) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Background == (Object)null) { GameObject val = new GameObject("Background", new Type[2] { typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(((Component)this).transform, false); Background = val.GetComponent<Image>(); RectTransform rectTransform = ((Graphic)Background).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = offsetMin; if (!backgroundColor.HasValue) { backgroundColor = DEFAULT_BACKGROUND_COLOR; } ((Graphic)Background).color = backgroundColor.Value; } return this; } public override void OnClose() { UnityAction? obj = onCloseAction; if (obj != null) { obj.Invoke(); } } public override void OnOpen() { UnityAction? obj = onOpenAction; if (obj != null) { obj.Invoke(); } } public PeakCustomPage SetOnClose(UnityAction onCloseEvent) { onCloseAction = onCloseEvent; return this; } public PeakCustomPage SetOnOpen(UnityAction onOpenEvent) { onOpenAction = onOpenEvent; return this; } } [RequireComponent(typeof(RectTransform))] public class PeakElement : MonoBehaviour { public RectTransform RectTransform { get; internal set; } private void Awake() { RectTransform = ((Component)this).GetComponent<RectTransform>(); } } [RequireComponent(typeof(ScrollRect))] [RequireComponent(typeof(RectMask2D))] public class PeakHorizontalTabs : PeakElement { private RectTransform Content { get; set; } private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); base.RectTransform.anchoredPosition = new Vector2(0f, 0f); base.RectTransform.sizeDelta = new Vector2(0f, 40f); base.RectTransform.pivot = new Vector2(0.5f, 1f); base.RectTransform.anchorMin = new Vector2(0f, 1f); base.RectTransform.anchorMax = new Vector2(1f, 1f); ScrollRect component = ((Component)this).GetComponent<ScrollRect>(); GameObject val = new GameObject("Content", new Type[3] { typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(ContentSizeFitter) }); Content = val.GetComponent<RectTransform>(); ((Transform)Content).SetParent(((Component)this).transform, false); Content.pivot = Vector2.zero; Utilities.ExpandToParent(Content); component.content = Content; component.scrollSensitivity = 50f; component.elasticity = 0f; component.vertical = false; component.horizontal = true; component.movementType = (MovementType)2; HorizontalLayoutGroup component2 = ((Component)Content).GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).spacing = 20f; ((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true; ContentSizeFitter component3 = ((Component)Content).GetComponent<ContentSizeFitter>(); component3.horizontalFit = (FitMode)2; } public GameObject AddTab(string tabName) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(tabName, new Type[3] { typeof(RectTransform), typeof(Button), typeof(LayoutElement) }); val.transform.SetParent((Transform)(object)Content, false); LayoutElement component = val.GetComponent<LayoutElement>(); component.minWidth = 220f; component.flexibleWidth = 1f; component.preferredHeight = 40f; RectTransform component2 = ElementExtensions.ParentTo(new GameObject("Image", new Type[2] { typeof(RectTransform), typeof(Image) }), val.transform).GetComponent<RectTransform>(); Utilities.ExpandToParent(component2); Image component3 = ((Component)component2).GetComponent<Image>(); ((Graphic)component3).color = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f); RectTransform component4 = ElementExtensions.ParentTo(new GameObject("Selected", new Type[2] { typeof(RectTransform), typeof(Image) }), val.transform).GetComponent<RectTransform>(); Utilities.ExpandToParent(component4); PeakText peakText = new GameObject("Text (TMP)", new Type[1] { typeof(PeakText) }).GetComponent<PeakText>().ParentTo(val.transform); RectTransform component5 = ((Component)peakText).GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.pivot = Vector2.zero; component5.anchoredPosition = Vector2.zero; ((TMP_Text)peakText.TextMesh).enableAutoSizing = true; ((TMP_Text)peakText.TextMesh).fontSizeMin = 18f; ((TMP_Text)peakText.TextMesh).fontSizeMax = 22f; ((TMP_Text)peakText.TextMesh).fontSize = 22f; ((TMP_Text)peakText.TextMesh).fontStyle = (FontStyles)16; ((TMP_Text)peakText.TextMesh).alignment = (TextAlignmentOptions)514; ((TMP_Text)peakText.TextMesh).text = tabName; return val; } } [RequireComponent(typeof(RectTransform))] public class PeakLocalizableElement : PeakElement { internal string unlocalizedText = ""; internal LocalizedText? localizedText; public TMP_Text Text { get; internal set; } internal void SetTextInternal(string text) { ThrowHelper.ThrowIfFieldNull<TMP_Text>(Text, "Text").text = text; unlocalizedText = text; } } public class PeakMenuButton : PeakLocalizableElement { public Button Button { get; private set; } public Image Panel { get; private set; } public Image BorderTop { get; private set; } public Image BorderBottom { get; private set; } private void Awake() { base.RectTransform = ((Component)this).GetComponent<RectTransform>(); Button = ((Component)this).GetComponent<Button>(); Panel = ((Component)((Component)this).transform.Find("Panel")).GetComponent<Image>(); base.Text = (TMP_Text)(object)((Component)((Component)this).transform.Find("Text")).GetComponent<TextMeshProUGUI>(); BorderTop = ((Component)((Component)this).transform.Find("Border")).GetComponent<Image>(); BorderBottom = ((Component)((Component)this).transform.GetChild(((Component)BorderTop).transform.GetSiblingIndex() + 1)).GetComponent<Image>(); } public PeakMenuButton SetText(string text) { SetTextInternal(text); return this; } public PeakMenuButton SetColor(Color color, bool automaticBorderColor = true) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(Panel, "Panel")).color = color; if (automaticBorderColor) { SetBorderColor(Utilities.GetContrastingColor(color)); } return this; } public PeakMenuButton SetBorderColor(Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(BorderTop, "BorderTop")).color = color; ((Graphic)ThrowHelper.ThrowIfFieldNull<Image>(BorderBottom, "BorderBottom")).color = color; return this; } public PeakMenuButton SetWidth(float width) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform"); base.RectTransform.sizeDelta = new Vector2(width, base.RectTransform.sizeDelta.y); return this; } public PeakMenuButton OnClick(UnityAction onClickEvent) { ThrowHelper.ThrowIfArgumentNull<UnityAction>(onClickEvent, "onClickEvent"); ((UnityEvent)Button.onClick).AddListener(onClickEvent); return this; } } [RequireComponent(typeof(RectTransform))] [RequireComponent(typeof(RectMask2D))] [RequireComponent(typeof(ScrollRect))] public class PeakScrollableContent : PeakElement { public RectTransform Content { get; private set; } private void Awake() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); ScrollRect component = ((Component)this).GetComponent<ScrollRect>(); component.scrollSensitivity = 50f; component.elasticity = 0f; component.vertical = true; component.horizontal = false; component.movementType = (MovementType)2; GameObject val = new GameObject("Content", new Type[3] { typeof(RectTransform), typeof(VerticalLayoutGroup), typeof(ContentSizeFitter) }); Content = val.GetComponent<RectTransform>(); ((Transform)Content).SetParent(((Component)this).transform, false); Content.pivot = new Vector2(0.5f, 1f); VerticalLayoutGroup component2 = val.GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false; Utilities.ExpandToParent(Content); ContentSizeFitter component3 = val.GetComponent<ContentSizeFitter>(); component3.verticalFit = (FitMode)2; component.content = Content; } } [RequireComponent(typeof(CanvasRenderer))] [RequireComponent(typeof(TextMeshProUGUI))] public class PeakText : PeakLocalizableElement { private static TMP_FontAsset? _darumaFontAsset; private static TMP_FontAsset DarumaDropOne { get { if ((Object)(object)_darumaFontAsset == (Object)null) { TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); _darumaFontAsset = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)delegate(TMP_FontAsset fontAsset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) FaceInfo faceInfo = ((TMP_Asset)fontAsset).faceInfo; return ((FaceInfo)(ref faceInfo)).familyName == "Daruma Drop One"; }); } return _darumaFontAsset; } } public TextMeshProUGUI TextMesh => (TextMeshProUGUI)base.Text; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) base.RectTransform = ((Component)this).GetComponent<RectTransform>(); base.Text = (TMP_Text)(object)((Component)this).GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = base.RectTransform; RectTransform rectTransform2 = base.RectTransform; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); rectTransform2.anchorMax = val; rectTransform.anchorMin = val; base.RectTransform.pivot = new Vector2(0f, 1f); ((TMP_Text)TextMesh).font = DarumaDropOne; ((Graphic)TextMesh).color = Color.white; base.RectTransform.sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues(); } public PeakText SetText(string text) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) SetTextInternal(text); ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform").sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues(); return this; } public PeakText SetFontSize(float size) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).fontSize = size; ThrowHelper.ThrowIfFieldNull<RectTransform>(base.RectTransform, "RectTransform").sizeDelta = ((TMP_Text)TextMesh).GetPreferredValues(); return this; } public PeakText SetColor(Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ThrowHelper.ThrowIfFieldNull<TextMeshProUGUI>(TextMesh, "TextMesh")).color = color; return this; } } public class PeakTextInput : PeakElement { private static GameObject? _textInputPrefab; internal static GameObject TextInputPrefab { get { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_textInputPrefab == (Object)null) { if ((Object)(object)SingletonAsset<InputCellMapper>.Instance == (Object)null || (Object)(object)SingletonAsset<InputCellMapper>.Instance.FloatSettingCell == (Object)null) { throw new Exception("Tried to create a TextInput but prefab was not found. Please wait until the game fully loads to create UI elements."); } _textInputPrefab = Object.Instantiate<GameObject>(SingletonAsset<InputCellMapper>.Instance.FloatSettingCell); ((Object)_textInputPrefab).name = "PeakTextInput"; Transform transform = _textInputPrefab.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val != null) { val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(0f, 1f); val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(200f, 80f); } FloatSettingUI component = _textInputPrefab.GetComponent<FloatSettingUI>(); TMP_InputField inputField = component.inputField; Object.DestroyImmediate((Object)(object)((Component)component.slider).gameObject); Object.DestroyImmediate((Object)(object)component); inputField.characterValidation = (CharacterValidation)0; RectTransform component2 = ((Component)inputField).GetComponent<RectTransform>(); component2.pivot = new Vector2(0.5f, 0.5f); Utilities.ExpandToParent(component2); TextMeshProUGUI[] componentsInChildren = ((Component)inputField).GetComponentsInChildren<TextMeshProUGUI>(); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val2 in array) { float num2 = (((TMP_Text)val2).fontSizeMax = 22f); float fontSize = (((TMP_Text)val2).fontSizeMin = num2); ((TMP_Text)val2).fontSize = fontSize; ((TMP_Text)val2).alignment = (TextAlignmentOptions)4097; } Object.DontDestroyOnLoad((Object)(object)_textInputPrefab); } return _textInputPrefab; } } public TMP_InputField InputField { get; private set; } private TextMeshProUGUI Placeholder { get; set; } internal static PeakTextInput Create() { return Object.Instantiate<GameObject>(TextInputPrefab).AddComponent<PeakTextInput>(); } private void Awake() { base.RectTransform = ((Component)this).GetComponent<RectTransform>(); InputField = ((Component)this).GetComponentInChildren<TMP_InputField>(); Placeholder = ((Component)InputField.placeholder).GetComponent<TextMeshProUGUI>(); ((TMP_Text)Placeholder).text = ""; } public PeakTextInput OnValueChanged(UnityAction<string> onValueChanged) { ThrowHelper.ThrowIfArgumentNull<UnityAction<string>>(onValueChanged, "onValueChanged"); ((UnityEvent<string>)(object)InputField.onValueChanged).AddListener(onValueChanged); return this; } public PeakTextInput SetPlaceholder(string placeholder) { ((TMP_Text)Placeholder).text = placeholder; return this; } } public static class Templates { public static GameObject? ButtonTemplate { get; internal set; } public static GameObject? SettingsCellPrefab { get; internal set; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }