Decompiled source of SuitTextures v1.1.0

BepInEx/plugins/SuitTextures/cyclozarin.contentwarning.SuitTextures.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using Microsoft.CodeAnalysis;
using On;
using On.UCustomPrefabsAPI;
using Photon.Pun;
using Photon.Realtime;
using SuitTextures.Hooks;
using TMPro;
using UCustomPrefabsAPI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Localization.PropertyVariants;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Ashley.MeshSplitter")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("com.rlabrecque.steamworks.net")]
[assembly: IgnoresAccessChecksTo("Discord")]
[assembly: IgnoresAccessChecksTo("HBAO.Demo.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("MeshSplit")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("pworld")]
[assembly: IgnoresAccessChecksTo("sc.posteffects.runtime")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Tayx.Graphy")]
[assembly: IgnoresAccessChecksTo("Unity.Addressables")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")]
[assembly: IgnoresAccessChecksTo("Unity.Localization")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.PlayableGraphVisualizer")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipeline.Universal.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Universal.Shaders")]
[assembly: IgnoresAccessChecksTo("Unity.ResourceManager")]
[assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")]
[assembly: IgnoresAccessChecksTo("Unity.Splines")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("Zorro.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.PhotonUtility")]
[assembly: IgnoresAccessChecksTo("Zorro.Recorder")]
[assembly: IgnoresAccessChecksTo("Zorro.Settings.Runtime")]
[assembly: IgnoresAccessChecksTo("Zorro.UI.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("cyclozarin.contentwarning.SuitTextures")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+0c4dd292ed7d65eb95bc928744b01e3008ebe7ba")]
[assembly: AssemblyProduct("SuitTextures")]
[assembly: AssemblyTitle("cyclozarin.contentwarning.SuitTextures")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.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;
		}
	}
	[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;
		}
	}
}
namespace SuitTextures
{
	internal class SuitTextureUpdater : IInRoomCallbacks
	{
		public void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
		{
			Player targetPlayer2 = targetPlayer;
			if (!targetPlayer2.IsLocal)
			{
				string text = null;
				if (((Dictionary<object, object>)(object)changedProps).ContainsKey((object)"Suit texture"))
				{
					text = (string)changedProps[(object)"Suit texture"];
				}
				Player player2 = PlayerHandler.instance.players.First((Player player) => ((MonoBehaviourPun)player).photonView.Owner == targetPlayer2);
				if (text != "Default")
				{
					SuitTextures.ApplySuitTexture(player2, text);
				}
				else
				{
					SuitTextures.ApplySuitTexture(player2, text, reset: true);
				}
				SuitTextures.Logger.LogDebug((object)$"targetPlayer: {targetPlayer2.NickName} changedProps: {changedProps}");
			}
		}

		public void OnMasterClientSwitched(Player newMasterClient)
		{
		}

		public void OnPlayerEnteredRoom(Player newPlayer)
		{
		}

		public void OnPlayerLeftRoom(Player otherPlayer)
		{
		}

		public void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
		{
		}
	}
	[BepInPlugin("cyclozarin.contentwarning.SuitTextures", "SuitTextures", "1.1.0")]
	[ContentWarningPlugin("cyclozarin.contentwarning.SuitTextures", "1.1.0", true)]
	public class SuitTextures : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Update <>9__20_0;

			internal void <HookAll>b__20_0(orig_Update orig, Player self)
			{
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (((Dictionary<object, object>)(object)((MonoBehaviourPun)self).photonView.Owner.CustomProperties).ContainsKey((object)"Suit texture") && (string)((MonoBehaviourPun)self).photonView.Owner.CustomProperties[(object)"Suit texture"] != "Default")
				{
					Transform val = (UCPPlayer(self) ? ((Component)self).transform.GetChild(5) : ((Component)self).transform.GetChild(1));
					List<SkinnedMeshRenderer> list = ((Component)val).GetComponentsInChildren<SkinnedMeshRenderer>().ToList();
					try
					{
						if (UCPPlayer(self))
						{
							list.AddRange(((Component)((Component)self).transform.GetChild(6)).GetComponentsInChildren<SkinnedMeshRenderer>());
						}
					}
					catch
					{
					}
					foreach (SkinnedMeshRenderer item in list)
					{
						for (int i = 0; i < ((Renderer)item).materials.Length; i++)
						{
							if (!VisorMaterial(((Renderer)item).materials[i]))
							{
								((Renderer)item).materials[i].color = Color.white;
							}
						}
					}
				}
				if (Input.GetKeyDown((KeyCode)304) && Input.GetKeyDown((KeyCode)102))
				{
					ApplyCurrentSuitTexture();
					UserInterface.ShowMoneyNotification("Successfully reapplied suit texture", string.Empty, (MoneyCellType)2);
				}
			}
		}

		internal static List<Texture2D> Skins = new List<Texture2D>();

		internal static Dictionary<string, Vector2> SkinsScales = new Dictionary<string, Vector2>
		{
			{
				"cow",
				new Vector2(-5f, 3f)
			},
			{
				"eu",
				new Vector2(-5f, -5f)
			},
			{
				"russia",
				new Vector2(0f, -3f)
			},
			{
				"usa",
				new Vector2(0f, -3.5f)
			},
			{
				"melon",
				new Vector2(-3f, -6.3f)
			},
			{
				"zebra",
				new Vector2(0f, -10f)
			},
			{
				"tiger",
				new Vector2(-3f, -6.3f)
			},
			{
				"gold",
				new Vector2(-3f, -6.3f)
			},
			{
				"silver",
				new Vector2(-3f, -6.3f)
			},
			{
				"spiderman",
				new Vector2(-10f, -10f)
			},
			{
				"hearts",
				new Vector2(-5f, -5f)
			},
			{
				"gingerbread",
				new Vector2(-5f, -5f)
			},
			{
				"wood",
				new Vector2(-2f, -5f)
			},
			{
				"metal",
				new Vector2(-5f, -5f)
			},
			{
				"clown",
				new Vector2(-7f, -7f)
			},
			{
				"target",
				new Vector2(-5f, -5f)
			},
			{
				"sack",
				new Vector2(-5f, -5f)
			},
			{
				"bliss",
				new Vector2(-5f, -5f)
			},
			{
				"water",
				new Vector2(-10f, -10f)
			},
			{
				"fire",
				new Vector2(-10f, -10f)
			},
			{
				"earth",
				new Vector2(-10f, -10f)
			},
			{
				"camouflage",
				new Vector2(-10f, -10f)
			},
			{
				"weed",
				new Vector2(-5f, -5f)
			},
			{
				"catpaws",
				new Vector2(-5f, -10f)
			},
			{
				"bubbles",
				new Vector2(-5f, -10f)
			},
			{
				"pinkguy",
				new Vector2(0f, 0f)
			}
		};

		internal static int CurrentSuitTextureIndex = -1;

		private static TextMeshProUGUI _currentSkinText = null;

		public static SuitTextures Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static AssetBundle Bundle { get; private set; } = null;


		private static string CurrentSuitTextureName
		{
			get
			{
				if (CurrentSuitTextureIndex != 1)
				{
					return ((Object)Skins[CurrentSuitTextureIndex]).name;
				}
				return "Default";
			}
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			HookAll();
			PhotonNetwork.AddCallbackTarget((object)new SuitTextureUpdater());
			Logger.LogInfo((object)("SuitTextures by " + "cyclozarin.contentwarning.SuitTextures".Split(".")[0] + " v1.1.0 has loaded!"));
		}

		private void Start()
		{
			Bundle = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("SuitTextures.Bundles.suittexturesbundle"));
			Texture2D[] array = Bundle.LoadAllAssets<Texture2D>();
			foreach (Texture2D val in array)
			{
				Skins.Add(val);
				Logger.LogInfo((object)("Loaded " + ((Object)val).name + " suit texture"));
			}
			Logger.LogWarning((object)$"Loaded {Skins.Count} suit textures");
		}

		internal static void HookAll()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			Logger.LogDebug((object)"Hooking...");
			PlayerHook.Init();
			FaceCustomizerHook.Init();
			if (UCPLoaded())
			{
				UCPHook.Init();
			}
			object obj = <>c.<>9__20_0;
			if (obj == null)
			{
				hook_Update val = delegate(orig_Update orig, Player self)
				{
					//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					if (((Dictionary<object, object>)(object)((MonoBehaviourPun)self).photonView.Owner.CustomProperties).ContainsKey((object)"Suit texture") && (string)((MonoBehaviourPun)self).photonView.Owner.CustomProperties[(object)"Suit texture"] != "Default")
					{
						Transform val2 = (UCPPlayer(self) ? ((Component)self).transform.GetChild(5) : ((Component)self).transform.GetChild(1));
						List<SkinnedMeshRenderer> list = ((Component)val2).GetComponentsInChildren<SkinnedMeshRenderer>().ToList();
						try
						{
							if (UCPPlayer(self))
							{
								list.AddRange(((Component)((Component)self).transform.GetChild(6)).GetComponentsInChildren<SkinnedMeshRenderer>());
							}
						}
						catch
						{
						}
						foreach (SkinnedMeshRenderer item in list)
						{
							for (int i = 0; i < ((Renderer)item).materials.Length; i++)
							{
								if (!VisorMaterial(((Renderer)item).materials[i]))
								{
									((Renderer)item).materials[i].color = Color.white;
								}
							}
						}
					}
					if (Input.GetKeyDown((KeyCode)304) && Input.GetKeyDown((KeyCode)102))
					{
						ApplyCurrentSuitTexture();
						UserInterface.ShowMoneyNotification("Successfully reapplied suit texture", string.Empty, (MoneyCellType)2);
					}
				};
				<>c.<>9__20_0 = val;
				obj = (object)val;
			}
			Player.Update += (hook_Update)obj;
			Logger.LogDebug((object)"Finished Hooking!");
		}

		internal static void ChangeMaterialTexture(Material material, Texture2D texture)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!VisorMaterial(material))
			{
				material.shader = Shader.Find("NiceShader_Extra");
				material.color = Color.white;
				material.SetTexture("_ExtraTexture", (Texture)(object)texture);
				material.SetTextureScale("_ExtraTexture", SkinsScales[((Object)texture).name]);
			}
		}

		internal static void ResetMaterialTextureAndChangeColor(Material material, Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			material.shader = Shader.Find("NiceShader");
			material.color = color;
		}

		internal static void ApplySuitTexture(Player player, string texture, bool reset = false)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			string texture2 = texture;
			Transform val = (UCPPlayer(player) ? ((Component)player).transform.GetChild(5) : ((Component)player).transform.GetChild(1));
			List<SkinnedMeshRenderer> list = ((Component)val).GetComponentsInChildren<SkinnedMeshRenderer>().ToList();
			if (UCPPlayer(player))
			{
				list.AddRange(((Component)((Component)player).transform.GetChild(6)).GetComponentsInChildren<SkinnedMeshRenderer>());
			}
			if ((Object)(object)player == (Object)(object)Player.localPlayer)
			{
				ApplySuitTextureInProperties(((MonoBehaviourPun)player).photonView.Owner, texture2);
				PlayerPrefs.SetString("SuitTexture", texture2);
			}
			if (reset && !UCPPlayer(player))
			{
				Color val2 = default(Color);
				((Color)(ref val2))..ctor(0.1887f, 0.1887f, 0.1887f);
				val2.a = 0.913f;
				Color color = val2;
				((Color)(ref val2))..ctor(0.32f, 0.307f, 0.289f);
				val2.a = 0.749f;
				Color color2 = val2;
				{
					foreach (SkinnedMeshRenderer item in list)
					{
						for (int i = 0; i < ((Renderer)item).materials.Length; i++)
						{
							if (!VisorMaterial(((Renderer)item).materials[i]))
							{
								if (((Object)((Renderer)item).materials[i]).name.Contains("M_Player"))
								{
									ResetMaterialTextureAndChangeColor(((Renderer)item).materials[i], color);
								}
								else if (((Object)((Renderer)item).materials[i]).name.Contains("M_Player 1"))
								{
									ResetMaterialTextureAndChangeColor(((Renderer)item).materials[i], color2);
								}
							}
						}
					}
					return;
				}
			}
			Texture2D texture3 = Skins.First((Texture2D t) => ((Object)t).name == texture2);
			foreach (SkinnedMeshRenderer item2 in list)
			{
				for (int j = 0; j < ((Renderer)item2).materials.Length; j++)
				{
					ChangeMaterialTexture(((Renderer)item2).materials[j], texture3);
				}
			}
		}

		internal static void ApplyCurrentSuitTexture()
		{
			ApplySuitTexture(Player.localPlayer, CurrentSuitTextureName, CurrentSuitTextureIndex == -1);
		}

		internal static void ApplySuitTextureInProperties(Player player, string texture)
		{
			Hashtable customProperties = player.CustomProperties;
			if (((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"Suit texture"))
			{
				customProperties[(object)"Suit texture"] = texture;
			}
			else
			{
				((Dictionary<object, object>)(object)customProperties).Add((object)"Suit texture", (object)(texture ?? "Default"));
			}
			player.SetCustomProperties(customProperties, (Hashtable)null, (WebFlags)null);
		}

		internal static bool UCPLoaded()
		{
			return Chainloader.PluginInfos.ContainsKey("UCustomPrefabsAPI.ContentWarning");
		}

		internal static bool UCPPlayer(Player player)
		{
			if (!UCPLoaded())
			{
				return false;
			}
			return Object.op_Implicit((Object)(object)((Component)player).GetComponentInChildren<PrefabTemplate>());
		}

		internal static bool VisorMaterial(Material material)
		{
			return ((Object)material).name.Contains("M_PlayerVisor");
		}

		internal static void NextSkin()
		{
			CurrentSuitTextureIndex++;
			CurrentSuitTextureIndex = Mathf.Clamp(CurrentSuitTextureIndex, -1, Skins.Count - 1);
			ChangeSkinTextureText();
			FaceCustomizerHook.PlayChooseSound();
			ApplyCurrentSuitTexture();
		}

		internal static void PreviousSkin()
		{
			CurrentSuitTextureIndex--;
			CurrentSuitTextureIndex = Mathf.Clamp(CurrentSuitTextureIndex, -1, Skins.Count - 1);
			ChangeSkinTextureText();
			FaceCustomizerHook.PlayChooseSound();
			if (CurrentSuitTextureIndex == -1)
			{
				ApplySuitTexture(Player.localPlayer, "Default", reset: true);
			}
			else
			{
				ApplyCurrentSuitTexture();
			}
		}

		internal static void ResetSkin()
		{
			CurrentSuitTextureIndex = -1;
			ChangeSkinTextureText();
			FaceCustomizerHook.PlayResetSound();
			ApplyCurrentSuitTexture();
		}

		internal static void SetSkinTextureTextMesh(TextMeshProUGUI textMesh)
		{
			_currentSkinText = textMesh;
			ChangeSkinTextureText();
		}

		internal static void ChangeSkinTextureText()
		{
			((TMP_Text)_currentSkinText).text = "Selected skin texture:\n" + ((CurrentSuitTextureIndex == -1) ? "Default" : ((Object)Skins[CurrentSuitTextureIndex]).name);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "cyclozarin.contentwarning.SuitTextures";

		public const string PLUGIN_NAME = "SuitTextures";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace SuitTextures.Hooks
{
	internal class FaceCustomizerHook
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__MMHook_Postfix_SpawnSkinChangeButtons;

			public static UnityAction <1>__PreviousSkin;

			public static UnityAction <2>__NextSkin;

			public static UnityAction <3>__ResetSkin;
		}

		private static PlayerCustomizer _playerCustomizer;

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__MMHook_Postfix_SpawnSkinChangeButtons;
			if (obj == null)
			{
				hook_Awake val = MMHook_Postfix_SpawnSkinChangeButtons;
				<>O.<0>__MMHook_Postfix_SpawnSkinChangeButtons = val;
				obj = (object)val;
			}
			PlayerCustomizer.Awake += (hook_Awake)obj;
		}

		private static void MMHook_Postfix_SpawnSkinChangeButtons(orig_Awake orig, PlayerCustomizer self)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_01b7: 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_01c2: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			orig.Invoke(self);
			Transform transform = GameObject.Find("Tools/PlayerCustomizerMachine/WhyDoesThisObjectExist/WorldSpace").transform;
			_playerCustomizer = GameObject.Find("Tools/PlayerCustomizerMachine").GetComponent<PlayerCustomizer>();
			GameObject gameObject = ((Component)((Component)_playerCustomizer.pastButton).transform.parent).gameObject;
			RectTransform component = gameObject.GetComponent<RectTransform>();
			Vector3 localPosition = ((Transform)gameObject.GetComponent<RectTransform>()).localPosition;
			localPosition.y = -190f;
			((Transform)component).localPosition = localPosition;
			GameObject gameObject2 = ((Component)transform.Find("Hats")).gameObject;
			GameObject val = Object.Instantiate<GameObject>(gameObject2, gameObject2.transform.position, new Quaternion(0f, 0f, 0f, 0f), transform);
			((Object)val).name = "Skin texture select";
			RectTransform component2 = val.GetComponent<RectTransform>();
			localPosition = ((Transform)val.GetComponent<RectTransform>()).localPosition;
			localPosition.x = 643f;
			((Transform)component2).localPosition = localPosition;
			Button componentInChildren = ((Component)val.transform.Find("Left")).GetComponentInChildren<Button>();
			Button componentInChildren2 = ((Component)val.transform.Find("Right")).GetComponentInChildren<Button>();
			Button component3 = ((Component)val.transform.Find("ClearHat")).GetComponent<Button>();
			TextMeshProUGUI componentInChildren3 = ((Component)val.transform.Find("BG/HatName")).GetComponentInChildren<TextMeshProUGUI>();
			Object.Destroy((Object)(object)((Component)componentInChildren3).GetComponent<GameObjectLocalizer>());
			((TMP_Text)componentInChildren3).autoSizeTextContainer = true;
			((TMP_Text)componentInChildren3).fontSize = 20f;
			((UnityEventBase)componentInChildren.onClick).RemoveAllListeners();
			((UnityEventBase)componentInChildren2.onClick).RemoveAllListeners();
			((UnityEventBase)component3.onClick).RemoveAllListeners();
			ButtonClickedEvent onClick = componentInChildren.onClick;
			object obj = <>O.<1>__PreviousSkin;
			if (obj == null)
			{
				UnityAction val2 = SuitTextures.PreviousSkin;
				<>O.<1>__PreviousSkin = val2;
				obj = (object)val2;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			ButtonClickedEvent onClick2 = componentInChildren2.onClick;
			object obj2 = <>O.<2>__NextSkin;
			if (obj2 == null)
			{
				UnityAction val3 = SuitTextures.NextSkin;
				<>O.<2>__NextSkin = val3;
				obj2 = (object)val3;
			}
			((UnityEvent)onClick2).AddListener((UnityAction)obj2);
			ButtonClickedEvent onClick3 = component3.onClick;
			object obj3 = <>O.<3>__ResetSkin;
			if (obj3 == null)
			{
				UnityAction val4 = SuitTextures.ResetSkin;
				<>O.<3>__ResetSkin = val4;
				obj3 = (object)val4;
			}
			((UnityEvent)onClick3).AddListener((UnityAction)obj3);
			TextMeshProUGUI componentInChildren4 = ((Component)component3).GetComponentInChildren<TextMeshProUGUI>();
			Object.Destroy((Object)(object)((Component)componentInChildren4).GetComponent<GameObjectLocalizer>());
			((TMP_Text)componentInChildren4).text = "RESET SKIN";
			SuitTextures.SetSkinTextureTextMesh(componentInChildren3);
		}

		internal static void PlayChooseSound()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			_playerCustomizer.clickSound.Play(((Component)_playerCustomizer).transform.position, false, 1f, (Transform)null);
		}

		internal static void PlayResetSound()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			_playerCustomizer.backSound.Play(((Component)_playerCustomizer).transform.position, false, 1f, (Transform)null);
		}
	}
	internal class PlayerHook
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__MMHook_Postfix_ApplySuitTextureOnStart;
		}

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__MMHook_Postfix_ApplySuitTextureOnStart;
			if (obj == null)
			{
				hook_Awake val = MMHook_Postfix_ApplySuitTextureOnStart;
				<>O.<0>__MMHook_Postfix_ApplySuitTextureOnStart = val;
				obj = (object)val;
			}
			Player.Awake += (hook_Awake)obj;
		}

		private static void MMHook_Postfix_ApplySuitTextureOnStart(orig_Awake orig, Player self)
		{
			orig.Invoke(self);
			if (self.IsLocal)
			{
				string _currentSuitTextureString = PlayerPrefs.GetString("SuitTexture");
				SuitTextures.CurrentSuitTextureIndex = ((_currentSuitTextureString == "Default" || _currentSuitTextureString == null) ? (-1) : Mathf.Clamp(SuitTextures.Skins.IndexOf(SuitTextures.Skins.First((Texture2D t) => ((Object)t).name == _currentSuitTextureString)), 0, SuitTextures.Skins.Count - 1));
				SuitTextures.ApplySuitTextureInProperties(((MonoBehaviourPun)self).photonView.Owner, _currentSuitTextureString);
				SuitTextures.ApplyCurrentSuitTexture();
				if (PhotonGameLobbyHandler.IsSurface)
				{
					SuitTextures.ChangeSkinTextureText();
				}
			}
		}
	}
	internal class UCPHook
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Initialize <0>__MMHook_Postfix_ApplyTextureToSuit;
		}

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__MMHook_Postfix_ApplyTextureToSuit;
			if (obj == null)
			{
				hook_Initialize val = MMHook_Postfix_ApplyTextureToSuit;
				<>O.<0>__MMHook_Postfix_ApplyTextureToSuit = val;
				obj = (object)val;
			}
			UCustomPrefabHandler.Initialize += (hook_Initialize)obj;
		}

		private static void MMHook_Postfix_ApplyTextureToSuit(orig_Initialize orig, UCustomPrefabHandler self)
		{
			orig.Invoke(self);
			SuitTextures.ApplyCurrentSuitTexture();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}