Decompiled source of PluginConfigurator v1.10.0

plugins/PluginConfigurator/PluginConfigurator.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using PluginConfig.Patches;
using PluginConfiguratorComponents;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PluginConfigurator")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Ultrakill mod that makes configuring mods easier")]
[assembly: AssemblyFileVersion("1.10.0.0")]
[assembly: AssemblyInformationalVersion("1.10.0+34429d31c94758afa7afb03c73e8b7a3ef6ef6ec")]
[assembly: AssemblyProduct("PluginConfigurator")]
[assembly: AssemblyTitle("PluginConfigurator")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.10.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 PluginConfig
{
	public static class NotificationPanel
	{
		private class NotificationPanelComp : MonoBehaviour
		{
			private void OnEnable()
			{
				((Component)this).transform.SetAsLastSibling();
				MonoSingleton<OptionsManager>.Instance.dontUnpause = true;
			}

			private void OnDisable()
			{
				MonoSingleton<OptionsManager>.Instance.dontUnpause = false;
			}
		}

		private class OptionsMenuListener : MonoBehaviour
		{
			private void OnEnable()
			{
				if ((Object)(object)root != (Object)null && currentNotification != null)
				{
					((Component)root).gameObject.SetActive(true);
				}
			}
		}

		public abstract class Notification
		{
			internal bool closed;

			public abstract void OnUI(RectTransform panel);

			public void Close()
			{
				if (!closed)
				{
					closed = true;
					if (this == currentNotification)
					{
						CloseInternal();
					}
				}
			}
		}

		internal static Queue<Notification> notificationQueue = new Queue<Notification>();

		internal static Notification currentNotification = null;

		private static RectTransform root;

		private static Image currentBackground;

		internal static void UpdateBackgroundColor()
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)currentBackground == (Object)null))
			{
				Color value = PluginConfiguratorController.notificationPanelBackground.value;
				value.a = PluginConfiguratorController.notificationPanelOpacity.value / 100f;
				((Graphic)currentBackground).color = value;
			}
		}

		internal static void InitUI()
		{
			//IL_0030: 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_0076: 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)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)root == (Object)null && (Object)(object)PluginConfiguratorController.optionsMenu != (Object)null)
			{
				((Component)PluginConfiguratorController.optionsMenu).gameObject.AddComponent<OptionsMenuListener>();
				root = new GameObject().AddComponent<RectTransform>();
				((Transform)root).SetParent(PluginConfiguratorController.optionsMenu);
				root.anchorMin = new Vector2(0f, 0f);
				root.anchorMax = new Vector2(1f, 1f);
				root.pivot = new Vector2(0f, 0f);
				root.sizeDelta = new Vector2(0f, 0f);
				root.anchoredPosition = new Vector2(0f, 0f);
				((Transform)root).localScale = Vector3.one;
				((Component)root).gameObject.AddComponent<NotificationPanelComp>();
				currentBackground = ((Component)root).gameObject.AddComponent<Image>();
				Color value = PluginConfiguratorController.notificationPanelBackground.value;
				value.a = PluginConfiguratorController.notificationPanelOpacity.value / 100f;
				((Graphic)currentBackground).color = value;
				((Component)root).gameObject.AddComponent<MenuEsc>().DontClose = true;
				if (currentNotification != null)
				{
					currentNotification.OnUI(root);
					((Component)root).gameObject.SetActive(true);
				}
				else
				{
					((Component)root).gameObject.SetActive(false);
				}
			}
		}

		private static void ClearUI()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			foreach (Transform item in ((Component)root).transform)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
		}

		public static void Open(Notification notification)
		{
			if (currentNotification != null)
			{
				notificationQueue.Enqueue(notification);
				return;
			}
			currentNotification = notification;
			if (!((Object)(object)root == (Object)null))
			{
				ClearUI();
				((Component)root).gameObject.SetActive(true);
				currentNotification.OnUI(root);
			}
		}

		internal static void CloseInternal()
		{
			ClearUI();
			currentNotification = null;
			while (notificationQueue.Count != 0)
			{
				currentNotification = notificationQueue.Dequeue();
				if (!currentNotification.closed)
				{
					break;
				}
				currentNotification = null;
			}
			if (currentNotification != null)
			{
				if ((Object)(object)root != (Object)null)
				{
					currentNotification.OnUI(root);
					((Component)root).gameObject.SetActive(true);
				}
			}
			else if ((Object)(object)root != (Object)null)
			{
				((Component)root).gameObject.SetActive(false);
			}
		}

		public static int CurrentNotificationCount()
		{
			return notificationQueue.Count + ((currentNotification != null) ? 1 : 0);
		}
	}
	internal class OptionsMenuCloseListener : MonoBehaviour
	{
		private void OnDisable()
		{
			PluginConfiguratorController.FlushAllConfigs();
		}
	}
	internal class MainPanelComponent : MonoBehaviour
	{
		private void OnEnable()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			PluginConfiguratorController.activePanel = ((Component)this).gameObject;
			PluginConfiguratorController.backButton.onClick = new ButtonClickedEvent();
			((UnityEvent)PluginConfiguratorController.backButton.onClick).AddListener((UnityAction)delegate
			{
				if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null && (Object)(object)PluginConfiguratorController.activePanel != (Object)(object)((Component)this).gameObject)
				{
					PluginConfiguratorController.activePanel.SetActive(false);
				}
				MonoSingleton<OptionsManager>.Instance.CloseOptions();
			});
		}

		private void OnDisable()
		{
			if ((Object)(object)PluginConfiguratorController.activePanel == (Object)(object)((Component)this).gameObject)
			{
				PluginConfiguratorController.activePanel = null;
			}
		}
	}
	[BepInPlugin("com.eternalUnion.pluginConfigurator", "PluginConfigurator", "1.10.0")]
	public class PluginConfiguratorController : BaseUnityPlugin
	{
		private static class TestConfigs
		{
			internal enum TestEnum
			{
				SampleText,
				SecondElement,
				Third
			}

			private class CustomImageField : CustomConfigField
			{
				private class ControllerComp : MonoBehaviour
				{
					public IEnumerator LoadSprite(CustomImageField field, string url)
					{
						UnityWebRequest request = UnityWebRequestTexture.GetTexture(url);
						yield return request.SendWebRequest();
						if (request.isNetworkError || request.isHttpError)
						{
							Debug.LogError((object)("Error: " + request.error));
							yield break;
						}
						Texture2D content = DownloadHandlerTexture.GetContent(request);
						field.sprite = Sprite.Create(content, new Rect(0f, 0f, (float)((Texture)content).width, (float)((Texture)content).height), Vector2.zero);
						field.SetImageSprite();
						logger.LogInfo((object)("Loaded sprite from " + url + " successfully"));
					}
				}

				private Sprite sprite;

				private Image currentUI;

				private static ControllerComp controller;

				public CustomImageField(ConfigPanel parentPanel, string url)
					: base(parentPanel)
				{
					//IL_0014: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_001f: Expected O, but got Unknown
					if ((Object)(object)controller == (Object)null)
					{
						GameObject val = new GameObject();
						Object.DontDestroyOnLoad((Object)val);
						controller = val.AddComponent<ControllerComp>();
					}
					if (!string.IsNullOrWhiteSpace(url))
					{
						((MonoBehaviour)controller).StartCoroutine(controller.LoadSprite(this, url));
					}
				}

				public void ReloadImage(string newUrl)
				{
					((MonoBehaviour)controller).StartCoroutine(controller.LoadSprite(this, newUrl));
				}

				protected override void OnCreateUI(RectTransform fieldUI)
				{
					currentUI = ((Component)fieldUI).gameObject.AddComponent<Image>();
					if ((Object)(object)sprite != (Object)null)
					{
						SetImageSprite();
					}
					((Component)fieldUI).gameObject.SetActive(!base.hierarchyHidden);
				}

				public override void OnHiddenChange(bool selfHidden, bool hierarchyHidden)
				{
					if ((Object)(object)currentUI != (Object)null)
					{
						((Component)currentUI).gameObject.SetActive(!hierarchyHidden);
					}
				}

				private void SetImageSprite()
				{
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					//IL_003d: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0050: Unknown result type (might be due to invalid IL or missing references)
					//IL_005a: Unknown result type (might be due to invalid IL or missing references)
					if (!((Object)(object)currentUI == (Object)null) && !((Object)(object)sprite == (Object)null))
					{
						RectTransform component = ((Component)currentUI).GetComponent<RectTransform>();
						Rect rect = sprite.rect;
						float height = ((Rect)(ref rect)).height;
						rect = sprite.rect;
						component.sizeDelta = new Vector2(600f, 600f * (height / ((Rect)(ref rect)).width));
						currentUI.sprite = sprite;
					}
				}
			}

			private class CustomRandomColorPickerField : CustomConfigValueField
			{
				private class RandomColorPickerComp : MonoBehaviour
				{
					public CustomRandomColorPickerField callback;

					private void Awake()
					{
						//IL_000b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0010: Unknown result type (might be due to invalid IL or missing references)
						//IL_0012: Unknown result type (might be due to invalid IL or missing references)
						//IL_0018: Expected O, but got Unknown
						EventTrigger obj = ((Component)this).gameObject.AddComponent<EventTrigger>();
						Entry val = new Entry
						{
							eventID = (EventTriggerType)4
						};
						((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate
						{
							OnPointerClick();
						});
						obj.triggers.Add(val);
					}

					private void OnPointerClick()
					{
						//IL_0010: Unknown result type (might be due to invalid IL or missing references)
						//IL_006a: Unknown result type (might be due to invalid IL or missing references)
						if (callback.hierarchyInteractable)
						{
							Color value = default(Color);
							value.r = Random.Range(0f, 1f);
							value.g = Random.Range(0f, 1f);
							value.b = Random.Range(0f, 1f);
							value.a = 1f;
							callback.value = value;
						}
					}
				}

				private Image currentImg;

				private Color _value;

				private Color defaultValue;

				public Color value
				{
					get
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						return _value;
					}
					set
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0002: Unknown result type (might be due to invalid IL or missing references)
						//IL_0008: 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)
						_value = value;
						SetFieldValue(value);
						if ((Object)(object)currentImg != (Object)null)
						{
							((Graphic)currentImg).color = value;
						}
					}
				}

				public override void OnHiddenChange(bool selfHidden, bool hierarchyHidden)
				{
					if ((Object)(object)currentImg != (Object)null)
					{
						((Component)currentImg).gameObject.SetActive(!hierarchyHidden);
					}
				}

				private void SetFieldValue(Color c)
				{
					base.fieldValue = c.r.ToString(CultureInfo.InvariantCulture) + "," + c.g.ToString(CultureInfo.InvariantCulture) + "," + c.b.ToString(CultureInfo.InvariantCulture);
				}

				public CustomRandomColorPickerField(ConfigPanel parentPanel, string guid, Color defaultValue)
					: base(parentPanel, guid)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: 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)
					this.defaultValue = defaultValue;
					if (base.fieldValue != null)
					{
						LoadFromString(base.fieldValue);
					}
					else
					{
						value = defaultValue;
					}
				}

				protected override void OnCreateUI(RectTransform fieldUI)
				{
					//IL_0029: Unknown result type (might be due to invalid IL or missing references)
					((Component)fieldUI).gameObject.AddComponent<RandomColorPickerComp>().callback = this;
					currentImg = ((Component)fieldUI).gameObject.AddComponent<Image>();
					((Graphic)currentImg).color = value;
					((Component)currentImg).gameObject.SetActive(!base.hierarchyHidden);
				}

				protected override void LoadDefaultValue()
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					value = defaultValue;
				}

				protected override void LoadFromString(string data)
				{
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					//IL_001a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0095: Unknown result type (might be due to invalid IL or missing references)
					string[] array = data.Split(new char[1] { ',' });
					if (array.Length != 3)
					{
						value = defaultValue;
						return;
					}
					Color val = default(Color);
					val.a = 1f;
					if (float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
					{
						val.r = result;
					}
					if (float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
					{
						val.g = result2;
					}
					if (float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3))
					{
						val.b = result3;
					}
					value = val;
				}
			}

			private static List<PluginConfigurator> testConfigs = new List<PluginConfigurator>();

			public static void SetVisibility(bool visible)
			{
				foreach (PluginConfigurator testConfig in testConfigs)
				{
					testConfig.hidden = !visible;
				}
			}

			public static void Init()
			{
				//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0463: Unknown result type (might be due to invalid IL or missing references)
				//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
				PluginConfigurator pluginConfigurator = PluginConfigurator.Create("Division", "divisionTest");
				testConfigs.Add(pluginConfigurator);
				pluginConfigurator.saveToFile = true;
				pluginConfigurator.rootPanel.onPannelOpenEvent += delegate(bool external)
				{
					Debug.LogError((object)$"Root panel opened, external: {external}");
				};
				pluginConfigurator.rootPanel.onPannelCloseEvent += delegate
				{
					Debug.LogError((object)"Root panel closed");
				};
				BoolField boolField = new BoolField(pluginConfigurator.rootPanel, "Enable div 1", "enabler1", defaultValue: true);
				boolField.presetLoadPriority = 1;
				BoolField boolField2 = new BoolField(pluginConfigurator.rootPanel, "Enable div 2", "enabler2", defaultValue: true);
				boolField2.presetLoadPriority = 1;
				BoolField boolField3 = new BoolField(pluginConfigurator.rootPanel, "Enable interacable 1", "interactable1", defaultValue: true);
				boolField3.presetLoadPriority = 1;
				BoolField boolField4 = new BoolField(pluginConfigurator.rootPanel, "Enable interacable 2", "interactable2", defaultValue: true);
				boolField4.presetLoadPriority = 1;
				ConfigDivision div1 = new ConfigDivision(pluginConfigurator.rootPanel, "div1");
				new ButtonField(div1, "A Button...", "button").onClick += delegate
				{
					Application.OpenURL("http://www.google.com");
				};
				new KeyCodeField(div1, "A key", "aKey", (KeyCode)0);
				ConfigPanel configPanel = new ConfigPanel(div1, "Big Button Panel", "bigButtonPanel", ConfigPanel.PanelFieldType.BigButton);
				configPanel.onPannelOpenEvent += delegate(bool external)
				{
					Debug.LogWarning((object)$"Sub panel opened, external: {external}");
				};
				configPanel.onPannelCloseEvent += delegate
				{
					Debug.LogWarning((object)"Sub panel closed");
				};
				new ConfigPanel(div1, "Icon panel", "iconPanel", ConfigPanel.PanelFieldType.StandardWithBigIcon);
				FormattedStringBuilder formattedStringBuilder = new FormattedStringBuilder();
				formattedStringBuilder.currentFormat = new CharacterInfo
				{
					bold = true,
					color = Color.red
				};
				formattedStringBuilder += "FORMATTED TEXT";
				new FormattedStringField(div1, "Formatted string", "formattedString", formattedStringBuilder.Build());
				new StringListField(div1, "Sample list", "strList", new string[3] { "Item 1", "2", "Item 3" }, "2");
				new ConfigHeader(div1, "Division 1");
				new IntField(div1, "Sample Field", "sampleField1", 0);
				new StringMultilineField(div1, "Multiline edit", "strMulti", "Hello!\nThis is a sample multiline field\n\nEnter as many lines as you want!");
				ConfigDivision div2 = new ConfigDivision(div1, "div2");
				new ConfigHeader(div2, "Division 2");
				ButtonArrayField buttonArrayField = new ButtonArrayField(div2, "buttons", 4, new float[4] { 0.25f, 0.5f, 0.125f, 0.125f }, new string[4] { "First", "Second", "Third", "Fourth" });
				buttonArrayField.OnClickEventHandler(0).onClick += delegate
				{
					logger.LogWarning((object)"Button 1 pressed");
				};
				buttonArrayField.OnClickEventHandler(1).onClick += delegate
				{
					logger.LogWarning((object)"Button 2 pressed");
				};
				buttonArrayField.OnClickEventHandler(2).onClick += delegate
				{
					logger.LogWarning((object)"Button 3 pressed");
				};
				buttonArrayField.OnClickEventHandler(3).onClick += delegate
				{
					logger.LogWarning((object)"Button 4 pressed");
				};
				new BoolField(div2, "Sample Field", "sampleField2", defaultValue: true);
				new ConfigPanel(div2, "SamplePanel", "samplePanel");
				new FloatSliderField(div2, "Slider field", "slider", new Tuple<float, float>(0f, 100f), 50f, 2).onValueChange += delegate(FloatSliderField.FloatSliderValueChangeEvent e)
				{
					if (e.newValue == 20f)
					{
						e.newValue = 5.5f;
					}
					else if (e.newValue == 30f)
					{
						e.canceled = true;
					}
				};
				new ColorField(div2, "Sample Color", "sampleColor", new Color(0.3f, 0.2f, 0.1f)).onValueChange += delegate(ColorField.ColorValueChangeEvent data)
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					logger.LogDebug((object)$"New color: {data.value}");
				};
				EnumField<TestEnum> enumField = new EnumField<TestEnum>(div2, "Sample Enum", "sampleEnum1", TestEnum.SampleText);
				enumField.SetEnumDisplayName(TestEnum.SampleText, "Sample Text");
				enumField.SetEnumDisplayName(TestEnum.SecondElement, "Second Element");
				enumField.SetEnumDisplayName(TestEnum.Third, "Third");
				boolField.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
				{
					div1.hidden = !data.value;
				};
				boolField2.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
				{
					div2.hidden = !data.value;
				};
				boolField3.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
				{
					div1.interactable = data.value;
				};
				boolField4.onValueChange += delegate(BoolField.BoolValueChangeEvent data)
				{
					div2.interactable = data.value;
				};
				PluginConfigurator pluginConfigurator2 = PluginConfigurator.Create("Range", "rangeTest");
				testConfigs.Add(pluginConfigurator2);
				pluginConfigurator2.saveToFile = false;
				new IntField(pluginConfigurator2.rootPanel, "-5 to 5 near", "intrange1", 0, -5, 5, setToNearestValidValueOnUnvalidInput: true);
				new IntField(pluginConfigurator2.rootPanel, "-5 to 5 invalid", "intrange2", 0, -5, 5, setToNearestValidValueOnUnvalidInput: false);
				new FloatField(pluginConfigurator2.rootPanel, "-2.5 to 2.5 near", "floatrange1", 0f, -2.5f, 2.5f, setToNearestValidValueOnUnvalidInput: true);
				new FloatField(pluginConfigurator2.rootPanel, "-2.5 to 2.5 invalid", "floatrange2", 0f, -2.5f, 2.5f, setToNearestValidValueOnUnvalidInput: false);
				new StringField(pluginConfigurator2.rootPanel, "do not allow empty string", "stringfield1", "Test", allowEmptyValues: false);
				new StringField(pluginConfigurator2.rootPanel, "allow empty string", "stringfield2", "Test", allowEmptyValues: true);
				PluginConfigurator pluginConfigurator3 = PluginConfigurator.Create("Custom Fields", "customFields");
				testConfigs.Add(pluginConfigurator3);
				pluginConfigurator3.saveToFile = true;
				new ConfigHeader(pluginConfigurator3.rootPanel, "Test Image Field:");
				string defaultValue = "https://c4.wallpaperflare.com/wallpaper/981/954/357/ultrakill-red-background-v1-ultrakill-weapon-hd-wallpaper-thumb.jpg";
				CustomImageField imgField = new CustomImageField(pluginConfigurator3.rootPanel, null);
				StringField urlField = new StringField(pluginConfigurator3.rootPanel, "URL", "imgUrl", defaultValue, allowEmptyValues: false, saveToConfig: false);
				new ButtonField(pluginConfigurator3.rootPanel, "Load Image From URL", "imgUrlLoad").onClick += delegate
				{
					imgField.ReloadImage(urlField.value);
				};
				imgField.ReloadImage(urlField.value);
				new ConfigHeader(pluginConfigurator3.rootPanel, "Random Color Picker (peak laziness)", 16);
				new CustomRandomColorPickerField(pluginConfigurator3.rootPanel, "randomColor", new Color(1f, 0f, 0f));
				PluginConfigurator pluginConfigurator4 = PluginConfigurator.Create("Source Config", "eternalUnion.sourceConfig");
				testConfigs.Add(pluginConfigurator4);
				PluginConfigurator bridgedConfig = PluginConfigurator.Create("Bridged config", "eternalUnion.bridgedConfig");
				testConfigs.Add(bridgedConfig);
				new StringField(pluginConfigurator4.rootPanel, "Local field", "localFieldSource", "local value");
				ConfigDivision parentPanel = new ConfigDivision(pluginConfigurator4.rootPanel, "LocalDiv");
				ConfigPanel sourceBridgedPanel = new ConfigPanel(parentPanel, "Bridged panel", "sourceBridgedPanel");
				StringField stringField = new StringField(sourceBridgedPanel, "Bridged field", "localBridgedSource", "bridged value", allowEmptyValues: true);
				StringField sourceBridgeCopier = new StringField(pluginConfigurator4.rootPanel, "Bridged copier", "sourceBridgeCopier", stringField.value, allowEmptyValues: true);
				sourceBridgeCopier.interactable = false;
				stringField.postValueChangeEvent += delegate(string newVal)
				{
					sourceBridgeCopier.value = newVal;
				};
				ButtonField createBridgeButton = new ButtonField(bridgedConfig.rootPanel, "Create Bridge", "bridge_button");
				createBridgeButton.onClick += delegate
				{
					createBridgeButton.hidden = true;
					ConfigBridge bridge = new ConfigBridge(sourceBridgedPanel, bridgedConfig.rootPanel);
					new BoolField(bridgedConfig.rootPanel, "Bridge hidden", "bridge_hidden", defaultValue: false, saveToConfig: false).postValueChangeEvent += delegate(bool newVal)
					{
						bridge.hidden = newVal;
					};
					new BoolField(bridgedConfig.rootPanel, "Bridge interactable", "bridge_interactable", defaultValue: true, saveToConfig: false).postValueChangeEvent += delegate(bool newVal)
					{
						bridge.interactable = newVal;
					};
				};
			}
		}

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

			public static UnityAction <>9__16_0;

			public static Func<GameObject, bool> <>9__21_2;

			public static UnityAction <>9__21_5;

			public static UnityAction <>9__21_4;

			public static UnityAction <>9__21_1;

			public static ButtonArrayField.OnClick <>9__33_0;

			public static ButtonArrayField.OnClick <>9__33_1;

			public static ColorField.PostColorValueChangeEvent <>9__33_2;

			public static FloatSliderField.PostFloatSliderValueChangeEvent <>9__33_3;

			public static BoolField.PostBoolValueChangeEvent <>9__33_5;

			public static Action <>9__33_10;

			public static Action<bool> <>9__33_11;

			internal void <HandleUltraTweakerUI>b__16_0()
			{
				if ((Object)(object)activePanel != (Object)null)
				{
					activePanel.SetActive(false);
				}
				activePanel = null;
				((Component)mainPanel).gameObject.SetActive(false);
			}

			internal bool <OnSceneLoad>b__21_2(GameObject obj)
			{
				return ((Object)obj).name == "Canvas";
			}

			internal void <OnSceneLoad>b__21_4()
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Expected O, but got Unknown
				((Component)mainPanel).gameObject.SetActive(false);
				if ((Object)(object)activePanel != (Object)null)
				{
					activePanel.SetActive(false);
				}
				backButton.onClick = new ButtonClickedEvent();
				ButtonClickedEvent onClick = backButton.onClick;
				object obj = <>9__21_5;
				if (obj == null)
				{
					UnityAction val = delegate
					{
						MonoSingleton<OptionsMenuToManager>.Instance.CloseOptions();
					};
					<>9__21_5 = val;
					obj = (object)val;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
			}

			internal void <OnSceneLoad>b__21_5()
			{
				MonoSingleton<OptionsMenuToManager>.Instance.CloseOptions();
			}

			internal void <OnSceneLoad>b__21_1()
			{
				if ((Object)(object)activePanel != (Object)null && (Object)(object)activePanel != (Object)(object)((Component)mainPanel).gameObject)
				{
					ConfigPanelComponent configPanelComponent = default(ConfigPanelComponent);
					if (activePanel.TryGetComponent<ConfigPanelComponent>(ref configPanelComponent))
					{
						if (configPanelComponent.panel != null)
						{
							configPanelComponent.panel.rootConfig.FlushAll();
						}
						else
						{
							Debug.LogWarning((object)"Panel component does not have a config panel attached, could not flush");
						}
					}
					else
					{
						Debug.LogWarning((object)"Could not find panel's component");
					}
					activePanel.SetActive(false);
				}
				activePanel = null;
				((Component)mainPanel).gameObject.SetActive(true);
			}

			internal void <Awake>b__33_0()
			{
				Application.OpenURL(PresetOldFileManager.trashBinDir);
			}

			internal void <Awake>b__33_1()
			{
				Application.OpenURL(PresetOldFileManager.resetBinDir);
			}

			internal void <Awake>b__33_2(Color v)
			{
				NotificationPanel.UpdateBackgroundColor();
			}

			internal void <Awake>b__33_3(float v, Tuple<float, float> r)
			{
				NotificationPanel.UpdateBackgroundColor();
			}

			internal void <Awake>b__33_5(bool newVal)
			{
				TestConfigs.SetVisibility(devToggle.value && newVal);
			}

			internal void <Awake>b__33_10()
			{
				foreach (PluginConfigurator config in configs)
				{
					config.FlushAll();
				}
			}

			internal void <Awake>b__33_11(bool hasFocus)
			{
				if (hasFocus)
				{
					return;
				}
				foreach (PluginConfigurator config in configs)
				{
					config.FlushAll();
				}
			}
		}

		public static ManualLogSource logger;

		public const string PLUGIN_NAME = "PluginConfigurator";

		public const string PLUGIN_GUID = "com.eternalUnion.pluginConfigurator";

		public const string PLUGIN_VERSION = "1.10.0";

		private const string ASSET_PATH_CONFIG_BUTTON = "PluginConfigurator/PluginConfiguratorButton.prefab";

		private const string ASSET_PATH_CONFIG_MENU = "PluginConfigurator/PluginConfigField.prefab";

		private const string ASSET_PATH_CONFIG_PANEL = "PluginConfigurator/Fields/ConcretePanel.prefab";

		public static string workingPath;

		public static string workingDir;

		public static string catalogPath;

		internal static List<PluginConfigurator> configs = new List<PluginConfigurator>();

		internal static Transform optionsMenu;

		internal static ConfigPanelConcrete mainPanel;

		internal static GameObject activePanel;

		internal static Button backButton;

		internal static Harmony configuratorPatches;

		internal static PluginConfigurator config;

		internal static BoolField patchCheatKeys;

		internal static BoolField patchPause;

		internal static BoolField cancelOnEsc;

		internal static BoolField devToggle;

		internal static BoolField devConfigs;

		internal static ColorField notificationPanelBackground;

		internal static FloatSliderField notificationPanelOpacity;

		internal static Sprite defaultPluginIcon;

		internal static void RegisterConfigurator(PluginConfigurator config)
		{
			configs.Add(config);
		}

		public static bool ConfigExists(string guid)
		{
			return configs.Where((PluginConfigurator c) => c.guid == guid).FirstOrDefault() != null;
		}

		public static PluginConfigurator GetConfig(string guid)
		{
			return configs.Where((PluginConfigurator c) => c.guid == guid).FirstOrDefault();
		}

		public static void FlushAllConfigs()
		{
			foreach (PluginConfigurator config in configs)
			{
				config.FlushAll();
			}
		}

		private void CreateConfigUI(Transform optionsMenu)
		{
			//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)
			foreach (PluginConfigurator config in configs)
			{
				try
				{
					GameObject obj = Addressables.InstantiateAsync((object)"PluginConfigurator/PluginConfigField.prefab", mainPanel.content, false, true).WaitForCompletion();
					ConfigPluginMenuField component = obj.GetComponent<ConfigPluginMenuField>();
					((TMP_Text)component.name).text = config.displayName;
					component.icon.sprite = config.image ?? defaultPluginIcon;
					config.configMenu = component;
					obj.SetActive(!config.hidden);
					((Selectable)component.button).interactable = config.interactable;
					config.CreateUI(component.button, optionsMenu);
				}
				catch (Exception arg)
				{
					Debug.LogError((object)$"Error while creating ui for {config.guid}: {arg}");
				}
			}
		}

		private static void HandleUltraTweakerUI(GameObject ___newBtn)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_002b: Expected O, but got Unknown
			Button component = ___newBtn.GetComponent<Button>();
			ButtonClickedEvent onClick = component.onClick;
			object obj = <>c.<>9__16_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					if ((Object)(object)activePanel != (Object)null)
					{
						activePanel.SetActive(false);
					}
					activePanel = null;
					((Component)mainPanel).gameObject.SetActive(false);
				};
				<>c.<>9__16_0 = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			((Component)component).GetComponent<RectTransform>().anchoredPosition = new Vector2(30f, 330f);
		}

		private void OnSceneLoad(Scene currentScene, LoadSceneMode mode)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Expected O, but got Unknown
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Expected O, but got Unknown
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Expected O, but got Unknown
			if ((int)mode == 1 || (Object)(object)mainPanel != (Object)null)
			{
				return;
			}
			GameObject val = null;
			foreach (GameObject item in from obj in ((Scene)(ref currentScene)).GetRootGameObjects()
				where ((Object)obj).name == "Canvas"
				select obj)
			{
				optionsMenu = item.transform.Find("OptionsMenu");
				if (!((Object)(object)optionsMenu == (Object)null))
				{
					val = item;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			((Component)optionsMenu).gameObject.AddComponent<OptionsMenuCloseListener>();
			Transform val2 = ((Component)optionsMenu).transform.Find("Text");
			if ((Object)(object)val2 != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)val2).gameObject);
			}
			Transform val3 = ((Component)optionsMenu).transform.Find("Panel");
			backButton = ((Component)((Component)optionsMenu).transform.Find("Panel/Back")).GetComponent<Button>();
			GameObject val4 = Addressables.InstantiateAsync((object)"PluginConfigurator/PluginConfiguratorButton.prefab", val3, false, true).WaitForCompletion();
			val4.SetActive(true);
			Button component = val4.GetComponent<Button>();
			val4.transform.SetSiblingIndex(0);
			Image buttonImage = val4.GetComponent<Image>();
			ButtonHighlightParent highlightParent = ((Component)val3).GetComponent<ButtonHighlightParent>();
			((UnityEvent)component.onClick).AddListener((UnityAction)delegate
			{
				highlightParent.ChangeButton(buttonImage);
			});
			mainPanel = Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConcretePanel.prefab", optionsMenu, false, true).WaitForCompletion().GetComponent<ConfigPanelConcrete>();
			((Component)mainPanel).gameObject.AddComponent<MainPanelComponent>();
			((TMP_Text)mainPanel.header).text = "--PLUGIN CONFIGURATOR--";
			((Component)mainPanel).gameObject.SetActive(false);
			((Component)mainPanel).GetComponent<GamepadObjectSelector>();
			GamepadObjectSelector goj = default(GamepadObjectSelector);
			Button val5 = default(Button);
			foreach (Transform item2 in UnityUtils.GetChilds(((Component)optionsMenu).transform).Concat(UnityUtils.GetChilds(val3)))
			{
				if ((Object)(object)item2 == (Object)(object)((Component)mainPanel).transform || (Object)(object)item2 == (Object)(object)val4.transform)
				{
					continue;
				}
				if (((Component)item2).gameObject.TryGetComponent<GamepadObjectSelector>(ref goj))
				{
					((UnityEvent)component.onClick).AddListener((UnityAction)delegate
					{
						((Component)goj).gameObject.SetActive(false);
					});
				}
				else
				{
					if (!((Component)item2).gameObject.TryGetComponent<Button>(ref val5))
					{
						continue;
					}
					ButtonClickedEvent onClick = val5.onClick;
					object obj2 = <>c.<>9__21_4;
					if (obj2 == null)
					{
						UnityAction val6 = delegate
						{
							//IL_002d: Unknown result type (might be due to invalid IL or missing references)
							//IL_0037: Expected O, but got Unknown
							//IL_0055: Unknown result type (might be due to invalid IL or missing references)
							//IL_005a: Unknown result type (might be due to invalid IL or missing references)
							//IL_0060: Expected O, but got Unknown
							((Component)mainPanel).gameObject.SetActive(false);
							if ((Object)(object)activePanel != (Object)null)
							{
								activePanel.SetActive(false);
							}
							backButton.onClick = new ButtonClickedEvent();
							ButtonClickedEvent onClick3 = backButton.onClick;
							object obj4 = <>c.<>9__21_5;
							if (obj4 == null)
							{
								UnityAction val8 = delegate
								{
									MonoSingleton<OptionsMenuToManager>.Instance.CloseOptions();
								};
								<>c.<>9__21_5 = val8;
								obj4 = (object)val8;
							}
							((UnityEvent)onClick3).AddListener((UnityAction)obj4);
						};
						<>c.<>9__21_4 = val6;
						obj2 = (object)val6;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj2);
				}
			}
			ButtonClickedEvent onClick2 = component.onClick;
			object obj3 = <>c.<>9__21_1;
			if (obj3 == null)
			{
				UnityAction val7 = delegate
				{
					if ((Object)(object)activePanel != (Object)null && (Object)(object)activePanel != (Object)(object)((Component)mainPanel).gameObject)
					{
						ConfigPanelComponent configPanelComponent = default(ConfigPanelComponent);
						if (activePanel.TryGetComponent<ConfigPanelComponent>(ref configPanelComponent))
						{
							if (configPanelComponent.panel != null)
							{
								configPanelComponent.panel.rootConfig.FlushAll();
							}
							else
							{
								Debug.LogWarning((object)"Panel component does not have a config panel attached, could not flush");
							}
						}
						else
						{
							Debug.LogWarning((object)"Could not find panel's component");
						}
						activePanel.SetActive(false);
					}
					activePanel = null;
					((Component)mainPanel).gameObject.SetActive(true);
				};
				<>c.<>9__21_1 = val7;
				obj3 = (object)val7;
			}
			((UnityEvent)onClick2).AddListener((UnityAction)obj3);
			CreateConfigUI(optionsMenu);
			mainPanel.rect.normalizedPosition = new Vector2(0f, 1f);
			NotificationPanel.InitUI();
		}

		private void Awake()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Expected O, but got Unknown
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Expected O, but got Unknown
			Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
			logger = ((BaseUnityPlugin)this).Logger;
			workingPath = Assembly.GetExecutingAssembly().Location;
			workingDir = Path.GetDirectoryName(workingPath);
			catalogPath = Path.Combine(workingDir, "Assets");
			PresetOldFileManager.Init();
			PresetOldFileManager.CheckForOldFiles();
			Addressables.InitializeAsync().WaitForCompletion();
			Addressables.LoadContentCatalogAsync(Path.Combine(catalogPath, "catalog.json"), true, (string)null).WaitForCompletion();
			defaultPluginIcon = Addressables.LoadAssetAsync<Sprite>((object)"PluginConfigurator/Textures/default-icon.png").WaitForCompletion();
			configuratorPatches = new Harmony("com.eternalUnion.pluginConfigurator");
			config = PluginConfigurator.Create("Plugin Configurator", "com.eternalUnion.pluginConfigurator");
			config.SetIconWithURL(Path.Combine(workingDir, "icon.png"));
			ButtonArrayField buttonArrayField = new ButtonArrayField(config.rootPanel, "binButtons", 2, new float[2] { 0.5f, 0.5f }, new string[2] { "Deleted Presets Folder", "Reset Presets Folder" });
			buttonArrayField.OnClickEventHandler(0).onClick += delegate
			{
				Application.OpenURL(PresetOldFileManager.trashBinDir);
			};
			buttonArrayField.OnClickEventHandler(1).onClick += delegate
			{
				Application.OpenURL(PresetOldFileManager.resetBinDir);
			};
			new ConfigHeader(config.rootPanel, "Patches").textColor = new Color(50f / 51f, 32f / 51f, 32f / 51f);
			patchCheatKeys = new BoolField(config.rootPanel, "Patch cheat keys", "cheatKeyPatch", defaultValue: true);
			patchPause = new BoolField(config.rootPanel, "Patch unpause", "unpausePatch", defaultValue: true);
			new ConfigSpace(config.rootPanel, 10f);
			new ConfigHeader(config.rootPanel, "Behaviour").textColor = new Color(50f / 51f, 32f / 51f, 32f / 51f);
			cancelOnEsc = new BoolField(config.rootPanel, "Cancel on ESC", "cancelOnEsc", defaultValue: false);
			new ConfigSpace(config.rootPanel, 10f);
			new ConfigHeader(config.rootPanel, "Notification Panel").textColor = new Color(50f / 51f, 32f / 51f, 32f / 51f);
			notificationPanelBackground = new ColorField(config.rootPanel, "Background color", "notificationPanelBg", Color.black);
			notificationPanelBackground.postValueChangeEvent += delegate
			{
				NotificationPanel.UpdateBackgroundColor();
			};
			notificationPanelOpacity = new FloatSliderField(config.rootPanel, "Opacity", "notificationPanelAlpha", new Tuple<float, float>(0f, 100f), 89.64f);
			notificationPanelOpacity.postValueChangeEvent += delegate
			{
				NotificationPanel.UpdateBackgroundColor();
			};
			new ConfigSpace(config.rootPanel, 10f);
			new ConfigHeader(config.rootPanel, "Developer Stuff").textColor = new Color(0.5372549f, 69f / 85f, 0.9411765f);
			devToggle = new BoolField(config.rootPanel, "Enable developer features", "devToggle", defaultValue: false);
			ConfigDivision devDiv = new ConfigDivision(config.rootPanel, "devDiv");
			devToggle.postValueChangeEvent += delegate(bool newVal)
			{
				devDiv.hidden = !newVal;
				TestConfigs.SetVisibility(devConfigs.value && newVal);
			};
			devConfigs = new BoolField(devDiv, "Config tests", "configTestToggle", defaultValue: false);
			devConfigs.postValueChangeEvent += delegate(bool newVal)
			{
				TestConfigs.SetVisibility(devToggle.value && newVal);
			};
			TestConfigs.Init();
			devToggle.TriggerPostValueChangeEvent();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Working path: " + workingPath + ", Working dir: " + workingDir));
			patchCheatKeys.onValueChange += CheatKeyListener;
			if (patchCheatKeys.value)
			{
				CheatKeyListener(new BoolField.BoolValueChangeEvent
				{
					value = true
				});
			}
			patchPause.onValueChange += UnpauseListener;
			if (patchPause.value)
			{
				UnpauseListener(new BoolField.BoolValueChangeEvent
				{
					value = true
				});
			}
			configuratorPatches.Patch((MethodBase)GetInstanceMethod<HUDOptions>("Start"), (HarmonyMethod)null, new HarmonyMethod(GetStaticMethod<MenuFinderPatch>("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			configuratorPatches.Patch((MethodBase)GetInstanceMethod<MenuEsc>("Update"), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(GetStaticMethod<MenuEscPatch>("FixNullExcpCausedByUncheckedField")), (HarmonyMethod)null, (HarmonyMethod)null);
			config.FlushAll();
			SceneManager.sceneLoaded += OnSceneLoad;
			Application.quitting += delegate
			{
				foreach (PluginConfigurator config in configs)
				{
					config.FlushAll();
				}
			};
			Application.focusChanged += delegate(bool hasFocus)
			{
				if (!hasFocus)
				{
					foreach (PluginConfigurator config2 in configs)
					{
						config2.FlushAll();
					}
				}
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.eternalUnion.pluginConfigurator is loaded!");
			static void CheatKeyListener(BoolField.BoolValueChangeEvent data)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				if (data.value)
				{
					configuratorPatches.Patch((MethodBase)GetInstanceMethod<CheatsManager>("HandleCheatBind"), new HarmonyMethod(GetStaticMethod<HandleCheatBindPatch>("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					configuratorPatches.Unpatch((MethodBase)GetInstanceMethod<CheatsManager>("HandleCheatBind"), GetStaticMethod<HandleCheatBindPatch>("Prefix"));
				}
			}
			static MethodInfo GetInstanceMethod<T>(string name)
			{
				return typeof(T).GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			}
			static MethodInfo GetStaticMethod<T>(string name)
			{
				return typeof(T).GetMethod(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			}
			static void UnpauseListener(BoolField.BoolValueChangeEvent data)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Expected O, but got Unknown
				if (data.value)
				{
					configuratorPatches.Patch((MethodBase)GetInstanceMethod<OptionsManager>("UnPause"), new HarmonyMethod(GetStaticMethod<UnpausePatch>("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					configuratorPatches.Patch((MethodBase)GetInstanceMethod<OptionsManager>("CloseOptions"), new HarmonyMethod(GetStaticMethod<CloseOptionsPatch>("Prefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					configuratorPatches.Unpatch((MethodBase)GetInstanceMethod<OptionsManager>("UnPause"), GetStaticMethod<UnpausePatch>("Prefix"));
					configuratorPatches.Unpatch((MethodBase)GetInstanceMethod<OptionsManager>("CloseOptions"), GetStaticMethod<CloseOptionsPatch>("Prefix"));
				}
			}
		}

		private void OnDestroy()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			Scene val = SceneManager.GetActiveScene();
			Debug.LogError((object)("Plugin configurator controller instance destroyed in scene '" + ((Scene)(ref val)).name + "'"));
			val = ((Component)this).gameObject.scene;
			Debug.LogError((object)("Plugin was in scene '" + ((Scene)(ref val)).name + "'"));
			Debug.LogError((object)("Object name was '" + ((Object)((Component)this).gameObject).name + "'"));
		}
	}
	public static class UnityUtils
	{
		public static void PrintGameobject(GameObject o, int iters = 0)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			for (int i = 0; i < iters; i++)
			{
				text += "|";
			}
			text += ((Object)o).name;
			Debug.Log((object)text);
			foreach (Transform item in o.transform)
			{
				PrintGameobject(((Component)item).gameObject, iters + 1);
			}
		}

		public static IEnumerable<Transform> GetChilds(Transform obj)
		{
			return (from i in Enumerable.Range(0, obj.childCount)
				select obj.GetChild(i)).ToArray().AsEnumerable();
		}

		public static IEnumerable<T> GetComponentsInChildrenRecursively<T>(Transform obj)
		{
			foreach (Transform item in obj)
			{
				Transform child = item;
				T component = ((Component)child).gameObject.GetComponent<T>();
				if (component != null)
				{
					yield return component;
				}
				foreach (T item2 in GetComponentsInChildrenRecursively<T>(child))
				{
					yield return item2;
				}
			}
		}

		public static T GetComponentInChildrenRecursively<T>(Transform obj)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			foreach (Transform item in obj)
			{
				Transform val = item;
				if (!((Object)(object)val == (Object)(object)obj))
				{
					T component = ((Component)val).gameObject.GetComponent<T>();
					if (component != null)
					{
						return component;
					}
					component = GetComponentInChildrenRecursively<T>(val);
					if (component != null)
					{
						return component;
					}
				}
			}
			return default(T);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "PluginConfigurator";

		public const string PLUGIN_NAME = "PluginConfigurator";

		public const string PLUGIN_VERSION = "1.10.0";
	}
}
namespace PluginConfig.Patches
{
	[HarmonyPatch(typeof(CheatsManager), "HandleCheatBind")]
	public class HandleCheatBindPatch
	{
		public static bool Prefix(CheatsManager __instance)
		{
			if (((Object)(object)MenuFinderPatch.pauseMenu != (Object)null && ((Component)MenuFinderPatch.pauseMenu).gameObject.activeInHierarchy) || ((Object)(object)MenuFinderPatch.optionsMenu != (Object)null && ((Component)MenuFinderPatch.optionsMenu).gameObject.activeInHierarchy))
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(MenuEsc))]
	public class MenuEscPatch
	{
		public static MethodInfo vm_UnityEngine_UI_Selectable_Select = (from m in typeof(Selectable).GetMethods()
			where m.IsVirtual && !m.IsStatic && m.Name == "Select"
			select m).FirstOrDefault();

		public static MethodInfo sm_MenuEscPatch_HandleField = typeof(MenuEscPatch).GetMethod("HandleField", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

		public static void HandleField(Selectable field)
		{
			if ((Object)(object)field != (Object)null)
			{
				field.Select();
			}
			else
			{
				EventSystem.current.SetSelectedGameObject((GameObject)null);
			}
		}

		[HarmonyTranspiler]
		[HarmonyPatch("Update")]
		public static IEnumerable<CodeInstruction> FixNullExcpCausedByUncheckedField(IEnumerable<CodeInstruction> inst)
		{
			List<CodeInstruction> list = inst.ToList();
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Callvirt && CodeInstructionExtensions.OperandIs(list[i], (MemberInfo)vm_UnityEngine_UI_Selectable_Select))
				{
					list[i].opcode = OpCodes.Call;
					list[i].operand = sm_MenuEscPatch_HandleField;
				}
			}
			return list.AsEnumerable();
		}
	}
	public class MenuFinderPatch
	{
		public static Transform pauseMenu;

		public static Transform optionsMenu;

		public static void Postfix(HUDOptions __instance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject val = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects()
				where ((Object)obj).name == "Canvas"
				select obj).FirstOrDefault();
			if (!((Object)(object)val == (Object)null))
			{
				pauseMenu = val.transform.Find("PauseMenu");
				optionsMenu = val.transform.Find("OptionsMenu");
			}
		}
	}
	[HarmonyPatch(typeof(OptionsManager), "CloseOptions")]
	public class CloseOptionsPatch
	{
		private static bool Prefix(OptionsManager __instance)
		{
			if ((Object)(object)PluginConfiguratorController.activePanel == (Object)null || !PluginConfiguratorController.activePanel.activeSelf)
			{
				return true;
			}
			if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null && (Object)(object)PluginConfiguratorController.activePanel != (Object)(object)((Component)PluginConfiguratorController.mainPanel).gameObject)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(OptionsManager), "UnPause")]
	public class UnpausePatch
	{
		private static bool Prefix(OptionsManager __instance)
		{
			if ((Object)(object)MenuFinderPatch.optionsMenu != (Object)null && ((Component)MenuFinderPatch.optionsMenu).gameObject.activeInHierarchy)
			{
				return false;
			}
			return true;
		}
	}
}
namespace PluginConfig.API
{
	public class ConfigBridge : ConfigField
	{
		public readonly ConfigField targetField;

		public override string displayName
		{
			get
			{
				return targetField.displayName;
			}
			set
			{
				if (targetField != null)
				{
					targetField.displayName = value;
				}
			}
		}

		public override bool hidden
		{
			get
			{
				return targetField.hidden;
			}
			set
			{
				if (targetField != null)
				{
					targetField.hidden = value;
				}
			}
		}

		public override bool interactable
		{
			get
			{
				return targetField.interactable;
			}
			set
			{
				if (targetField != null)
				{
					targetField.interactable = value;
				}
			}
		}

		public ConfigBridge(ConfigField targetField, ConfigPanel parentPanel)
			: base(targetField.displayName, "bridge_" + targetField.guid, parentPanel)
		{
			base.strictGuid = false;
			if (targetField == null)
			{
				throw new NullReferenceException("Target field cannot be null");
			}
			if (targetField.bridged)
			{
				throw new ArgumentException("Tried to create config bridge but target field " + targetField.guid + " is already connected to another config bridge");
			}
			if (targetField.parentPanel == null)
			{
				throw new ArgumentException("Root panels cannot be bridged");
			}
			if (targetField.parentPanel == targetField)
			{
				throw new ArgumentException("Panels cannot be bridged to themselves");
			}
			this.targetField = targetField;
			DestroyFieldUI(targetField);
			Stack<ConfigPanel> stack = new Stack<ConfigPanel>();
			if (targetField is ConfigPanel item)
			{
				stack.Push(item);
			}
			while (stack.Count != 0)
			{
				ConfigPanel configPanel = stack.Pop();
				configPanel.fieldsCreated = false;
				if ((Object)(object)configPanel.currentPanel != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)configPanel.currentPanel).gameObject);
				}
				foreach (ConfigField field in configPanel.fields)
				{
					if (field is ConfigPanel item2)
					{
						stack.Push(item2);
					}
				}
			}
			targetField.bridged = true;
			targetField.bridge = this;
			parentPanel.Register(this);
			static void DestroyFieldUI(ConfigField field)
			{
				ConfigPanel configPanel2 = field.parentPanel;
				if (configPanel2.fieldsCreated)
				{
					int num = configPanel2.fields.IndexOf(field);
					if (num != -1)
					{
						foreach (Transform item3 in configPanel2.fieldObjects[num])
						{
							Object.Destroy((Object)(object)((Component)item3).gameObject);
						}
					}
				}
			}
		}

		protected internal override GameObject CreateUI(Transform content)
		{
			return targetField.CreateUI(content);
		}

		internal override void ReloadDefault()
		{
			throw new NotImplementedException();
		}

		internal override void ReloadFromString(string data)
		{
			throw new NotImplementedException();
		}
	}
	internal class ConfigDivisionComp : UIBehaviour
	{
		public ConfigDivision div;

		public bool dirty;

		protected override void OnRectTransformDimensionsChange()
		{
			((UIBehaviour)this).OnRectTransformDimensionsChange();
			div.RecalculateLayout();
		}

		protected override void OnEnable()
		{
			div.RecalculateLayout();
		}

		protected override void OnDisable()
		{
			div.RecalculateLayout();
		}

		public void Update()
		{
			if (dirty)
			{
				dirty = false;
				div.RecalculateLayout();
			}
		}
	}
	public class ConfigDivision : ConfigPanel
	{
		public const string ASSET_PATH = "PluginConfigurator/Fields/VirtualPanel.prefab";

		internal ConfigPanelVirtual currentVirtualPanel;

		internal ConfigDivisionComp currentDivComp;

		public override string displayName { get; set; }

		public override bool hidden
		{
			get
			{
				return base.hidden;
			}
			set
			{
				base.hidden = value;
				if ((Object)(object)currentVirtualPanel != (Object)null)
				{
					((Component)currentVirtualPanel).gameObject.SetActive(!hidden && !base.parentHidden);
				}
				foreach (ConfigField field in fields)
				{
					field.parentHidden = value || hidden || base.parentHidden;
				}
			}
		}

		public override bool interactable
		{
			get
			{
				return base.interactable;
			}
			set
			{
				base.interactable = value;
				foreach (ConfigField field in fields)
				{
					field.parentInteractable = value && interactable && base.parentInteractable;
				}
			}
		}

		protected internal override void RecalculateLayoutDeepestFirst()
		{
			foreach (ConfigPanel childPanel in childPanels)
			{
				childPanel.RecalculateLayoutDeepestFirst();
			}
			if (!((Object)(object)currentVirtualPanel == (Object)null))
			{
				((Component)currentVirtualPanel.contentSizeFitter).SendMessage("SetDirty");
				LayoutRebuilder.ForceRebuildLayoutImmediate(currentVirtualPanel.trans);
			}
		}

		protected internal override void RecalculateLayout()
		{
			if ((Object)(object)currentVirtualPanel != (Object)null)
			{
				((Component)currentVirtualPanel.contentSizeFitter).SendMessage("SetDirty");
				LayoutRebuilder.ForceRebuildLayoutImmediate(currentVirtualPanel.trans);
			}
			base.parentPanel.RecalculateLayout();
		}

		public override void FieldDimensionChanged()
		{
			if ((Object)(object)currentDivComp != (Object)null)
			{
				currentDivComp.dirty = true;
			}
		}

		public ConfigDivision(ConfigPanel panel, string guid)
			: base(panel, guid)
		{
			panel.Register(this);
			panel.childPanels.Add(this);
			base.currentDirectory = base.parentPanel.currentDirectory + "/" + guid;
		}

		internal override void Register(ConfigField field)
		{
			fields.Add(field);
			if ((Object)(object)currentVirtualPanel != (Object)null)
			{
				int i = currentVirtualPanel.content.childCount;
				if (field.createUI && !field.bridged)
				{
					field.CreateUI(currentVirtualPanel.content);
				}
				List<Transform> list = new List<Transform>();
				for (; i < currentVirtualPanel.content.childCount; i++)
				{
					list.Add(currentVirtualPanel.content.GetChild(i));
				}
				fieldObjects.Add(list);
			}
		}

		internal override void ActivatePanel()
		{
			if (base.parentPanel != null)
			{
				base.parentPanel.ActivatePanel();
			}
		}

		internal override GameObject GetConcretePanelObj()
		{
			return base.parentPanel.GetConcretePanelObj();
		}

		internal override ConfigPanel GetConcretePanel()
		{
			return base.parentPanel.GetConcretePanel();
		}

		protected internal override GameObject CreateUI(Transform content)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			currentPanel = base.parentPanel.currentPanel;
			currentComp = base.parentPanel.currentComp;
			GameObject val = Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/VirtualPanel.prefab", content, false, true).WaitForCompletion();
			currentVirtualPanel = val.GetComponent<ConfigPanelVirtual>();
			val.SetActive(false);
			fieldsCreated = true;
			fieldObjects.Clear();
			int i = currentVirtualPanel.content.childCount;
			foreach (ConfigField field in fields)
			{
				List<Transform> list = new List<Transform>();
				if (field.createUI && !field.bridged)
				{
					field.CreateUI(currentVirtualPanel.content);
				}
				for (; i < currentVirtualPanel.content.childCount; i++)
				{
					list.Add(currentVirtualPanel.content.GetChild(i));
				}
				fieldObjects.Add(list);
			}
			currentDivComp = val.AddComponent<ConfigDivisionComp>();
			currentDivComp.div = this;
			((Component)currentVirtualPanel.contentSizeFitter).SendMessage("OnRectTransformDimensionsChange");
			val.SetActive(!hidden && !base.parentHidden);
			return val;
		}
	}
	public abstract class ConfigField
	{
		public readonly bool createUI = true;

		public int presetLoadPriority;

		private bool _parentHidden;

		private bool _parentInteractable = true;

		public abstract string displayName { get; set; }

		public string guid { get; private set; }

		public bool strictGuid { get; protected set; }

		public abstract bool hidden { get; set; }

		internal bool parentHidden
		{
			get
			{
				return _parentHidden;
			}
			set
			{
				_parentHidden = value;
				hidden = hidden;
			}
		}

		public bool hierarchyHidden
		{
			get
			{
				if (!hidden)
				{
					return _parentHidden;
				}
				return true;
			}
		}

		public abstract bool interactable { get; set; }

		internal bool parentInteractable
		{
			get
			{
				return _parentInteractable;
			}
			set
			{
				_parentInteractable = value;
				interactable = interactable;
			}
		}

		public bool hierarchyInteractable
		{
			get
			{
				if (interactable)
				{
					return _parentInteractable;
				}
				return false;
			}
		}

		public PluginConfigurator rootConfig { get; private set; }

		public ConfigPanel parentPanel { get; internal set; }

		public bool bridged { get; internal set; }

		public ConfigBridge bridge { get; internal set; }

		public int siblingIndex
		{
			get
			{
				if (parentPanel == null)
				{
					return 0;
				}
				return parentPanel.fields.IndexOf(this);
			}
			set
			{
				if (parentPanel == null)
				{
					return;
				}
				List<ConfigField> fields = parentPanel.fields;
				int count = fields.Count;
				if (value < 0)
				{
					value = 0;
				}
				else if (value >= count)
				{
					value = count - 1;
				}
				int num = fields.IndexOf(this);
				if (num == value)
				{
					return;
				}
				fields.RemoveAt(num);
				fields.Insert(value, this);
				if (!((Object)(object)parentPanel.currentPanel != (Object)null) || parentPanel.currentPanel.content.childCount == 0)
				{
					return;
				}
				List<Transform> item = parentPanel.fieldObjects[num];
				parentPanel.fieldObjects.RemoveAt(num);
				parentPanel.fieldObjects.Insert(value, item);
				int num2 = 0;
				foreach (List<Transform> fieldObject in parentPanel.fieldObjects)
				{
					foreach (Transform item2 in fieldObject)
					{
						if (!((Object)(object)item2 == (Object)null))
						{
							item2.SetSiblingIndex(num2++);
						}
					}
				}
			}
		}

		internal ConfigField(string displayName, string guid, PluginConfigurator rootConfig)
		{
			strictGuid = true;
			this.displayName = displayName;
			this.guid = guid;
			parentPanel = null;
			this.rootConfig = rootConfig;
		}

		public ConfigField(string displayName, string guid, ConfigPanel parentPanel, bool createUI)
		{
			strictGuid = true;
			this.createUI = createUI;
			this.displayName = displayName;
			this.guid = guid;
			this.parentPanel = parentPanel;
			rootConfig = parentPanel.rootConfig;
			if (parentPanel is ConfigDivision configDivision)
			{
				_parentHidden = configDivision.hidden || configDivision.parentHidden;
				_parentInteractable = configDivision.interactable && configDivision.parentInteractable;
			}
		}

		public ConfigField(string displayName, string guid, ConfigPanel parentPanel)
			: this(displayName, guid, parentPanel, createUI: true)
		{
		}

		protected internal abstract GameObject CreateUI(Transform content);

		internal abstract void ReloadFromString(string data);

		internal abstract void ReloadDefault();
	}
	internal struct PanelInfo
	{
		public RectTransform rect;

		public ContentSizeFitter content;
	}
	internal class ConfigPanelComponent : MonoBehaviour
	{
		public static ConfigPanelComponent lastActivePanel;

		public ConfigPanel panel;

		public bool dirty;

		private void Awake()
		{
			try
			{
				panel.CreateFieldUI();
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Exception thrown while creating panel UI\n{arg}");
			}
			panel.RecalculateLayoutDeepestFirst();
		}

		protected void OnEnable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			lastActivePanel = this;
			PluginConfiguratorController.activePanel = ((Component)this).gameObject;
			PluginConfiguratorController.backButton.onClick = new ButtonClickedEvent();
			((UnityEvent)PluginConfiguratorController.backButton.onClick).AddListener((UnityAction)delegate
			{
				((Component)this).gameObject.SetActive(false);
				if (!panel.bridged)
				{
					if (panel.parentPanel == null)
					{
						panel.rootConfig.FlushAll();
						((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(true);
					}
					else
					{
						panel.parentPanel.ActivatePanel();
					}
				}
				else
				{
					panel.bridge.parentPanel.ActivatePanel();
				}
			});
			if (!panel.bridged)
			{
				if (panel.parentPanel == null)
				{
					panel.currentEsc.previousPage = ((Component)PluginConfiguratorController.mainPanel).gameObject;
				}
				else
				{
					panel.currentEsc.previousPage = panel.parentPanel.GetConcretePanelObj();
				}
			}
			else
			{
				panel.currentEsc.previousPage = panel.bridge.parentPanel.GetConcretePanelObj();
			}
			PluginConfigurator pluginConfigurator = panel.ParentBridgedRootConfig();
			pluginConfigurator.presetButtonCanBeShown = true;
			((Component)pluginConfigurator.presetMenuButton).gameObject.SetActive(!pluginConfigurator.presetButtonHidden);
			try
			{
				panel.OnPanelOpen(panel.externalPanelOpenFlag);
				panel.externalPanelOpenFlag = false;
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Exception thrown while calling on pannel open event\n{arg}");
			}
		}

		private void OnDisable()
		{
			PluginConfigurator pluginConfigurator = panel.ParentBridgedRootConfig();
			pluginConfigurator.presetButtonCanBeShown = false;
			((Component)pluginConfigurator.presetMenuButton).gameObject.SetActive(false);
			if ((Object)(object)PluginConfiguratorController.activePanel == (Object)(object)((Component)this).gameObject)
			{
				PluginConfiguratorController.activePanel = null;
			}
			try
			{
				panel.OnPanelClose();
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Exception thrown while calling on pannel close event\n{arg}");
			}
		}

		public void Update()
		{
			if (dirty)
			{
				dirty = false;
				panel.RecalculateLayout();
			}
		}
	}
	public class ConfigPanel : ConfigField
	{
		public enum PanelFieldType
		{
			Standard,
			StandardWithIcon,
			StandardWithBigIcon,
			BigButton
		}

		public delegate void OpenPanelEventDelegate(bool openedExternally);

		public delegate void ClosePanelEventDelegate();

		private const string ASSET_PATH_PANEL = "PluginConfigurator/Fields/ConcretePanel.prefab";

		private const string ASSET_PATH_MENU_STANDARD = "PluginConfigurator/Fields/ConfigMenu.prefab";

		private const string ASSET_PATH_MENU_ICON = "PluginConfigurator/Fields/ConfigMenuIcon.prefab";

		private const string ASSET_PATH_MENU_ICON_BIG = "PluginConfigurator/Fields/ConfigMenuBigIcon.prefab";

		private const string ASSET_PATH_MENU_BIG_BUTTON = "PluginConfigurator/Fields/ConfigMenuBigButton.prefab";

		protected internal ConfigPanelConcrete currentPanel;

		protected internal ConfigMenuField currentMenu;

		protected internal MenuEsc currentEsc;

		internal ConfigPanelComponent currentComp;

		private Color _fieldColor = Color.black;

		protected internal List<ConfigPanel> childPanels = new List<ConfigPanel>();

		private string _displayName;

		private string _headerText;

		private string _buttonText = "Open";

		private PanelFieldType fieldType;

		private Sprite _icon;

		internal List<ConfigField> fields = new List<ConfigField>();

		private bool _hidden;

		private bool _interactable = true;

		internal List<List<Transform>> fieldObjects = new List<List<Transform>>();

		internal bool fieldsCreated;

		internal bool externalPanelOpenFlag;

		public Color fieldColor
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _fieldColor;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: 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)
				_fieldColor = value;
				if (!((Object)(object)currentMenu == (Object)null) && (Object)(object)currentMenu.fieldBg != (Object)null)
				{
					((Graphic)currentMenu.fieldBg).color = fieldColor;
				}
			}
		}

		public override string displayName
		{
			get
			{
				return _displayName;
			}
			set
			{
				_displayName = value;
				if ((Object)(object)currentMenu != (Object)null)
				{
					((TMP_Text)currentMenu.name).text = _displayName;
				}
			}
		}

		public string headerText
		{
			get
			{
				return _headerText;
			}
			set
			{
				_headerText = value;
				if ((Object)(object)currentPanel != (Object)null)
				{
					((TMP_Text)currentPanel.header).text = _headerText;
				}
			}
		}

		public string buttonText
		{
			get
			{
				return _buttonText;
			}
			set
			{
				_buttonText = value;
				if ((Object)(object)currentMenu != (Object)null)
				{
					((TMP_Text)currentMenu.buttonText).text = _buttonText;
				}
			}
		}

		public Sprite icon
		{
			get
			{
				return _icon;
			}
			set
			{
				_icon = value;
				if ((Object)(object)currentMenu != (Object)null && (Object)(object)currentMenu.icon != (Object)null)
				{
					currentMenu.icon.sprite = icon;
				}
			}
		}

		public ConfigField this[int index] => FieldAt(index);

		public ConfigField this[string guid] => fields.Where((ConfigField field) => field.guid == guid).FirstOrDefault();

		public int fieldCount => fields.Count;

		public string currentDirectory { get; protected set; }

		public override bool hidden
		{
			get
			{
				return _hidden;
			}
			set
			{
				_hidden = value;
				if ((Object)(object)currentMenu != (Object)null)
				{
					((Component)currentMenu).gameObject.SetActive(!_hidden && !base.parentHidden);
				}
			}
		}

		public override bool interactable
		{
			get
			{
				return _interactable;
			}
			set
			{
				_interactable = value;
				if ((Object)(object)currentMenu != (Object)null)
				{
					((Selectable)currentMenu.button).interactable = _interactable && base.parentInteractable;
					SetInteractableColor(_interactable && base.parentInteractable);
				}
			}
		}

		public event OpenPanelEventDelegate onPannelOpenEvent;

		public event ClosePanelEventDelegate onPannelCloseEvent;

		internal PluginConfigurator ParentBridgedRootConfig()
		{
			for (ConfigPanel configPanel = this; configPanel != null; configPanel = configPanel.parentPanel)
			{
				if (configPanel.bridged)
				{
					return configPanel.bridge.rootConfig;
				}
			}
			return base.rootConfig;
		}

		protected internal virtual void RecalculateLayoutDeepestFirst()
		{
			foreach (ConfigPanel childPanel in childPanels)
			{
				childPanel.RecalculateLayoutDeepestFirst();
			}
			((Component)currentPanel.contentSizeFitter).SendMessage("SetDirty");
			LayoutRebuilder.ForceRebuildLayoutImmediate(currentPanel.trans);
		}

		protected internal virtual void RecalculateLayout()
		{
			((Component)currentPanel.contentSizeFitter).SendMessage("SetDirty");
			LayoutRebuilder.ForceRebuildLayoutImmediate(currentPanel.trans);
		}

		public virtual void FieldDimensionChanged()
		{
			if ((Object)(object)currentComp != (Object)null)
			{
				currentComp.dirty = true;
			}
		}

		public void SetIconWithURL(string url)
		{
			if (fieldType != PanelFieldType.StandardWithIcon && fieldType != PanelFieldType.StandardWithBigIcon)
			{
				return;
			}
			UnityWebRequest iconDownload = UnityWebRequestTexture.GetTexture(url);
			((AsyncOperation)iconDownload.SendWebRequest()).completed += delegate
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if (!iconDownload.isHttpError && !iconDownload.isNetworkError)
					{
						Texture2D content = DownloadHandlerTexture.GetContent(iconDownload);
						Sprite val = Sprite.Create(content, new Rect(0f, 0f, (float)((Texture)content).width, (float)((Texture)content).height), new Vector2(0.5f, 0.5f));
						icon = val;
					}
				}
				finally
				{
					iconDownload.Dispose();
				}
			};
		}

		public ConfigField FieldAt(int index)
		{
			if (index < 0 || index >= fields.Count)
			{
				return null;
			}
			return fields[index];
		}

		public ConfigField[] GetAllFields()
		{
			return fields.ToArray();
		}

		private void SetInteractableColor(bool interactable)
		{
			//IL_0024: 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 (!((Object)(object)currentMenu == (Object)null))
			{
				((Graphic)currentMenu.name).color = (interactable ? Color.white : Color.gray);
			}
		}

		internal ConfigPanel(PluginConfigurator config)
			: base(config.displayName, "", config)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)


		internal ConfigPanel(ConfigPanel panel, string name)
			: base(name, "", panel)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)


		public ConfigPanel(ConfigPanel parentPanel, string name, string guid, PanelFieldType fieldType)
			: base(name, guid, parentPanel)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			headerText = "--" + displayName + "--";
			this.fieldType = fieldType;
			parentPanel.Register(this);
			currentDirectory = parentPanel.currentDirectory + "/" + guid;
		}

		public ConfigPanel(ConfigPanel parentPanel, string name, string guid)
			: this(parentPanel, name, guid, PanelFieldType.Standard)
		{
		}

		internal virtual void Register(ConfigField field)
		{
			fields.Add(field);
			if ((Object)(object)currentPanel != (Object)null && fieldsCreated)
			{
				int i = currentPanel.content.childCount;
				if (field.createUI && !field.bridged)
				{
					field.CreateUI(currentPanel.content);
				}
				List<Transform> list = new List<Transform>();
				for (; i < currentPanel.content.childCount; i++)
				{
					list.Add(currentPanel.content.GetChild(i));
				}
				fieldObjects.Add(list);
			}
		}

		internal virtual void ActivatePanel()
		{
			if ((Object)(object)currentPanel != (Object)null)
			{
				((Component)currentPanel).gameObject.SetActive(true);
			}
		}

		internal virtual GameObject GetConcretePanelObj()
		{
			if (!((Object)(object)currentPanel == (Object)null))
			{
				return ((Component)currentPanel).gameObject;
			}
			return null;
		}

		internal virtual ConfigPanel GetConcretePanel()
		{
			return this;
		}

		protected internal override GameObject CreateUI(Transform content)
		{
			//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_00da: 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_00fb: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			fieldsCreated = false;
			GameObject val = Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConcretePanel.prefab", PluginConfiguratorController.optionsMenu, false, true).WaitForCompletion();
			currentPanel = val.GetComponent<ConfigPanelConcrete>();
			val.SetActive(false);
			currentComp = val.AddComponent<ConfigPanelComponent>();
			currentComp.panel = this;
			((TMP_Text)currentPanel.header).text = _headerText;
			MenuEsc val2 = (currentEsc = val.AddComponent<MenuEsc>());
			if (!base.bridged)
			{
				if (base.parentPanel == null)
				{
					val2.previousPage = ((Component)PluginConfiguratorController.mainPanel).gameObject;
				}
				else
				{
					val2.previousPage = base.parentPanel.GetConcretePanelObj();
				}
			}
			else
			{
				val2.previousPage = base.bridge.parentPanel.GetConcretePanelObj();
			}
			if ((Object)(object)content != (Object)null)
			{
				GameObject val3 = null;
				val3 = ((fieldType == PanelFieldType.StandardWithIcon) ? Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenuIcon.prefab", content, false, true).WaitForCompletion() : ((fieldType == PanelFieldType.StandardWithBigIcon) ? Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenuBigIcon.prefab", content, false, true).WaitForCompletion() : ((fieldType != PanelFieldType.BigButton) ? Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenu.prefab", content, false, true).WaitForCompletion() : Addressables.InstantiateAsync((object)"PluginConfigurator/Fields/ConfigMenuBigButton.prefab", content, false, true).WaitForCompletion())));
				currentMenu = val3.GetComponent<ConfigMenuField>();
				((TMP_Text)currentMenu.name).text = displayName;
				if ((Object)(object)currentMenu.icon != (Object)null)
				{
					currentMenu.icon.sprite = icon;
				}
				if ((Object)(object)currentMenu.buttonText != (Object)null)
				{
					((TMP_Text)currentMenu.buttonText).text = _buttonText;
				}
				currentMenu.button.onClick = new ButtonClickedEvent();
				((UnityEvent)currentMenu.button.onClick).AddListener((UnityAction)delegate
				{
					OpenPanelInternally(openedExternally: false);
				});
				if ((Object)(object)currentMenu.fieldBg != (Object)null)
				{
					((Graphic)currentMenu.fieldBg).color = _fieldColor;
				}
				((Component)currentMenu).gameObject.SetActive(!hidden && !base.parentHidden);
				((Selectable)currentMenu.button).interactable = interactable && base.parentInteractable;
			}
			return val;
		}

		internal void CreateFieldUI()
		{
			if ((Object)(object)currentPanel == (Object)null || fieldsCreated)
			{
				return;
			}
			fieldsCreated = true;
			fieldObjects.Clear();
			int i = currentPanel.content.childCount;
			foreach (ConfigField field in fields)
			{
				List<Transform> list = new List<Transform>();
				if (field.createUI && !field.bridged)
				{
					field.CreateUI(currentPanel.content);
				}
				for (; i < currentPanel.content.childCount; i++)
				{
					list.Add(currentPanel.content.GetChild(i));
				}
				fieldObjects.Add(list);
			}
		}

		internal void OnPanelClose()
		{
			if (this.onPannelCloseEvent != null)
			{
				this.onPannelCloseEvent();
			}
		}

		internal void OnPanelOpen(bool external)
		{
			if (this.onPannelOpenEvent != null)
			{
				this.onPannelOpenEvent(external);
			}
		}

		internal void OpenPanelInternally(bool openedExternally)
		{
			if ((!openedExternally || !((Object)(object)PluginConfiguratorController.activePanel == (Object)null)) && !((Object)(object)currentPanel == (Object)null))
			{
				if ((Object)(object)PluginConfiguratorController.activePanel != (Object)null)
				{
					PluginConfiguratorController.activePanel.SetActive(false);
				}
				externalPanelOpenFlag = openedExternally;
				((Component)currentPanel).gameObject.SetActive(true);
				PluginConfiguratorController.activePanel = ((Component)currentPanel).gameObject;
			}
		}

		public void OpenPanel()
		{
			OpenPanelInternally(openedExternally: true);
		}

		public void ClosePanel()
		{
			if ((Object)(object)currentPanel != (Object)null && ((Component)currentPanel).gameObject.activeSelf)
			{
				((Component)currentPanel).gameObject.SetActive(false);
				if (base.parentPanel == null)
				{
					base.rootConfig.FlushAll();
					((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(true);
					PluginConfiguratorController.activePanel = ((Component)PluginConfiguratorController.mainPanel).gameObject;
				}
				else
				{
					base.parentPanel.ActivatePanel();
				}
			}
		}

		internal override void ReloadFromString(string data)
		{
			throw new NotImplementedException();
		}

		internal override void ReloadDefault()
		{
			throw new NotImplementedException();
		}
	}
	internal class PresetPanelComp : MonoBehaviour
	{
		private MenuEsc esc;

		private void Awake()
		{
			esc = ((Component)this).GetComponent<MenuEsc>();
		}

		private void OnEnable()
		{
			esc.previousPage = PluginConfiguratorController.activePanel;
			((Component)this).transform.SetSiblingIndex(((Component)this).transform.parent.childCount - 1);
		}

		private void OnDisable()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	internal static class PresetOldFileManager
	{
		public static string trashBinDir;

		public static string resetBinDir;

		private static readonly char[] pathSafeCharacters = new char[4] { '.', '-', '_', ' ' };

		public static void Init()
		{
			trashBinDir = Path.Combine(Paths.ConfigPath, "PluginConfigurator", "preset_trash_bin");
			resetBinDir = Path.Combine(Paths.ConfigPath, "PluginConfigurator", "preset_reset_bin");
			if (!Directory.Exists(trashBinDir))
			{
				Directory.CreateDirectory(trashBinDir);
			}
			if (!Directory.Exists(resetBinDir))
			{
				Directory.CreateDirectory(resetBinDir);
			}
		}

		public static void CheckForOldFiles()
		{
			string[] files = Directory.GetFiles(trashBinDir);
			for (int i = 0; i < files.Length; i++)
			{
				FileInfo fileInfo = new FileInfo(files[i]);
				if (fileInfo.CreationTime < DateTime.Now.AddDays(-7.0))
				{
					fileInfo.Delete();
				}
			}
			files = Directory.GetFiles(resetBinDir);
			for (int i = 0; i < files.Length; i++)
			{
				FileInfo fileInfo2 = new FileInfo(files[i]);
				if (fileInfo2.CreationTime < DateTime.Now.AddDays(-7.0))
				{
					fileInfo2.Delete();
				}
			}
		}

		private static string TurnToUniquePath(string path)
		{
			string directoryName = Path.GetDirectoryName(path);
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
			string extension = Path.GetExtension(path);
			int num = 0;
			string text = path;
			while (File.Exists(text))
			{
				text = Path.Combine(directoryName, $"{fileNameWithoutExtension}_{num++}{extension}");
			}
			return text;
		}

		private static string GetPathSafeString(string s)
		{
			StringBuilder stringBuilder = new StringBuilder();
			foreach (char c in s)
			{
				if (char.IsLetter(c) || char.IsDigit(c) || Array.IndexOf(pathSafeCharacters, c) != -1)
				{
					stringBuilder.Append(c);
				}
				else if (stringBuilder.Length != 0 && stringBuilder[stringBuilder.Length - 1] != '_')
				{
					stringBuilder.Append('_');
				}
			}
			if (stringBuilder.Length != 0)
			{
				return stringBuilder.ToString();
			}
			return "file";
		}

		public static void MoveFileToTrashBin(string path, string fileName)
		{
			if (File.Exists(path))
			{
				fileName = GetPathSafeString(fileName);
				string destFileName = TurnToUniquePath(Path.Combine(trashBinDir, fileName));
				File.Move(path, destFileName);
			}
		}

		public static void CopyFileToResetBin(string path, string fileName)
		{
			if (File.Exists(path))
			{
				fileName = GetPathSafeString(fileName);
				string destFileName = TurnToUniquePath(Path.Combine(resetBinDir, fileName));
				File.Copy(path, destFileName);
			}
		}
	}
	public class PluginConfigurator
	{
		internal class Preset
		{
			public readonly PluginConfigurator rootConfig;

			public string name;

			public string filePath;

			public string fileId;

			public int listIndex;

			public ConfigCustomPresetField currentUI;

			public bool markedForDelete;

			public Preset(PluginConfigurator config)
			{
				rootConfig = config;
			}

			public void SetButtonColor()
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)currentUI == (Object)null))
				{
					((Selectable)currentUI.preset).colors = GetButtonColor((rootConfig.currentPreset == this) ? Color.red : Color.white);
				}
			}

			public void SetResetInteractable()
			{
				if (!((Object)(object)currentUI == (Object)null))
				{
					((Selectable)currentUI.reset).interactable = rootConfig.currentPreset == this;
				}
			}

			public void CreateUI()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: 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_0075: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Expected O, but got Unknown
				//IL_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Expected O, but got Unknown
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Expected O, but got Unknown
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Expected O, but got Unknown
				if ((Object)(object)currentUI != (Object)null)
				{
					return;
				}
				currentUI = Addressables.InstantiateAsync((object)"PluginConfigurator/CustomPresetButton.prefab", rootConfig.presetPanel.content, false, true).WaitForCompletion().GetComponent<ConfigCustomPresetField>();
				currentUI.nameInput.SetTextWithoutNotify(name);
				((UnityEvent)currentUI.preset.onClick).AddListener((UnityAction)delegate
				{
					if (rootConfig.currentPreset != this)
					{
						rootConfig.ChangePreset(this);
					}
				});
				((Selectable)currentUI.reset).interactable = rootConfig.currentPreset == this;
				((UnityEvent)currentUI.reset.onClick).AddListener((UnityAction)delegate
				{
					if (rootConfig.currentPreset != this)
					{
						((Selectable)currentUI.reset).interactable = false;
					}
					else
					{
						rootConfig.ResetPreset(this);
					}
				});
				((UnityEvent)currentUI.edit.onClick).AddListener((UnityAction)delegate
				{
					((Selectable)currentUI.nameInput).interactable = true;
					((Selectable)currentUI.nameInput).Select();
				});
				((UnityEvent<string>)(object)currentUI.nameInput.onEndEdit).AddListener((UnityAction<string>)delegate(string newVal)
				{
					((Selectable)currentUI.nameInput).interactable = false;
					if (!(name == newVal))
					{
						rootConfig.isPresetHeaderDirty = true;
						name = newVal;
						currentUI.nameInput.SetTextWithoutNotify(newVal);
					}
				});
				((UnityEvent)currentUI.delete.onClick).AddListener((UnityAction)delegate
				{
					rootConfig.DeletePreset(this);
				});
				((UnityEvent)currentUI.moveUp.onClick).AddListener((UnityAction)delegate
				{
					if (((Component)currentUI).transform.GetSiblingIndex() > 1)
					{
						((Component)currentUI).transform.SetSiblingIndex(((Component)currentUI).transform.GetSiblingIndex() - 1);
						rootConfig.SetPresetIndexFromUi();
					}
				});
				((UnityEvent)currentUI.moveDown.onClick).AddListener((UnityAction)delegate
				{
					if (((Component)currentUI).transform.GetSiblingIndex() < ((Component)currentUI).transform.parent.childCount - 2)
					{
						((Component)currentUI).transform.SetSiblingIndex(((Component)currentUI).transform.GetSiblingIndex() + 1);
						rootConfig.SetPresetIndexFromUi();
					}
				});
				SetButtonColor();
			}

			public int GetListIndexFromUI()
			{
				if (!((Object)(object)currentUI == (Object)null))
				{
					return ((Component)currentUI).transform.GetSiblingIndex() - 1;
				}
				return listIndex;
			}
		}

		public delegate void PreConfigChangeEvent();

		public delegate void PostConfigChangeEvent();

		public delegate void PrePresetChangeEvent(string presetIdBefore, string presetIdAfter);

		public delegate void PostPresetChangeEvent(string presetIdBefore, string presetIdAfter);

		public delegate void PrePresetResetEvent(string presetId);

		public delegate void PostPresetResetEvent(string presetId);

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

			public static Func<Preset, int> <>9__80_0;

			public static Func<KeyValuePair<int, List<ConfigField>>, int> <>9__85_0;

			public static Func<KeyValuePair<int, List<ConfigField>>, List<ConfigField>> <>9__85_1;

			public static Func<KeyValuePair<int, List<ConfigField>>, int> <>9__86_0;

			public static Func<KeyValuePair<int, List<ConfigField>>, List<ConfigField>> <>9__86_1;

			public static Func<Preset, bool> <>9__117_0;

			public static UnityAction <>9__127_0;

			internal int <ReorderAllPresetsFromId>b__80_0(Preset p)
			{
				return p.listIndex;
			}

			internal int <ChangePreset>b__85_0(KeyValuePair<int, List<ConfigField>> i)
			{
				return i.Key;
			}

			internal List<ConfigField> <ChangePreset>b__85_1(KeyValuePair<int, List<ConfigField>> i)
			{
				return i.Value;
			}

			internal int <ResetPreset>b__86_0(KeyValuePair<int, List<ConfigField>> i)
			{
				return i.Key;
			}

			internal List<ConfigField> <ResetPreset>b__86_1(KeyValuePair<int, List<ConfigField>> i)
			{
				return i.Value;
			}

			internal bool <FlushPresets>b__117_0(Preset preset)
			{
				return !preset.markedForDelete;
			}

			internal void <CreateUI>b__127_0()
			{
				((Component)PluginConfiguratorController.mainPanel).gameObject.SetActive(false);
			}
		}

		private const string ASSET_PATH_PRESET_BUTTON = "PluginConfigurator/PresetButton.prefab";

		private const string ASSET_PATH_PRESET_PANEL = "PluginConfigurator/PresetPanel.prefab";

		private const string ASSET_PATH_PRESET_ADD_BUTTON = "PluginConfigurator/PresetAddButton.prefab";

		private const string ASSET_PATH_DEFAULT_PRESET_BUTTON = "PluginConfigurator/DefaultPresetButton.prefab";

		private const string ASSET_PATH_CUSTOM_PRESET_BUTTON = "PluginConfigurator/CustomPresetButton.prefab";

		private string _displayName;

		private bool _hidden;

		private bool _interactable = true;

		private Sprite _image;

		private bool _presetButtonHidden;

		private bool _presetButtonInteractable = true;

		internal bool presetButtonCanBeShown;

		internal ConfigPluginMenuField configMenu;

		internal ConfigButtonField presetMenuButton;

		internal ConfigPresetPanelField presetPanel;

		internal ConfigDefaultPresetButtonField defaultPresetButton;

		internal ConfigButtonField addPresetButton;

		internal bool isDirty;

		internal Dictionary<string, string> config = new Dictionary<string, string>();

		internal Dictionary<string, ConfigField> fields = new Dictionary<string, ConfigField>();

		internal bool isPresetHeaderDirty;

		internal List<Preset> presets = new List<Preset>();

		private Preset currentPreset;

		public bool saveToFile = true;

		public string displayName
		{
			get
			{
				return _displayName;
			}
			set
			{
				_displayName = value;
				if ((Object)(object)configMenu != (Object)null)
				{
					((TMP_Text)configMenu.name).text = _displayName;
				}
			}
		}

		public string guid { get; private set; }

		public ConfigPanel rootPanel { get; private set; }

		public bool hidden
		{
			get
			{
				return _hidden;
			}
			set
			{
				_hidden = value;
				if ((Object)(object)configMenu != (Object)null)
				{
					((Component)configMenu).gameObject.SetActive(!value);
				}
			}
		}

		public bool interactable
		{
			get
			{
				return _interactable;
			}
			set
			{
				_interactable = value;
				if ((Object)(object)configMenu != (Object)null)
				{
					((Selectable)configMenu.button).interactable = value;
				}
			}
		}

		public Sprite image
		{
			get
			{
				return _image;
			}
			set
			{
				_image = value;
				if ((Object)(object)configMenu != (Object)null)
				{
					configMenu.icon.sprite = _image ?? PluginConfiguratorController.defaultPluginIcon;
				}
			}
		}

		public Sprite icon
		{
			get
			{
				return image;
			}
			set
			{
				image = value;
			}
		}

		public bool presetButtonHidden
		{
			get
			{
				return _presetButtonHidden;
			}
			set
			{
				_presetButtonHidden = value;
				if ((Object)(object)presetMenuButton != (Object)null)
				{
					((Component)presetMenuButton).gameObject.SetActive(presetButtonCanBeShown && !_presetButtonHidden);
				}
			}
		}

		public bool presetButtonInteractable
		{
			get
			{
				return _presetButtonInteractable;
			}
			set
			{
				_presetButtonInteractable = value;
				if ((Object)(object)presetMenuButton != (Object)null)
				{
					((Selectable)presetMenuButton.button).interactable = value;
				}
			}
		}

		public string currentPresetName
		{
			get
			{
				if (currentPreset != null)
				{
					return currentPreset.name;
				}
				return null;
			}
		}

		public string currentPresetId
		{
			get
			{
				if (currentPreset != null)
				{
					return currentPreset.fileId;
				}
				return null;
			}
		}

		public string defaultConfigFilePath => Path.Combine(Paths.ConfigPath, "PluginConfigurator", guid + ".config");

		public string currentConfigFilePath
		{
			get
			{
				if (currentPreset != null)
				{
					return currentPreset.filePath;
				}
				return defaultConfigFilePath;
			}
		}

		public string configFolderPath => Path.Combine(Paths.ConfigPath, "PluginConfigurator");

		public string configPresetsFolderPath => Path.Combine(Paths.ConfigPath, "PluginConfigurator", guid + "_presets");

		public bool changingPreset { get; private set; }

		public bool resetting { get; private set; }

		internal string configPresetsHeaderPath => Path.Combine(Paths.ConfigPath, "PluginConfigurator", guid + "_presets", "config.txt");

		private string currentPresetHeaderName
		{
			get
			{
				if (currentPreset != null)
				{
					return currentPreset.name;
				}
				return "[Default Config]";
			}
		}

		public bool firstTime { get; private set; }

		public event PreConfigChangeEvent preConfigChange;

		public event PostConfigChangeEvent postConfigChange;

		public event PrePresetChangeEvent prePresetChangeEvent;

		public event PostPresetChangeEvent postPresetChangeEvent;

		public event PrePresetResetEvent prePresetResetEvent;

		public event PostPresetResetEvent postPresetResetEvent;

		public void SetIconWithURL(string url)
		{
			UnityWebRequest iconDownload = UnityWebRequestTexture.GetTexture(url);
			((AsyncOperation)iconDownload.SendWebRequest()).completed += delegate
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if (!iconDownload.isHttpError && !iconDownload.isNetworkError)
					{
						Texture2D content = DownloadHandlerTexture.GetContent(iconDownload);
						Sprite val = Sprite.Create(content, new Rect(0f, 0f, (float)((Texture)content).width, (float)((Texture)content).height), new Vector2(0.5f, 0.5f));
						image = val;
					}
				}
				finally
				{
					iconDownload.Dispose();
				}
			};
		}

		private static ColorBlock GetButtonColor(Color clr)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock defaultColorBlock = ColorBlock.defaultColorBlock;
			((ColorBlock)(ref defaultColorBlock)).normalColor = clr;
			((ColorBlock)(ref defaultColorBlock)).pressedColor = clr * 0.5f;
			((ColorBlock)(ref defaultColorBlock)).selectedColor = clr * 0.7f;
			((ColorBlock)(ref defaultColorBlock)).highlightedColor = clr * 0.6f;
			return defaultColorBlock;
		}

		private Preset CreatePreset(Preset newPreset)
		{
			presets.Add(newPreset);
			if ((Object)(object)presetPanel != (Object)null)
			{
				newPreset.CreateUI();
			}
			isPresetHeaderDirty = true;
			return newPreset;
		}

		private void ReorderAllPresetsFromId()
		{
			if ((Object)(object)presetPanel == (Object)null)
			{
				return;
			}
			((Component)defaultPresetButton).transform.SetSiblingIndex(0);
			int num = 0;
			foreach (Preset item in presets.OrderBy((Preset p) => p.listIndex))
			{
				if ((Object)(object)item.currentUI == (Object)null)
				{
					item.CreateUI();
				}
				((Component)item.currentUI).transform.SetSiblingIndex(num + 1);
				if (item.listIndex != num)
				{
					item.listIndex = num;
					isPresetHeaderDirty = true;
				}
				num++;
			}
			if (isPresetHeaderDirty)
			{
				FlushPresets();
			}
			((Component)addPresetButton).transform.SetAsLastSibling();
		}

		private void RecolorAllPresets()
		{
			//IL_0029: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)presetPanel == (Object)null)
			{
				return;
			}
			((Selectable)defaultPresetButton.button).colors = GetButtonColor((currentPreset == null) ? Color.red : Color.white);
			foreach (Preset preset in presets)
			{
				preset.SetButtonColor();
			}
		}

		private void ResetPresetButtons()
		{
			if ((Object)(object)presetPanel == (Object)null)
			{
				return;
			}
			((Selectable)defaultPresetButton.reset).interactable = currentPreset == null;
			foreach (Preset preset in presets)
			{
				preset.SetResetInteractable();
			}
		}

		private void SetPresetIndexFromUi()
		{
			if ((Object)(object)presetPanel == (Object)null)
			{
				return;
			}
			foreach (Preset preset in presets)
			{
				if ((Object)(object)preset.currentUI == (Object)null)
				{
					preset.CreateUI();
					((Component)preset.currentUI).transform.SetSiblingIndex(((Component)preset.currentUI).transform.parent.childCount - 2);
				}
				int num = ((Component)preset.currentUI).transform.GetSiblingIndex() - 1;
				if (num != preset.lis

plugins/PluginConfigurator/PluginConfiguratorComponents.dll

Decompiled 7 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PluginConfiguratorComponents")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+49e15bd76cadd6844686f5be87ca6886eaea29ac")]
[assembly: AssemblyProduct("PluginConfiguratorComponents")]
[assembly: AssemblyTitle("PluginConfiguratorComponents")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PluginConfiguratorComponents;

public class ConfigButtonField : MonoBehaviour
{
	public TextMeshProUGUI text;

	public Button button;

	public RectTransform rect;
}
public class ConfigColorField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Image fieldBg;

	public Image image;

	public Slider red;

	public Slider green;

	public Slider blue;

	public TMP_InputField redInput;

	public TMP_InputField greenInput;

	public TMP_InputField blueInput;

	public Button resetButton;

	public void SliderSetR(float newR)
	{
		redInput.SetTextWithoutNotify(((int)(red.normalizedValue * 255f)).ToString());
		SetColor();
	}

	public void SliderSetG(float newG)
	{
		greenInput.SetTextWithoutNotify(((int)(green.normalizedValue * 255f)).ToString());
		SetColor();
	}

	public void SliderSetB(float newB)
	{
		blueInput.SetTextWithoutNotify(((int)(blue.normalizedValue * 255f)).ToString());
		SetColor();
	}

	public void SetColor()
	{
		SetColor(red.value, green.value, blue.value);
	}

	public void SetColor(float newR, float newG, float newB)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		((Graphic)image).color = new Color(newR, newG, newB);
	}
}
public class ConfigCustomPresetField : MonoBehaviour
{
	public Button preset;

	public TMP_InputField nameInput;

	public Button reset;

	public Button edit;

	public Button delete;

	public Button moveUp;

	public Button moveDown;
}
public class ConfigDefaultPresetButtonField : MonoBehaviour
{
	public Button button;

	public Button reset;
}
public class ConfigDropdownField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public TMP_Dropdown dropdown;

	public Image fieldBg;

	public Button resetButton;
}
public class ConfigFormattedInputField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public TMP_InputField input;

	public TextMeshProUGUI text;

	public Button edit;

	public Image fieldBg;

	public Button reset;
}
public class ConfigFormattedStringEditorField : MonoBehaviour
{
	public MenuEsc menuEsc;

	public InputField input;

	public Text displayText;

	public Text formattedText;

	public Image preview;

	public Slider redSlider;

	public Slider greenSlider;

	public Slider blueSlider;

	public TMP_InputField redInput;

	public TMP_InputField greenInput;

	public TMP_InputField blueInput;

	public Toggle bold;

	public Toggle italic;

	public void SetRed(float val)
	{
		redInput.SetTextWithoutNotify(((int)(redSlider.normalizedValue * 255f)).ToString());
		SetColor();
	}

	public void SetGreen(float val)
	{
		greenInput.SetTextWithoutNotify(((int)(greenSlider.normalizedValue * 255f)).ToString());
		SetColor();
	}

	public void SetBlue(float val)
	{
		blueInput.SetTextWithoutNotify(((int)(blueSlider.normalizedValue * 255f)).ToString());
		SetColor();
	}

	public void SetColor()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		Color color = default(Color);
		((Color)(ref color))..ctor(redSlider.normalizedValue, greenSlider.normalizedValue, blueSlider.normalizedValue);
		((Graphic)preview).color = color;
	}
}
public class ConfigHeaderField : MonoBehaviour
{
	public RectTransform rect;

	public TextMeshProUGUI text;
}
public class ConfigInputField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public TMP_InputField input;

	public Image fieldBg;

	public Button resetButton;
}
public class ConfigKeycodeField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Button keycode;

	public TextMeshProUGUI keycodeText;

	public Image fieldBg;

	public Button resetButton;
}
public class ConfigMenuField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Button button;

	public Image fieldBg;

	public TextMeshProUGUI buttonText;

	public Image icon;
}
public class ConfigPanelConcrete : MonoBehaviour
{
	public TextMeshProUGUI header;

	public VerticalLayoutGroup layout;

	public RectTransform trans;

	public ScrollRect rect;

	public Transform content;

	public ContentSizeFitter contentSizeFitter;
}
public class ConfigPanelField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Button button;

	public Image icon;
}
public class ConfigPanelVirtual : MonoBehaviour
{
	public VerticalLayoutGroup layout;

	public RectTransform trans;

	public ContentSizeFitter contentSizeFitter;

	public Transform content;
}
public class ConfigPluginMenuField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Image icon;

	public Button button;
}
public class ConfigPresetPanelField : MonoBehaviour
{
	public Transform content;

	public ScrollRect rect;

	public Button export;

	public Button openFolder;
}
public class ConfigSliderField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Slider slider;

	public Button resetButton;
}
public class ConfigToggleField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Toggle toggle;

	public Image checkmark;

	public Image fieldBg;

	public Button resetButton;
}
public class ConfigValueSliderField : MonoBehaviour
{
	public TextMeshProUGUI name;

	public Slider slider;

	public TMP_InputField input;

	public Image fieldBg;

	public Button resetButton;
}
public class DisableWhenHidden : MonoBehaviour
{
	private void OnDisable()
	{
		((Component)this).gameObject.SetActive(false);
	}
}