using System;
using System.Collections;
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 BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using InnerNet;
using Microsoft.CodeAnalysis;
using TMPro;
using TabsBuilderApi.Utils;
using TabsBuilderApi.Utils.Stubs;
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.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0-ci.43+87b8542d808d55ee5ab5dd56567932b8c4b29ce2")]
[assembly: AssemblyProduct("OutfitsPresets")]
[assembly: AssemblyTitle("OutfitsPresets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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;
}
}
}
[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> { "" };
private static string GetOutfitsPath()
{
string text = Path.Combine(Application.persistentDataPath, "OutfitPresets");
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
return text;
}
public static List<string> GetPath()
{
string[] files = Directory.GetFiles(GetOutfitsPath(), "*.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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
try
{
string outfitsPath = GetOutfitsPath();
fileName = Path.GetFileName(fileName);
if (!fileName.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
{
fileName += ".json";
}
File.WriteAllText(Path.Combine(outfitsPath, 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.1.0-ci.43+87b8542d808d55ee5ab5dd56567932b8c4b29ce2")]
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.1.0-ci.43+87b8542d808d55ee5ab5dd56567932b8c4b29ce2";
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 : TabScript
{
private const float RpcDelay = 0.25f;
private bool EquipInProgress;
private Outfit PendingOutfit;
private bool PendingColorChange;
private Coroutine EquipCoroutine;
private bool EnabledDelete;
public override void componentEnabledFinished(PlayerCustomizationMenu __instance)
{
if (__instance != null)
{
PoolablePlayer previewArea = __instance.PreviewArea;
if (previewArea != null)
{
GameObject gameObject = ((Component)previewArea).gameObject;
if (gameObject != null)
{
gameObject.SetActive(true);
}
}
}
if (this != null)
{
PoolablePlayer playerPreview = ((InventoryTab)this).PlayerPreview;
if (playerPreview != null)
{
GameObject gameObject2 = ((Component)playerPreview).gameObject;
if (gameObject2 != null)
{
gameObject2.SetActive(true);
}
}
}
if (__instance == null)
{
return;
}
GameObject nameplateMaskArea = __instance.nameplateMaskArea;
if (nameplateMaskArea != null)
{
GameObject gameObject3 = nameplateMaskArea.gameObject;
if (gameObject3 != null)
{
gameObject3.SetActive(false);
}
}
}
private void Awake()
{
Transform val = ((Component)this).transform.Find("Text");
TextTranslatorTMP val2 = ((val != null) ? ((Component)val).GetComponent<TextTranslatorTMP>() : null);
if (Object.op_Implicit((Object)(object)val2))
{
val2.defaultStr = "Outfits";
val2.TargetText = (StringNames)0;
((TMP_Text)((Component)val).GetComponent<TextMeshPro>()).SetText("Outfits", true);
val2.ResetText();
}
}
[HideFromIl2Cpp]
private void StartOutfitEquip(Outfit outfit, bool changeColor)
{
if (outfit != null)
{
PendingOutfit = new Outfit
{
Hat = (outfit.Hat ?? ""),
Skin = (outfit.Skin ?? ""),
Visor = (outfit.Visor ?? ""),
Pet = (outfit.Pet ?? ""),
Color = outfit.Color
};
PendingColorChange = changeColor;
EquipInProgress = true;
if (EquipCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(EquipCoroutine);
EquipCoroutine = null;
}
EquipCoroutine = ((MonoBehaviour)DestroyableSingleton<InnerNetServer>.Instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(EquipOutfitRoutine()));
}
}
private void StopOutfitEquip()
{
EquipInProgress = false;
PendingOutfit = null;
PendingColorChange = false;
if (EquipCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(EquipCoroutine);
EquipCoroutine = null;
}
}
[HideFromIl2Cpp]
private void loadsetData()
{
int color = PendingOutfit.Color;
if (color >= 0 && color < ((Il2CppArrayBase<Color32>)(object)Palette.PlayerColors).Length)
{
DataManager.Player.Customization.colorID = (byte)color;
}
DataManager.Player.Customization.hat = PendingOutfit.Hat;
DataManager.Player.Customization.skin = PendingOutfit.Skin;
DataManager.Player.Customization.visor = PendingOutfit.Visor;
DataManager.Player.Customization.pet = PendingOutfit.Pet;
}
private IEnumerator EquipOutfitRoutine()
{
if (!((InventoryTab)this).HasLocalPlayer() || (Object)(object)PlayerControl.LocalPlayer == (Object)null)
{
loadsetData();
StopOutfitEquip();
yield break;
}
Outfit outfit = PendingOutfit;
bool pendingColorChange = PendingColorChange;
if (outfit == null)
{
StopOutfitEquip();
yield break;
}
PlayerControl localPlayer = PlayerControl.LocalPlayer;
bool flag = default(bool);
if (pendingColorChange)
{
int color = outfit.Color;
if (color >= 0 && color < ((Il2CppArrayBase<Color32>)(object)Palette.PlayerColors).Length)
{
if (DataManager.Player.Customization.colorID != color)
{
DataManager.Player.Customization.colorID = (byte)color;
localPlayer.RpcSetColor((byte)color);
yield return (object)new WaitForSeconds(0.25f);
}
}
else
{
ManualLogSource mls = OutfitsPresetsPlugin.mls;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[OutfitsPresets] Invalid color ID: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(color);
}
mls.LogWarning(val);
}
}
if (!((InventoryTab)this).HasLocalPlayer() || (Object)(object)PlayerControl.LocalPlayer == (Object)null)
{
loadsetData();
yield break;
}
localPlayer = PlayerControl.LocalPlayer;
if (DataManager.Player.Customization.Hat != outfit.Hat)
{
string text = outfit.Hat ?? "";
if (string.IsNullOrEmpty(text) || (Object)(object)DestroyableSingleton<HatManager>.Instance.GetHatById(text) != (Object)null)
{
DataManager.Player.Customization.Hat = text;
localPlayer.RpcSetHat(text);
yield return (object)new WaitForSeconds(0.25f);
}
else
{
ManualLogSource mls2 = OutfitsPresetsPlugin.mls;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[OutfitsPresets] Invalid hat ID: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
}
mls2.LogWarning(val);
}
}
if (!((InventoryTab)this).HasLocalPlayer() || (Object)(object)PlayerControl.LocalPlayer == (Object)null)
{
loadsetData();
StopOutfitEquip();
yield break;
}
localPlayer = PlayerControl.LocalPlayer;
if (DataManager.Player.Customization.skin != outfit.Skin)
{
string text2 = outfit.Skin ?? "";
if (string.IsNullOrEmpty(text2) || (Object)(object)DestroyableSingleton<HatManager>.Instance.GetSkinById(text2) != (Object)null)
{
DataManager.Player.Customization.skin = text2;
localPlayer.RpcSetSkin(text2);
yield return (object)new WaitForSeconds(0.25f);
}
else
{
ManualLogSource mls3 = OutfitsPresetsPlugin.mls;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[OutfitsPresets] Invalid skin ID: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
}
mls3.LogWarning(val);
}
}
if (!((InventoryTab)this).HasLocalPlayer() || (Object)(object)PlayerControl.LocalPlayer == (Object)null)
{
loadsetData();
StopOutfitEquip();
yield break;
}
localPlayer = PlayerControl.LocalPlayer;
if (DataManager.Player.Customization.Visor != outfit.Visor)
{
string text3 = outfit.Visor ?? "";
if (string.IsNullOrEmpty(text3) || (Object)(object)DestroyableSingleton<HatManager>.Instance.GetVisorById(text3) != (Object)null)
{
DataManager.Player.Customization.Visor = text3;
localPlayer.RpcSetVisor(text3);
yield return (object)new WaitForSeconds(0.25f);
}
else
{
ManualLogSource mls4 = OutfitsPresetsPlugin.mls;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[OutfitsPresets] Invalid visor ID: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text3);
}
mls4.LogWarning(val);
}
}
if (!((InventoryTab)this).HasLocalPlayer() || (Object)(object)PlayerControl.LocalPlayer == (Object)null)
{
loadsetData();
StopOutfitEquip();
yield break;
}
localPlayer = PlayerControl.LocalPlayer;
if (DataManager.Player.Customization.Pet != outfit.Pet)
{
string text4 = outfit.Pet ?? "";
if (string.IsNullOrEmpty(text4) || (Object)(object)DestroyableSingleton<HatManager>.Instance.GetPetById(text4) != (Object)null)
{
DataManager.Player.Customization.Pet = text4;
localPlayer.RpcSetPet(text4);
yield return (object)new WaitForSeconds(0.25f);
}
else
{
ManualLogSource mls5 = OutfitsPresetsPlugin.mls;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[OutfitsPresets] Invalid pet ID: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text4);
}
mls5.LogWarning(val);
}
}
EquipInProgress = false;
PendingOutfit = null;
PendingColorChange = false;
EquipCoroutine = null;
}
public void ClickEquipHat(string hatname)
{
Outfit outfit = new Outfit
{
Hat = (hatname ?? ""),
Skin = DataManager.Player.Customization.skin,
Visor = DataManager.Player.Customization.Visor,
Pet = DataManager.Player.Customization.Pet,
Color = DataManager.Player.Customization.colorID
};
StartOutfitEquip(outfit, changeColor: false);
}
public void ClickEquipSkins(string skin)
{
Outfit outfit = new Outfit
{
Hat = DataManager.Player.Customization.Hat,
Skin = (skin ?? ""),
Visor = DataManager.Player.Customization.Visor,
Pet = DataManager.Player.Customization.Pet,
Color = DataManager.Player.Customization.colorID
};
StartOutfitEquip(outfit, changeColor: false);
}
public void ClickEquipVisor(string visor)
{
Outfit outfit = new Outfit
{
Hat = DataManager.Player.Customization.Hat,
Skin = DataManager.Player.Customization.skin,
Visor = (visor ?? ""),
Pet = DataManager.Player.Customization.Pet,
Color = DataManager.Player.Customization.colorID
};
StartOutfitEquip(outfit, changeColor: false);
}
public void ClickEquipPet(string pet)
{
Outfit outfit = new Outfit
{
Hat = DataManager.Player.Customization.Hat,
Skin = DataManager.Player.Customization.skin,
Visor = DataManager.Player.Customization.Visor,
Pet = (pet ?? ""),
Color = DataManager.Player.Customization.colorID
};
StartOutfitEquip(outfit, changeColor: false);
}
public void ClickColorEquip(byte color)
{
Outfit outfit = new Outfit
{
Hat = DataManager.Player.Customization.Hat,
Skin = DataManager.Player.Customization.skin,
Visor = DataManager.Player.Customization.Visor,
Pet = DataManager.Player.Customization.Pet,
Color = color
};
StartOutfitEquip(outfit, changeColor: true);
}
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 = ((PendingOutfit != null && PendingOutfit.Visor != null) ? PendingOutfit.Visor : (((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 override void OnEnable()
{
StubInventoryTab.OnEnable((InventoryTab)(object)this);
LoadTab();
}
public override void OnDisable()
{
StubInventoryTab.OnDisable((InventoryTab)(object)this);
}
public void LoadTab()
{
Il2CppArrayBase<ColorChip> val = ((InventoryTab)this).ColorChips?.ToArray();
if (val != null)
{
for (int i = 0; i < val.Length; i++)
{
ColorChip val2 = val[i];
if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null)
{
Object.Destroy((Object)(object)((Component)val2).gameObject);
}
}
((InventoryTab)this).ColorChips.Clear();
}
Scroller scroller = ((InventoryTab)this).scroller;
Transform val3 = ((scroller != null) ? scroller.Inner : null);
if (!((Object)(object)val3 == (Object)null))
{
int pos = 0;
AddPlusButton(val3, ref pos);
AddMinusButton(val3, ref pos);
string[] array = FileUtils.GetPath().ToArray();
foreach (string text in array)
{
Outfit outfit = JsonSerializer.Deserialize<Outfit>(FileUtils.ReadJsonFile(text)) ?? new Outfit();
AddOutfitButton(val3, outfit, text, ref pos);
}
((InventoryTab)this).SetScrollerBounds();
}
}
private void AddPlusButton(Transform inner, ref int pos)
{
//IL_001f: 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)
if (((InventoryTab)this).ColorChips != null)
{
ColorChip val = Object.Instantiate<ColorChip>(((InventoryTab)this).ColorTabPrefab, 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_001f: 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)
if (((InventoryTab)this).ColorChips != null)
{
ColorChip val = Object.Instantiate<ColorChip>(((InventoryTab)this).ColorTabPrefab, 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);
}
[HideFromIl2Cpp]
private bool ColorEquipable(Outfit outfit)
{
if (Object.op_Implicit((Object)(object)GameData.Instance))
{
List<NetworkedPlayerInfo> allPlayers = GameData.Instance.AllPlayers;
for (int i = 0; i < allPlayers.Count; i++)
{
if (allPlayers[i].DefaultOutfit.ColorId == outfit.Color)
{
return false;
}
}
}
return true;
}
[HideFromIl2Cpp]
private void AddOutfitButton(Transform inner, Outfit outfit, string file, ref int pos)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
if (((InventoryTab)this).ColorChips == null)
{
return;
}
ColorChip val = Object.Instantiate<ColorChip>(((InventoryTab)this).ColorTabPrefab, 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((PendingOutfit != null && PendingOutfit.Hat != null) ? PendingOutfit.Hat : DataManager.Player.Customization.Hat, DataManager.Player.Customization.Color);
SelectSkin((PendingOutfit != null && PendingOutfit.Skin != null) ? PendingOutfit.Skin : DataManager.Player.Customization.skin, DataManager.Player.Customization.Color);
SelectVisor((PendingOutfit != null && PendingOutfit.Visor != null) ? PendingOutfit.Visor : DataManager.Player.Customization.Visor, DataManager.Player.Customization.Color);
SelectPet((PendingOutfit != null && PendingOutfit.Pet != null) ? PendingOutfit.Pet : DataManager.Player.Customization.Pet, DataManager.Player.Customization.Color);
};
((UiElement)val.Button).OnMouseOut.AddListener(UnityAction.op_Implicit(action2));
Action action3 = delegate
{
PlayerCustomizationMenu.Instance.SetItemName(fileName);
StartOutfitEquip(outfit, ColorEquipable(outfit));
};
((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);
if (val2 != null)
{
((Component)val2).gameObject.SetActive(true);
}
if (val2 != null)
{
val2.ToggleName(false);
}
if (outfit.Color < 0 || outfit.Color >= ((Il2CppArrayBase<Color32>)(object)Palette.PlayerColors).Length)
{
if (val2 != null)
{
val2.SetBodyColor((int)DataManager.Player.Customization.Color);
}
}
else if (val2 != null)
{
val2.SetBodyColor(outfit.Color);
}
if (Object.op_Implicit((Object)(object)val2))
{
((Component)val2).transform.localScale = Vector3.one * 0.4f;
((Component)val2).transform.localPosition = new Vector3(0f, 0f, -40f);
if (val2 != null)
{
val2.SetHat(outfit.Hat, val2.ColorId);
}
if (val2 != null)
{
val2.SetSkin(outfit.Skin, val2.ColorId);
}
if (val2 != null)
{
val2.SetVisor(outfit.Visor, val2.ColorId);
}
if (val2 != null)
{
val2.SetPetIdle(DestroyableSingleton<HatManager>.Instance.GetPetById(outfit.Pet), val2.ColorId);
}
if (val2 != null)
{
CosmeticsLayer cosmetics = val2.cosmetics;
if (cosmetics != null)
{
Transform transform = ((Component)cosmetics).transform;
if (transform != null)
{
Transform obj = transform.Find("PetSlot");
if (obj != null)
{
Transform child = obj.GetChild(0);
if (child != null)
{
GameObject gameObject = ((Component)child).gameObject;
if (gameObject != null)
{
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);
}));
}
}
}