using 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.PauseMenuControlsPage;
using On.PauseMenuMainPage;
using On.PauseMenuSettingsMenuPage;
using PEAKLib.Core;
using PEAKLib.UI.Elements;
using PEAKLib.UI.Elements.Settings;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Localization;
using UnityEngine.TextCore;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Settings;
using Zorro.Settings.DebugUI;
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, darmuh")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("UI module of the PEAKLib community API for the game PEAK.")]
[assembly: AssemblyFileVersion("1.6.1.0")]
[assembly: AssemblyInformationalVersion("1.6.1+28e0e84d3b92ce9e6e874cbe33f7050ea59100dd")]
[assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.UI")]
[assembly: AssemblyTitle("PEAKLib.UI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.1.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]
internal sealed class IsUnmanagedAttribute : Attribute
{
}
[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.PauseMenuMainPage
{
internal static class Start
{
public delegate void PrefixSignature(PauseMenuMainPage self);
public delegate void PostfixSignature(PauseMenuMainPage 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(PauseMenuMainPage);
MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
if ((object)method == null)
{
throw new MissingMethodException("PauseMenuMainPage", "Start");
}
return method;
}
}
internal static class get_resumeButton
{
}
internal static class OnEnable
{
}
internal static class InviteFriendsClicked
{
}
internal static class OnControlsClicked
{
}
internal static class OnAccoladesClicked
{
}
internal static class OnResumeClicked
{
}
internal static class OnSettingsClicked
{
}
internal static class OnQuitClicked
{
}
internal static class GetFirstSelectedGameObject
{
}
internal static class _ctor
{
}
}
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.PauseMenuControlsPage
{
internal static class BackClicked
{
public delegate void PrefixSignature(PauseMenuControlsPage self);
public delegate void PostfixSignature(PauseMenuControlsPage 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(PauseMenuControlsPage);
MethodInfo method = typeFromHandle.GetMethod("BackClicked", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
if ((object)method == null)
{
throw new MissingMethodException("PauseMenuControlsPage", "BackClicked");
}
return method;
}
}
internal static class GetParentPage
{
public delegate void PrefixSignature(PauseMenuControlsPage self);
public delegate void PostfixSignature(PauseMenuControlsPage 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(PauseMenuControlsPage);
MethodInfo method = typeFromHandle.GetMethod("GetParentPage", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
if ((object)method == null)
{
throw new MissingMethodException("PauseMenuControlsPage", "GetParentPage");
}
return method;
}
}
internal static class Start
{
public delegate void PrefixSignature(PauseMenuControlsPage self);
public delegate void PostfixSignature(PauseMenuControlsPage 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(PauseMenuControlsPage);
MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
if ((object)method == null)
{
throw new MissingMethodException("PauseMenuControlsPage", "Start");
}
return method;
}
}
internal static class Awake
{
public delegate void PrefixSignature(PauseMenuControlsPage self);
public delegate void PostfixSignature(PauseMenuControlsPage 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(PauseMenuControlsPage);
MethodInfo method = typeFromHandle.GetMethod("Awake", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
if ((object)method == null)
{
throw new MissingMethodException("PauseMenuControlsPage", "Awake");
}
return method;
}
}
internal static class OnResetClicked
{
}
internal static class OnEnable
{
}
internal static class OnDisable
{
}
internal static class OnDeviceChange
{
}
internal static class InitButtons
{
}
internal static class InitButtonBindingVisuals
{
}
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;
internal static BuilderDelegate? controlsMenuBuilderDelegate;
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 void AddToControlsMenu(BuilderDelegate builderDelegate)
{
controlsMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(controlsMenuBuilderDelegate, 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.mainTable.TryGetValue(index, out var value))
{
value = new List<string>();
value.AddRange(from Language _ in Enum.GetValues(typeof(Language))
select translation2);
LocalizedText.mainTable.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);
}
public static GenericBoolSetting AddOnOffSetting(string displayName, bool defaultValue, SettingsCategory category, bool currentValue, Action<bool>? saveCallback = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
GenericBoolSetting genericBoolSetting = new GenericBoolSetting(displayName, defaultValue, category, currentValue, saveCallback);
if (SettingsHandler.Instance == null)
{
UIPlugin.Log.LogWarning((object)("SettingsHandler.Instance is null! You will need to manually add this setting (" + displayName + ")"));
}
else
{
SettingsHandler.Instance.AddSetting((Setting)(object)genericBoolSetting);
}
return genericBoolSetting;
}
public static GenericFloatSetting AddSliderSetting(string displayName, float defaultValue, SettingsCategory category, float currentValue, float minValue = 0f, float maxValue = 1000f, Action<float>? saveCallback = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
GenericFloatSetting genericFloatSetting = new GenericFloatSetting(displayName, defaultValue, category, minValue, maxValue, currentValue, saveCallback);
if (SettingsHandler.Instance == null)
{
UIPlugin.Log.LogWarning((object)("SettingsHandler.Instance is null! You will need to manually add this setting (" + displayName + ")"));
}
else
{
SettingsHandler.Instance.AddSetting((Setting)(object)genericFloatSetting);
}
return genericFloatSetting;
}
public static GenericEnumSetting<T> AddEnumSetting<T>(string displayName, T currentValue, T defaultValue, SettingsCategory category, Action<T>? saveCallback = null) where T : unmanaged, Enum
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
GenericEnumSetting<T> genericEnumSetting = new GenericEnumSetting<T>(displayName, currentValue, defaultValue, category, saveCallback);
if (SettingsHandler.Instance == null)
{
UIPlugin.Log.LogWarning((object)("SettingsHandler.Instance is null! You will need to manually add this setting (" + displayName + ")"));
}
else
{
SettingsHandler.Instance.AddSetting((Setting)(object)genericEnumSetting);
}
return genericEnumSetting;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.github.PEAKModding.PEAKLib.UI", "PEAKLib.UI", "1.6.1")]
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.6.1";
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.LogDebug((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.LogDebug((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(PauseMenuControlsPage))]
internal static class PauseMenuControlsPageHooks
{
internal static bool InitComplete;
[MonoDetourHookInitialize]
private static void Init()
{
Awake.Prefix(Prefix_Start);
}
private static void Prefix_Start(PauseMenuControlsPage self)
{
if (!InitComplete)
{
GameObject gameObject = ((Component)TransformExtensions.FindChildRecursive(((Component)self).transform, "UI_Control_KB_MoveForward")).gameObject;
UIPlugin.Log.LogDebug((object)$"control is null - {(Object)(object)gameObject == (Object)null}");
GameObject val = ((gameObject != null) ? ((Component)gameObject.transform.Find("ResetButton")).gameObject : null);
GameObject val2 = ((gameObject != null) ? ((Component)gameObject.transform.Find("Warning")).gameObject : null);
InputIcon val3 = ((gameObject != null) ? gameObject.gameObject.GetComponentInChildren<InputIcon>() : null);
List<GameObject> source = new List<GameObject>(3) { gameObject, val, val2 };
if (source.Any((GameObject o) => (Object)(object)o == (Object)null) || (Object)(object)val3 == (Object)null)
{
ThrowHelper.ThrowIfArgumentNull<GameObject>(gameObject, "Unable to get valid control gameobject for control button templates!");
ThrowHelper.ThrowIfArgumentNull<GameObject>(val, "Unable to get reset button template!");
ThrowHelper.ThrowIfArgumentNull<GameObject>(val2, "Unable to get bind warning object for template!");
ThrowHelper.ThrowIfArgumentNull<InputIcon>(val3, "Unable to get valid inputIcon for template!");
return;
}
Templates.ResetBindButton = Object.Instantiate<GameObject>(val);
((Object)Templates.ResetBindButton).name = "PeakUIResetBindButton";
Object.DontDestroyOnLoad((Object)(object)Templates.ResetBindButton);
Templates.BindWarningButton = Object.Instantiate<GameObject>(val2);
((Object)Templates.BindWarningButton).name = "PeakUIBindWarningButton";
Object.DontDestroyOnLoad((Object)(object)Templates.BindWarningButton);
Templates.PS5SpriteSheet = val3.ps5Sprites;
Templates.PS4SpriteSheet = val3.ps4Sprites;
Templates.XboxSpriteSheet = val3.xboxSprites;
Templates.SwitchSpriteSheet = val3.switchSprites;
Templates.KeyboardSpriteSheet = val3.keyboardSprites;
InitComplete = true;
}
}
}
[MonoDetourTargets(typeof(PauseMenuMainPage))]
internal static class PauseMenuMainPageHooks
{
internal static bool RunOnce;
[MonoDetourHookInitialize]
private static void Init()
{
On.PauseMenuMainPage.Start.Postfix(PostfixEnable);
}
private static void PostfixEnable(PauseMenuMainPage self)
{
MenuAPI.pauseMenuBuilderDelegate?.Invoke(((Component)self).transform);
Transform transform = ((Component)self).transform.parent.Find("ControlsPage");
MenuAPI.controlsMenuBuilderDelegate?.Invoke(transform);
}
}
[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.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
{
public List<GameObject> Tabs = new List<GameObject>();
private Color backgroundColor = new Color(0.1792453f, 0.1253449f, 0.09046815f, 62f / 85f);
private RectTransform Content { get; set; }
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
Tabs.Clear();
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_00b8: 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_00f7: Expected O, but got Unknown
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: 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 = backgroundColor;
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;
Tabs.Add(val);
return val;
}
private bool DoesTabExist(string tabName, out GameObject match)
{
string tabName2 = tabName;
match = null;
if (string.IsNullOrEmpty(tabName2))
{
return false;
}
match = ((IEnumerable<GameObject>)Tabs).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == tabName2));
if ((Object)(object)match == (Object)null)
{
UIPlugin.Log.LogWarning((object)("Unable to find existing tab by name: " + tabName2));
}
return (Object)(object)match != (Object)null;
}
public void DeleteTab(string tabName)
{
if (DoesTabExist(tabName, out GameObject match))
{
Object.Destroy((Object)(object)match);
Tabs.Remove(match);
}
}
public void UpdateName(string currentName, string newName)
{
if (DoesTabExist(currentName, out GameObject match))
{
((Object)match.gameObject).name = newName;
match.GetComponent<PeakText>().SetText(newName);
}
}
public void SetBackgroundColor(Color color)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
backgroundColor = color;
}
}
[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; }
public static GameObject? ResetBindButton { get; internal set; }
public static GameObject? BindWarningButton { get; internal set; }
public static TMP_SpriteAsset? KeyboardSpriteSheet { get; internal set; }
public static TMP_SpriteAsset? XboxSpriteSheet { get; internal set; }
public static TMP_SpriteAsset? PS4SpriteSheet { get; internal set; }
public static TMP_SpriteAsset? PS5SpriteSheet { get; internal set; }
public static TMP_SpriteAsset? SwitchSpriteSheet { get; internal set; }
}
}
namespace PEAKLib.UI.Elements.Settings
{
public class GenericBoolSetting : OffOnSetting, IExposedSetting
{
[CompilerGenerated]
private string <displayName>P;
[CompilerGenerated]
private bool <defaultValue>P;
[CompilerGenerated]
private SettingsCategory <category>P;
[CompilerGenerated]
private bool <currentValue>P;
[CompilerGenerated]
private Action<bool>? <saveCallback>P;
[CompilerGenerated]
private Action<GenericBoolSetting>? <onApply>P;
public GenericBoolSetting(string displayName, bool defaultValue = false, SettingsCategory category = 0, bool currentValue = false, Action<bool>? saveCallback = null, Action<GenericBoolSetting>? onApply = null)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
<displayName>P = displayName;
<defaultValue>P = defaultValue;
<category>P = category;
<currentValue>P = currentValue;
<saveCallback>P = saveCallback;
<onApply>P = onApply;
((OffOnSetting)this)..ctor();
}
public override void Load(ISettingsSaveLoad loader)
{
((EnumSetting<OffOnMode>)this).Value = (OffOnMode)(<currentValue>P ? 1 : 0);
}
public override void Save(ISettingsSaveLoad saver)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
<saveCallback>P?.Invoke((int)((EnumSetting<OffOnMode>)this).Value == 1);
}
public override void ApplyValue()
{
<onApply>P?.Invoke(this);
}
protected override OffOnMode GetDefaultValue()
{
if (<defaultValue>P)
{
return (OffOnMode)1;
}
return (OffOnMode)0;
}
public string GetDisplayName()
{
return <displayName>P;
}
public string GetCategory()
{
return ((object)(SettingsCategory)(ref <category>P)).ToString();
}
public override List<LocalizedString>? GetLocalizedChoices()
{
return null;
}
public override List<string> GetUnlocalizedChoices()
{
return new List<string>(2) { "OFF", "ON" };
}
}
public class GenericEnumSetting<T> : EnumSetting<T>, IExposedSetting where T : unmanaged, Enum
{
[CompilerGenerated]
private string <displayName>P;
[CompilerGenerated]
private T <currentValue>P;
[CompilerGenerated]
private T <defaultValue>P;
[CompilerGenerated]
private SettingsCategory <category>P;
[CompilerGenerated]
private Action<T>? <saveCallback>P;
[CompilerGenerated]
private Action<GenericEnumSetting<T>>? <onApply>P;
public GenericEnumSetting(string displayName, T currentValue, T defaultValue, SettingsCategory category = 0, Action<T>? saveCallback = null, Action<GenericEnumSetting<T>>? onApply = null)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
<displayName>P = displayName;
<currentValue>P = currentValue;
<defaultValue>P = defaultValue;
<category>P = category;
<saveCallback>P = saveCallback;
<onApply>P = onApply;
base..ctor();
}
public override void Load(ISettingsSaveLoad loader)
{
base.Value = <currentValue>P;
}
public override void Save(ISettingsSaveLoad saver)
{
<saveCallback>P?.Invoke(base.Value);
}
public override GameObject GetSettingUICell()
{
return SingletonAsset<InputCellMapper>.Instance.EnumSettingCell;
}
public override void ApplyValue()
{
<onApply>P?.Invoke(this);
}
protected override T GetDefaultValue()
{
return <defaultValue>P;
}
public string GetDisplayName()
{
return <displayName>P;
}
public string GetCategory()
{
return ((object)(SettingsCategory)(ref <category>P)).ToString();
}
public override List<LocalizedString>? GetLocalizedChoices()
{
return null;
}
public override List<string> GetUnlocalizedChoices()
{
return Enum.GetNames(typeof(T)).ToList();
}
public override SettingUI GetDebugUI(ISettingHandler settingHandler)
{
return null;
}
}
public class GenericFloatSetting : FloatSetting, IExposedSetting
{
[CompilerGenerated]
private string <displayName>P;
[CompilerGenerated]
private float <defaultValue>P;
[CompilerGenerated]
private SettingsCategory <category>P;
[CompilerGenerated]
private float <minValue>P;
[CompilerGenerated]
private float <maxValue>P;
[CompilerGenerated]
private float <currentValue>P;
[CompilerGenerated]
private Action<float>? <saveCallback>P;
[CompilerGenerated]
private Action<GenericFloatSetting>? <onApply>P;
public GenericFloatSetting(string displayName, float defaultValue = 0f, SettingsCategory category = 0, float minValue = 0f, float maxValue = 1f, float currentValue = 0f, Action<float>? saveCallback = null, Action<GenericFloatSetting>? onApply = null)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
<displayName>P = displayName;
<defaultValue>P = defaultValue;
<category>P = category;
<minValue>P = minValue;
<maxValue>P = maxValue;
<currentValue>P = currentValue;
<saveCallback>P = saveCallback;
<onApply>P = onApply;
((FloatSetting)this)..ctor();
}
public override void Load(ISettingsSaveLoad loader)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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)
((FloatSetting)this).Value = <currentValue>P;
float2 minMaxValue = ((FloatSetting)this).GetMinMaxValue();
((FloatSetting)this).MinValue = minMaxValue.x;
((FloatSetting)this).MaxValue = minMaxValue.y;
}
public override void Save(ISettingsSaveLoad saver)
{
<saveCallback>P?.Invoke(((FloatSetting)this).Value);
}
public override void ApplyValue()
{
<onApply>P?.Invoke(this);
}
public string GetDisplayName()
{
return <displayName>P;
}
public string GetCategory()
{
return ((object)(SettingsCategory)(ref <category>P)).ToString();
}
protected override float GetDefaultValue()
{
return <defaultValue>P;
}
protected override float2 GetMinMaxValue()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return new float2(<minValue>P, <maxValue>P);
}
}
}
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
{
}
}