Decompiled source of Outfit Presets v1.0.1

OutfitsPresets.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using AmongUs.Data;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections;
using Microsoft.CodeAnalysis;
using OutfitsPresets.FastDestroyableSingleton;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("OutfitsPresets")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Save Outfits ingame")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1-release")]
[assembly: AssemblyProduct("OutfitsPresets")]
[assembly: AssemblyTitle("OutfitsPresets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[HarmonyPatch(typeof(ModManager), "LateUpdate")]
internal class ModManagerLateUpdatePatch
{
	public static void Prefix(ModManager __instance)
	{
		__instance.ShowModStamp();
	}
}
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 OutfitsPresets
{
	internal class FileUtils
	{
		public static List<string> Files = new List<string> { "" };

		public static List<string> GetPath()
		{
			string path = Path.Combine(Application.persistentDataPath, "OutfitPresets");
			path = Path.GetFullPath(path);
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
				return Files;
			}
			string[] files = Directory.GetFiles(path, "*.json");
			Files.Clear();
			string[] array = files;
			foreach (string item in array)
			{
				Files.Add(item);
			}
			return Files;
		}

		public static string ReadJsonFile(string filePath)
		{
			if (File.Exists(filePath))
			{
				try
				{
					return File.ReadAllText(filePath);
				}
				catch (Exception)
				{
				}
			}
			return null;
		}

		public static bool SaveFile(string fileName, string content)
		{
			try
			{
				string path = Path.Combine(Application.persistentDataPath, "OutfitPresets");
				path = Path.GetFullPath(path);
				if (!Directory.Exists(path))
				{
					Directory.CreateDirectory(path);
				}
				File.WriteAllText(Path.Combine(path, fileName), content);
				return true;
			}
			catch (Exception)
			{
				return false;
			}
		}
	}
	[BepInProcess("Among Us.exe")]
	[BepInPlugin("OutfitsPresets", "OutfitsPresets", "1.0.1-release")]
	public class OutfitsPresetsPlugin : BasePlugin
	{
		[HarmonyPatch(typeof(PlayerCustomizationMenu))]
		public static class TabSync
		{
			public class Outfit
			{
				public string Hat { get; set; }

				public string Skin { get; set; }

				public string Visor { get; set; }

				public string Pet { get; set; }

				public int Color { get; set; }
			}

			private static bool EnabledDelete;

			public static SkinsTab FakeNameTab;

			internal static TextBoxTMP FileTextBox { get; set; }

			public static void ClickEquipHat(string hatname)
			{
				DataManager.Player.Customization.Hat = hatname;
				FastDestroyableSingleton<HatManager>.Instance.GetHatById(hatname);
				if (Object.op_Implicit((Object)(object)PlayerControl.LocalPlayer))
				{
					PlayerControl.LocalPlayer.RpcSetHat(hatname);
				}
			}

			public static void ClickEquipSkins(string RpcSetSkin)
			{
				DataManager.Player.Customization.skin = RpcSetSkin;
				if (Object.op_Implicit((Object)(object)PlayerControl.LocalPlayer))
				{
					PlayerControl.LocalPlayer.RpcSetSkin(RpcSetSkin);
				}
			}

			public static void ClickEquipVisor(string RpcSetVisor)
			{
				DataManager.Player.Customization.visor = RpcSetVisor;
				if (Object.op_Implicit((Object)(object)PlayerControl.LocalPlayer))
				{
					PlayerControl.LocalPlayer.RpcSetVisor(RpcSetVisor);
				}
			}

			public static void ClickEquipPet(string RpcSetPet)
			{
				DataManager.Player.Customization.Pet = RpcSetPet;
				if (Object.op_Implicit((Object)(object)PlayerControl.LocalPlayer))
				{
					PlayerControl.LocalPlayer.RpcSetPet(RpcSetPet);
				}
			}

			private static void SelectHat(string hatstr, int color)
			{
				HatData hatById = FastDestroyableSingleton<HatManager>.Instance.GetHatById(hatstr);
				((InventoryTab)FakeNameTab).PlayerPreview.SetHat(hatById, color);
				if (hatById.BlocksVisors)
				{
					((InventoryTab)FakeNameTab).PlayerPreview.SetVisor(string.Empty, 0);
				}
				else
				{
					((InventoryTab)FakeNameTab).PlayerPreview.SetVisor(((InventoryTab)FakeNameTab).HasLocalPlayer() ? PlayerControl.LocalPlayer.Data.DefaultOutfit.VisorId : DataManager.Player.Customization.Visor, color);
				}
			}

			private static void SelectSkin(string str, int color)
			{
				SkinData skinById = FastDestroyableSingleton<HatManager>.Instance.GetSkinById(str);
				((InventoryTab)FakeNameTab).PlayerPreview.SetSkin(skinById, color);
			}

			private static void SelectVisor(string str, int color)
			{
				VisorData visorById = FastDestroyableSingleton<HatManager>.Instance.GetVisorById(str);
				((InventoryTab)FakeNameTab).PlayerPreview.SetVisor(visorById, color);
			}

			private static void SelectPet(string str, int color)
			{
				PetData petById = FastDestroyableSingleton<HatManager>.Instance.GetPetById(str);
				((InventoryTab)FakeNameTab).PlayerPreview.SetPetIdle(petById, color);
			}

			public static void push(PlayerCustomizationMenu __instance)
			{
				__instance.OpenTab((InventoryTab)(object)FakeNameTab);
				EnabledDelete = false;
				LoadTab(__instance);
			}

			public static void LoadTab(PlayerCustomizationMenu __instance)
			{
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0365: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0612: Unknown result type (might be due to invalid IL or missing references)
				//IL_0637: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
				_ = PlayerCustomizationMenu.Instance;
				Transform inner = ((InventoryTab)FakeNameTab).scroller.Inner;
				IEnumerator enumerator = inner.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						Transform val = ((Il2CppObjectBase)enumerator.Current).TryCast<Transform>();
						if (Object.op_Implicit((Object)(object)val))
						{
							Object.Destroy((Object)(object)((Component)val).gameObject);
						}
					}
				}
				finally
				{
					if (enumerator is IDisposable disposable)
					{
						disposable.Dispose();
					}
				}
				((InventoryTab)FakeNameTab).ColorChips.Clear();
				int num = 0;
				ColorChip val2 = Object.Instantiate<ColorChip>(((InventoryTab)FakeNameTab).ColorTabPrefab, ((Component)inner).transform);
				((InventoryTab)FakeNameTab).ColorChips.Add(val2);
				Transform val3 = ((Component)FakeNameTab).transform.Find("Text");
				TextTranslatorTMP component = ((Component)val3).GetComponent<TextTranslatorTMP>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.defaultStr = "Outfits";
					component.TargetText = (StringNames)0;
					((TMP_Text)((Component)val3).GetComponent<TextMeshPro>()).SetText("Outfits", true);
					component.ResetText();
				}
				Transform val4 = Object.Instantiate<Transform>(((Component)val3).transform, ((Component)val2).transform);
				component = ((Component)val4).GetComponent<TextTranslatorTMP>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.defaultStr = "+";
					component.TargetText = (StringNames)0;
					((TMP_Text)((Component)val4).GetComponent<TextMeshPro>()).SetText("+", true);
					((Graphic)((Component)val4).GetComponent<TextMeshPro>()).color = Palette.AcceptedGreen;
					component.ResetText();
				}
				((Component)val4).gameObject.transform.localScale = new Vector3(3.5f, 3.5f, 1f);
				((Component)val4).gameObject.transform.localPosition = new Vector3(8.1481f, 0.267f, -1f);
				float num2 = ((InventoryTab)FakeNameTab).XRange.Lerp((float)(num % ((InventoryTab)FakeNameTab).NumPerRow) / ((float)((InventoryTab)FakeNameTab).NumPerRow - 1f));
				float num3 = ((InventoryTab)FakeNameTab).YStart - (float)(num / ((InventoryTab)FakeNameTab).NumPerRow) * ((InventoryTab)FakeNameTab).YOffset;
				((Component)val2).transform.localPosition = new Vector3(num2, num3, -1f);
				num++;
				((UnityEvent)val2.Button.OnClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					//IL_0047: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_005d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
					//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
					//IL_016d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0178: Unknown result type (might be due to invalid IL or missing references)
					//IL_0182: Unknown result type (might be due to invalid IL or missing references)
					//IL_025b: Unknown result type (might be due to invalid IL or missing references)
					//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
					//IL_0314: Unknown result type (might be due to invalid IL or missing references)
					//IL_0334: Unknown result type (might be due to invalid IL or missing references)
					//IL_0354: Unknown result type (might be due to invalid IL or missing references)
					GenericPopup popup = Object.Instantiate<GenericPopup>(DestroyableSingleton<DiscordManager>.Instance.discordPopup, ((Component)FakeNameTab).transform);
					SpriteRenderer component2 = ((Component)((Component)popup).transform.Find("Background")).GetComponent<SpriteRenderer>();
					Vector2 size = component2.size;
					size.x *= 2.5f;
					component2.size = size;
					((Component)popup).gameObject.transform.localPosition = new Vector3(3.5f, -1.8f, ((Component)popup).gameObject.transform.localPosition.z);
					((TMP_Text)popup.TextAreaTMP).fontSizeMin = 2f;
					popup.Show("What would you like to save this outfit as?");
					Transform val7 = ((Component)popup).transform.Find("ExitGame");
					((Component)val7).transform.localPosition = new Vector3(-1f, val7.localPosition.y, val7.localPosition.z);
					Transform val8 = val7.Find("Text_TMP");
					TextTranslatorTMP component3 = ((Component)val8).GetComponent<TextTranslatorTMP>();
					if (Object.op_Implicit((Object)(object)component3))
					{
						component3.defaultStr = "Cancel";
						component3.TargetText = (StringNames)0;
						((TMP_Text)((Component)val8).GetComponent<TextMeshPro>()).SetText("Cancel", true);
						component3.ResetText();
					}
					Transform obj = Object.Instantiate<Transform>(val7, ((Component)popup).transform);
					((Component)obj).transform.localPosition = new Vector3(1f, val7.localPosition.y, val7.localPosition.z);
					val8 = obj.Find("Text_TMP");
					component3 = ((Component)val8).GetComponent<TextTranslatorTMP>();
					if (Object.op_Implicit((Object)(object)component3))
					{
						component3.defaultStr = "Confirm";
						component3.TargetText = (StringNames)0;
						((TMP_Text)((Component)val8).GetComponent<TextMeshPro>()).SetText("Confirm", true);
						component3.ResetText();
					}
					GameObject val9 = Object.Instantiate<GameObject>(((Component)FastDestroyableSingleton<AccountManager>.Instance.accountTab.editNameScreen.nameText).gameObject, ((Component)popup).gameObject.transform);
					Object.Destroy((Object)(object)val9.GetComponent<NameTextBehaviour>());
					Transform obj2 = val9.transform.Find("Background");
					TextBoxTMP textBox = val9.GetComponent<TextBoxTMP>();
					((TMP_Text)textBox.outputText).alignment = (TextAlignmentOptions)544;
					textBox.outputText.transform.position = val9.transform.position;
					val9.SetActive(false);
					val9.SetActive(true);
					textBox.SetText("Example", "");
					textBox.text = "Example";
					((TMP_Text)textBox.outputText).SetText("Example", true);
					textBox.AllowSymbols = true;
					textBox.AllowPaste = true;
					textBox.characterLimit = 30;
					((Component)obj2).GetComponent<SpriteRenderer>().size = new Vector2(9f, 0.7f);
					((Component)obj2).gameObject.layer = LayerMask.NameToLayer("UI");
					val9.GetComponent<BoxCollider2D>().size = new Vector2(9f, 0.8f);
					val9.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
					val9.transform.localPosition = new Vector3(0f, 0.15f, -2f);
					((UnityEvent)((Component)val7).GetComponent<PassiveButton>().OnClick).AddListener(UnityAction.op_Implicit((Action)delegate
					{
						Object.Destroy((Object)(object)((Component)popup).gameObject);
						Object.Destroy((Object)(object)popup);
					}));
					((UnityEvent)((Component)obj).GetComponent<PassiveButton>().OnClick).AddListener(UnityAction.op_Implicit((Action)delegate
					{
						string content = "{\n\"Hat\" :\"" + DataManager.Player.Customization.Hat + "\",\n\"Visor\" :\"" + DataManager.Player.Customization.Visor + "\",\n\"Skin\" :\"" + DataManager.Player.Customization.skin + "\",\n\"Color\" :" + DataManager.Player.Customization.colorID + ",\n\"Pet\" :\"" + DataManager.Player.Customization.Pet + "\"}";
						if (!textBox.text.EndsWith(".json"))
						{
							FileUtils.SaveFile(textBox.text + ".json", content);
						}
						else
						{
							FileUtils.SaveFile(textBox.text, content);
						}
						LoadTab(__instance);
						Object.Destroy((Object)(object)((Component)popup).gameObject);
					}));
				}));
				val2 = Object.Instantiate<ColorChip>(((InventoryTab)FakeNameTab).ColorTabPrefab, ((Component)inner).transform);
				val4 = Object.Instantiate<Transform>(((Component)val3).transform, ((Component)val2).transform);
				component = ((Component)val4).GetComponent<TextTranslatorTMP>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.defaultStr = "-";
					component.TargetText = (StringNames)0;
					((TMP_Text)((Component)val4).GetComponent<TextMeshPro>()).SetText("-", true);
					((Graphic)((Component)val4).GetComponent<TextMeshPro>()).color = Palette.ImpostorRed;
					component.ResetText();
				}
				((Component)val4).gameObject.transform.localScale = new Vector3(3.5f, 3.5f, 1f);
				((Component)val4).gameObject.transform.localPosition = new Vector3(8.1481f, 0.267f, -1f);
				num2 = ((InventoryTab)FakeNameTab).XRange.Lerp((float)(num % ((InventoryTab)FakeNameTab).NumPerRow) / ((float)((InventoryTab)FakeNameTab).NumPerRow - 1f));
				num3 = ((InventoryTab)FakeNameTab).YStart - (float)(num / ((InventoryTab)FakeNameTab).NumPerRow) * ((InventoryTab)FakeNameTab).YOffset;
				((Component)val2).transform.localPosition = new Vector3(num2, num3, -1f);
				num++;
				((UnityEvent)val2.Button.OnClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					EnabledDelete = !EnabledDelete;
					LoadTab(__instance);
				}));
				foreach (string child in FileUtils.GetPath())
				{
					Outfit Contain = JsonSerializer.Deserialize<Outfit>(FileUtils.ReadJsonFile(child));
					if (Contain.Skin == null)
					{
						Contain.Skin = "";
					}
					if (Contain.Hat == null)
					{
						Contain.Hat = "";
					}
					if (Contain.Visor == null)
					{
						Contain.Visor = "";
					}
					if (Contain.Pet == null)
					{
						Contain.Pet = "";
					}
					string FileName = Path.GetFileNameWithoutExtension(child);
					float num4 = ((InventoryTab)FakeNameTab).XRange.Lerp((float)(num % ((InventoryTab)FakeNameTab).NumPerRow) / ((float)((InventoryTab)FakeNameTab).NumPerRow - 1f));
					float num5 = ((InventoryTab)FakeNameTab).YStart - (float)(num / ((InventoryTab)FakeNameTab).NumPerRow) * ((InventoryTab)FakeNameTab).YOffset;
					ColorChip val5 = Object.Instantiate<ColorChip>(((InventoryTab)FakeNameTab).ColorTabPrefab, ((Component)inner).transform);
					((Component)val5).transform.localPosition = new Vector3(num4, num5, -1f);
					((InventoryTab)FakeNameTab).ColorChips.Add(val5);
					if (!EnabledDelete)
					{
						((UiElement)val5.Button).OnMouseOver.AddListener(UnityAction.op_Implicit((Action)delegate
						{
							PlayerCustomizationMenu.Instance.SetItemName(FileName);
							SelectHat(Contain.Hat, Contain.Color);
							SelectSkin(Contain.Skin, Contain.Color);
							SelectVisor(Contain.Visor, Contain.Color);
							SelectPet(Contain.Pet, Contain.Color);
						}));
						((UiElement)val5.Button).OnMouseOut.AddListener(UnityAction.op_Implicit((Action)delegate
						{
							PlayerCustomizationMenu.Instance.SetItemName("None");
							SelectHat(DataManager.Player.Customization.Hat, DataManager.Player.Customization.Color);
							SelectSkin(DataManager.Player.Customization.skin, DataManager.Player.Customization.Color);
							SelectVisor(DataManager.Player.Customization.Visor, DataManager.Player.Customization.Color);
						}));
						((UnityEvent)val5.Button.OnClick).AddListener(UnityAction.op_Implicit((Action)delegate
						{
							PlayerCustomizationMenu.Instance.SetItemName(FileName);
							ClickEquipHat(Contain.Hat);
							ClickEquipSkins(Contain.Skin);
							ClickEquipVisor(Contain.Visor);
							ClickEquipPet(Contain.Pet);
						}));
					}
					else
					{
						val4 = Object.Instantiate<Transform>(((Component)val3).transform, ((Component)val5).transform);
						component = ((Component)val4).GetComponent<TextTranslatorTMP>();
						if (Object.op_Implicit((Object)(object)component))
						{
							component.defaultStr = "-";
							component.TargetText = (StringNames)0;
							((TMP_Text)((Component)val4).GetComponent<TextMeshPro>()).SetText("-", true);
							((Graphic)((Component)val4).GetComponent<TextMeshPro>()).color = Palette.ImpostorRed;
							component.ResetText();
						}
						((Component)val4).gameObject.transform.localScale = new Vector3(3.5f, 3.5f, 1f);
						((Component)val4).gameObject.transform.localPosition = new Vector3(8.1481f, 0.267f, -50f);
						((UnityEvent)val5.Button.OnClick).AddListener(UnityAction.op_Implicit((Action)delegate
						{
							File.Delete(child);
							LoadTab(__instance);
						}));
					}
					PoolablePlayer val6 = Object.Instantiate<PoolablePlayer>(((InventoryTab)FakeNameTab).PlayerPreview, ((Component)val5).transform);
					val6.SetBodyColor(Contain.Color);
					((Component)val6).transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
					((Component)val6).transform.localPosition = new Vector3(0f, 0f, -40f);
					val6.SetHat(Contain.Hat, val6.ColorId);
					val6.SetSkin(Contain.Skin, val6.ColorId);
					val6.SetVisor(Contain.Visor, val6.ColorId);
					if (Object.op_Implicit((Object)(object)((Component)val6.cosmetics).transform.Find("PetSlot")) && Object.op_Implicit((Object)(object)((Component)val6.cosmetics).transform.Find("PetSlot").GetChild(0)))
					{
						((Component)((Component)val6.cosmetics).transform.Find("PetSlot").GetChild(0)).gameObject.SetActive(false);
					}
					val6.SetPetIdle(FastDestroyableSingleton<HatManager>.Instance.GetPetById(Contain.Pet), val6.ColorId);
					((Component)val5.SelectionHighlight).gameObject.SetActive(false);
					num++;
				}
				((InventoryTab)FakeNameTab).SetScrollerBounds();
			}

			[HarmonyPatch("Start")]
			[HarmonyPrefix]
			public static bool Start_Prefix(PlayerCustomizationMenu __instance)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Expected O, but got Unknown
				//IL_012e: 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_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_0189: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)FakeNameTab))
				{
					return true;
				}
				TabButton val = new TabButton();
				FakeNameTab = ((Il2CppObjectBase)Object.Instantiate<InventoryTab>(((Il2CppArrayBase<TabButton>)(object)__instance.Tabs)[2].Tab, ((Component)((Il2CppArrayBase<TabButton>)(object)__instance.Tabs)[2].Tab).transform.parent)).TryCast<SkinsTab>();
				((Object)FakeNameTab).name = "Outfits Presets";
				((Component)FakeNameTab).gameObject.active = false;
				val.Tab = (InventoryTab)(object)FakeNameTab;
				((Object)val.Tab).name = "Outfits-Presets";
				Action action = delegate
				{
					push(__instance);
				};
				val.tabText = ((Component)((Component)FakeNameTab).transform.Find("Text")).GetComponent<TextMeshPro>();
				Transform val2 = Object.Instantiate<Transform>(((Component)((Il2CppArrayBase<TabButton>)(object)__instance.Tabs)[1].Button).transform.parent.parent, ((Component)((Il2CppArrayBase<TabButton>)(object)__instance.Tabs)[1].Button).transform.parent.parent.parent);
				((Object)val2).name = "OutfitsButtons";
				val2.position = new Vector3(val2.position.x + 3f, val2.position.y, val2.position.z);
				Transform val3 = ((Component)val2).transform.parent.Find("CubesTab");
				val2.position = new Vector3(val3.position.x + 1f, val2.position.y, val2.position.z);
				SwapPos(val3, val2);
				Transform val4 = val2.GetChild(0).Find("Tab Background");
				PassiveButton component = ((Component)val4).GetComponent<PassiveButton>();
				component.OnClick = new ButtonClickedEvent();
				((UnityEvent)component.OnClick).AddListener(UnityAction.op_Implicit(action));
				val.Button = ((Component)val4).GetComponent<SpriteRenderer>();
				List<TabButton> list = ((IEnumerable<TabButton>)__instance.Tabs).ToList();
				list.Add(val);
				__instance.Tabs = Il2CppReferenceArray<TabButton>.op_Implicit(list.ToArray());
				return true;
			}
		}

		public const string Id = "OutfitsPresets";

		public Harmony Harmony { get; } = new Harmony("OutfitsPresets");


		public static string Name => "OutfitsPresets";

		public static string Version => "1.0.1-release";

		public override void Load()
		{
			FileUtils.GetPath();
			Harmony.PatchAll();
		}

		public static void SwapPos(Transform Object1, Transform Object2)
		{
			//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)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = Object1.position;
			Vector3 position2 = Object2.position;
			Object1.position = position2;
			Object2.position = position;
		}
	}
}
namespace OutfitsPresets.FastDestroyableSingleton
{
	public static class FastDestroyableSingleton<T> where T : MonoBehaviour
	{
		private static readonly IntPtr _fieldPtr;

		private static readonly Func<IntPtr, T> _createObject;

		public unsafe static T Instance
		{
			get
			{
				IntPtr intPtr = default(IntPtr);
				IL2CPP.il2cpp_field_static_get_value(_fieldPtr, (void*)(&intPtr));
				if (intPtr == IntPtr.Zero)
				{
					return DestroyableSingleton<T>.Instance;
				}
				return _createObject(intPtr);
			}
		}

		static FastDestroyableSingleton()
		{
			_fieldPtr = IL2CPP.GetIl2CppField(Il2CppClassPointerStore<DestroyableSingleton<T>>.NativeClassPtr, "_instance");
			ConstructorInfo? constructor = typeof(T).GetConstructor(new Type[1] { typeof(IntPtr) });
			ParameterExpression parameterExpression = Expression.Parameter(typeof(IntPtr));
			_createObject = Expression.Lambda<Func<IntPtr, T>>(Expression.New(constructor, parameterExpression), new ParameterExpression[1] { parameterExpression }).Compile();
		}
	}
}