using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
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(Core), "QuickAvatarMenu", "1.0.0", "Checkerboard", null)]
[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: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace QuickAvatarMenu
{
[RegisterTypeInIl2Cpp]
public class ActiveLink : MonoBehaviour
{
public GameObject Linked;
public void OnEnable()
{
GameObject linked = Linked;
if (linked != null)
{
linked.SetActive(true);
}
}
public void OnDisable()
{
GameObject linked = Linked;
if (linked != null)
{
linked.SetActive(false);
}
}
}
[HarmonyPatch]
public class Core : MelonMod
{
private static MelonPreferences_Category Category;
private static MelonPreferences_Entry<int> Pages;
public override void OnInitializeMelon()
{
Category = MelonPreferences.CreateCategory("QuickAvatarMenu");
Pages = Category.CreateEntry<int>("Pages", 10, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
Category.SaveToFile(false);
}
[HarmonyPatch(typeof(AvatarsPanelView), "Awake")]
[HarmonyPostfix]
private static void AvatarsPanelViewAwake(AvatarsPanelView __instance)
{
AddSkipButtons(((Component)__instance).gameObject, __instance.forwardButton, __instance.backButton, __instance.isBodyMall ? 15f : 80f, (Action)__instance.NextPage, (Action)__instance.PrevPage);
}
[HarmonyPatch(typeof(LevelsPanelView), "Awake")]
[HarmonyPostfix]
private static void LevelsPanelViewAwake(LevelsPanelView __instance)
{
AddSkipButtons(((Component)__instance).gameObject, __instance.forwardButton, __instance.backButton, 80f, (Action)__instance.NextPage, (Action)__instance.PrevPage);
}
private static void AddSkipButtons(GameObject parent, GameObject originalForward, GameObject originalBack, float offset, Action nextPage, Action prevPage)
{
GameObject linked = CreateSkipButton(originalForward, offset, nextPage);
GameObject linked2 = CreateSkipButton(originalBack, 0f - offset, prevPage);
originalForward.AddComponent<ActiveLink>().Linked = linked;
originalBack.AddComponent<ActiveLink>().Linked = linked2;
}
private static GameObject CreateSkipButton(GameObject original, float xOffset, Action pageAction)
{
//IL_002a: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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)
GameObject obj = Object.Instantiate<GameObject>(original, original.transform.parent);
obj.transform.position = original.transform.position;
Transform transform = obj.transform;
transform.localPosition += new Vector3(xOffset, 0f, 0f);
Transform transform2 = obj.transform;
transform2.localScale *= 0.8f;
Button component = obj.GetComponent<Button>();
((UnityEventBase)component.onClick).RemoveAllListeners();
Action action = delegate
{
for (int i = 0; i < Pages.Value - 1; i++)
{
pageAction();
}
};
((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit(action));
return obj;
}
}
}