Decompiled source of QuickAvatarMenu v1.0.2

Mods/QuickAvatarMenu.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.UI;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using QuickAvatarMenu;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Main), "QuickAvatarMenu", "1.0.2", "Checkerboard", null)]
[assembly: MelonColor(255, 255, 255, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("QuickAvatarMenu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuickAvatarMenu")]
[assembly: AssemblyTitle("QuickAvatarMenu")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace QuickAvatarMenu
{
	public class Main : MelonMod
	{
		[HarmonyPatch]
		private static class AvatarPagePatch
		{
			[HarmonyPatch(typeof(AvatarsPanelView), "Awake")]
			[HarmonyPostfix]
			private static void AwakePatch(AvatarsPanelView __instance)
			{
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: 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)
				GameObject val = Object.Instantiate<GameObject>(__instance.forwardButton, __instance.forwardButton.transform);
				GameObject val2 = Object.Instantiate<GameObject>(__instance.backButton, __instance.backButton.transform);
				Button component = val.GetComponent<Button>();
				Button component2 = val2.GetComponent<Button>();
				if ((Object)(object)__instance.spiderChart == (Object)null)
				{
					val.transform.localPosition = new Vector3(80f, 0f, 0f);
					val2.transform.localPosition = new Vector3(-80f, 0f, 0f);
				}
				else
				{
					val.transform.localPosition = new Vector3(15f, 0f, 0f);
					val2.transform.localPosition = new Vector3(-15f, 0f, 0f);
					val.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
					val2.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
				}
				for (int i = 0; (float)i < Preferences.Amount.Value - 1f; i++)
				{
					((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)__instance.NextPage));
				}
				for (int j = 0; (float)j < Preferences.Amount.Value - 1f; j++)
				{
					((UnityEvent)component2.onClick).AddListener(UnityAction.op_Implicit((Action)__instance.PrevPage));
				}
			}
		}

		[HarmonyPatch]
		private static class LevelPagePatch
		{
			[HarmonyPatch(typeof(LevelsPanelView), "Awake")]
			[HarmonyPostfix]
			private static void AwakePatch(LevelsPanelView __instance)
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(__instance.forwardButton, __instance.forwardButton.transform);
				GameObject obj = Object.Instantiate<GameObject>(__instance.backButton, __instance.backButton.transform);
				Button component = val.GetComponent<Button>();
				Button component2 = obj.GetComponent<Button>();
				val.transform.localPosition = new Vector3(80f, 0f, 0f);
				obj.transform.localPosition = new Vector3(-80f, 0f, 0f);
				for (int i = 0; (float)i < Preferences.Amount.Value - 1f; i++)
				{
					((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)__instance.NextPage));
				}
				for (int j = 0; (float)j < Preferences.Amount.Value - 1f; j++)
				{
					((UnityEvent)component2.onClick).AddListener(UnityAction.op_Implicit((Action)__instance.PrevPage));
				}
			}
		}

		public override void OnInitializeMelon()
		{
			Preferences.Setup();
		}
	}
	internal class Preferences
	{
		public static readonly MelonPreferences_Category ModCategory = MelonPreferences.CreateCategory("Quick Avatar Menu");

		public static MelonPreferences_Entry<float> Amount;

		public static void Setup()
		{
			Amount = ModCategory.CreateEntry<float>("Amount", 10f, "Amount of pages to skip when using the buttons.", (string)null, false, false, (ValueValidator)null, (string)null);
			ModCategory.SaveToFile(false);
		}
	}
}