Decompiled source of Outfit Presets v1.0.4

OutfitsPresets.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using Microsoft.CodeAnalysis;
using TMPro;
using TabsBuilderApi.Utils;
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.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4-ci.38+50783784d99c8fd649982178b6af4063316bd043")]
[assembly: AssemblyProduct("OutfitsPresets")]
[assembly: AssemblyTitle("OutfitsPresets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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 ex)
				{
					OutfitsPresetsPlugin.mls.LogError((object)("Error reading file: " + ex.Message));
				}
			}
			else
			{
				OutfitsPresetsPlugin.mls.LogDebug((object)("File does not exist: " + filePath));
			}
			return null;
		}

		public static bool SaveFile(string fileName, string content)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			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 ex)
			{
				ManualLogSource mls = OutfitsPresetsPlugin.mls;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to save file: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				mls.LogError(val);
				return false;
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Among Us.exe")]
	[BepInPlugin("OutfitsPresets", "OutfitsPresets", "1.0.4-ci.38+50783784d99c8fd649982178b6af4063316bd043")]
	public class OutfitsPresetsPlugin : BasePlugin
	{
		public static ManualLogSource mls;

		public const string Id = "OutfitsPresets";

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


		public static string Name => "OutfitsPresets";

		public static string Version => "1.0.4-ci.38+50783784d99c8fd649982178b6af4063316bd043";

		public override void Load()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			mls = Logger.CreateLogSource("OutfitsPresets");
			ManualLogSource obj = mls;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("OutfitsPresets");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is now awake!");
			}
			obj.LogInfo(val);
			FileUtils.GetPath();
			Harmony.PatchAll();
			ClassInjector.RegisterTypeInIl2Cpp<OutfitsPresetsTab>();
		}
	}
	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; }
	}
	[TabBuilder(/*Could not decode attribute arguments.*/)]
	public class OutfitsPresetsTab : InventoryTab
	{
		private bool EnabledDelete;

		private HashSet<int> AvailableColors = new HashSet<int>();

		private void Awake()
		{
			Transform val = ((Component)this).transform.Find("Text");
			TextTranslatorTMP component = ((Component)val).GetComponent<TextTranslatorTMP>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.defaultStr = "Outfits";
				component.TargetText = (StringNames)0;
				((TMP_Text)((Component)val).GetComponent<TextMeshPro>()).SetText("Outfits", true);
				component.ResetText();
			}
		}

		public void ClickEquipHat(string hatname)
		{
			DataManager.Player.Customization.Hat = hatname;
			PlayerControl localPlayer = PlayerControl.LocalPlayer;
			if (localPlayer != null)
			{
				localPlayer.RpcSetHat(hatname);
			}
		}

		public void ClickEquipSkins(string skin)
		{
			DataManager.Player.Customization.skin = skin;
			PlayerControl localPlayer = PlayerControl.LocalPlayer;
			if (localPlayer != null)
			{
				localPlayer.RpcSetSkin(skin);
			}
		}

		public void ClickEquipVisor(string visor)
		{
			DataManager.Player.Customization.visor = visor;
			PlayerControl localPlayer = PlayerControl.LocalPlayer;
			if (localPlayer != null)
			{
				localPlayer.RpcSetVisor(visor);
			}
		}

		public void ClickEquipPet(string pet)
		{
			DataManager.Player.Customization.Pet = pet;
			PlayerControl localPlayer = PlayerControl.LocalPlayer;
			if (localPlayer != null)
			{
				localPlayer.RpcSetPet(pet);
			}
		}

		private void SelectHat(string hat, int color)
		{
			HatData hatById = DestroyableSingleton<HatManager>.Instance.GetHatById(hat);
			((InventoryTab)this).PlayerPreview.SetHat(hatById, color);
			if (hatById != null && hatById.BlocksVisors)
			{
				((InventoryTab)this).PlayerPreview.SetVisor(string.Empty, 0);
				return;
			}
			string text = (((InventoryTab)this).HasLocalPlayer() ? PlayerControl.LocalPlayer.Data.DefaultOutfit.VisorId : DataManager.Player.Customization.Visor);
			((InventoryTab)this).PlayerPreview.SetVisor(text, color);
		}

		private void SelectSkin(string skin, int color)
		{
			SkinData skinById = DestroyableSingleton<HatManager>.Instance.GetSkinById(skin);
			((InventoryTab)this).PlayerPreview.SetSkin(skinById, color);
		}

		private void SelectVisor(string visor, int color)
		{
			VisorData visorById = DestroyableSingleton<HatManager>.Instance.GetVisorById(visor);
			((InventoryTab)this).PlayerPreview.SetVisor(visorById, color);
		}

		private void SelectPet(string pet, int color)
		{
			PetData petById = DestroyableSingleton<HatManager>.Instance.GetPetById(pet);
			((InventoryTab)this).PlayerPreview.SetPetIdle(petById, color);
		}

		public void ClickColorEquip(byte color)
		{
			DataManager.Player.Customization.colorID = color;
			PlayerControl localPlayer = PlayerControl.LocalPlayer;
			if (localPlayer != null)
			{
				localPlayer.SetColor((int)color);
			}
		}

		public override void OnEnable()
		{
			((Component)((InventoryTab)this).PlayerPreview).gameObject.SetActive(true);
			if (((InventoryTab)this).HasLocalPlayer())
			{
				((InventoryTab)this).PlayerPreview.UpdateFromLocalPlayer((MaskType)0);
			}
			else
			{
				((InventoryTab)this).PlayerPreview.UpdateFromDataManager((MaskType)0);
			}
			LoadTab();
		}

		public void LoadTab()
		{
			for (int i = 0; i < ((InventoryTab)this).ColorChips.Count; i++)
			{
				Object.Destroy((Object)(object)((Component)((InventoryTab)this).ColorChips[i]).gameObject);
			}
			((InventoryTab)this).ColorChips.Clear();
			((Component)((InventoryTab)this).PlayerPreview).gameObject.SetActive(true);
			Transform inner = ((InventoryTab)this).scroller.Inner;
			int pos = 0;
			AddPlusButton(inner, ref pos);
			AddMinusButton(inner, ref pos);
			foreach (string item in FileUtils.GetPath())
			{
				Outfit outfit = JsonSerializer.Deserialize<Outfit>(FileUtils.ReadJsonFile(item)) ?? new Outfit();
				AddOutfitButton(inner, outfit, item, ref pos);
			}
			PlayerCustomizationMenu.Instance.nameplateMaskArea.gameObject.SetActive(false);
			((InventoryTab)this).SetScrollerBounds();
			((MonoBehaviour)this).Invoke("playerfix", 0.1f);
		}

		public void playerfix()
		{
			((Component)((InventoryTab)this).PlayerPreview).gameObject.SetActive(true);
			if (((InventoryTab)this).HasLocalPlayer())
			{
				((InventoryTab)this).PlayerPreview.UpdateFromLocalPlayer((MaskType)0);
			}
			else
			{
				((InventoryTab)this).PlayerPreview.UpdateFromDataManager((MaskType)0);
			}
		}

		private void AddPlusButton(Transform inner, ref int pos)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ColorChip val = Object.Instantiate<ColorChip>(((InventoryTab)this).ColorTabPrefab, ((InventoryTab)this).scroller.Inner);
			((Component)val).transform.localPosition = ChipPosition(pos);
			((InventoryTab)this).ColorChips.Add(val);
			SetButtonText(val, "+", Palette.AcceptedGreen);
			pos++;
			Action action = delegate
			{
				OpenSavePopup();
			};
			((UnityEvent)val.Button.OnClick).AddListener(UnityAction.op_Implicit(action));
		}

		private void AddMinusButton(Transform inner, ref int pos)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ColorChip val = Object.Instantiate<ColorChip>(((InventoryTab)this).ColorTabPrefab, ((InventoryTab)this).scroller.Inner);
			((Component)val).transform.localPosition = ChipPosition(pos);
			((InventoryTab)this).ColorChips.Add(val);
			SetButtonText(val, "-", Palette.ImpostorRed);
			pos++;
			Action action = delegate
			{
				EnabledDelete = !EnabledDelete;
				LoadTab();
			};
			((UnityEvent)val.Button.OnClick).AddListener(UnityAction.op_Implicit(action));
		}

		private Vector3 ChipPosition(int num)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			int num2 = num % 4;
			int num3 = num / 4;
			float num4 = -1f + (float)num2 * 1f;
			float num5 = -1f - (float)num3 * 1f;
			float num6 = -1f;
			return new Vector3(num4, num5, num6);
		}

		private bool ColorEquipable(Outfit outfit)
		{
			for (int i = 0; i < ((Il2CppArrayBase<Color32>)(object)Palette.PlayerColors).Length; i++)
			{
				AvailableColors.Add(i);
			}
			if (Object.op_Implicit((Object)(object)GameData.Instance))
			{
				List<NetworkedPlayerInfo> allPlayers = GameData.Instance.AllPlayers;
				for (int j = 0; j < allPlayers.Count; j++)
				{
					NetworkedPlayerInfo val = allPlayers[j];
					AvailableColors.Remove(val.DefaultOutfit.ColorId);
				}
			}
			return AvailableColors.Contains(outfit.Color);
		}

		private void AddOutfitButton(Transform inner, Outfit outfit, string file, ref int pos)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			ColorChip val = Object.Instantiate<ColorChip>(((InventoryTab)this).ColorTabPrefab, ((InventoryTab)this).scroller.Inner);
			((Component)val).transform.localPosition = ChipPosition(pos);
			((PassiveUiElement)val.Button).ClickMask = ((InventoryTab)this).scroller.Hitbox;
			((InventoryTab)this).ColorChips.Add(val);
			pos++;
			string fileName = Path.GetFileNameWithoutExtension(file);
			if (!EnabledDelete)
			{
				Action action = delegate
				{
					PlayerCustomizationMenu.Instance.SetItemName(fileName);
					if (ColorEquipable(outfit))
					{
						((InventoryTab)this).PlayerPreview.SetBodyColor(outfit.Color);
					}
					SelectHat(outfit.Hat, outfit.Color);
					SelectSkin(outfit.Skin, outfit.Color);
					SelectVisor(outfit.Visor, outfit.Color);
					SelectPet(outfit.Pet, outfit.Color);
				};
				((UiElement)val.Button).OnMouseOver.AddListener(UnityAction.op_Implicit(action));
				Action action2 = delegate
				{
					PlayerCustomizationMenu.Instance.SetItemName("None");
					((InventoryTab)this).PlayerPreview.SetBodyColor((int)DataManager.Player.Customization.Color);
					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);
					SelectPet(DataManager.Player.Customization.Pet, DataManager.Player.Customization.Color);
				};
				((UiElement)val.Button).OnMouseOut.AddListener(UnityAction.op_Implicit(action2));
				Action action3 = delegate
				{
					PlayerCustomizationMenu.Instance.SetItemName(fileName);
					if (ColorEquipable(outfit))
					{
						ClickColorEquip((byte)outfit.Color);
					}
					ClickEquipHat(outfit.Hat);
					ClickEquipSkins(outfit.Skin);
					ClickEquipVisor(outfit.Visor);
					ClickEquipPet(outfit.Pet);
				};
				((UnityEvent)val.Button.OnClick).AddListener(UnityAction.op_Implicit(action3));
			}
			else
			{
				SetButtonText(val, "-", Palette.ImpostorRed);
				Action action4 = delegate
				{
					File.Delete(file);
					LoadTab();
				};
				((UnityEvent)val.Button.OnClick).AddListener(UnityAction.op_Implicit(action4));
			}
			PoolablePlayer val2 = Object.Instantiate<PoolablePlayer>(((InventoryTab)this).PlayerPreview, ((Component)val).transform);
			val2.ToggleName(false);
			val2.SetBodyColor(outfit.Color);
			((Component)val2).transform.localScale = Vector3.one * 0.4f;
			((Component)val2).transform.localPosition = new Vector3(0f, 0f, -40f);
			val2.SetHat(outfit.Hat, val2.ColorId);
			val2.SetSkin(outfit.Skin, val2.ColorId);
			val2.SetVisor(outfit.Visor, val2.ColorId);
			val2.SetPetIdle(DestroyableSingleton<HatManager>.Instance.GetPetById(outfit.Pet), val2.ColorId);
			Transform obj = ((Component)val2.cosmetics).transform.Find("PetSlot");
			if (obj != null)
			{
				Transform child = obj.GetChild(0);
				if (child != null)
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
			((Component)val.SelectionHighlight).gameObject.SetActive(false);
		}

		private void SetButtonText(ColorChip chip, string text, Color color)
		{
			//IL_006e: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			Transform val = Object.Instantiate<Transform>(((Component)this).transform.Find("Text"), ((Component)chip).transform);
			TextTranslatorTMP component = ((Component)val).GetComponent<TextTranslatorTMP>();
			if ((Object)(object)component != (Object)null)
			{
				component.defaultStr = text;
				component.TargetText = (StringNames)0;
				((TMP_Text)((Component)val).GetComponent<TextMeshPro>()).SetText(text, true);
				((Graphic)((Component)val).GetComponent<TextMeshPro>()).color = color;
				component.ResetText();
			}
			((Component)val).transform.localScale = new Vector3(3.5f, 3.5f, 1f);
			((Component)val).transform.localPosition = new Vector3(8.1481f, 0.267f, -64f);
		}

		private void OpenSavePopup()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			GenericPopup popup = Object.Instantiate<GenericPopup>(DestroyableSingleton<DiscordManager>.Instance.discordPopup, ((Component)this).transform);
			SpriteRenderer component = ((Component)((Component)popup).transform.Find("Background")).GetComponent<SpriteRenderer>();
			Vector2 size = component.size;
			size.x *= 2.5f;
			component.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 val = ((Component)popup).transform.Find("ExitGame");
			((Component)val).transform.localPosition = new Vector3(-1f, val.localPosition.y, val.localPosition.z);
			Transform val2 = val.Find("Text_TMP");
			TextTranslatorTMP component2 = ((Component)val2).GetComponent<TextTranslatorTMP>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.defaultStr = "Cancel";
				component2.TargetText = (StringNames)0;
				((TMP_Text)((Component)val2).GetComponent<TextMeshPro>()).SetText("Cancel", true);
				component2.ResetText();
			}
			Transform obj = Object.Instantiate<Transform>(val, ((Component)popup).transform);
			((Component)obj).transform.localPosition = new Vector3(1f, val.localPosition.y, val.localPosition.z);
			val2 = obj.Find("Text_TMP");
			component2 = ((Component)val2).GetComponent<TextTranslatorTMP>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.defaultStr = "Confirm";
				component2.TargetText = (StringNames)0;
				((TMP_Text)((Component)val2).GetComponent<TextMeshPro>()).SetText("Confirm", true);
				component2.ResetText();
			}
			GameObject val3 = Object.Instantiate<GameObject>(((Component)DestroyableSingleton<AccountManager>.Instance.accountTab.editNameScreen.nameText).gameObject, ((Component)popup).gameObject.transform);
			Object.Destroy((Object)(object)val3.GetComponent<NameTextBehaviour>());
			Transform obj2 = val3.transform.Find("Background");
			TextBoxTMP textBox = val3.GetComponent<TextBoxTMP>();
			((TMP_Text)textBox.outputText).alignment = (TextAlignmentOptions)544;
			textBox.outputText.transform.position = val3.transform.position;
			val3.SetActive(false);
			val3.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");
			val3.GetComponent<BoxCollider2D>().size = new Vector2(9f, 0.8f);
			val3.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
			val3.transform.localPosition = new Vector3(0f, 0.15f, -2f);
			((UnityEvent)((Component)val).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();
				Object.Destroy((Object)(object)((Component)popup).gameObject);
			}));
		}
	}
}