Decompiled source of Advanced Emote Picker v1.3.0

plugins/CustomEmotesAdvancedPicker.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EmotesAPI;
using HG.Reflection;
using On.RoR2.UI;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomEmotesAdvancedPicker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomEmotesAdvancedPicker")]
[assembly: AssemblyTitle("CustomEmotesAdvancedPicker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomEmotesAdvancedPicker;

[Serializable]
[BepInPlugin("com.brynzananas.customemotesadvancedpicker", "Custom Emotes Advanced Picker", "1.3.0")]
[BepInDependency("com.bepis.r2api", "5.0.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
	public class NewPicker : MonoBehaviour
	{
		private TextMeshProUGUI currentEmoteText;

		public bool edit = false;

		public bool addingEmote = false;

		private void OnEnable()
		{
			BoneMapper localMapper = CustomEmotesAPI.localMapper;
			currentEmoteText = ((Component)((Component)this).transform.Find("CurrentEmotePanel/text")).GetComponent<TextMeshProUGUI>();
			if ((Object)(object)localMapper != (Object)null)
			{
				((TMP_Text)currentEmoteText).text = "Current Emote: \n" + localMapper.currentClipName;
			}
			ScrollRect component = ((Component)((Component)this).transform.Find("AllEmotesPanel")).GetComponent<ScrollRect>();
			component.scrollSensitivity = Sensivity.Value;
			component = ((Component)((Component)this).transform.Find("CustomEmotesPanel")).GetComponent<ScrollRect>();
			component.scrollSensitivity = Sensivity.Value;
		}

		private void OnDisable()
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (HoldAndRelease.Value)
			{
				if (Object.op_Implicit((Object)(object)selected))
				{
					try
					{
						CustomEmotesAPI.PlayAnimation(((Object)selected).name, -2);
					}
					catch
					{
					}
				}
				else if (!continueEmote)
				{
					try
					{
						CustomEmotesAPI.PlayAnimation("none", -2);
					}
					catch
					{
					}
				}
			}
			if (Object.op_Implicit((Object)(object)selected))
			{
				((Graphic)selected.GetComponent<Image>()).color = inactiveColorConfig.Value;
				selected.transform.localScale = Vector3.one;
			}
			((Graphic)((Component)((Component)this).transform.Find("CurrentEmotePanel")).GetComponent<Image>()).color = inactiveColorConfig.Value;
			continueEmote = false;
			if (Object.op_Implicit((Object)(object)dragged))
			{
				Object.Destroy((Object)(object)dragged);
			}
		}

		private void Update()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			BoneMapper localMapper = CustomEmotesAPI.localMapper;
			if ((Object)(object)localMapper != (Object)null)
			{
				((TMP_Text)currentEmoteText).text = "Current Emote: \n" + localMapper.currentClipName;
			}
			Transform val = ((Component)this).transform.Find("CustomEmotesPanel");
			KeyboardShortcut value = AddCurrentEmoteConfig.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey) && Object.op_Implicit((Object)(object)localMapper) && localMapper.currentClipName != "none")
			{
				AddCurrentEmote();
			}
			value = SwitchList.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
			{
				SwitchListMethod();
			}
			value = BindCurrentEmoteConfig.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
			{
				BindCurrentEmoteMethod();
			}
		}
	}

	public class EmoteClick : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IDragHandler, IDropHandler, IEndDragHandler
	{
		private string text;

		private Image image;

		public NewPicker hudComponent;

		public int index;

		public bool change = false;

		private GameObject allPanel;

		private GameObject customPanel;

		public Canvas canvas;

		public Transform previousTransform;

		private RectTransform rectTransform;

		private bool isDragging = false;

		private GameObject keyPicker;

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Invalid comparison between Unknown and I4
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Invalid comparison between Unknown and I4
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Invalid comparison between Unknown and I4
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			if (hudComponent.addingEmote && (int)eventData.button == 0)
			{
				if (PreventDupicates.Value)
				{
					string[] array = GetConfigString().Split("*");
					if (array.Length != 0 && array.Contains(((Object)((Component)this).gameObject).name))
					{
						GameObject val = Object.Instantiate<GameObject>(Effect, trueHud.transform);
						((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = "Emote " + ((Object)((Component)this).gameObject).name + " has been already added";
						return;
					}
				}
				GameObject val2 = Object.Instantiate<GameObject>(((Component)this).gameObject, customPanel.transform.Find("scroll"));
				((Object)val2).name = ((Object)((Component)this).gameObject).name;
				CustomEmotes.Value = GenerateCustomEmotesString();
				((Graphic)val2.GetComponent<Image>()).color = inactiveColorConfig.Value;
				GameObject val3 = Object.Instantiate<GameObject>(Effect, trueHud.transform);
				((TMP_Text)val3.GetComponent<TextMeshProUGUI>()).text = "Added " + ((Object)((Component)this).gameObject).name;
				return;
			}
			if (hudComponent.addingEmote && (int)eventData.button == 1)
			{
				try
				{
					CustomEmotesAPI.PlayAnimation(((Object)((Component)this).gameObject).name, -2);
					return;
				}
				catch
				{
					return;
				}
			}
			if (((Input.GetKey((KeyCode)323) && (int)eventData.button == 1) || (Input.GetKey((KeyCode)324) && (int)eventData.button == 0)) && !change && !isDragging && !hudComponent.edit)
			{
				keybindEmotes[((Object)((Component)this).gameObject).name].Value = new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>());
			}
			else if ((int)eventData.button == 1 && !change && !isDragging && !hudComponent.edit && !keyPicker.activeSelf)
			{
				keyPicker.GetComponent<AddKeybind>().emote = ((Object)((Component)this).gameObject).name;
				keyPicker.GetComponent<AddKeybind>().emoteOrNot = true;
				keyPicker.SetActive(true);
			}
			else if (Input.GetKey((KeyCode)324) && (int)eventData.button == 0 && !change && !isDragging && hudComponent.edit)
			{
				GameObject val4 = Object.Instantiate<GameObject>(Effect, trueHud.transform);
				((TMP_Text)val4.GetComponent<TextMeshProUGUI>()).text = "Removed " + ((Object)((Component)this).gameObject).name;
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else if ((int)eventData.button == 0 && !change && !isDragging)
			{
				try
				{
					CustomEmotesAPI.PlayAnimation(((Object)((Component)this).gameObject).name, -2);
				}
				catch
				{
				}
				if (CloseMenu.Value)
				{
					trueHud.SetActive(false);
					ToggleCursor();
				}
			}
		}

		private void OnDestroy()
		{
			CustomEmotes.Value = GenerateCustomEmotesString();
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			selected = ((Component)this).gameObject;
			((Graphic)image).color = activeColorConfig.Value;
			((Component)this).transform.localScale = new Vector3(1.1f, 1.1f, 1.1f);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			selected = null;
			((Graphic)image).color = inactiveColorConfig.Value;
			((Component)this).transform.localScale = Vector3.one;
		}

		private void Start()
		{
			text = ((TMP_Text)((Component)((Component)this).transform.Find("EmoteName")).GetComponent<TextMeshProUGUI>()).text;
			image = ((Component)this).GetComponent<Image>();
			hudComponent = trueHud.GetComponent<NewPicker>();
			canvas = trueHud.GetComponent<Canvas>();
			allPanel = ((Component)trueHud.transform.Find("AllEmotesPanel")).gameObject;
			customPanel = ((Component)trueHud.transform.Find("CustomEmotesPanel")).gameObject;
			rectTransform = ((Component)this).GetComponent<RectTransform>();
			keyPicker = ((Component)trueHud.transform.Find("KeybindingEmote")).gameObject;
		}

		private void Update()
		{
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			if (hudComponent.edit && (int)eventData.button <= 0)
			{
				previousTransform = ((Component)this).transform.parent;
				index = ((Component)this).transform.GetSiblingIndex();
				((Component)this).transform.SetParent(((Component)canvas).transform);
				((Component)this).transform.SetAsLastSibling();
				((Graphic)((Component)this).GetComponent<Image>()).raycastTarget = false;
				Debug.Log((object)((Graphic)((Component)this).GetComponent<Image>()).raycastTarget);
				isDragging = true;
				dragged = ((Component)this).gameObject;
			}
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (hudComponent.edit && (int)eventData.button <= 0)
			{
				RectTransform obj = rectTransform;
				obj.anchoredPosition += eventData.delta / canvas.scaleFactor;
			}
		}

		public void OnDrop(PointerEventData eventData)
		{
			if (hudComponent.edit)
			{
				Debug.Log((object)((Component)this).gameObject);
				Debug.Log((object)eventData.pointerDrag);
				eventData.pointerDrag.GetComponent<EmoteClick>().change = true;
				eventData.pointerDrag.transform.SetParent(((Component)this).transform.parent);
				eventData.pointerDrag.transform.SetSiblingIndex(((Component)this).transform.GetSiblingIndex());
				eventData.pointerDrag.GetComponent<EmoteClick>().isDragging = false;
				CustomEmotes.Value = GenerateCustomEmotesString();
			}
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (!hudComponent.edit || (int)eventData.button > 0)
			{
				return;
			}
			List<RaycastResult> list = new List<RaycastResult>();
			((BaseRaycaster)((Component)hudComponent).gameObject.GetComponent<GraphicRaycaster>()).Raycast(eventData, list);
			foreach (RaycastResult item in list)
			{
				RaycastResult current = item;
				Debug.Log((object)((RaycastResult)(ref current)).gameObject);
			}
			if (!change)
			{
				((Component)this).transform.SetParent(previousTransform);
				((Component)this).transform.SetSiblingIndex(index);
			}
			change = false;
			((Graphic)((Component)this).GetComponent<Image>()).raycastTarget = true;
			isDragging = false;
			dragged = null;
		}
	}

	public class ContinueEmote : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler
	{
		private Image image;

		private void Start()
		{
			image = ((Component)this).GetComponent<Image>();
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			continueEmote = true;
			((Graphic)image).color = activeColorConfig.Value;
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			continueEmote = false;
			((Graphic)image).color = inactiveColorConfig.Value;
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			CustomEmotesAPI.PlayAnimation("none", -2);
			trueHud.SetActive(false);
			ToggleCursor();
		}
	}

	public class CreatePanel : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		private GameObject allPanel;

		private GameObject customPanel;

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)eventData.button == 1)
			{
				((Component)trueHud.transform.Find("KeybindingEmote")).GetComponent<AddKeybind>().emote = "CreateNewPanel";
				((Component)trueHud.transform.Find("KeybindingEmote")).GetComponent<AddKeybind>().emoteOrNot = false;
				((Component)trueHud.transform.Find("KeybindingEmote")).gameObject.SetActive(true);
			}
			else
			{
				SwitchListMethod();
			}
		}

		private void Start()
		{
			allPanel = ((Component)trueHud.transform.Find("AllEmotesPanel")).gameObject;
			customPanel = ((Component)trueHud.transform.Find("CustomEmotesPanel")).gameObject;
		}

		private void Update()
		{
		}
	}

	public class AddOrDelete : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IDropHandler
	{
		private GameObject allPanel;

		private GameObject customPanel;

		public void OnDrop(PointerEventData eventData)
		{
			if (Object.op_Implicit((Object)(object)eventData.pointerDrag.GetComponent<EmoteClick>()))
			{
				Object.Destroy((Object)(object)eventData.pointerDrag);
				CustomEmotes.Value = GenerateCustomEmotesString();
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			((Component)trueHud.transform).GetComponent<NewPicker>().addingEmote = true;
			allPanel.SetActive(true);
			customPanel.SetActive(false);
			((Component)trueHud.transform).GetComponent<NewPicker>().edit = false;
			((TMP_Text)((Component)trueHud.transform.Find("CreateNewPanel/text")).GetComponent<TextMeshProUGUI>()).text = "Click to end adding emotes";
		}

		private void Start()
		{
			allPanel = ((Component)trueHud.transform.Find("AllEmotesPanel")).gameObject;
			customPanel = ((Component)trueHud.transform.Find("CustomEmotesPanel")).gameObject;
		}

		private void Update()
		{
		}
	}

	public class AddedEffect : MonoBehaviour
	{
		private RectTransform rectTransform;

		private float timer = 0f;

		private TextMeshProUGUI text;

		private void Start()
		{
			rectTransform = ((Component)this).GetComponent<RectTransform>();
			text = ((Component)this).GetComponent<TextMeshProUGUI>();
		}

		private void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = rectTransform;
			obj.anchoredPosition += new Vector2(0f, 60f * Time.deltaTime);
			timer += Time.deltaTime;
			((Graphic)text).color = new Color(1f, 1f, 1f, 1f - timer);
			if (timer > 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}

	public class AddKeybind : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		private RectTransform rectTransform;

		private float timer = 0f;

		private TextMeshProUGUI text;

		public string emote;

		public bool emoteOrNot;

		private KeyCode keyToBind;

		private void OnEnable()
		{
			if (emoteOrNot)
			{
				((TMP_Text)((Component)((Component)this).transform.Find("text")).GetComponent<TextMeshProUGUI>()).text = "Press a button to bind \"" + emote + "\" emote to it";
			}
			else
			{
				((TMP_Text)((Component)((Component)this).transform.Find("text")).GetComponent<TextMeshProUGUI>()).text = "Press a button to bind \"" + emote + "\" keybind";
			}
		}

		private void Update()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			if (!Input.anyKeyDown)
			{
				return;
			}
			foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
			{
				if (!Input.GetKey(value))
				{
					continue;
				}
				keyToBind = value;
				if ((int)value == 323 || (int)value == 324)
				{
					break;
				}
				if ((int)value == 27)
				{
					if (emoteOrNot)
					{
						keybindEmotes[emote].Value = new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>());
					}
					else
					{
						switch (emote)
						{
						case "CreateNewPanel":
							SwitchList.Value = new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>());
							break;
						case "AddCurrentEmote":
							AddCurrentEmoteConfig.Value = new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>());
							break;
						case "BindEmotePanel":
							BindCurrentEmoteConfig.Value = new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>());
							break;
						}
					}
				}
				else if (emoteOrNot)
				{
					keybindEmotes[emote].Value = new KeyboardShortcut(value, Array.Empty<KeyCode>());
				}
				else
				{
					switch (emote)
					{
					case "CreateNewPanel":
						SwitchList.Value = new KeyboardShortcut(value, Array.Empty<KeyCode>());
						break;
					case "AddCurrentEmote":
						AddCurrentEmoteConfig.Value = new KeyboardShortcut(value, Array.Empty<KeyCode>());
						break;
					case "BindEmotePanel":
						BindCurrentEmoteConfig.Value = new KeyboardShortcut(value, Array.Empty<KeyCode>());
						break;
					}
				}
				((Component)this).gameObject.SetActive(false);
				break;
			}
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			foreach (GameObject item in eventData.hovered)
			{
				if (((Object)item).name.Contains("cancel"))
				{
					((Component)this).gameObject.SetActive(false);
				}
			}
		}
	}

	public class HighlightEmote : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler
	{
		private Image Image;

		private float timer = 0f;

		public void OnPointerEnter(PointerEventData eventData)
		{
			Object.Destroy((Object)(object)this);
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = Vector3.one;
			((Graphic)Image).color = inactiveColorConfig.Value;
		}

		private void Start()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Image = ((Component)this).GetComponent<Image>();
			((Graphic)Image).color = activeColorConfig.Value;
			((Component)this).transform.localScale = new Vector3(1.25f, 1.25f, 1.25f);
		}

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.MoveTowards(new Vector3(((Graphic)Image).color.r, ((Graphic)Image).color.g, ((Graphic)Image).color.b), new Vector3(inactiveColorConfig.Value.r, inactiveColorConfig.Value.g, inactiveColorConfig.Value.b), 0.5f * Time.deltaTime);
			((Graphic)Image).color = new Color(val.x, val.y, val.z);
			((Component)this).transform.localScale = Vector3.MoveTowards(((Component)this).transform.localScale, Vector3.one, 0.5f * Time.deltaTime);
			timer += Time.deltaTime;
			if (timer > 1f)
			{
				Object.Destroy((Object)(object)this);
			}
		}
	}

	public class SettingsComponent : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public void OnPointerClick(PointerEventData eventData)
		{
			if (((Object)eventData.hovered[0].transform.parent).name.Contains("EnableDuplicates") || ((Object)eventData.hovered[0]).name.Contains("EnableDuplicates"))
			{
				if (PreventDupicates.Value)
				{
					PreventDupicates.Value = false;
				}
				else
				{
					PreventDupicates.Value = true;
				}
			}
			if (((Object)eventData.hovered[0].transform.parent).name.Contains("CloseAfterSelection") || ((Object)eventData.hovered[0]).name.Contains("CloseAfterSelection"))
			{
				if (CloseMenu.Value)
				{
					CloseMenu.Value = false;
				}
				else
				{
					CloseMenu.Value = true;
				}
			}
		}
	}

	public class BindCurrentEmote : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		private GameObject keyPicker;

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)eventData.button == 1)
			{
				((Component)trueHud.transform.Find("KeybindingEmote")).GetComponent<AddKeybind>().emote = "BindEmotePanel";
				((Component)trueHud.transform.Find("KeybindingEmote")).GetComponent<AddKeybind>().emoteOrNot = false;
				((Component)trueHud.transform.Find("KeybindingEmote")).gameObject.SetActive(true);
			}
			else
			{
				BindCurrentEmoteMethod();
			}
		}
	}

	public class AddCurrentEmoteComponent : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)eventData.button == 1)
			{
				((Component)trueHud.transform.Find("KeybindingEmote")).GetComponent<AddKeybind>().emote = "AddCurrentEmote";
				((Component)trueHud.transform.Find("KeybindingEmote")).GetComponent<AddKeybind>().emoteOrNot = false;
				((Component)trueHud.transform.Find("KeybindingEmote")).gameObject.SetActive(true);
			}
			else
			{
				AddCurrentEmote();
			}
		}
	}

	public class DoIReallyNeedToAddAnotherComponent : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public void OnPointerClick(PointerEventData eventData)
		{
			GameObject gameObject = ((Component)trueHud.transform.Find("DOCUMENTATION!!!")).gameObject;
			if (!gameObject.activeSelf)
			{
				gameObject.SetActive(true);
			}
			else
			{
				gameObject.SetActive(false);
			}
		}
	}

	public const string ModGuid = "com.brynzananas.customemotesadvancedpicker";

	public const string ModName = "Custom Emotes Advanced Picker";

	public const string ModVer = "1.3.0";

	public static AssetBundle UnityAssets;

	public static GameObject HudObject;

	public static GameObject EmoteObject;

	public static GameObject Effect;

	public static Material FontMaterial;

	public static Material FontMaterial2;

	public static Vector3 mousePosition;

	public static GameObject selected;

	public static GameObject dragged;

	public static Sprite inactiveSprite;

	public static Sprite activeSprite;

	public static Color activeColor = new Color(1f, 0.8f, 0f);

	public static Color inactiveColor = Color.white;

	public static bool continueEmote = false;

	public static ConfigEntry<KeyboardShortcut> NewEmoteMenu;

	public static ConfigEntry<KeyboardShortcut> CustomRandomEmote;

	public static ConfigEntry<KeyboardShortcut> BindCurrentEmoteConfig;

	public static ConfigEntry<KeyboardShortcut> AddCurrentEmoteConfig;

	public static ConfigEntry<KeyboardShortcut> SwitchList;

	public static ConfigEntry<bool> CloseMenu;

	public static ConfigEntry<bool> HoldAndRelease;

	public static ConfigEntry<float> Sensivity;

	public static ConfigEntry<string> CustomEmotes;

	public static ConfigEntry<bool> PreventDupicates;

	public static ConfigEntry<bool> Sort;

	public static ConfigEntry<Color> activeColorConfig;

	public static ConfigEntry<Color> inactiveColorConfig;

	public static ConfigEntry<Color> textColor;

	public static ConfigEntry<Color> outlineColor;

	public static ConfigEntry<Color> textColorKey;

	public static ConfigEntry<Color> outlineColorKey;

	public static ConfigEntry<Color> backgroundColor;

	public static ConfigEntry<int> Scale;

	public static ConfigEntry<float> TextScale;

	public static ConfigEntry<bool> ShowButton1;

	public static ConfigEntry<bool> ShowButton2;

	public static ConfigEntry<bool> ShowButton3;

	public static ConfigEntry<bool> ShowButton4;

	public static ConfigEntry<bool> ShowSettings;

	public static Dictionary<ConfigEntry<KeyboardShortcut>, string> emoteKeybinds = new Dictionary<ConfigEntry<KeyboardShortcut>, string>();

	public static Dictionary<string, ConfigEntry<KeyboardShortcut>> keybindEmotes = new Dictionary<string, ConfigEntry<KeyboardShortcut>>();

	public static GameObject trueHud;

	private HUD MenuHud = null;

	public ChatBox chatBox;

	public static PluginInfo PInfo { get; private set; }

	public void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: 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_05cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d9: Expected O, but got Unknown
		//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Expected O, but got Unknown
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fa: Expected O, but got Unknown
		//IL_0600: Unknown result type (might be due to invalid IL or missing references)
		//IL_060a: Expected O, but got Unknown
		//IL_0610: Unknown result type (might be due to invalid IL or missing references)
		//IL_061a: Expected O, but got Unknown
		//IL_0620: Unknown result type (might be due to invalid IL or missing references)
		//IL_062a: Expected O, but got Unknown
		//IL_0630: Unknown result type (might be due to invalid IL or missing references)
		//IL_063a: Expected O, but got Unknown
		//IL_0640: Unknown result type (might be due to invalid IL or missing references)
		//IL_064a: Expected O, but got Unknown
		//IL_0650: Unknown result type (might be due to invalid IL or missing references)
		//IL_065a: Expected O, but got Unknown
		//IL_0660: Unknown result type (might be due to invalid IL or missing references)
		//IL_066a: Expected O, but got Unknown
		//IL_0670: Unknown result type (might be due to invalid IL or missing references)
		//IL_067a: Expected O, but got Unknown
		//IL_0680: Unknown result type (might be due to invalid IL or missing references)
		//IL_068a: Expected O, but got Unknown
		//IL_0690: Unknown result type (might be due to invalid IL or missing references)
		//IL_069a: Expected O, but got Unknown
		//IL_06a0: 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_06ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b9: Expected O, but got Unknown
		//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06be: Expected O, but got Unknown
		//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e4: Expected O, but got Unknown
		//IL_06df: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e9: Expected O, but got Unknown
		//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f9: Expected O, but got Unknown
		//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0709: Expected O, but got Unknown
		//IL_070f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0719: Expected O, but got Unknown
		//IL_071f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0729: Expected O, but got Unknown
		//IL_072f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0739: Expected O, but got Unknown
		//IL_073f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0749: Expected O, but got Unknown
		//IL_074f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0759: Expected O, but got Unknown
		//IL_075f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0769: Expected O, but got Unknown
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0779: Expected O, but got Unknown
		//IL_077f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0789: Expected O, but got Unknown
		//IL_078f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0799: Expected O, but got Unknown
		//IL_079f: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a9: Expected O, but got Unknown
		NewEmoteMenu = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "New Emote Picker", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), "Displays the new emote picker");
		CustomRandomEmote = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Random Emote", new KeyboardShortcut((KeyCode)106, Array.Empty<KeyCode>()), "Plays random emote from your custom emote list");
		BindCurrentEmoteConfig = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Bind Current Emote", new KeyboardShortcut((KeyCode)118, Array.Empty<KeyCode>()), "Start binding current emote");
		AddCurrentEmoteConfig = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Add Current Emote", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), "Adds current emote to custom emote list");
		SwitchList = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Switch List", new KeyboardShortcut((KeyCode)325, Array.Empty<KeyCode>()), "Switch between lists");
		CloseMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Close Menu After Selecting", true, "Close menu after selecting emote?");
		HoldAndRelease = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Hold And Release", false, "Pick emote by holding and releasing the button");
		Sensivity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Scroll Sensivity", 48f, "Control scroll sensivity");
		PreventDupicates = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Prevent Adding Duplicates", true, "Prevents emote addition to the custom emote list if it's already there");
		Sort = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Sort Emotes", true, "Sorts emotes in all emotes panel. Needs restart if hud has been already built");
		CustomEmotes = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Custom Emotes List", "", "Do not try to edit it here!");
		Scale = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "Scale", 8, "Control the scale of emote list slot");
		TextScale = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "Text Scale", 30f, "Control the scale of emote list maximum text size");
		inactiveColorConfig = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Slot Color", new Color(0.8f, 0.8f, 0.8f), "Control the color of emote list slot");
		activeColorConfig = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Active Slot Color", new Color(1f, 0.8f, 0f), "Control the color of active emote list slot");
		textColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Text Color", Color.white, "Control the color of text");
		outlineColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Outline Color", Color.black, "Control the color of text outline");
		textColorKey = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Second Text Color", new Color(1f, 0.8f, 0f), "Control the color of text for keybinds");
		outlineColorKey = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Second Outline Color", Color.black, "Control the color of text outline for keybinds");
		backgroundColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI", "Background Color", new Color(0f, 0f, 0f, 0.8f), "Control the color of background");
		ShowButton1 = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Switch List button?", true, "");
		ShowButton2 = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Current Emote button?", true, "");
		ShowButton3 = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Add Current Emote button?", true, "");
		ShowButton4 = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Bind Current Emote button?", true, "");
		ShowSettings = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Settings?", true, "");
		PInfo = ((BaseUnityPlugin)this).Info;
		UnityAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PInfo.Location), "assetbundles", "customemotesadvancedpicker"));
		HudObject = UnityAssets.LoadAsset<GameObject>("Assets/CustomEmotes/EmotePicker.prefab");
		EmoteObject = UnityAssets.LoadAsset<GameObject>("Assets/CustomEmotes/Emote.prefab");
		activeSprite = UnityAssets.LoadAsset<Sprite>("Assets/CustomEmotes/texUICheckboxes_1.png");
		inactiveSprite = UnityAssets.LoadAsset<Sprite>("Assets/CustomEmotes/texUICheckboxes_0.png");
		Effect = UnityAssets.LoadAsset<GameObject>("Assets/CustomEmotes/AddedEffect.prefab");
		FontMaterial = UnityAssets.LoadAsset<Material>("Assets/TextMesh Pro/Examples & Extras/Resources/Fonts & Materials/Roboto-Bold SDF.asset");
		FontMaterial2 = UnityAssets.LoadAsset<Material>("Assets/CustomEmotes/Font2.asset");
		Effect.AddComponent<AddedEffect>();
		HudObject.AddComponent<NewPicker>();
		EmoteObject.AddComponent<EmoteClick>();
		((Component)HudObject.transform.Find("CurrentEmotePanel")).gameObject.AddComponent<ContinueEmote>();
		((Component)HudObject.transform.Find("CreateNewPanel")).gameObject.AddComponent<CreatePanel>();
		((LayoutGroup)((Component)HudObject.transform.Find("CustomEmotesPanel/scroll")).gameObject.GetComponent<GridLayoutGroup>()).childAlignment = (TextAnchor)4;
		((Component)HudObject.transform.Find("CustomEmotesPanel/AddAndDelete")).gameObject.AddComponent<AddOrDelete>();
		((LayoutGroup)((Component)HudObject.transform.Find("AllEmotesPanel/scroll")).gameObject.GetComponent<GridLayoutGroup>()).childAlignment = (TextAnchor)4;
		((Component)HudObject.transform.Find("KeybindingEmote")).gameObject.AddComponent<AddKeybind>();
		((Component)HudObject.transform.Find("Settings")).gameObject.AddComponent<SettingsComponent>();
		((Component)HudObject.transform.Find("BindEmotePanel")).gameObject.AddComponent<BindCurrentEmote>();
		((Component)HudObject.transform.Find("AddCurrentEmote")).gameObject.AddComponent<AddCurrentEmoteComponent>();
		HUD.Awake += new hook_Awake(AwakeMyHud);
		ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Open Emote List", "General", new UnityAction(ConfigOpen)));
		ModSettingsManager.AddOption((BaseOption)new KeyBindOption(NewEmoteMenu));
		ModSettingsManager.AddOption((BaseOption)new KeyBindOption(CustomRandomEmote));
		ModSettingsManager.AddOption((BaseOption)new KeyBindOption(BindCurrentEmoteConfig));
		ModSettingsManager.AddOption((BaseOption)new KeyBindOption(AddCurrentEmoteConfig));
		ModSettingsManager.AddOption((BaseOption)new KeyBindOption(SwitchList));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(CloseMenu));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(HoldAndRelease));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(Sensivity));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(PreventDupicates));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Sort));
		ModSettingsManager.AddOption((BaseOption)new IntSliderOption(Scale, new IntSliderConfig
		{
			min = 1,
			max = 40
		}));
		ModSettingsManager.AddOption((BaseOption)new SliderOption(TextScale, new SliderConfig
		{
			min = 12f,
			max = 64f
		}));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(inactiveColorConfig));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(activeColorConfig));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(textColor));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(outlineColor));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(textColorKey));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(outlineColorKey));
		ModSettingsManager.AddOption((BaseOption)new ColorOption(backgroundColor));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowButton1));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowButton2));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowButton3));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowButton4));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowSettings));
		PreventDupicates.SettingChanged += PreventDupicates_SettingChanged;
		CloseMenu.SettingChanged += PreventDupicates_SettingChanged;
		inactiveColorConfig.SettingChanged += GoThrough;
		textColor.SettingChanged += RecolorMaterial;
		outlineColor.SettingChanged += RecolorMaterial;
		textColorKey.SettingChanged += RecolorMaterial;
		outlineColorKey.SettingChanged += RecolorMaterial;
		backgroundColor.SettingChanged += BindCurrentEmoteConfig_SettingChanged;
		Scale.SettingChanged += GoThrough;
		ShowButton1.SettingChanged += ShowDocumentation_SettingChanged;
		ShowButton2.SettingChanged += ShowDocumentation_SettingChanged;
		ShowButton3.SettingChanged += ShowDocumentation_SettingChanged;
		ShowButton4.SettingChanged += ShowDocumentation_SettingChanged;
		ShowSettings.SettingChanged += ShowDocumentation_SettingChanged;
		BindCurrentEmoteConfig.SettingChanged += BindCurrentEmoteConfig_SettingChanged;
		TextScale.SettingChanged += GoThrough;
		SwitchList.SettingChanged += BindCurrentEmoteConfig_SettingChanged;
		ModSettingsManager.SetModIcon(UnityAssets.LoadAsset<Sprite>("Assets/CustomEmotes/menu-icon.png"));
	}

	private void BindCurrentEmoteConfig_SettingChanged(object sender, EventArgs e)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//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_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)trueHud))
		{
			TextMeshProUGUI component = ((Component)trueHud.transform.Find("CreateNewPanel/keytext")).GetComponent<TextMeshProUGUI>();
			KeyboardShortcut value = SwitchList.Value;
			KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			((TMP_Text)component).text = ((object)(KeyCode)(ref mainKey)).ToString();
			TextMeshProUGUI component2 = ((Component)trueHud.transform.Find("BindEmotePanel/keytext")).GetComponent<TextMeshProUGUI>();
			value = BindCurrentEmoteConfig.Value;
			mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			((TMP_Text)component2).text = ((object)(KeyCode)(ref mainKey)).ToString();
			TextMeshProUGUI component3 = ((Component)trueHud.transform.Find("AddCurrentEmote/keytext")).GetComponent<TextMeshProUGUI>();
			value = AddCurrentEmoteConfig.Value;
			mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			((TMP_Text)component3).text = ((object)(KeyCode)(ref mainKey)).ToString();
			((Graphic)((Component)trueHud.transform.Find("background")).GetComponent<Image>()).color = backgroundColor.Value;
		}
	}

	private void ShowDocumentation_SettingChanged(object sender, EventArgs e)
	{
		if (Object.op_Implicit((Object)(object)trueHud))
		{
			DoI(new string[5] { "CurrentEmotePanel", "CreateNewPanel", "Settings", "BindEmotePanel", "AddCurrentEmote" }, new ConfigEntry<bool>[5] { ShowButton2, ShowButton1, ShowSettings, ShowButton4, ShowButton3 });
		}
		void DoI(string[] paths, ConfigEntry<bool>[] configs)
		{
			for (int i = 0; i < paths.Length; i++)
			{
				((Component)trueHud.transform.Find(paths[i])).gameObject.SetActive(configs[i].Value);
			}
			ShowButton1.SettingChanged += ShowDocumentation_SettingChanged;
		}
	}

	private void ConfigOpen()
	{
		if (!Object.op_Implicit((Object)(object)trueHud))
		{
			BuildUI();
		}
		trueHud.SetActive(true);
	}

	private void RecolorMaterial(object sender, EventArgs e)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		FontMaterial.SetColor("_FaceColor", textColor.Value);
		FontMaterial.SetColor("_OutlineColor", outlineColor.Value);
		FontMaterial2.SetColor("_FaceColor", textColorKey.Value);
		FontMaterial2.SetColor("_OutlineColor", outlineColorKey.Value);
	}

	private void BuildUI()
	{
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0403: Unknown result type (might be due to invalid IL or missing references)
		//IL_0408: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0414: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_0446: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_049b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Expected O, but got Unknown
		if (Object.op_Implicit((Object)(object)trueHud))
		{
			return;
		}
		GameObject val = Object.Instantiate<GameObject>(HudObject);
		List<string> list = new List<string>();
		string[] array = CustomEmotes.Value.Split("*");
		foreach (KeyValuePair<string, CustomAnimationClip> animClip in BoneMapper.animClips)
		{
			list.Add(animClip.Key);
		}
		if (Sort.Value)
		{
			list.Sort();
		}
		foreach (string item in list)
		{
			GameObject val2 = Object.Instantiate<GameObject>(EmoteObject);
			string text = item;
			while (text.Contains("\\"))
			{
				text = text.Replace("\\", "");
			}
			((Object)val2).name = text;
			((TMP_Text)((Component)val2.transform.Find("EmoteName")).GetComponent<TextMeshProUGUI>()).text = text;
			val2.transform.SetParent(val.transform.Find("AllEmotesPanel/scroll"));
			string text2 = text;
			while (text.Contains("'"))
			{
				text = text.Replace("'", "");
			}
			while (text.Contains("\""))
			{
				text = text.Replace("\"", "");
			}
			while (text.Contains("["))
			{
				text = text.Replace("[", "");
			}
			while (text.Contains("]"))
			{
				text = text.Replace("]", "");
			}
			ConfigEntry<KeyboardShortcut> val3 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Emote Keybinds", text, new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Keybind to play " + text);
			val3.SettingChanged += EmoteConfig_SettingChanged;
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(val3));
			emoteKeybinds.Add(val3, text2);
			keybindEmotes.Add(text2, val3);
		}
		if (array.Length != 0)
		{
			string[] array2 = array;
			foreach (string text3 in array2)
			{
				if (text3 != null && text3 != "")
				{
					GameObject val4 = Object.Instantiate<GameObject>(EmoteObject);
					string text4 = text3;
					while (text4.Contains("\\"))
					{
						text4 = text4.Replace("\\", "");
					}
					((Object)val4).name = text4;
					((TMP_Text)((Component)val4.transform.Find("EmoteName")).GetComponent<TextMeshProUGUI>()).text = text4;
					val4.transform.SetParent(val.transform.Find("CustomEmotesPanel/scroll"));
				}
			}
		}
		val.SetActive(false);
		trueHud = val;
		Object.DontDestroyOnLoad((Object)(object)trueHud);
		KeyboardShortcut value = keybindEmotes["none"].Value;
		KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
		keybindEmotes["none"].Value = new KeyboardShortcut((KeyCode)27, Array.Empty<KeyCode>());
		keybindEmotes["none"].Value = new KeyboardShortcut(mainKey, Array.Empty<KeyCode>());
		bool value2 = PreventDupicates.Value;
		if (PreventDupicates.Value)
		{
			PreventDupicates.Value = false;
		}
		else
		{
			PreventDupicates.Value = true;
		}
		PreventDupicates.Value = value2;
		Color value3 = inactiveColorConfig.Value;
		inactiveColorConfig.Value = ((inactiveColorConfig.Value == Color.white) ? Color.black : Color.white);
		inactiveColorConfig.Value = value3;
		value = BindCurrentEmoteConfig.Value;
		mainKey = ((KeyboardShortcut)(ref value)).MainKey;
		BindCurrentEmoteConfig.Value = new KeyboardShortcut((KeyCode)27, Array.Empty<KeyCode>());
		BindCurrentEmoteConfig.Value = new KeyboardShortcut(mainKey, Array.Empty<KeyCode>());
		value3 = textColor.Value;
		textColor.Value = ((textColor.Value == Color.white) ? Color.black : Color.white);
		textColor.Value = value3;
	}

	private void GoThrough(object sender, EventArgs e)
	{
		if (Object.op_Implicit((Object)(object)trueHud))
		{
			DoIt(trueHud.transform.Find("CustomEmotesPanel/scroll"));
			DoIt(trueHud.transform.Find("AllEmotesPanel/scroll"));
			ColorIt(new string[13]
			{
				"AllEmotesPanel", "CustomEmotesPanel", "AllEmotesPanel/scrollbar/Sliding Area/Handle", "AllEmotesPanel/scrollbar", "CustomEmotesPanel/scrollbar/Sliding Area/Handle", "CustomEmotesPanel/scrollbar", "KeybindingEmote", "Settings", "BindEmotePanel", "AddCurrentEmote",
				"CustomEmotesPanel/AddAndDelete", "CreateNewPanel", "CurrentEmotePanel"
			});
		}
		static void ColorIt(string[] paths)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			foreach (string text in paths)
			{
				((Graphic)((Component)trueHud.transform.Find(text)).GetComponent<Image>()).color = inactiveColorConfig.Value;
			}
		}
		static void DoIt(Transform transform)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)Scale.Value / 4f;
			((Component)transform).GetComponent<GridLayoutGroup>().cellSize = new Vector2(80f * num, 40f * num);
			foreach (Transform item in transform)
			{
				Transform val = item;
				((Graphic)((Component)val).GetComponent<Image>()).color = inactiveColorConfig.Value;
				val.Find("EmoteName").localScale = new Vector3(num / 2f, num / 2f, 1f);
				val.Find("EmoteKey").localScale = new Vector3(num / 2f, num / 2f, 1f);
				((TMP_Text)((Component)val.Find("EmoteName")).GetComponent<TextMeshProUGUI>()).fontSizeMax = TextScale.Value;
				((TMP_Text)((Component)val.Find("EmoteKey")).GetComponent<TextMeshProUGUI>()).fontSizeMax = TextScale.Value / 1.5f;
			}
		}
	}

	private void PreventDupicates_SettingChanged(object sender, EventArgs e)
	{
		if (Object.op_Implicit((Object)(object)trueHud))
		{
			((Component)trueHud.transform.Find("Settings/EnableDuplicates/Image")).GetComponent<Image>().sprite = (PreventDupicates.Value ? inactiveSprite : activeSprite);
			((Component)trueHud.transform.Find("Settings/CloseAfterSelection/Image")).GetComponent<Image>().sprite = (CloseMenu.Value ? activeSprite : inactiveSprite);
		}
	}

	public void Update()
	{
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Invalid comparison between Unknown and I4
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		int cursorOpenerCount = MPEventSystemManager.primaryEventSystem.cursorOpenerCount;
		if (Input.GetKeyDown((KeyCode)27) && Object.op_Implicit((Object)(object)trueHud) && trueHud.activeSelf)
		{
			trueHud.SetActive(false);
			if (Object.op_Implicit((Object)(object)Run.instance) && cursorOpenerCount > 0)
			{
				ToggleCursor();
			}
		}
		if (PauseManager.isPaused || !Object.op_Implicit((Object)(object)Run.instance))
		{
			return;
		}
		KeyboardShortcut value;
		if (HoldAndRelease.Value)
		{
			value = NewEmoteMenu.Value;
			if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
			{
				if (!trueHud.activeSelf)
				{
					if (RequestChatBox())
					{
						return;
					}
					trueHud.SetActive(true);
					if (cursorOpenerCount <= 0)
					{
						ToggleCursor();
					}
				}
			}
			else if (trueHud.activeSelf)
			{
				if (RequestChatBox())
				{
					return;
				}
				trueHud.SetActive(false);
				if (cursorOpenerCount > 0)
				{
					ToggleCursor();
				}
			}
		}
		else
		{
			value = NewEmoteMenu.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
			{
				if (trueHud.activeSelf)
				{
					if (RequestChatBox())
					{
						return;
					}
					trueHud.SetActive(false);
					if (cursorOpenerCount > 0)
					{
						ToggleCursor();
					}
				}
				else
				{
					if (RequestChatBox())
					{
						return;
					}
					trueHud.SetActive(true);
					if (cursorOpenerCount <= 0)
					{
						ToggleCursor();
					}
				}
			}
		}
		value = CustomRandomEmote.Value;
		if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
		{
			string[] array = CustomEmotes.Value.Split("*");
			int num = Random.RandomRangeInt(0, array.Length - 1);
			CustomEmotesAPI.PlayAnimation(array[num], -2);
		}
		if (!Input.anyKeyDown)
		{
			return;
		}
		List<string> list = new List<string>();
		foreach (KeyValuePair<ConfigEntry<KeyboardShortcut>, string> emoteKeybind in emoteKeybinds)
		{
			value = emoteKeybind.Key.Value;
			if ((int)((KeyboardShortcut)(ref value)).MainKey > 0)
			{
				value = emoteKeybind.Key.Value;
				if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
				{
					list.Add(emoteKeybind.Value);
				}
			}
		}
		if (list.Count == 1)
		{
			CustomEmotesAPI.PlayAnimation(list[0], -2);
		}
		else if (list.Count > 1)
		{
			int index = Random.RandomRangeInt(0, list.Count);
			CustomEmotesAPI.PlayAnimation(list[index], -2);
		}
	}

	public bool RequestChatBox()
	{
		if ((Object)(object)chatBox == (Object)null)
		{
			chatBox = ((Component)((Component)MenuHud).transform).GetComponentInChildren<ChatBox>();
		}
		if (Object.op_Implicit((Object)(object)chatBox) && chatBox.showInput)
		{
			return true;
		}
		return false;
	}

	public static string GetConfigString()
	{
		string text = CustomEmotes.Value;
		while (text.Contains("\\"))
		{
			text = text.Replace("\\", "");
		}
		return text;
	}

	public static int ToggleCursor()
	{
		MPEventSystem primaryEventSystem = MPEventSystemManager.primaryEventSystem;
		primaryEventSystem.cursorOpenerCount += ((primaryEventSystem.cursorOpenerCount <= 0) ? 1 : (-1));
		primaryEventSystem.cursorOpenerForGamepadCount += ((primaryEventSystem.cursorOpenerForGamepadCount <= 0) ? 1 : (-1));
		return primaryEventSystem.cursorOpenerCount;
	}

	public static void SaveCursorPosition()
	{
		//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)
		mousePosition = Input.mousePosition;
	}

	private void AwakeMyHud(orig_Awake orig, HUD self)
	{
		orig.Invoke(self);
		MenuHud = self;
		BuildUI();
	}

	private void EmoteConfig_SettingChanged(object sender, EventArgs e)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Invalid comparison between Unknown and I4
		if (!Object.op_Implicit((Object)(object)trueHud))
		{
			return;
		}
		foreach (Transform item in trueHud.transform.Find("AllEmotesPanel/scroll"))
		{
			Transform val = item;
			KeyboardShortcut value = keybindEmotes[((Object)val).name].Value;
			KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			if ((int)mainKey == 0)
			{
				((Component)val.Find("EmoteKey")).gameObject.SetActive(false);
				((TMP_Text)((Component)val.Find("EmoteKey")).gameObject.GetComponent<TextMeshProUGUI>()).text = "Key";
			}
			else
			{
				((Component)val.Find("EmoteKey")).gameObject.SetActive(true);
				((TMP_Text)((Component)val.Find("EmoteKey")).gameObject.GetComponent<TextMeshProUGUI>()).text = ((object)(KeyCode)(ref mainKey)).ToString();
			}
		}
	}

	public static void SwitchListMethod()
	{
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)trueHud.transform).GetComponent<NewPicker>().addingEmote)
		{
			AllEmotesPanel().SetActive(false);
			CustomEmotesPanel().SetActive(true);
			trueHud.GetComponent<NewPicker>().edit = true;
			trueHud.GetComponent<NewPicker>().addingEmote = false;
			PanelText().text = "Switch to all emotes panel";
			return;
		}
		if (AllEmotesPanel().activeSelf)
		{
			AllEmotesPanel().SetActive(false);
			CustomEmotesPanel().SetActive(true);
			trueHud.GetComponent<NewPicker>().edit = true;
			PanelText().text = "Switch to all emotes panel";
		}
		else
		{
			AllEmotesPanel().SetActive(true);
			CustomEmotesPanel().SetActive(false);
			trueHud.GetComponent<NewPicker>().edit = false;
			PanelText().text = "Switch to custom emotes panel";
		}
		if (Object.op_Implicit((Object)(object)selected))
		{
			((Graphic)selected.GetComponent<Image>()).color = inactiveColorConfig.Value;
			selected.transform.localScale = Vector3.one;
		}
		static GameObject AllEmotesPanel()
		{
			return ((Component)trueHud.transform.Find("AllEmotesPanel")).gameObject;
		}
		static GameObject CustomEmotesPanel()
		{
			return ((Component)trueHud.transform.Find("CustomEmotesPanel")).gameObject;
		}
		static TMP_Text PanelText()
		{
			return (TMP_Text)(object)((Component)trueHud.transform.Find("CreateNewPanel/text")).GetComponent<TextMeshProUGUI>();
		}
	}

	public static string GenerateCustomEmotesString()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		string text = "";
		foreach (Transform item in trueHud.transform.Find("CustomEmotesPanel/scroll"))
		{
			Transform val = item;
			text = text + ((Object)((Component)val).gameObject).name + "*";
		}
		return text;
	}

	public static void BindCurrentEmoteMethod()
	{
		if (Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper))
		{
			if (!BindEmotePanel().activeSelf)
			{
				BindEmotePanel().GetComponent<AddKeybind>().emote = CustomEmotesAPI.localMapper.currentClipName;
				BindEmotePanel().GetComponent<AddKeybind>().emoteOrNot = true;
				BindEmotePanel().SetActive(true);
			}
			else
			{
				BindEmotePanel().SetActive(false);
			}
		}
		static GameObject BindEmotePanel()
		{
			return ((Component)trueHud.transform.Find("KeybindingEmote")).gameObject;
		}
	}

	public static void AddCurrentEmote()
	{
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper))
		{
			return;
		}
		BoneMapper localMapper = CustomEmotesAPI.localMapper;
		if (PreventDupicates.Value)
		{
			string[] array = GetConfigString().Split("*");
			if (array.Length != 0 && array.Contains(localMapper.currentClipName))
			{
				GameObject val = Object.Instantiate<GameObject>(Effect, trueHud.transform);
				((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = "Emote " + localMapper.currentClipName + " has been already added";
				GameObject gameObject = ((Component)trueHud.transform.Find("CustomEmotesPanel/scroll/" + localMapper.currentClipName)).gameObject;
				if (gameObject.activeInHierarchy)
				{
					gameObject.AddComponent<HighlightEmote>();
				}
				return;
			}
		}
		GameObject val2 = Object.Instantiate<GameObject>(EmoteObject, trueHud.transform.Find("CustomEmotesPanel/scroll"));
		float num = (float)Scale.Value / 4f;
		val2.transform.Find("EmoteName").localScale = new Vector3(num / 2f, num / 2f, 1f);
		val2.transform.Find("EmoteKey").localScale = new Vector3(num / 2f, num / 2f, 1f);
		((Graphic)val2.GetComponent<Image>()).color = inactiveColorConfig.Value;
		((Object)val2).name = localMapper.currentClipName;
		((TMP_Text)((Component)val2.transform.Find("EmoteName")).GetComponent<TextMeshProUGUI>()).text = localMapper.currentClipName;
		GameObject val3 = Object.Instantiate<GameObject>(Effect, trueHud.transform);
		((TMP_Text)val3.GetComponent<TextMeshProUGUI>()).text = "Added " + localMapper.currentClipName;
		CustomEmotes.Value = GenerateCustomEmotesString();
	}
}