Decompiled source of MoreEyes v1.0.0

plugins/MoreEyes/com.github.s1ckboii.MoreEyes.dll

Decompiled 3 days ago
using System;
using System.Collections;
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;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using MoreEyes.Collections;
using MoreEyes.Components;
using MoreEyes.Core;
using MoreEyes.Managers;
using MoreEyes.SDK;
using MoreEyes.Utility;
using Photon.Pun;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("s1ckboy, darmuh")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 s1ckboy")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2349900b4fa3c0220fcbdc8368d8b2de6c29b70a")]
[assembly: AssemblyProduct("MoreEyes")]
[assembly: AssemblyTitle("com.github.s1ckboii.MoreEyes")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreEyes
{
	internal static class MyPluginInfo
	{
		internal const string PLUGIN_GUID = "com.github.s1ckboii.MoreEyes";

		internal const string PLUGIN_NAME = "MoreEyes";

		internal const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreEyes.Utility
{
	internal class Enums
	{
		internal enum ModLogLevel
		{
			WarningsOnly,
			Standard,
			Debug
		}

		internal enum ModInMenuDisplay
		{
			Never,
			Duplicates,
			Always
		}

		internal enum MenuOrderBy
		{
			NameOnly,
			ModNameOnly,
			ModNameAndName,
			None
		}

		internal enum EyePart
		{
			Pupil,
			Iris
		}

		internal enum EyeSide
		{
			Left,
			Right
		}

		internal enum PrefabSide
		{
			Left,
			Right,
			Both
		}
	}
	internal sealed class Menu
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action <0>__CreatePopupMenu;

			public static Action <1>__BackButton;

			public static Action <2>__RandomizeLocalEyeSelection;

			public static Action <3>__ResetLocalEyeSelection;

			public static Action <4>__PupilLeftSliders;

			public static Action <5>__PupilRightSliders;

			public static Action <6>__IrisLeftSliders;

			public static Action <7>__IrisRightSliders;

			public static Action <8>__LeftPupilPrev;

			public static Action <9>__RightPupilPrev;

			public static Action <10>__LeftIrisPrev;

			public static Action <11>__RightIrisPrev;

			public static Action <12>__LeftPupilNext;

			public static Action <13>__RightPupilNext;

			public static Action <14>__LeftIrisNext;

			public static Action <15>__RightIrisNext;

			public static Action<int> <16>__RedSlider;

			public static Action<int> <17>__GreenSlider;

			public static Action<int> <18>__BlueSlider;

			public static ShouldCloseMenuDelegate <19>__ShouldCloseMenu;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuilderDelegate <>9__39_1;

			public static BuilderDelegate <>9__39_2;

			public static BuilderDelegate <>9__48_0;

			public static BuilderDelegate <>9__48_1;

			public static BuilderDelegate <>9__48_2;

			public static BuilderDelegate <>9__48_3;

			public static BuilderDelegate <>9__48_4;

			public static BuilderDelegate <>9__48_5;

			public static BuilderDelegate <>9__48_6;

			public static BuilderDelegate <>9__48_7;

			public static BuilderDelegate <>9__48_8;

			public static BuilderDelegate <>9__48_9;

			public static BuilderDelegate <>9__48_10;

			internal void <Initialize>b__39_1(Transform p)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("More Eyes", (Action)CreatePopupMenu, p, new Vector2(600f, 22f));
			}

			internal void <Initialize>b__39_2(Transform p)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("More Eyes", (Action)CreatePopupMenu, p, new Vector2(600f, 22f));
			}

			internal void <CreatePopupMenu>b__48_0(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Back", (Action)BackButton, ((Component)MoreEyesMenu).transform, new Vector2(190f, 30f));
			}

			internal void <CreatePopupMenu>b__48_1(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Randomize", (Action)RandomizeLocalEyeSelection, ((Component)MoreEyesMenu).transform, new Vector2(270f, 30f));
			}

			internal void <CreatePopupMenu>b__48_2(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Reset", (Action)ResetLocalEyeSelection, ((Component)MoreEyesMenu).transform, new Vector2(400f, 30f));
			}

			internal void <CreatePopupMenu>b__48_3(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<", (Action)LeftPupilPrev, ((Component)pupilLeft).transform, new Vector2(-25f, -10f));
			}

			internal void <CreatePopupMenu>b__48_4(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<", (Action)RightPupilPrev, ((Component)pupilRight).transform, new Vector2(-25f, -10f));
			}

			internal void <CreatePopupMenu>b__48_5(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<", (Action)LeftIrisPrev, ((Component)irisLeft).transform, new Vector2(-25f, -10f));
			}

			internal void <CreatePopupMenu>b__48_6(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("<", (Action)RightIrisPrev, ((Component)irisRight).transform, new Vector2(-25f, -10f));
			}

			internal void <CreatePopupMenu>b__48_7(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton(">", (Action)LeftPupilNext, ((Component)pupilLeft).transform, new Vector2(70f, -10f));
			}

			internal void <CreatePopupMenu>b__48_8(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton(">", (Action)RightPupilNext, ((Component)pupilRight).transform, new Vector2(70f, -10f));
			}

			internal void <CreatePopupMenu>b__48_9(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton(">", (Action)LeftIrisNext, ((Component)irisLeft).transform, new Vector2(70f, -10f));
			}

			internal void <CreatePopupMenu>b__48_10(Transform e)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton(">", (Action)RightIrisNext, ((Component)irisRight).transform, new Vector2(70f, -10f));
			}
		}

		internal static REPOPopupPage MoreEyesMenu = new REPOPopupPage();

		internal static REPOAvatarPreview AvatarPreview;

		internal static REPOButton pupilLeft;

		internal static REPOButton pupilRight;

		internal static REPOButton irisLeft;

		internal static REPOButton irisRight;

		internal static REPOLabel zoomTip;

		internal static REPOLabel pupilLeftHeader;

		internal static REPOLabel pupilRightHeader;

		internal static REPOLabel irisLeftHeader;

		internal static REPOLabel irisRightHeader;

		internal static REPOSlider redSlider;

		internal static REPOSlider greenSlider;

		internal static REPOSlider blueSlider;

		private static int currentRed;

		private static int currentGreen;

		private static int currentBlue;

		internal static string eyePart;

		internal static string eyeSide;

		internal static string eyeStyle;

		internal static object ColorSelection { get; private set; } = null;


		internal static Enums.EyePart CurrentEyePart { get; private set; }

		internal static Enums.EyeSide CurrentEyeSide { get; private set; }

		internal static bool SlidersOn { get; private set; } = false;


		private static string GetEyePartName(Enums.EyePart part)
		{
			if (1 == 0)
			{
			}
			string result = part switch
			{
				Enums.EyePart.Pupil => "Pupil", 
				Enums.EyePart.Iris => "Iris", 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private static string GetEyeSideName(Enums.EyeSide side)
		{
			if (1 == 0)
			{
			}
			string result = side switch
			{
				Enums.EyeSide.Left => "Left", 
				Enums.EyeSide.Right => "Right", 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private static string GetEyeStyle()
		{
			Enums.EyePart currentEyePart = CurrentEyePart;
			Enums.EyeSide currentEyeSide = CurrentEyeSide;
			if (1 == 0)
			{
			}
			string result;
			if (currentEyePart != 0)
			{
				if (currentEyePart != Enums.EyePart.Iris)
				{
					goto IL_007a;
				}
				if (currentEyeSide != 0)
				{
					if (currentEyeSide != Enums.EyeSide.Right)
					{
						goto IL_007a;
					}
					result = ((TMP_Text)irisRight.labelTMP).text;
				}
				else
				{
					result = ((TMP_Text)irisLeft.labelTMP).text;
				}
			}
			else if (currentEyeSide != 0)
			{
				if (currentEyeSide != Enums.EyeSide.Right)
				{
					goto IL_007a;
				}
				result = ((TMP_Text)pupilRight.labelTMP).text;
			}
			else
			{
				result = ((TMP_Text)pupilLeft.labelTMP).text;
			}
			goto IL_0082;
			IL_0082:
			if (1 == 0)
			{
			}
			return result;
			IL_007a:
			result = "";
			goto IL_0082;
		}

		internal static void Initialize()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0069: Expected O, but got Unknown
			//IL_007e: 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_0089: Expected O, but got Unknown
			//IL_00a3: 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_00ae: Expected O, but got Unknown
			int num = 0;
			if (ModCompats.IsSpawnManagerPresent)
			{
				num++;
			}
			if (ModCompats.IsTwitchChatAPIPresent)
			{
				num++;
			}
			if (ModCompats.IsTwitchTrollingPresent)
			{
				num++;
			}
			float num2 = 22f;
			float num3 = 35f;
			Vector2 buttonPos = new Vector2(595f, num2 + num3 * (float)num);
			MenuAPI.AddElementToMainMenu((BuilderDelegate)delegate(Transform p)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("More Eyes", (Action)CreatePopupMenu, p, buttonPos);
			});
			object obj = <>c.<>9__39_1;
			if (obj == null)
			{
				BuilderDelegate val = delegate(Transform p)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("More Eyes", (Action)CreatePopupMenu, p, new Vector2(600f, 22f));
				};
				<>c.<>9__39_1 = val;
				obj = (object)val;
			}
			MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj);
			object obj2 = <>c.<>9__39_2;
			if (obj2 == null)
			{
				BuilderDelegate val2 = delegate(Transform p)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("More Eyes", (Action)CreatePopupMenu, p, new Vector2(600f, 22f));
				};
				<>c.<>9__39_2 = val2;
				obj2 = (object)val2;
			}
			MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj2);
		}

		private static void RandomizeLocalEyeSelection()
		{
			PatchedEyes.Local.RandomizeEyes();
			UpdateButtons();
		}

		private static void ResetLocalEyeSelection()
		{
			PatchedEyes.Local.ResetEyes();
			UpdateButtons();
		}

		internal static void UpdateButtons()
		{
			PlayerEyeSelection currentSelections = PatchedEyes.Local.CurrentSelections;
			((TMP_Text)pupilLeft.labelTMP).text = MenuUtils.ApplyGradient(currentSelections.pupilLeft.MenuName, inverse: true);
			((TMP_Text)pupilRight.labelTMP).text = MenuUtils.ApplyGradient(currentSelections.pupilRight.MenuName, inverse: true);
			((TMP_Text)irisLeft.labelTMP).text = MenuUtils.ApplyGradient(currentSelections.irisLeft.MenuName, inverse: true);
			((TMP_Text)irisRight.labelTMP).text = MenuUtils.ApplyGradient(currentSelections.irisRight.MenuName, inverse: true);
			UpdateHeaders();
		}

		private static void SetSliders(int red, int green, int blue)
		{
			redSlider.SetValue((float)red, false);
			greenSlider.SetValue((float)green, false);
			blueSlider.SetValue((float)blue, false);
			currentRed = red;
			currentGreen = green;
			currentBlue = blue;
		}

		private static void UpdateSliders(object selection)
		{
			//IL_0034: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (selection == null)
			{
				return;
			}
			Color colorForMenu;
			if (selection is CustomPupilType pupil)
			{
				ColorSelection = selection;
				colorForMenu = PatchedEyes.Local.CurrentSelections.GetColorForMenu(pupil);
			}
			else
			{
				if (!(selection is CustomIrisType iris))
				{
					Loggers.Warning("Selection is invalid type at UpdateSliders!");
					return;
				}
				ColorSelection = selection;
				colorForMenu = PatchedEyes.Local.CurrentSelections.GetColorForMenu(iris);
			}
			int value = Mathf.RoundToInt(colorForMenu.r * 255f);
			int value2 = Mathf.RoundToInt(colorForMenu.g * 255f);
			int value3 = Mathf.RoundToInt(colorForMenu.b * 255f);
			RedSlider(value);
			GreenSlider(value2);
			BlueSlider(value3);
			SetSliders(currentRed, currentGreen, currentBlue);
		}

		private static void UpdateMaterialColor()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (ColorSelection != null)
			{
				Color color = default(Color);
				((Color)(ref color))..ctor((float)currentRed / 255f, (float)currentGreen / 255f, (float)currentBlue / 255f);
				if (ColorSelection is CustomPupilType pupil)
				{
					PatchedEyes.Local.CurrentSelections.UpdateColorInMenu(pupil, color);
				}
				else if (ColorSelection is CustomIrisType iris)
				{
					PatchedEyes.Local.CurrentSelections.UpdateColorInMenu(iris, color);
				}
				else
				{
					Loggers.Warning("Unable to set color of current selection! Invalid type!");
				}
			}
		}

		private static void UpdateHeaders()
		{
			eyePart = GetEyePartName(CurrentEyePart);
			eyeSide = GetEyeSideName(CurrentEyeSide);
			eyeStyle = GetEyeStyle();
			((TMP_Text)redSlider.labelTMP).text = eyeStyle ?? "";
			((TMP_Text)greenSlider.labelTMP).text = MenuUtils.ApplyGradient(eyePart ?? "");
			((TMP_Text)blueSlider.labelTMP).text = MenuUtils.ApplyGradient(eyeSide ?? "");
		}

		private static void BackButton()
		{
			SlidersOn = true;
			MoreEyesMenu.ClosePage(true);
			MenuPageEsc instance = MenuPageEsc.instance;
			if (instance != null)
			{
				instance.ButtonEventContinue();
			}
			if (FileManager.UpdateWrite)
			{
				MoreEyesNetwork.SyncMoreEyesChanges();
				FileManager.WriteTextFile();
			}
		}

		private static void CreatePopupMenu()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Expected O, but got Unknown
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Expected O, but got Unknown
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Expected O, but got Unknown
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Expected O, but got Unknown
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Expected O, but got Unknown
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Expected O, but got Unknown
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Expected O, but got Unknown
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_077c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Expected O, but got Unknown
			//IL_076c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0771: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Expected O, but got Unknown
			if ((Object)(object)MoreEyesMenu.menuPage != (Object)null)
			{
				return;
			}
			PlayerEyeSelection currentSelections = PatchedEyes.Local.CurrentSelections;
			MoreEyesMenu = MenuAPI.CreateREPOPopupPage(MenuUtils.ApplyGradient("More Eyes"), false, true, 0f, (Vector2?)new Vector2(-150f, 5f));
			AvatarPreview = MenuAPI.CreateREPOAvatarPreview(((Component)MoreEyesMenu).transform, new Vector2(471.25f, 156.5f), false, (Color?)null);
			AvatarPreview.previewSize = new Vector2(266.6667f, 500f);
			((REPOElement)AvatarPreview).rectTransform.sizeDelta = new Vector2(266.6667f, 210f);
			AvatarPreview.rigTransform.parent.localScale = new Vector3(2f, 2f, 2f);
			AvatarPreview.rigTransform.parent.localPosition = new Vector3(0f, -3.5f, 0f);
			MenuUtils.zoomLevel = 1f;
			MenuUtils.HandleScrollZoom(AvatarPreview);
			zoomTip = MenuAPI.CreateREPOLabel("! Scroll to zoom", ((Component)MoreEyesMenu).transform, new Vector2(480f, 0f));
			MenuUtils.SetTipTextStyling(zoomTip);
			REPOPopupPage moreEyesMenu = MoreEyesMenu;
			object obj = <>c.<>9__48_0;
			if (obj == null)
			{
				BuilderDelegate val = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Back", (Action)BackButton, ((Component)MoreEyesMenu).transform, new Vector2(190f, 30f));
				};
				<>c.<>9__48_0 = val;
				obj = (object)val;
			}
			moreEyesMenu.AddElement((BuilderDelegate)obj);
			REPOPopupPage moreEyesMenu2 = MoreEyesMenu;
			object obj2 = <>c.<>9__48_1;
			if (obj2 == null)
			{
				BuilderDelegate val2 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Randomize", (Action)RandomizeLocalEyeSelection, ((Component)MoreEyesMenu).transform, new Vector2(270f, 30f));
				};
				<>c.<>9__48_1 = val2;
				obj2 = (object)val2;
			}
			moreEyesMenu2.AddElement((BuilderDelegate)obj2);
			REPOPopupPage moreEyesMenu3 = MoreEyesMenu;
			object obj3 = <>c.<>9__48_2;
			if (obj3 == null)
			{
				BuilderDelegate val3 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("Reset", (Action)ResetLocalEyeSelection, ((Component)MoreEyesMenu).transform, new Vector2(400f, 30f));
				};
				<>c.<>9__48_2 = val3;
				obj3 = (object)val3;
			}
			moreEyesMenu3.AddElement((BuilderDelegate)obj3);
			pupilLeft = MenuAPI.CreateREPOButton(MenuUtils.ApplyGradient(currentSelections.pupilLeft.MenuName, inverse: true), (Action)PupilLeftSliders, ((Component)MoreEyesMenu).transform, new Vector2(215f, 265f));
			pupilRight = MenuAPI.CreateREPOButton(MenuUtils.ApplyGradient(currentSelections.pupilRight.MenuName, inverse: true), (Action)PupilRightSliders, ((Component)MoreEyesMenu).transform, new Vector2(360f, 265f));
			irisLeft = MenuAPI.CreateREPOButton(MenuUtils.ApplyGradient(currentSelections.irisLeft.MenuName, inverse: true), (Action)IrisLeftSliders, ((Component)MoreEyesMenu).transform, new Vector2(215f, 215f));
			irisRight = MenuAPI.CreateREPOButton(MenuUtils.ApplyGradient(currentSelections.irisRight.MenuName, inverse: true), (Action)IrisRightSliders, ((Component)MoreEyesMenu).transform, new Vector2(360f, 215f));
			MenuUtils.SetTextStyling(new List<REPOButton>(4) { pupilLeft, pupilRight, irisLeft, irisRight });
			pupilLeftHeader = MenuAPI.CreateREPOLabel("Pupil Left", ((Component)MoreEyesMenu).transform, new Vector2(151.5f, 285f));
			pupilRightHeader = MenuAPI.CreateREPOLabel("Pupil Right", ((Component)MoreEyesMenu).transform, new Vector2(297.5f, 285f));
			irisLeftHeader = MenuAPI.CreateREPOLabel("Iris Left", ((Component)MoreEyesMenu).transform, new Vector2(151.5f, 235f));
			irisRightHeader = MenuAPI.CreateREPOLabel("Iris Right", ((Component)MoreEyesMenu).transform, new Vector2(297.5f, 235f));
			MenuUtils.SetHeaderTextStyling(new List<REPOLabel>(4) { pupilLeftHeader, pupilRightHeader, irisLeftHeader, irisRightHeader });
			REPOPopupPage moreEyesMenu4 = MoreEyesMenu;
			object obj4 = <>c.<>9__48_3;
			if (obj4 == null)
			{
				BuilderDelegate val4 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("<", (Action)LeftPupilPrev, ((Component)pupilLeft).transform, new Vector2(-25f, -10f));
				};
				<>c.<>9__48_3 = val4;
				obj4 = (object)val4;
			}
			moreEyesMenu4.AddElement((BuilderDelegate)obj4);
			REPOPopupPage moreEyesMenu5 = MoreEyesMenu;
			object obj5 = <>c.<>9__48_4;
			if (obj5 == null)
			{
				BuilderDelegate val5 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("<", (Action)RightPupilPrev, ((Component)pupilRight).transform, new Vector2(-25f, -10f));
				};
				<>c.<>9__48_4 = val5;
				obj5 = (object)val5;
			}
			moreEyesMenu5.AddElement((BuilderDelegate)obj5);
			REPOPopupPage moreEyesMenu6 = MoreEyesMenu;
			object obj6 = <>c.<>9__48_5;
			if (obj6 == null)
			{
				BuilderDelegate val6 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("<", (Action)LeftIrisPrev, ((Component)irisLeft).transform, new Vector2(-25f, -10f));
				};
				<>c.<>9__48_5 = val6;
				obj6 = (object)val6;
			}
			moreEyesMenu6.AddElement((BuilderDelegate)obj6);
			REPOPopupPage moreEyesMenu7 = MoreEyesMenu;
			object obj7 = <>c.<>9__48_6;
			if (obj7 == null)
			{
				BuilderDelegate val7 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton("<", (Action)RightIrisPrev, ((Component)irisRight).transform, new Vector2(-25f, -10f));
				};
				<>c.<>9__48_6 = val7;
				obj7 = (object)val7;
			}
			moreEyesMenu7.AddElement((BuilderDelegate)obj7);
			REPOPopupPage moreEyesMenu8 = MoreEyesMenu;
			object obj8 = <>c.<>9__48_7;
			if (obj8 == null)
			{
				BuilderDelegate val8 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton(">", (Action)LeftPupilNext, ((Component)pupilLeft).transform, new Vector2(70f, -10f));
				};
				<>c.<>9__48_7 = val8;
				obj8 = (object)val8;
			}
			moreEyesMenu8.AddElement((BuilderDelegate)obj8);
			REPOPopupPage moreEyesMenu9 = MoreEyesMenu;
			object obj9 = <>c.<>9__48_8;
			if (obj9 == null)
			{
				BuilderDelegate val9 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton(">", (Action)RightPupilNext, ((Component)pupilRight).transform, new Vector2(70f, -10f));
				};
				<>c.<>9__48_8 = val9;
				obj9 = (object)val9;
			}
			moreEyesMenu9.AddElement((BuilderDelegate)obj9);
			REPOPopupPage moreEyesMenu10 = MoreEyesMenu;
			object obj10 = <>c.<>9__48_9;
			if (obj10 == null)
			{
				BuilderDelegate val10 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton(">", (Action)LeftIrisNext, ((Component)irisLeft).transform, new Vector2(70f, -10f));
				};
				<>c.<>9__48_9 = val10;
				obj10 = (object)val10;
			}
			moreEyesMenu10.AddElement((BuilderDelegate)obj10);
			REPOPopupPage moreEyesMenu11 = MoreEyesMenu;
			object obj11 = <>c.<>9__48_10;
			if (obj11 == null)
			{
				BuilderDelegate val11 = delegate
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.CreateREPOButton(">", (Action)RightIrisNext, ((Component)irisRight).transform, new Vector2(70f, -10f));
				};
				<>c.<>9__48_10 = val11;
				obj11 = (object)val11;
			}
			moreEyesMenu11.AddElement((BuilderDelegate)obj11);
			redSlider = MenuAPI.CreateREPOSlider(MenuUtils.ApplyGradient(eyeStyle ?? ""), "<color=#FF0000>Red</color>", (Action<int>)RedSlider, ((Component)MoreEyesMenu).transform, new Vector2(205f, 180f), 0, 255, 0, "", "", (BarBehavior)0);
			greenSlider = MenuAPI.CreateREPOSlider(MenuUtils.ApplyGradient(eyePart ?? ""), "<color=#00FF00>Green</color>", (Action<int>)GreenSlider, ((Component)MoreEyesMenu).transform, new Vector2(205f, 135f), 0, 255, 0, "", "", (BarBehavior)0);
			blueSlider = MenuAPI.CreateREPOSlider(MenuUtils.ApplyGradient(eyeSide ?? ""), "<color=#0000FF>Blue</color>", (Action<int>)BlueSlider, ((Component)MoreEyesMenu).transform, new Vector2(205f, 90f), 0, 255, 0, "", "", (BarBehavior)0);
			MenuUtils.SliderSetups(new List<REPOSlider>(3) { redSlider, greenSlider, blueSlider });
			((Component)redSlider).gameObject.SetActive(false);
			((Component)greenSlider).gameObject.SetActive(false);
			((Component)blueSlider).gameObject.SetActive(false);
			SlidersOn = false;
			MoreEyesMenu.OpenPage(false);
			REPOPopupPage moreEyesMenu12 = MoreEyesMenu;
			ShouldCloseMenuDelegate onEscapePressed = moreEyesMenu12.onEscapePressed;
			object obj12 = <>O.<19>__ShouldCloseMenu;
			if (obj12 == null)
			{
				ShouldCloseMenuDelegate val12 = ShouldCloseMenu;
				<>O.<19>__ShouldCloseMenu = val12;
				obj12 = (object)val12;
			}
			moreEyesMenu12.onEscapePressed = (ShouldCloseMenuDelegate)Delegate.Combine((Delegate?)(object)onEscapePressed, (Delegate?)obj12);
		}

		private static bool ShouldCloseMenu()
		{
			BackButton();
			return true;
		}

		private static void CommonSliders(Enums.EyeSide eyeSide, Enums.EyePart eyePart)
		{
			if (!SlidersOn)
			{
				((Component)redSlider).gameObject.SetActive(true);
				((Component)greenSlider).gameObject.SetActive(true);
				((Component)blueSlider).gameObject.SetActive(true);
			}
			SlidersOn = true;
			CurrentEyePart = eyePart;
			CurrentEyeSide = eyeSide;
			eyeStyle = GetEyeStyle();
			UpdateHeaders();
			if (CurrentEyePart == Enums.EyePart.Pupil)
			{
				if (eyeSide == Enums.EyeSide.Left && (Object)(object)PatchedEyes.Local.CurrentSelections.pupilLeft.Prefab != (Object)null)
				{
					UpdateSliders(PatchedEyes.Local.CurrentSelections.pupilLeft);
				}
				if (eyeSide == Enums.EyeSide.Right && (Object)(object)PatchedEyes.Local.CurrentSelections.pupilRight.Prefab != (Object)null)
				{
					UpdateSliders(PatchedEyes.Local.CurrentSelections.pupilRight);
				}
			}
			else
			{
				if (eyeSide == Enums.EyeSide.Left && (Object)(object)PatchedEyes.Local.CurrentSelections.irisLeft.Prefab != (Object)null)
				{
					UpdateSliders(PatchedEyes.Local.CurrentSelections.irisLeft);
				}
				if (eyeSide == Enums.EyeSide.Right && (Object)(object)PatchedEyes.Local.CurrentSelections.irisRight.Prefab != (Object)null)
				{
					UpdateSliders(PatchedEyes.Local.CurrentSelections.irisRight);
				}
			}
		}

		private static void PupilLeftSliders()
		{
			CommonSliders(Enums.EyeSide.Left, Enums.EyePart.Pupil);
		}

		private static void PupilRightSliders()
		{
			CommonSliders(Enums.EyeSide.Right, Enums.EyePart.Pupil);
		}

		private static void IrisLeftSliders()
		{
			CommonSliders(Enums.EyeSide.Left, Enums.EyePart.Iris);
		}

		private static void IrisRightSliders()
		{
			CommonSliders(Enums.EyeSide.Right, Enums.EyePart.Iris);
		}

		private static void RedSlider(int value)
		{
			currentRed = value;
			UpdateMaterialColor();
		}

		private static void GreenSlider(int value)
		{
			currentGreen = value;
			UpdateMaterialColor();
		}

		private static void BlueSlider(int value)
		{
			currentBlue = value;
			UpdateMaterialColor();
		}

		private static void LeftIrisNext()
		{
			NewSelection(Enums.EyeSide.Left, Enums.EyePart.Iris, 1);
		}

		private static void RightIrisNext()
		{
			NewSelection(Enums.EyeSide.Right, Enums.EyePart.Iris, 1);
		}

		private static void LeftIrisPrev()
		{
			NewSelection(Enums.EyeSide.Left, Enums.EyePart.Iris, -1);
		}

		private static void RightIrisPrev()
		{
			NewSelection(Enums.EyeSide.Right, Enums.EyePart.Iris, -1);
		}

		private static void LeftPupilNext()
		{
			NewSelection(Enums.EyeSide.Left, Enums.EyePart.Pupil, 1);
		}

		private static void RightPupilNext()
		{
			NewSelection(Enums.EyeSide.Right, Enums.EyePart.Pupil, 1);
		}

		private static void LeftPupilPrev()
		{
			NewSelection(Enums.EyeSide.Left, Enums.EyePart.Pupil, -1);
		}

		private static void RightPupilPrev()
		{
			NewSelection(Enums.EyeSide.Right, Enums.EyePart.Pupil, -1);
		}

		private static void NewSelection(Enums.EyeSide side, Enums.EyePart part, int dir)
		{
			PlayerEyeSelection currentSelections = PatchedEyes.Local.CurrentSelections;
			if (part == Enums.EyePart.Pupil)
			{
				List<CustomPupilType> List = CustomPupilType.GetListing(side, currentSelections);
				MenuUtils.OrderListBy(ref List, ModConfig.MenuListOrder.Value);
				int num = CustomPupilType.IndexOf(side, List, currentSelections);
				int index = CycleIndex(num + dir, 0, List.Count - 1);
				CustomPupilType newSelection = List[index];
				PatchedEyes.Local.SelectPupil(newSelection, side == Enums.EyeSide.Left);
				UpdateButtons();
			}
			else
			{
				List<CustomIrisType> List2 = CustomIrisType.GetListing(side, currentSelections);
				MenuUtils.OrderListBy(ref List2, ModConfig.MenuListOrder.Value);
				int num2 = CustomIrisType.IndexOf(side, List2, currentSelections);
				int index2 = CycleIndex(num2 + dir, 0, List2.Count - 1);
				CustomIrisType newSelection2 = List2[index2];
				PatchedEyes.Local.SelectIris(newSelection2, side == Enums.EyeSide.Left);
				UpdateButtons();
			}
			CommonSliders(side, part);
		}

		public static int CycleIndex(int value, int min, int max)
		{
			if (value < min)
			{
				return max;
			}
			if (value > max)
			{
				return min;
			}
			return value;
		}
	}
	internal static class MenuUtils
	{
		[CompilerGenerated]
		private sealed class <AnimateZoom>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public REPOAvatarPreview preview;

			public float targetZoom;

			private Vector2 <sizeOut>5__1;

			private Vector2 <sizeIn>5__2;

			private Vector2 <deltaOut>5__3;

			private Vector2 <deltaIn>5__4;

			private Vector3 <scaleOut>5__5;

			private Vector3 <scaleIn>5__6;

			private Vector3 <posOut>5__7;

			private Vector3 <posIn>5__8;

			private Vector2 <anchorOut>5__9;

			private Vector2 <anchorIn>5__10;

			private float <startZoom>5__11;

			private float <duration>5__12;

			private float <elapsed>5__13;

			private float <t>5__14;

			private float <z>5__15;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <AnimateZoom>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: 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_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: 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_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01df: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Unknown result type (might be due to invalid IL or missing references)
				//IL_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_0273: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_0284: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_031d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0323: Unknown result type (might be due to invalid IL or missing references)
				//IL_032e: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<sizeOut>5__1 = new Vector2(182.4f, 342f);
					<sizeIn>5__2 = new Vector2(266.6667f, 500f);
					<deltaOut>5__3 = new Vector2(182.4f, 342f);
					<deltaIn>5__4 = new Vector2(266.6667f, 210f);
					<scaleOut>5__5 = Vector3.one;
					<scaleIn>5__6 = new Vector3(2f, 2f, 2f);
					<posOut>5__7 = new Vector3(0f, -0.6f, 0f);
					<posIn>5__8 = new Vector3(0f, -3.5f, 0f);
					<anchorOut>5__9 = new Vector2(471.25f, 24.5f);
					<anchorIn>5__10 = new Vector2(471.25f, 156.5f);
					<startZoom>5__11 = zoomLevel;
					<duration>5__12 = 0.45f;
					<elapsed>5__13 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__13 < <duration>5__12)
				{
					<elapsed>5__13 += Time.deltaTime;
					<t>5__14 = Mathf.SmoothStep(0f, 1f, <elapsed>5__13 / <duration>5__12);
					<z>5__15 = Mathf.Lerp(<startZoom>5__11, targetZoom, <t>5__14);
					preview.previewSize = Vector2.Lerp(<sizeOut>5__1, <sizeIn>5__2, <z>5__15);
					((REPOElement)preview).rectTransform.sizeDelta = Vector2.Lerp(<deltaOut>5__3, <deltaIn>5__4, <z>5__15);
					preview.rigTransform.parent.localScale = Vector3.Lerp(<scaleOut>5__5, <scaleIn>5__6, <z>5__15);
					preview.rigTransform.parent.localPosition = Vector3.Lerp(<posOut>5__7, <posIn>5__8, <z>5__15);
					((REPOElement)preview).rectTransform.anchoredPosition = Vector2.Lerp(<anchorOut>5__9, <anchorIn>5__10, <z>5__15);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				preview.previewSize = Vector2.Lerp(<sizeOut>5__1, <sizeIn>5__2, targetZoom);
				((REPOElement)preview).rectTransform.sizeDelta = Vector2.Lerp(<deltaOut>5__3, <deltaIn>5__4, targetZoom);
				preview.rigTransform.parent.localScale = Vector3.Lerp(<scaleOut>5__5, <scaleIn>5__6, targetZoom);
				preview.rigTransform.parent.localPosition = Vector3.Lerp(<posOut>5__7, <posIn>5__8, targetZoom);
				((REPOElement)preview).rectTransform.anchoredPosition = Vector2.Lerp(<anchorOut>5__9, <anchorIn>5__10, targetZoom);
				zoomCoroutine = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <AvatarZoomCoroutine>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public REPOAvatarPreview preview;

			private float <scrollDelta>5__1;

			private float <targetZoom>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <AvatarZoomCoroutine>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if ((Object)(object)preview != (Object)null && (Object)(object)preview.rigTransform != (Object)null)
				{
					<scrollDelta>5__1 = InputManager.instance.KeyPullAndPush();
					if (Mathf.Abs(<scrollDelta>5__1) > 0.001f)
					{
						<targetZoom>5__2 = Mathf.Clamp01(zoomLevel + Mathf.Sign(<scrollDelta>5__1));
						if (!Mathf.Approximately(<targetZoom>5__2, zoomLevel))
						{
							if (zoomCoroutine != null)
							{
								((MonoBehaviour)preview).StopCoroutine(zoomCoroutine);
								zoomCoroutine = null;
							}
							zoomCoroutine = ((MonoBehaviour)preview).StartCoroutine(AnimateZoom(preview, <targetZoom>5__2));
							zoomLevel = <targetZoom>5__2;
						}
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static Coroutine zoomCoroutine;

		internal static float zoomLevel;

		public static void HandleScrollZoom(REPOAvatarPreview preview)
		{
			if (!((Object)(object)preview == (Object)null) && !((Object)(object)preview.rigTransform == (Object)null) && zoomCoroutine == null)
			{
				((MonoBehaviour)preview).StartCoroutine(AvatarZoomCoroutine(preview));
			}
		}

		[IteratorStateMachine(typeof(<AvatarZoomCoroutine>d__3))]
		private static IEnumerator AvatarZoomCoroutine(REPOAvatarPreview preview)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AvatarZoomCoroutine>d__3(0)
			{
				preview = preview
			};
		}

		[IteratorStateMachine(typeof(<AnimateZoom>d__4))]
		private static IEnumerator AnimateZoom(REPOAvatarPreview preview, float targetZoom)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AnimateZoom>d__4(0)
			{
				preview = preview,
				targetZoom = targetZoom
			};
		}

		public static void SetTipTextStyling(REPOLabel label)
		{
			((TMP_Text)label.labelTMP).fontSize = 20f;
			((TMP_Text)label.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)2;
			((TMP_Text)label.labelTMP).alpha = 0.15f;
		}

		public static void SetTextStyling(List<REPOButton> buttons)
		{
			CollectionExtensions.Do<REPOButton>((IEnumerable<REPOButton>)buttons, (Action<REPOButton>)delegate(REPOButton t)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Expected O, but got Unknown
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: 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_00e9: 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)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				t.overrideButtonSize = new Vector2(75f, 20f);
				((TMP_Text)t.labelTMP).fontSize = 18f;
				GameObject val = new GameObject(((Object)t).name + " Mask Object");
				Image val2 = val.AddComponent<Image>();
				((Graphic)val2).color = new Color(0f, 0f, 0f, 0.05f);
				val.AddComponent<Mask>();
				val.transform.SetParent(((Component)t).transform);
				((Graphic)val2).rectTransform.anchoredPosition = new Vector2(0f, -2f);
				((Graphic)val2).rectTransform.sizeDelta = new Vector2(80f, 20f);
				((Component)t.labelTMP).gameObject.transform.SetParent(val.transform);
				t.menuButton.buttonTextSelectedOriginalPos = new Vector3(-42f, -18f, 0f);
				HorizontalTextScroller horizontalTextScroller = ((Component)t.labelTMP).gameObject.AddComponent<HorizontalTextScroller>();
				horizontalTextScroller.startPos = t.menuButton.buttonTextSelectedOriginalPos;
				horizontalTextScroller.SetButtonRef(t.menuButton);
			});
		}

		public static void SetHeaderTextStyling(List<REPOLabel> labels)
		{
			CollectionExtensions.Do<REPOLabel>((IEnumerable<REPOLabel>)labels, (Action<REPOLabel>)delegate(REPOLabel t)
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)t.labelTMP).fontStyle = (FontStyles)4;
				((TMP_Text)t.labelTMP).fontSize = 18f;
				((TMP_Text)t.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)2;
				((Graphic)t.labelTMP).color = Color.white;
			});
		}

		public static void SliderSetups(List<REPOSlider> root)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: 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_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			if (root == null)
			{
				return;
			}
			Material bodyMaterial = PlayerAvatar.instance.playerHealth.bodyMaterial;
			Color color = bodyMaterial.GetColor(Shader.PropertyToID("_AlbedoColor"));
			Color val = default(Color);
			((Color)(ref val))..ctor(1f - color.r, 1f - color.g, 1f - color.b, color.a);
			foreach (REPOSlider item in root)
			{
				Transform[] componentsInChildren = ((Component)item).GetComponentsInChildren<Transform>(true);
				foreach (Transform val2 in componentsInChildren)
				{
					switch (((Object)val2).name)
					{
					case "SliderBG":
					{
						RawImage[] componentsInChildren5 = ((Component)val2).GetComponentsInChildren<RawImage>(true);
						foreach (RawImage val6 in componentsInChildren5)
						{
							if ((Object)(object)val6 != (Object)null)
							{
								Color color2 = ((Graphic)val6).color;
								color2.a = 0f;
								((Graphic)val6).color = color2;
							}
						}
						break;
					}
					case "Bar":
					{
						RawImage[] componentsInChildren3 = ((Component)val2).GetComponentsInChildren<RawImage>(true);
						foreach (RawImage val4 in componentsInChildren3)
						{
							if ((Object)(object)val4 != (Object)null)
							{
								float num = 0.299f * val.r + 0.587f * val.g + 0.114f * val.b;
								float num2 = 0.5f;
								if (num < num2)
								{
									float num3 = Mathf.Clamp01((num2 - num) * 0.5f);
									val = Color.Lerp(val, Color.white, num3);
								}
								((Graphic)val4).color = val;
							}
						}
						break;
					}
					case "Bar Text":
					{
						TextMeshProUGUI[] componentsInChildren4 = ((Component)val2).GetComponentsInChildren<TextMeshProUGUI>(true);
						foreach (TextMeshProUGUI val5 in componentsInChildren4)
						{
							if ((Object)(object)val5 != (Object)null)
							{
								float num4 = 0.299f * val.r + 0.587f * val.g + 0.114f * val.b;
								float num5 = 0.5f;
								if (num4 < num5)
								{
									float num6 = Mathf.Clamp01((num5 - num4) * 0.5f);
									val = Color.Lerp(val, Color.white, num6);
								}
								((Graphic)val5).color = val;
							}
						}
						break;
					}
					case "Bar Text (1)":
					{
						TextMeshProUGUI[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<TextMeshProUGUI>(true);
						foreach (TextMeshProUGUI val3 in componentsInChildren2)
						{
							if ((Object)(object)val3 != (Object)null)
							{
								((Graphic)val3).color = Color.black;
							}
						}
						break;
					}
					}
				}
			}
		}

		public static string CleanName(string fileName)
		{
			string[] array = new string[7] { "pupil", "pupils", "iris", "irises", "left", "right", "both" };
			string text = fileName.Replace('_', ' ');
			string[] array2 = array;
			foreach (string oldValue in array2)
			{
				text = text.Replace(oldValue, "", StringComparison.OrdinalIgnoreCase);
			}
			return string.Join(' ', text.Split(' ', StringSplitOptions.RemoveEmptyEntries));
		}

		public static void OrderListBy(ref List<CustomPupilType> List, Enums.MenuOrderBy config)
		{
			switch (config)
			{
			case Enums.MenuOrderBy.NameOnly:
				List.OrderBy((CustomPupilType L) => L.Name);
				break;
			case Enums.MenuOrderBy.ModNameOnly:
				List.OrderBy((CustomPupilType L) => L.ModName);
				break;
			case Enums.MenuOrderBy.ModNameAndName:
				_ = from L in List
					orderby L.ModName, L.Name
					select L;
				break;
			}
		}

		public static void OrderListBy(ref List<CustomIrisType> List, Enums.MenuOrderBy config)
		{
			switch (config)
			{
			case Enums.MenuOrderBy.NameOnly:
				List.OrderBy((CustomIrisType L) => L.Name);
				break;
			case Enums.MenuOrderBy.ModNameOnly:
				List.OrderBy((CustomIrisType L) => L.ModName);
				break;
			case Enums.MenuOrderBy.ModNameAndName:
				_ = from L in List
					orderby L.ModName, L.Name
					select L;
				break;
			}
		}

		public static string ApplyGradient(string input, bool inverse = false, float minBrightness = 0.15f)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0080: 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_0082: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			Material bodyMaterial = PlayerAvatar.instance.playerHealth.bodyMaterial;
			Color color = bodyMaterial.GetColor(Shader.PropertyToID("_AlbedoColor"));
			Color val = color;
			float num = 0.299f * color.r + 0.587f * color.g + 0.114f * color.b;
			float num2 = 0.6f;
			Color val2 = ((num < 0.5f) ? Color.Lerp(color, Color.white, num2) : Color.Lerp(color, Color.black, num2));
			if (inverse)
			{
				Color val3 = val;
				val = val2;
				val2 = val3;
			}
			string text = "";
			int length = input.Length;
			for (int i = 0; i < length; i++)
			{
				float num3 = (float)i / (float)Mathf.Max(1, length - 1);
				Color val4 = Color.Lerp(val, val2, num3);
				float num4 = 0.299f * val4.r + 0.587f * val4.g + 0.114f * val4.b;
				if (num4 < minBrightness)
				{
					float num5 = Mathf.Clamp01((minBrightness - num4) * 0.5f);
					val4 = Color.Lerp(val4, Color.white, num5);
				}
				string arg = ColorUtility.ToHtmlStringRGB(val4);
				text += $"<color=#{arg}>{input[i]}</color>";
			}
			return text;
		}
	}
	internal static class ModCompats
	{
		internal const string MenuLib_PLUGIN_GUID = "nickklmao.menulib";

		internal const string SpawnManager_PLUGIN_GUID = "soundedsquash.spawnmanager";

		internal const string TwitchChatAPI_PLUGIN_GUID = "TwitchChatAPI.REPO";

		internal const string TwitchTrolling_PLUGIN_GUID = "com.github.zehsteam.TwitchTrolling";

		internal static bool IsSpawnManagerPresent => Chainloader.PluginInfos.ContainsKey("soundedsquash.spawnmanager");

		internal static bool IsTwitchChatAPIPresent => Chainloader.PluginInfos.ContainsKey("TwitchChatAPI.REPO");

		internal static bool IsTwitchTrollingPresent => Chainloader.PluginInfos.ContainsKey("com.github.zehsteam.TwitchTrolling");
	}
	internal class ModConfig
	{
		internal static ConfigEntry<Enums.ModLogLevel> ClientLogLevel { get; private set; }

		internal static ConfigEntry<Enums.ModInMenuDisplay> ModNamesInMenu { get; private set; }

		internal static ConfigEntry<Enums.MenuOrderBy> MenuListOrder { get; private set; }

		internal static ConfigEntry<float> MenuItemScrollSpeed { get; private set; }

		internal static ConfigFile ConfigFile { get; private set; }

		internal static void BindConfigItems(ConfigFile config)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			ConfigFile = config;
			ClientLogLevel = config.Bind<Enums.ModLogLevel>("General", "ClientLogLevel", Enums.ModLogLevel.Standard, "Set MoreEyes logging level");
			ModNamesInMenu = config.Bind<Enums.ModInMenuDisplay>("Menus", "Display Mod Names", Enums.ModInMenuDisplay.Duplicates, "Set when should mod names be displayed in the MoreEyes Menu");
			MenuListOrder = config.Bind<Enums.MenuOrderBy>("Menus", "Order By", Enums.MenuOrderBy.NameOnly, "Set pupil/iris ordering mode");
			MenuItemScrollSpeed = config.Bind<float>("Menus", "Auto-scroll Speed", 14f, new ConfigDescription("Set how fast the name of a pupil or iris will scroll when the name doesn't fit the text box.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(8f, 90f), Array.Empty<object>()));
		}

		internal static void GenerateConfigItems()
		{
			if (ConfigFile == null)
			{
				return;
			}
			foreach (IGrouping<string, CustomPupilType> item in from p in CustomEyeManager.AllPupilTypes
				where !p.isVanilla
				group p by p.PairName)
			{
				ConfigEntry<bool> configToggle = ConfigFile.Bind<bool>(item.First().ModName + " Pupils", item.Key, true, "Enable/Disable pupil" + ((item.Count() > 1) ? " pair" : "") + " - " + item.Key);
				foreach (CustomPupilType item2 in item)
				{
					item2.ConfigToggle = configToggle;
				}
			}
			foreach (IGrouping<string, CustomIrisType> item3 in from i in CustomEyeManager.AllIrisTypes
				where !i.isVanilla
				group i by i.PairName)
			{
				ConfigEntry<bool> configToggle2 = ConfigFile.Bind<bool>(item3.First().ModName + " Irises", item3.Key, true, "Enable/Disable iris" + ((item3.Count() > 1) ? " pair" : "") + " - " + item3.Key);
				foreach (CustomIrisType item4 in item3)
				{
					item4.ConfigToggle = configToggle2;
				}
			}
		}
	}
}
namespace MoreEyes.SDK
{
	[CreateAssetMenu(menuName = "MoreEyes/Mod", order = 0, fileName = "New MoreEyes Mod")]
	public class MoreEyesMod : ScriptableObject
	{
		[SerializeField]
		private string _name = null;

		[SerializeField]
		private string _author = null;

		[SerializeField]
		private string _version = "1.0.0";

		[SerializeField]
		private List<GameObject> _prefabs = new List<GameObject>();

		public string Name => _name;

		public string Author => _author;

		public string Version => _version;

		public string Identifier => Author + "-" + Name + "-" + Version;

		public List<GameObject> Prefabs => _prefabs;

		public void SetName(string value)
		{
			_name = value;
		}

		public void SetAuthor(string value)
		{
			_author = value;
		}

		public void SetVersion(string value)
		{
			_version = value;
		}

		public void SetPrefabs(List<GameObject> value)
		{
			_prefabs = value;
		}
	}
}
namespace MoreEyes.Managers
{
	internal class CustomEyeManager
	{
		internal static List<PlayerEyeSelection> AllPlayerSelections = new List<PlayerEyeSelection>();

		public static List<CustomPupilType> PupilsInUse = new List<CustomPupilType>();

		public static List<CustomIrisType> IrisInUse = new List<CustomIrisType>();

		public static bool isInitialized = false;

		public static CustomIrisType VanillaIris;

		public static List<CustomPupilType> AllPupilTypes { get; internal set; } = new List<CustomPupilType>();


		public static List<CustomIrisType> AllIrisTypes { get; internal set; } = new List<CustomIrisType>();


		public static List<PatchedEyes> AllPatchedEyes { get; internal set; } = new List<PatchedEyes>();


		public static CustomPupilType VanillaPupilRight { get; internal set; } = new CustomPupilType("Standard Right");


		public static CustomPupilType VanillaPupilLeft { get; internal set; } = new CustomPupilType("Standard Left");


		public static bool VanillaPupilsExist => (Object)(object)VanillaPupilLeft?.Prefab != (Object)null && (Object)(object)VanillaPupilRight?.Prefab != (Object)null;

		internal static void ClearLists()
		{
			AllPupilTypes.Clear();
			AllIrisTypes.Clear();
		}

		internal static void Init()
		{
			AllIrisTypes = new List<CustomIrisType>();
			VanillaPupilLeft.isVanilla = true;
			VanillaPupilRight.isVanilla = true;
			AllPupilTypes = new List<CustomPupilType>(2) { VanillaPupilLeft, VanillaPupilRight };
			if (!isInitialized)
			{
				VanillaIris = new CustomIrisType();
				VanillaIris.VanillaSetup();
				CollectionExtensions.Do<LoadedAsset>((IEnumerable<LoadedAsset>)EyesAssetManager.LoadedAssets, (Action<LoadedAsset>)delegate(LoadedAsset asset)
				{
					GetAllTypes(asset);
				});
				ModConfig.GenerateConfigItems();
				FileManager.ReadTextFile();
			}
		}

		internal static void GetAllTypes(LoadedAsset loadedAsset)
		{
			if ((Object)(object)loadedAsset.Bundle == (Object)null)
			{
				Loggers.Warning("Unable to get all types from loadedAsset, bundle is not loaded");
				return;
			}
			ScriptableObject[] source = loadedAsset.Bundle.LoadAllAssets<ScriptableObject>();
			ScriptableObject val = ((IEnumerable<ScriptableObject>)source).FirstOrDefault((Func<ScriptableObject, bool>)((ScriptableObject p) => p is MoreEyesMod));
			if ((Object)(object)val == (Object)null)
			{
				Loggers.Error("Mod info is null for " + ((Object)loadedAsset.Bundle).name + "!");
				return;
			}
			loadedAsset.ModInfo = val as MoreEyesMod;
			List<GameObject> prefabsLoaded = new List<GameObject>();
			List<string> list = loadedAsset.Bundle.GetAllAssetNames().ToList();
			List<string> list2 = list.FindAll((string n) => n.Contains("_iris_"));
			List<string> list3 = list.FindAll((string n) => n.Contains("_pupil_"));
			list2.RemoveAll((string i) => Utility.IsNullOrWhiteSpace(i));
			list3.RemoveAll((string p) => Utility.IsNullOrWhiteSpace(p));
			CollectionExtensions.Do<string>((IEnumerable<string>)list3, (Action<string>)delegate(string n)
			{
				CustomPupilType customPupilType = new CustomPupilType(loadedAsset, n, loadedAsset.ModInfo);
				prefabsLoaded.Add(customPupilType.Prefab);
			});
			CollectionExtensions.Do<string>((IEnumerable<string>)list2, (Action<string>)delegate(string n)
			{
				CustomIrisType customIrisType = new CustomIrisType();
				customIrisType.IrisSetup(loadedAsset, n, loadedAsset.ModInfo);
				prefabsLoaded.Add(customIrisType.Prefab);
			});
			loadedAsset.ModInfo.SetPrefabs(prefabsLoaded);
		}
	}
	internal class EyesAssetManager
	{
		internal static List<LoadedAsset> LoadedAssets = new List<LoadedAsset>();

		public static void InitBundles()
		{
			List<string> list = Directory.GetFiles(Path.Combine(Paths.BepInExRootPath, "plugins"), "*.eyes", SearchOption.AllDirectories).ToList();
			foreach (string path in list)
			{
				LoadedAsset loadedAsset = LoadedAssets.FirstOrDefault((LoadedAsset a) => a.isLoaded && a.FilePath == path);
				if (loadedAsset == null)
				{
					loadedAsset = new LoadedAsset(path);
				}
				else
				{
					Loggers.Warning("The asset at path " + path + " has already been loaded!");
				}
			}
		}

		internal static void UnloadBundle(string bundlePath)
		{
			LoadedAsset loadedAsset = LoadedAssets.FirstOrDefault((LoadedAsset a) => a.isLoaded && a.FilePath == bundlePath);
			if (loadedAsset == null)
			{
				Loggers.Warning("There is no bundles that are currently loaded at that path!");
			}
			else
			{
				loadedAsset.UnloadBundle();
			}
		}

		internal static void UnloadBundle(AssetBundle bundleRef)
		{
			if ((Object)(object)bundleRef == (Object)null)
			{
				Loggers.Warning("Cannot unload a null bundleRef!");
				return;
			}
			LoadedAsset loadedAsset = LoadedAssets.FirstOrDefault((LoadedAsset a) => a.isLoaded && (Object)(object)a.Bundle == (Object)(object)bundleRef);
			if (loadedAsset == null)
			{
				Loggers.Warning("The provided bundleRef is not being detected as loaded.");
			}
			else
			{
				loadedAsset.UnloadBundle();
			}
		}
	}
	internal class FileManager
	{
		internal static Dictionary<string, string> PlayerSelections { get; private set; } = new Dictionary<string, string>();


		internal static bool UpdateWrite { get; set; } = false;


		internal static void ReadTextFile()
		{
			string name = Path.Combine("%userprofile%\\appdata\\locallow\\semiwork\\Repo", "moreEyes");
			name = Environment.ExpandEnvironmentVariables(name);
			if (!Directory.Exists(name))
			{
				Directory.CreateDirectory(name);
			}
			if (!File.Exists(name + "\\selections.txt"))
			{
				Loggers.Message("No saved player selections exist!");
				return;
			}
			string text = File.ReadAllText(name + "\\selections.txt");
			Loggers.Message("Assigning saved player selections!");
			if (text.Length != 0)
			{
				PlayerSelections = new Dictionary<string, string>();
				if (text.EndsWith(';'))
				{
					text = text.TrimEnd(';');
				}
				PlayerSelections = (from item in text.Split(';')
					select item.Trim() into item
					select item.Split(':')).ToDictionary((string[] pair) => pair[0].Trim(), (string[] pair) => pair[1].Trim());
			}
		}

		private static void UpdatePlayerSelections()
		{
			CollectionExtensions.Do<PlayerEyeSelection>((IEnumerable<PlayerEyeSelection>)CustomEyeManager.AllPlayerSelections, (Action<PlayerEyeSelection>)delegate(PlayerEyeSelection a)
			{
				//IL_0029: 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_0084: 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)
				string value = "pupilLeft=" + a.pupilLeft.UID + ",pupilLeftColor=" + ColorUtility.ToHtmlStringRGB(a.PupilLeftColor) + ",pupilRight=" + a.pupilRight.UID + ",pupilRightColor=" + ColorUtility.ToHtmlStringRGB(a.PupilRightColor) + ",irisLeft=" + a.irisLeft.UID + ",irisLeftColor=" + ColorUtility.ToHtmlStringRGB(a.IrisLeftColor) + ",irisRight=" + a.irisRight.UID + ",irisRightColor=" + ColorUtility.ToHtmlStringRGB(a.IrisRightColor);
				if (PlayerSelections.ContainsKey(a.playerID))
				{
					PlayerSelections[a.playerID] = value;
				}
				else
				{
					PlayerSelections.Add(a.playerID, value);
				}
			});
		}

		internal static Dictionary<string, string> GetPairsFromString(string selections)
		{
			return (from item in selections.Split(',')
				select item.Trim() into item
				select item.Split('=')).ToDictionary((string[] pair) => pair[0].Trim(), (string[] pair) => pair[1].Trim());
		}

		internal static Dictionary<string, string> GetSelectionPairsFromFile(string playerID)
		{
			Dictionary<string, string> result = new Dictionary<string, string>();
			if (!CustomEyeManager.VanillaPupilsExist)
			{
				return result;
			}
			string playerSelections = GetPlayerSelections(playerID);
			if (string.IsNullOrEmpty(playerSelections))
			{
				Loggers.Info("Unable to get saved selection for [ " + playerID + " ]");
				return result;
			}
			return GetPairsFromString(playerSelections);
		}

		private static string GetPlayerSelections(string steamID)
		{
			if (PlayerSelections.ContainsKey(steamID))
			{
				return PlayerSelections[steamID];
			}
			return "";
		}

		internal static void WriteTextFile()
		{
			Loggers.Message("Updating saved selections!");
			UpdateWrite = false;
			UpdatePlayerSelections();
			string text = Path.Combine("%userprofile%\\appdata\\locallow\\semiwork\\Repo", "moreEyes");
			Loggers.Debug("Location: " + text);
			text = Environment.ExpandEnvironmentVariables(text);
			string fileContents = string.Empty;
			CollectionExtensions.Do<KeyValuePair<string, string>>((IEnumerable<KeyValuePair<string, string>>)PlayerSelections, (Action<KeyValuePair<string, string>>)delegate(KeyValuePair<string, string> p)
			{
				fileContents = fileContents + p.Key + ":";
				fileContents = fileContents + p.Value + ";";
			});
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			File.WriteAllText(text + "\\selections.txt", fileContents);
		}
	}
}
namespace MoreEyes.Core
{
	[HarmonyPatch(typeof(RunManagerPUN), "Start")]
	internal class NetworkComponentPatch
	{
		public static void Postfix(RunManagerPUN __instance)
		{
			if ((Object)(object)MoreEyesNetwork.instance == (Object)null)
			{
				ComponentHolderProtocol.AddComponent<MoreEyesNetwork>((Object)(object)__instance);
			}
			if (PlayerEyeSelection.LocalCache == null)
			{
				new PlayerEyeSelection(isCache: true);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatarVisuals), "Start")]
	internal class LocalPlayerMenuPatch
	{
		public static void Postfix(PlayerAvatarVisuals __instance)
		{
			if (!((Object)(object)PlayerAvatar.instance == (Object)null) && !SemiFunc.SplashScreenLevel() && __instance.isMenuAvatar)
			{
				PatchedEyes.Local.SetMenuEyes(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "SpawnRPC")]
	internal class PlayerSpawnPatch
	{
		public static void Postfix(PlayerAvatar __instance)
		{
			PatchedEyes.GetPatchedEyes(__instance);
		}
	}
	[HarmonyPatch(typeof(MenuPageEsc), "Update")]
	internal class MenuEscPatch
	{
		private static GameObject playerTarget;

		private static Transform playerAvatar;

		public static void Postfix(MenuPageEsc __instance)
		{
			if ((Object)(object)Menu.MoreEyesMenu.menuPage != (Object)null)
			{
				if ((Object)(object)playerTarget == (Object)null)
				{
					playerAvatar = ((Component)__instance).transform.Find("Menu Element Player Avatar");
					if ((Object)(object)playerAvatar != (Object)null)
					{
						playerTarget = ((Component)playerAvatar).gameObject;
					}
				}
				if ((Object)(object)playerTarget != (Object)null && playerTarget.activeSelf)
				{
					playerTarget.SetActive(false);
				}
			}
			else if ((Object)(object)playerTarget != (Object)null && !playerTarget.activeSelf)
			{
				playerTarget.SetActive(true);
			}
		}
	}
	internal class Loggers
	{
		private static bool ShouldLog(LogLevel level)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			Enums.ModLogLevel value = ModConfig.ClientLogLevel.Value;
			if ((int)level > 4 && value == Enums.ModLogLevel.WarningsOnly)
			{
				return false;
			}
			if (((int)level == 32 || (int)level == 16) && value != Enums.ModLogLevel.Debug)
			{
				return false;
			}
			return true;
		}

		private static void Log(LogLevel logLevel, object data)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (ShouldLog(logLevel))
			{
				ManualLogSource logger = Plugin.Logger;
				if (logger != null)
				{
					logger.Log(logLevel, data);
				}
			}
		}

		internal static void Info(object data)
		{
			Log((LogLevel)16, data);
		}

		internal static void Debug(object data)
		{
			Log((LogLevel)32, data);
		}

		internal static void Message(object data)
		{
			Log((LogLevel)8, data);
		}

		internal static void Warning(object data)
		{
			Log((LogLevel)4, data);
		}

		internal static void Error(object data)
		{
			Log((LogLevel)32, data);
		}

		internal static void Fatal(object data)
		{
			Log((LogLevel)32, data);
		}
	}
	[BepInPlugin("com.github.s1ckboii.MoreEyes", "MoreEyes", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		internal static Random Rand = new Random();

		internal const string moreEyesAscii = "\r\n _   .-')                _  .-')     ('-.           ('-.                 ('-.    .-')    \r\n( '.( OO )_             ( \\( -O )  _(  OO)        _(  OO)              _(  OO)  ( OO ).  \r\n ,--.   ,--.).-'),-----. ,------. (,------.      (,------. ,--.   ,--.(,------.(_)---\\_) \r\n |   `.'   |( OO'  .-.  '|   /`. ' |  .---'       |  .---'  \\  `.'  /  |  .---'/    _ |  \r\n |         |/   |  | |  ||  /  | | |  |           |  |    .-')     /   |  |    \\  :` `.  \r\n |  |'.'|  |\\_) |  |\\|  ||  |_.' |(|  '--.       (|  '--.(OO  \\   /   (|  '--.  '..`''.) \r\n |  |   |  |  \\ |  | |  ||  .  '.' |  .--'        |  .--' |   /  /\\_   |  .--' .-._)   \\ \r\n |  |   |  |   `'  '-'  '|  |\\  \\  |  `---.       |  `---.`-./  /.__)  |  `---.\\       / \r\n `--'   `--'     `-----' `--' '--' `------'       `------'  `--'       `------' `-----'  \r\n";

		internal static ManualLogSource Logger { get; private set; }

		public void Awake()
		{
			Logger = Logger.CreateLogSource("com.github.s1ckboii.MoreEyes");
			ModConfig.BindConfigItems(((BaseUnityPlugin)this).Config);
			EyesAssetManager.InitBundles();
			Menu.Initialize();
			CustomEyeManager.Init();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			Loggers.Message("MoreEyes has been loaded with version - 1.0.0");
			Loggers.Message("\r\n _   .-')                _  .-')     ('-.           ('-.                 ('-.    .-')    \r\n( '.( OO )_             ( \\( -O )  _(  OO)        _(  OO)              _(  OO)  ( OO ).  \r\n ,--.   ,--.).-'),-----. ,------. (,------.      (,------. ,--.   ,--.(,------.(_)---\\_) \r\n |   `.'   |( OO'  .-.  '|   /`. ' |  .---'       |  .---'  \\  `.'  /  |  .---'/    _ |  \r\n |         |/   |  | |  ||  /  | | |  |           |  |    .-')     /   |  |    \\  :` `.  \r\n |  |'.'|  |\\_) |  |\\|  ||  |_.' |(|  '--.       (|  '--.(OO  \\   /   (|  '--.  '..`''.) \r\n |  |   |  |  \\ |  | |  ||  .  '.' |  .--'        |  .--' |   /  /\\_   |  .--' .-._)   \\ \r\n |  |   |  |   `'  '-'  '|  |\\  \\  |  `---.       |  `---.`-./  /.__)  |  `---.\\       / \r\n `--'   `--'     `-----' `--' '--' `------'       `------'  `--'       `------' `-----'  \r\n");
		}
	}
}
namespace MoreEyes.Components
{
	internal class EyeRef : MonoBehaviour
	{
		internal Transform EyePlayerPos { get; set; }

		internal List<Transform> EyeMenuPos { get; set; } = new List<Transform>();


		internal List<GameObject> PupilMenu { get; private set; } = new List<GameObject>();


		internal GameObject PupilActual { get; private set; } = null;


		internal List<GameObject> IrisMenu { get; private set; } = new List<GameObject>();


		internal GameObject IrisActual { get; private set; } = null;


		internal void PlayerSetup(GameObject pupil)
		{
			if ((Object)(object)pupil == (Object)null)
			{
				Loggers.Error("Null pupil at PlayerSetup!!!");
			}
			SetFirstPupilActual(pupil);
		}

		internal void SetFirstPupilActual(GameObject pupil)
		{
			PupilActual = pupil;
		}

		internal void SetFirstPupilMenu(GameObject pupil)
		{
			PupilMenu.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
			PupilMenu.Add(pupil);
		}

		internal void SetColorPupil(Color color)
		{
			//IL_00c8: 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)
			PupilMenu.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
			if (PupilMenu.Count > 0)
			{
				foreach (GameObject item in PupilMenu)
				{
					if ((Object)(object)item != (Object)null)
					{
						MeshRenderer componentInChildren = item.GetComponentInChildren<MeshRenderer>();
						if (componentInChildren != null)
						{
							((Renderer)componentInChildren).material.SetColor("_EmissionColor", color);
						}
					}
				}
			}
			if ((Object)(object)PupilActual != (Object)null)
			{
				MeshRenderer componentInChildren2 = PupilActual.GetComponentInChildren<MeshRenderer>();
				if (componentInChildren2 != null)
				{
					((Renderer)componentInChildren2).material.SetColor("_EmissionColor", color);
				}
			}
			FileManager.UpdateWrite = true;
		}

		internal void SetColorIris(Color color)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			IrisMenu.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
			if (IrisMenu.Count > 0)
			{
				foreach (GameObject item in IrisMenu)
				{
					MeshRenderer componentInChildren = item.GetComponentInChildren<MeshRenderer>();
					if (componentInChildren != null)
					{
						((Renderer)componentInChildren).material.SetColor("_EmissionColor", color);
					}
				}
			}
			if ((Object)(object)IrisActual != (Object)null)
			{
				MeshRenderer componentInChildren2 = IrisActual.GetComponentInChildren<MeshRenderer>();
				if (componentInChildren2 != null)
				{
					((Renderer)componentInChildren2).material.SetColor("_EmissionColor", color);
				}
			}
			FileManager.UpdateWrite = true;
		}

		internal void RemovePupil()
		{
			for (int num = PupilMenu.Count - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)PupilMenu[num]);
			}
			PupilMenu.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
			if ((Object)(object)PupilActual != (Object)null)
			{
				Object.Destroy((Object)(object)PupilActual);
			}
		}

		internal void CreatePupil(CustomPupilType selection)
		{
			if ((Object)(object)selection.Prefab == (Object)null)
			{
				Loggers.Warning("Cannot create NULL Pupil!!!");
				return;
			}
			foreach (Transform eyeMenuPo in EyeMenuPos)
			{
				if (!((Object)(object)eyeMenuPo == (Object)null))
				{
					GameObject val = Object.Instantiate<GameObject>(selection.Prefab, eyeMenuPo);
					PupilMenu.Add(val);
					SetTransformAndActive(val, selection.isVanilla);
				}
			}
			EyeMenuPos.RemoveAll((Transform x) => (Object)(object)x == (Object)null);
			if ((Object)(object)EyePlayerPos != (Object)null)
			{
				PupilActual = Object.Instantiate<GameObject>(selection.Prefab, EyePlayerPos);
			}
			SetTransformAndActive(PupilActual, selection.isVanilla);
		}

		private void SetTransformAndActive(GameObject gameObject, bool isVanilla)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)gameObject == (Object)null))
			{
				Vector3 localPosition = default(Vector3);
				((Vector3)(ref localPosition))..ctor(0f, 0f, -0.1067f);
				gameObject.SetActive(true);
				if (!isVanilla)
				{
					gameObject.transform.localPosition = localPosition;
				}
			}
		}

		internal void RemoveIris()
		{
			for (int num = IrisMenu.Count - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)IrisMenu[num]);
			}
			IrisMenu.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
			if ((Object)(object)IrisActual != (Object)null)
			{
				Object.Destroy((Object)(object)IrisActual);
			}
		}

		internal void CreateIris(CustomIrisType selection)
		{
			if (selection.isVanilla)
			{
				return;
			}
			if ((Object)(object)selection.Prefab == (Object)null)
			{
				Loggers.Warning("Cannot create NULL Iris!!!");
				return;
			}
			EyeMenuPos.RemoveAll((Transform x) => (Object)(object)x == (Object)null);
			foreach (Transform eyeMenuPo in EyeMenuPos)
			{
				GameObject val = Object.Instantiate<GameObject>(selection.Prefab, eyeMenuPo);
				IrisMenu.Add(val);
				SetTransformAndActive(val, selection.isVanilla);
			}
			if ((Object)(object)EyePlayerPos != (Object)null)
			{
				IrisActual = Object.Instantiate<GameObject>(selection.Prefab, EyePlayerPos);
			}
			SetTransformAndActive(IrisActual, selection.isVanilla);
		}
	}
	internal class HorizontalTextScroller : MonoBehaviour
	{
		internal float widthOfText = 180f;

		internal TextMeshProUGUI textMesh;

		private RectTransform textRect;

		private float scrollPos = 0f;

		private float xOffset = 0f;

		internal Vector3 startPos = Vector3.zero;

		private bool ready = false;

		private bool shouldScroll = false;

		private MenuButton _button = null;

		private void Awake()
		{
			textMesh = ((Component)this).GetComponent<TextMeshProUGUI>();
			textRect = ((Component)this).GetComponent<RectTransform>();
		}

		private void Start()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			xOffset = ((Transform)textRect).localPosition.x * -1f;
			scrollPos = ((Transform)textRect).localPosition.x - xOffset;
			ready = true;
		}

		private void LateUpdate()
		{
			//IL_00e4: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)textMesh == (Object)null) && ready)
			{
				shouldScroll = ((TMP_Text)textMesh).preferredWidth > 85f;
				if (shouldScroll && (Object)(object)_button != (Object)null)
				{
					shouldScroll = _button.hovering;
				}
				if (!shouldScroll)
				{
					((Transform)textRect).localPosition = startPos;
					scrollPos = ((Transform)textRect).localPosition.x - xOffset;
					((TMP_Text)textMesh).horizontalAlignment = (HorizontalAlignmentOptions)2;
				}
				else
				{
					((Transform)textRect).localPosition = new Vector3(scrollPos % WidthMultiplier() + xOffset, startPos.y, startPos.z);
					scrollPos -= ModConfig.MenuItemScrollSpeed.Value * Time.deltaTime;
				}
			}
		}

		private float WidthMultiplier()
		{
			return ((TMP_Text)textMesh).preferredWidth * 1.5f;
		}

		internal void SetButtonRef(MenuButton button)
		{
			_button = button;
		}
	}
	internal class MoreEyesNetwork : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayedColorRPC>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string playerID;

			public bool isLeft;

			public bool isPupil;

			public Color color;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayedColorRPC>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					instance.photonView.RPC("SetSingleColorSelection", (RpcTarget)4, new object[4]
					{
						playerID,
						isLeft,
						isPupil,
						ColorToVector(color)
					});
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static MoreEyesNetwork instance;

		internal PhotonView photonView = null;

		private void Awake()
		{
			instance = this;
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		private void Start()
		{
			if (PhotonNetwork.MasterClient != null)
			{
				Loggers.Debug("MoreEyesNetwork Start: Sending other clients my selections");
				PlayerEyeSelection currentSelections = PatchedEyes.Local.CurrentSelections;
				instance.photonView.RPC("SetSelectionsByText", (RpcTarget)4, new object[2]
				{
					currentSelections.playerID,
					currentSelections.GetSelectionsString()
				});
			}
		}

		internal static void SyncMoreEyesChanges()
		{
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: 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_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: 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_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			PlayerEyeSelection localCache = PlayerEyeSelection.LocalCache;
			PlayerEyeSelection local;
			bool prefabChanged;
			if (PhotonNetwork.MasterClient != null && localCache != null)
			{
				Loggers.Debug("SyncMoreEyesChanges: Sending other clients my changes (if any)");
				local = PatchedEyes.Local.CurrentSelections;
				prefabChanged = false;
				if (localCache.pupilLeft != local.pupilLeft)
				{
					instance.photonView.RPC("SetSingleSelection", (RpcTarget)4, new object[4]
					{
						local.playerID,
						true,
						true,
						local.pupilLeft.UID
					});
					prefabChanged = true;
				}
				if (localCache.pupilRight != local.pupilRight)
				{
					instance.photonView.RPC("SetSingleSelection", (RpcTarget)4, new object[4]
					{
						local.playerID,
						false,
						true,
						local.pupilRight.UID
					});
					prefabChanged = true;
				}
				if (localCache.irisLeft != local.irisLeft)
				{
					instance.photonView.RPC("SetSingleSelection", (RpcTarget)4, new object[4]
					{
						local.playerID,
						true,
						false,
						local.irisLeft.UID
					});
					prefabChanged = true;
				}
				if (localCache.irisRight != local.irisRight)
				{
					instance.photonView.RPC("SetSingleSelection", (RpcTarget)4, new object[4]
					{
						local.playerID,
						false,
						false,
						local.irisRight.UID
					});
					prefabChanged = true;
				}
				if (localCache.PupilLeftColor != local.PupilLeftColor)
				{
					SendColorInformation(isLeft: true, isPupil: true, local.PupilLeftColor);
				}
				if (localCache.PupilRightColor != local.PupilRightColor)
				{
					SendColorInformation(isLeft: false, isPupil: true, local.PupilRightColor);
				}
				if (localCache.IrisLeftColor != local.IrisLeftColor)
				{
					SendColorInformation(isLeft: true, isPupil: false, local.IrisLeftColor);
				}
				if (localCache.IrisRightColor != local.IrisRightColor)
				{
					SendColorInformation(isLeft: false, isPupil: false, local.IrisRightColor);
				}
			}
			void SendColorInformation(bool isLeft, bool isPupil, Color color)
			{
				//IL_0063: 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_001d: Unknown result type (might be due to invalid IL or missing references)
				if (prefabChanged)
				{
					((MonoBehaviour)instance).StartCoroutine(DelayedColorRPC(local.playerID, isLeft, isPupil, color));
				}
				else
				{
					instance.photonView.RPC("SetSingleColorSelection", (RpcTarget)4, new object[4]
					{
						local.playerID,
						isLeft,
						isPupil,
						ColorToVector(color)
					});
				}
			}
		}

		[IteratorStateMachine(typeof(<DelayedColorRPC>d__5))]
		private static IEnumerator DelayedColorRPC(string playerID, bool isLeft, bool isPupil, Color color)
		{
			//IL_001c: 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)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayedColorRPC>d__5(0)
			{
				playerID = playerID,
				isLeft = isLeft,
				isPupil = isPupil,
				color = color
			};
		}

		private static Vector3 ColorToVector(Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(color.r, color.g, color.b);
		}

		[PunRPC]
		internal void SetSingleSelection(string playerID, bool isLeft, bool isPupil, string uniqueID)
		{
			if (!PlayerEyeSelection.TryGetSelections(playerID, out var playerSelections))
			{
				return;
			}
			Loggers.Debug($"--- [SetSingleSelection RPC]\n{playerID}:L-{isLeft}:P-{isPupil}:UID-{uniqueID}");
			if (isPupil)
			{
				CustomPupilType customPupilType = CustomEyeManager.AllPupilTypes.FirstOrDefault((CustomPupilType x) => x.UID == uniqueID);
				if (customPupilType == null)
				{
					Loggers.Warning("Unable to sync pupil with Unique ID: " + uniqueID + "\nPlease verify all clients have the same MoreEyes mods (and the same versions!)");
				}
				playerSelections.patchedEyes.SelectPupil(customPupilType, isLeft);
			}
			else
			{
				CustomIrisType customIrisType = CustomEyeManager.AllIrisTypes.FirstOrDefault((CustomIrisType x) => x.UID == uniqueID);
				if (customIrisType == null)
				{
					Loggers.Warning("Unable to sync iris with Unique ID: " + uniqueID + "\nPlease verify all clients have the same MoreEyes mods (and the same versions!)");
				}
				playerSelections.patchedEyes.SelectIris(customIrisType, isLeft);
			}
			playerSelections.ForceColors();
			FileManager.UpdateWrite = true;
		}

		[PunRPC]
		internal void SetSingleColorSelection(string playerID, bool isLeft, bool isPupil, Vector3 colorVector)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerEyeSelection.TryGetSelections(playerID, out var playerSelections))
			{
				return;
			}
			Color val = default(Color);
			((Color)(ref val))..ctor(colorVector.x, colorVector.y, colorVector.z);
			Loggers.Debug($"--- [SetSingleColorSelection RPC]\n{playerID}:L-{isLeft}:P-{isPupil}:C-{val}");
			if (isPupil)
			{
				if (isLeft)
				{
					playerSelections.patchedEyes.LeftEye.SetColorPupil(val);
				}
				else
				{
					playerSelections.patchedEyes.RightEye.SetColorPupil(val);
				}
			}
			else if (isLeft)
			{
				playerSelections.patchedEyes.LeftEye.SetColorIris(val);
			}
			else
			{
				playerSelections.patchedEyes.RightEye.SetColorIris(val);
			}
			FileManager.UpdateWrite = true;
		}

		[PunRPC]
		private void SetSelectionsByText(string playerID, string selectionsValue)
		{
			PlayerEyeSelection playerEyeSelection = PlayerEyeSelection.GetPlayerEyeSelection(playerID);
			if (playerEyeSelection != null)
			{
				playerEyeSelection.SetSelectionsFromPairs(FileManager.GetPairsFromString(selectionsValue));
				playerEyeSelection.PlayerEyesSpawn();
				FileManager.WriteTextFile();
			}
		}
	}
	internal class PatchedEyes : MonoBehaviour
	{
		internal string playerID = "";

		internal PlayerAvatar Player { get; private set; } = null;


		internal static PatchedEyes Local
		{
			get
			{
				if ((Object)(object)PlayerAvatar.instance == (Object)null)
				{
					Loggers.Error("Unable to return PatchedEyes Local, PlayerAvatar instance is null!");
					return null;
				}
				PatchedEyes component = ((Component)PlayerAvatar.instance).GetComponent<PatchedEyes>();
				if ((Object)(object)component == (Object)null)
				{
					return ComponentHolderProtocol.AddComponent<PatchedEyes>((Object)(object)PlayerAvatar.instance);
				}
				return component;
			}
		}

		internal EyeRef LeftEye { get; set; }

		internal EyeRef RightEye { get; set; }

		internal PlayerEyeSelection CurrentSelections
		{
			get
			{
				if (PlayerEyeSelection.TryGetSelections(playerID, out var playerSelections))
				{
					return playerSelections;
				}
				Loggers.Error("TRYING TO GET NULL PLAYEREYESELECTIONS!! [" + playerID + "]");
				return null;
			}
		}

		internal static PatchedEyes GetPatchedEyes(PlayerAvatar player)
		{
			if ((Object)(object)((Component)player).GetComponent<PatchedEyes>() == (Object)null)
			{
				return ComponentHolderProtocol.AddComponent<PatchedEyes>((Object)(object)player);
			}
			return ((Component)player).GetComponent<PatchedEyes>();
		}

		private void Awake()
		{
			CustomEyeManager.AllPatchedEyes.RemoveAll((PatchedEyes p) => (Object)(object)p == (Object)null);
			Player = ((Component)this).GetComponent<PlayerAvatar>();
			playerID = Player.steamID;
			if (!PlayerEyeSelection.TryGetSelections(Player.steamID, out var playerSelections))
			{
				playerSelections = new PlayerEyeSelection(Player.steamID);
			}
			playerSelections.patchedEyes = this;
			SetPlayerSavedSelection(Player);
			CustomEyeManager.AllPatchedEyes.Add(this);
		}

		private void Start()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)Player.playerAvatarVisuals.playerEyes.pupilLeft.GetChild(0).GetChild(0)).gameObject;
			GameObject gameObject2 = ((Component)Player.playerAvatarVisuals.playerEyes.pupilRight.GetChild(0).GetChild(0)).gameObject;
			GameObject val = new GameObject("MoreEyes-LEFT");
			val.transform.SetParent(Player.playerAvatarVisuals.playerEyes.pupilLeft.GetChild(0));
			val.transform.localPosition = Vector3.zero;
			GameObject val2 = new GameObject("MoreEyes-RIGHT");
			val2.transform.SetParent(Player.playerAvatarVisuals.playerEyes.pupilRight.GetChild(0));
			val2.transform.localPosition = Vector3.zero;
			LeftEye = val.AddComponent<EyeRef>();
			RightEye = val2.AddComponent<EyeRef>();
			LeftEye.EyePlayerPos = val.transform;
			RightEye.EyePlayerPos = val2.transform;
			LeftEye.SetFirstPupilActual(gameObject);
			RightEye.SetFirstPupilActual(gameObject2);
			if (!CustomEyeManager.VanillaPupilsExist)
			{
				CustomEyeManager.VanillaPupilLeft.VanillaSetup(isLeft: true, gameObject);
				CustomEyeManager.VanillaPupilRight.VanillaSetup(isLeft: false, gameObject2);
			}
			if (!Player.isLocal)
			{
				SetPlayerSavedSelection(Player);
				CurrentSelections.PlayerEyesSpawn();
			}
		}

		internal void SetMenuEyes(PlayerAvatarVisuals visuals)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			GameObject gameObject = ((Component)visuals.playerEyes.pupilLeft.GetChild(0).GetChild(0)).gameObject;
			GameObject gameObject2 = ((Component)visuals.playerEyes.pupilRight.GetChild(0).GetChild(0)).gameObject;
			GameObject val = new GameObject("MoreEyes-LEFT-MENU");
			val.transform.SetParent(visuals.playerEyes.pupilLeft.GetChild(0));
			GameObject val2 = new GameObject("MoreEyes-RIGHT-MENU");
			val2.transform.SetParent(visuals.playerEyes.pupilRight.GetChild(0));
			LeftEye.EyeMenuPos.Add(val.transform.parent);
			RightEye.EyeMenuPos.Add(val2.transform.parent);
			LeftEye.SetFirstPupilMenu(gameObject);
			RightEye.SetFirstPupilMenu(gameObject2);
			SetPlayerSavedSelection(Player);
			CurrentSelections.PlayerEyesSpawn();
		}

		internal void SelectPupil(CustomPupilType newSelection, bool isLeft)
		{
			if ((Object)(object)newSelection.Prefab == (Object)null)
			{
				Loggers.Warning("Invalid Selection! Pupil reference object for " + newSelection.Name + " is null");
				return;
			}
			EyeRef eyeRef = (isLeft ? LeftEye : RightEye);
			eyeRef.RemovePupil();
			eyeRef.CreatePupil(newSelection);
			CurrentSelections.UpdateSelectionOf(isLeft, newSelection);
			FileManager.UpdateWrite = true;
		}

		internal void SelectIris(CustomIrisType newSelection, bool isLeft)
		{
			EyeRef eyeRef = (isLeft ? LeftEye : RightEye);
			eyeRef.RemoveIris();
			eyeRef.CreateIris(newSelection);
			CurrentSelections.UpdateSelectionOf(isLeft, newSelection);
			FileManager.UpdateWrite = true;
		}

		internal void SetPlayerSavedSelection(PlayerAvatar player)
		{
			PlayerEyeSelection playerEyeSelection = PlayerEyeSelection.GetPlayerEyeSelection(player.steamID);
			if (playerEyeSelection == null)
			{
				Loggers.Warning(player.playerName + " does not have PlayerEyeSelection component!");
			}
			else
			{
				playerEyeSelection.GetCachedSelections();
			}
		}

		internal void RandomizeEyes()
		{
			List<CustomPupilType> list = CustomEyeManager.AllPupilTypes.FindAll((CustomPupilType p) => !p.Name.EndsWith("_right"));
			List<CustomPupilType> list2 = CustomEyeManager.AllPupilTypes.FindAll((CustomPupilType p) => !p.Name.EndsWith("_left"));
			List<CustomIrisType> list3 = CustomEyeManager.AllIrisTypes.FindAll((CustomIrisType i) => !i.Name.EndsWith("_right"));
			List<CustomIrisType> list4 = CustomEyeManager.AllIrisTypes.FindAll((CustomIrisType i) => !i.Name.EndsWith("_left"));
			CustomPupilType newSelection = list[Plugin.Rand.Next(0, list.Count)];
			CustomPupilType newSelection2 = list2[Plugin.Rand.Next(0, list2.Count)];
			CustomIrisType newSelection3 = list3[Plugin.Rand.Next(0, list3.Count)];
			CustomIrisType newSelection4 = list4[Plugin.Rand.Next(0, list4.Count)];
			SelectPupil(newSelection, isLeft: true);
			SelectPupil(newSelection2, isLeft: false);
			SelectIris(newSelection3, isLeft: true);
			SelectIris(newSelection4, isLeft: false);
			CurrentSelections.SetRandomColors();
		}

		internal void ResetEyes()
		{
			SelectPupil(CustomEyeManager.VanillaPupilLeft, isLeft: true);
			SelectPupil(CustomEyeManager.VanillaPupilRight, isLeft: false);
			SelectIris(CustomEyeManager.VanillaIris, isLeft: true);
			SelectIris(CustomEyeManager.VanillaIris, isLeft: false);
			CurrentSelections.SetDefaultColors();
			FileManager.UpdateWrite = true;
		}
	}
}
namespace MoreEyes.Collections
{
	internal class CustomIrisType
	{
		internal string M