Decompiled source of EasySettings v1.2.1

plugins/EasySettings.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Nessie.ATLYSS.EasySettings.Extensions;
using Nessie.ATLYSS.EasySettings.Prefabs;
using Nessie.ATLYSS.EasySettings.UIElements;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EasySettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+919d3f75b58234968cddabebe9f4fe7fa187c146")]
[assembly: AssemblyProduct("Easy Settings API")]
[assembly: AssemblyTitle("EasySettings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.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 Nessie.ATLYSS.EasySettings
{
	public class ComponentReferences : MonoBehaviour
	{
		public List<Component> components = new List<Component>();
	}
	[BepInPlugin("EasySettings", "Easy Settings API", "1.2.1")]
	[BepInProcess("ATLYSS.exe")]
	public class EasySettingsPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__2_0;

			internal void <TryAddModTabButton>b__2_0()
			{
				SettingsManager._current.Set_SettingMenuSelectionIndex(Settings.ModTabIndex);
			}
		}

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0011: 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_0032: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("EasySettings").PatchAll();
			SettingsPatches.OnSettingsMenuInitialized.AddListener((UnityAction)delegate
			{
				if (TryAddModTabButton())
				{
					AddModTabBottomSpace();
					Settings.OnInitialized.Invoke();
				}
			});
		}

		private bool TryAddModTabButton()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			if (!Utility.TryGetNextUnusedMenuIndex(out var index))
			{
				Logger.LogError((object)"Unable to find unused menu index to use for 'Mods' tab. EasySettings won't be available.");
				return false;
			}
			Settings.ModTabIndex = index;
			AtlyssTabButton atlyssTabButton = Settings.AddTabButton("Mods");
			UnityEvent onClicked = atlyssTabButton.OnClicked;
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					SettingsManager._current.Set_SettingMenuSelectionIndex(Settings.ModTabIndex);
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			onClicked.AddListener((UnityAction)obj);
			Settings.ModTab.TabButton = atlyssTabButton;
			return true;
		}

		private void AddModTabBottomSpace()
		{
			Settings.ModTab.BottomSpace = Settings.ModTab.AddSpace();
		}
	}
	public static class SettingsPatches
	{
		[HarmonyPatch(typeof(SettingsManager), "Update")]
		private static class MenuUpdate
		{
			[HarmonyPostfix]
			private static void SelectHighlightModTab(SettingsManager __instance)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				if ((int)__instance._currentSettingsMenuSelection == Settings.ModTabIndex)
				{
					((Component)__instance._selectHighlight).transform.position = ((Transform)ModTab.TabButton.Root).position;
				}
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Start")]
		private static class MenuInitialization
		{
			[Serializable]
			[CompilerGenerated]
			private sealed class <>c
			{
				public static readonly <>c <>9 = new <>c();

				public static UnityAction <>9__0_0;

				internal void <InitializeModTab>b__0_0()
				{
					Settings.OnCancelSettings.Invoke();
				}
			}

			[HarmonyPostfix]
			private static void InitializeModTab(SettingsManager __instance)
			{
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: 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_00e0: Expected O, but got Unknown
				Transform val = Utility.FindTabsContainer(__instance);
				if (!Object.op_Implicit((Object)(object)val))
				{
					EasySettingsPlugin.Logger.LogError((object)"Unable to find settings tabs container GameObject. EasySettings won't be available.");
					return;
				}
				HorizontalLayoutGroup component = ((Component)val).GetComponent<HorizontalLayoutGroup>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					EasySettingsPlugin.Logger.LogError((object)"Settings tabs container GameObject does not have a HorizontalLayoutGroup. EasySettings won't be available.");
					return;
				}
				((HorizontalOrVerticalLayoutGroup)component).spacing = 8f;
				((LayoutGroup)component).padding.right = ((LayoutGroup)component).padding.left;
				((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
				RectTransform selectHighlight = __instance._selectHighlight;
				selectHighlight.sizeDelta = new Vector2(110.4f, selectHighlight.sizeDelta.y);
				Button val2 = Utility.FindCancelButton(__instance);
				if (Object.op_Implicit((Object)(object)val2))
				{
					ButtonClickedEvent onClick = val2.onClick;
					object obj = <>c.<>9__0_0;
					if (obj == null)
					{
						UnityAction val3 = delegate
						{
							Settings.OnCancelSettings.Invoke();
						};
						<>c.<>9__0_0 = val3;
						obj = (object)val3;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj);
				}
				Button val4 = Utility.FindApplyButton(__instance);
				if (!Object.op_Implicit((Object)(object)val4))
				{
					EasySettingsPlugin.Logger.LogWarning((object)"Unable to find Apply Button. Saving the settings will not be possible during this play session.");
				}
				TemplateManager.Initialize();
				OnSettingsMenuInitialized.Invoke();
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Close_SettingsMenu")]
		private static class MenuClose
		{
			[HarmonyPostfix]
			private static void CloseSettings()
			{
				Settings.OnCloseSettings.Invoke();
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Save_SettingsData")]
		private static class SaveSettings
		{
			[HarmonyPostfix]
			private static void ApplySettings()
			{
				Settings.OnApplySettings.Invoke();
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Set_SettingMenuSelectionIndex")]
		private static class MenuSelection
		{
			[HarmonyPostfix]
			private static void ApplySelection(SettingsManager __instance)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Invalid comparison between Unknown and I4
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)ModTab.Element))
				{
					ModTab.Element.isEnabled = (int)__instance._currentSettingsMenuSelection == Settings.ModTabIndex;
				}
				if (Object.op_Implicit((Object)(object)ModTab.Content))
				{
					ModTab.Content.anchoredPosition = Vector2.zero;
				}
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "Handle_InputParameters")]
		private static class ListenForKeyChanges
		{
			[HarmonyPrefix]
			private static void RecordKeys(SettingsManager __instance, out string[] __state)
			{
				if (!__instance._waitingForKey)
				{
					__state = null;
					return;
				}
				KeyBindButton[] keyBindButtons = __instance.keyBindButtons;
				string[] array = new string[keyBindButtons.Length];
				for (int i = 0; i < keyBindButtons.Length; i++)
				{
					array[i] = keyBindButtons[i]?._keyBind;
				}
				__state = array;
			}

			[HarmonyPostfix]
			private static void CompareKeys(SettingsManager __instance, string[] __state)
			{
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				if (__state == null)
				{
					return;
				}
				KeyBindButton[] keyBindButtons = __instance.keyBindButtons;
				for (int i = 0; i < keyBindButtons.Length; i++)
				{
					string text = __state[i];
					string keyBind = keyBindButtons[i]._keyBind;
					if (!(text == keyBind) && SettingsTab.KeyButtonIndexToKeyButton.ContainsKey(i))
					{
						SettingsTab.KeyButtonIndexToKeyButton[i].SetValue(Enum.Parse<KeyCode>(keyBind));
					}
				}
			}
		}

		[HarmonyPatch(typeof(SettingsManager), "OnGUI")]
		private static class ListenForKeyChanges2
		{
			[HarmonyPrefix]
			private static void RecordKeys(SettingsManager __instance, out string[] __state)
			{
				if (!__instance._waitingForKey)
				{
					__state = null;
					return;
				}
				KeyBindButton[] keyBindButtons = __instance.keyBindButtons;
				string[] array = new string[keyBindButtons.Length];
				for (int i = 0; i < keyBindButtons.Length; i++)
				{
					array[i] = keyBindButtons[i]?._keyBind;
				}
				__state = array;
			}

			[HarmonyPostfix]
			private static void CompareKeys(SettingsManager __instance, string[] __state)
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				if (__state == null)
				{
					return;
				}
				KeyBindButton[] keyBindButtons = __instance.keyBindButtons;
				for (int i = 0; i < keyBindButtons.Length; i++)
				{
					string text = __state[i];
					string keyBind = keyBindButtons[i]._keyBind;
					if (!(text == keyBind) && SettingsTab.KeyButtonIndexToKeyButton.TryGetValue(i, out var value))
					{
						value.SetValue(Enum.Parse<KeyCode>(keyBind));
					}
				}
			}
		}

		internal static UnityEvent OnSettingsMenuInitialized { get; } = new UnityEvent();


		private static SettingsTab ModTab => Settings.ModTab;
	}
	public static class Settings
	{
		private const string CREATE_TAB_NOTE = "Sorry, but this mod currently doesn't have any way to handle overflowing the tabs container, so the functions to create more tabs will have to be inaccessible for now.";

		public static SettingsTab ModTab { get; } = new SettingsTab();


		public static UnityEvent OnInitialized { get; } = new UnityEvent();


		public static UnityEvent OnCancelSettings { get; } = new UnityEvent();


		public static UnityEvent OnApplySettings { get; } = new UnityEvent();


		public static UnityEvent OnCloseSettings { get; } = new UnityEvent();


		internal static int ModTabIndex { get; set; }

		internal static SettingsTab AddTab(string label)
		{
			return new SettingsTab();
		}

		internal static AtlyssTabButton AddTabButton(string label)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			SettingsManager current = SettingsManager._current;
			Transform val = Utility.FindTabsContainer(current);
			AtlyssTabButton atlyssTabButton = TemplateManager.CreateTabButton((RectTransform)val);
			atlyssTabButton.Label.text = label;
			((Component)atlyssTabButton.Root).gameObject.SetActive(true);
			return atlyssTabButton;
		}
	}
	public class SettingsTab
	{
		private const float DEFAULT_SLIDER_MIN = 0f;

		private const float DEFAULT_SLIDER_MAX = 1f;

		private const string PLACEHOLDER_DEFAULT_TEXT = "Text...";

		public AtlyssTabButton TabButton;

		public MenuElement Element;

		public RectTransform Content;

		public List<BaseAtlyssElement> ContentElements = new List<BaseAtlyssElement>();

		internal AtlyssSpace BottomSpace;

		internal static Dictionary<int, AtlyssKeyButton> KeyButtonIndexToKeyButton = new Dictionary<int, AtlyssKeyButton>();

		public AtlyssSpace AddSpace()
		{
			AtlyssSpace atlyssSpace = TemplateManager.CreateSpace(Content);
			((Component)atlyssSpace.Root).gameObject.SetActive(true);
			PushElement(atlyssSpace);
			return atlyssSpace;
		}

		public AtlyssHeader AddHeader(string label)
		{
			AtlyssHeader atlyssHeader = TemplateManager.CreateHeader(Content);
			atlyssHeader.Label.text = label;
			((Component)atlyssHeader.Root).gameObject.SetActive(true);
			PushElement(atlyssHeader);
			return atlyssHeader;
		}

		public AtlyssButton AddButton(string buttonLabel, UnityAction onClick)
		{
			AtlyssButton atlyssButton = AddButton(buttonLabel);
			((UnityEvent)atlyssButton.Button.onClick).AddListener(onClick);
			return atlyssButton;
		}

		public AtlyssButton AddButton(string buttonLabel)
		{
			AtlyssButton atlyssButton = TemplateManager.CreateButton(Content);
			atlyssButton.ButtonLabel.text = buttonLabel;
			((Component)atlyssButton.Root).gameObject.SetActive(true);
			PushElement(atlyssButton);
			return atlyssButton;
		}

		public AtlyssToggle AddToggle(ConfigEntry<bool> config)
		{
			return AddToggle(((ConfigEntryBase)config).Definition.Key, config);
		}

		public AtlyssToggle AddToggle(string label, ConfigEntry<bool> config)
		{
			AtlyssToggle atlyssToggle = AddToggle(label, config.Value);
			atlyssToggle.OnValueChanged.AddListener((UnityAction<bool>)delegate(bool newValue)
			{
				config.Value = newValue;
			});
			return atlyssToggle;
		}

		public AtlyssToggle AddToggle(string label, bool value = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			AtlyssToggle element = TemplateManager.CreateToggle(Content);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				element.Revert();
			});
			Settings.OnApplySettings.AddListener((UnityAction)delegate
			{
				element.Apply();
			});
			element.Label.text = label;
			element.Toggle.SetIsOnWithoutNotify(value);
			element.Apply();
			((Component)element.Root).gameObject.SetActive(true);
			PushElement(element);
			return element;
		}

		public AtlyssSimpleSlider AddSlider(ConfigEntry<float> config, bool wholeNumbers = false)
		{
			return AddSlider(((ConfigEntryBase)config).Definition.Key, config, wholeNumbers);
		}

		public AtlyssSimpleSlider AddSlider(string label, ConfigEntry<float> config, bool wholeNumbers = false)
		{
			float min = 0f;
			float max = 1f;
			if (((ConfigEntryBase)config).Description.AcceptableValues is AcceptableValueRange<float> val)
			{
				min = val.MinValue;
				max = val.MaxValue;
			}
			AtlyssSimpleSlider atlyssSimpleSlider = AddSlider(label, config.Value, min, max, wholeNumbers);
			atlyssSimpleSlider?.OnValueChanged.AddListener((UnityAction<float>)delegate(float newValue)
			{
				config.Value = newValue;
			});
			return atlyssSimpleSlider;
		}

		public AtlyssSimpleSlider AddSlider(string label, float value = 0f, float min = 0f, float max = 1f, bool wholeNumbers = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			AtlyssSimpleSlider element = TemplateManager.CreateSimpleSlider(Content);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				element.Revert();
			});
			Settings.OnApplySettings.AddListener((UnityAction)delegate
			{
				element.Apply();
			});
			element.Label.text = label;
			element.Slider.wholeNumbers = wholeNumbers;
			element.Slider.minValue = min;
			element.Slider.maxValue = max;
			element.Slider.SetValueWithoutNotify(value);
			element.Apply();
			((Component)element.Root).gameObject.SetActive(true);
			PushElement(element);
			return element;
		}

		public AtlyssAdvancedSlider AddAdvancedSlider(ConfigEntry<int> config)
		{
			return AddAdvancedSlider(((ConfigEntryBase)config).Definition.Key, config);
		}

		public AtlyssAdvancedSlider AddAdvancedSlider(string label, ConfigEntry<int> config)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			float min = 0f;
			float max = 1f;
			if (((ConfigEntryBase)config).Description.AcceptableValues is AcceptableValueRange<int> val)
			{
				min = val.MinValue;
				max = val.MaxValue;
			}
			AtlyssAdvancedSlider element = AddAdvancedSlider(label, config.Value, min, max, wholeNumbers: true);
			element?.OnValueChanged.AddListener((UnityAction<float>)delegate(float newValue)
			{
				config.Value = Mathf.RoundToInt(newValue);
			});
			AtlyssAdvancedSlider atlyssAdvancedSlider = element;
			if (atlyssAdvancedSlider != null)
			{
				atlyssAdvancedSlider.OnResetClicked.AddListener((UnityAction)delegate
				{
					element.SetValue(Convert.ToSingle(((ConfigEntryBase)config).DefaultValue));
				});
			}
			return element;
		}

		public AtlyssAdvancedSlider AddAdvancedSlider(ConfigEntry<float> config, bool wholeNumbers = false)
		{
			return AddAdvancedSlider(((ConfigEntryBase)config).Definition.Key, config, wholeNumbers);
		}

		public AtlyssAdvancedSlider AddAdvancedSlider(string label, ConfigEntry<float> config, bool wholeNumbers = false)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			float min = 0f;
			float max = 1f;
			if (((ConfigEntryBase)config).Description.AcceptableValues is AcceptableValueRange<float> val)
			{
				min = val.MinValue;
				max = val.MaxValue;
			}
			AtlyssAdvancedSlider element = AddAdvancedSlider(label, config.Value, min, max, wholeNumbers);
			element?.OnValueChanged.AddListener((UnityAction<float>)delegate(float newValue)
			{
				config.Value = newValue;
			});
			AtlyssAdvancedSlider atlyssAdvancedSlider = element;
			if (atlyssAdvancedSlider != null)
			{
				atlyssAdvancedSlider.OnResetClicked.AddListener((UnityAction)delegate
				{
					element.SetValue((float)((ConfigEntryBase)config).DefaultValue);
				});
			}
			return element;
		}

		public AtlyssAdvancedSlider AddAdvancedSlider(string label, float value = 0f, float min = 0f, float max = 1f, bool wholeNumbers = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			AtlyssAdvancedSlider element = TemplateManager.CreateAdvancedSlider(Content);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				element.Revert();
			});
			Settings.OnApplySettings.AddListener((UnityAction)delegate
			{
				element.Apply();
			});
			element.Label.text = label;
			element.ValueText.text = value.ToString(CultureInfo.InvariantCulture);
			element.Slider.wholeNumbers = wholeNumbers;
			element.Slider.minValue = min;
			element.Slider.maxValue = max;
			element.Slider.SetValueWithoutNotify(value);
			element.Apply();
			((UnityEvent<float>)(object)element.Slider.onValueChanged).AddListener((UnityAction<float>)delegate(float newValue)
			{
				element.ValueText.text = newValue.ToString(CultureInfo.InvariantCulture);
			});
			((Component)element.Root).gameObject.SetActive(true);
			PushElement(element);
			return element;
		}

		public AtlyssDropdown AddDropdown<T>(ConfigEntry<T> config) where T : Enum
		{
			return AddDropdown<T>(((ConfigEntryBase)config).Definition.Key, config);
		}

		public AtlyssDropdown AddDropdown<T>(string label, ConfigEntry<T> config) where T : Enum
		{
			Type type = config.Value.GetType();
			string[] names = Enum.GetNames(type);
			int index = config.Value.GetIndex();
			AtlyssDropdown atlyssDropdown = AddDropdown(label, names, index);
			atlyssDropdown.OnValueChanged.AddListener((UnityAction<int>)delegate(int newValue)
			{
				config.Value = EnumExtensions.FromIndex<T>(newValue);
			});
			return atlyssDropdown;
		}

		public AtlyssDropdown AddDropdown(string label, string[] options, int value = 0)
		{
			return AddDropdown(label, options.ToList(), value);
		}

		public AtlyssDropdown AddDropdown(string label, List<string> options, int value = 0)
		{
			AtlyssDropdown atlyssDropdown = AddDropdown(label);
			atlyssDropdown.Dropdown.AddOptions(options);
			atlyssDropdown.Dropdown.SetValueWithoutNotify(value);
			atlyssDropdown.Apply();
			PushElement(atlyssDropdown);
			return atlyssDropdown;
		}

		public AtlyssDropdown AddDropdown(string label, List<Sprite> options, int value = 0)
		{
			AtlyssDropdown atlyssDropdown = AddDropdown(label);
			atlyssDropdown.Dropdown.AddOptions(options);
			atlyssDropdown.Dropdown.SetValueWithoutNotify(value);
			atlyssDropdown.Apply();
			PushElement(atlyssDropdown);
			return atlyssDropdown;
		}

		public AtlyssDropdown AddDropdown(string label)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			AtlyssDropdown element = TemplateManager.CreateDropdown(Content);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				element.Revert();
			});
			Settings.OnApplySettings.AddListener((UnityAction)delegate
			{
				element.Apply();
			});
			element.Label.text = label;
			((Component)element.Root).gameObject.SetActive(true);
			PushElement(element);
			return element;
		}

		public AtlyssKeyButton AddKeyButton(ConfigEntry<KeyCode> config)
		{
			return AddKeyButton(((ConfigEntryBase)config).Definition.Key, config);
		}

		public AtlyssKeyButton AddKeyButton(string label, ConfigEntry<KeyCode> config)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			AtlyssKeyButton atlyssKeyButton = AddKeyButton(label, config.Value);
			atlyssKeyButton.OnValueChanged.AddListener((UnityAction<KeyCode>)delegate(KeyCode newValue)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				config.Value = newValue;
			});
			return atlyssKeyButton;
		}

		public AtlyssKeyButton AddKeyButton(string label, KeyCode value = 0)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			AtlyssKeyButton element = TemplateManager.CreateKeyButton(Content);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				element.Revert();
			});
			Settings.OnApplySettings.AddListener((UnityAction)delegate
			{
				element.Apply();
			});
			element.Label.text = label;
			element.SetValue(value);
			element.Apply();
			((Component)element.Root).gameObject.SetActive(true);
			RegisterKeyButton(element);
			PushElement(element);
			return element;
		}

		private static void RegisterKeyButton(AtlyssKeyButton element)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			SettingsManager manager = SettingsManager._current;
			KeyBindButton keyButton = new KeyBindButton
			{
				_inputReference = "",
				_keyBind = element.ButtonLabel.text,
				_button = element.Button,
				_buttonLabel = element.ButtonLabel
			};
			int newButtonIndex = manager.keyBindButtons.Length;
			((UnityEvent)keyButton._button.onClick).AddListener((UnityAction)delegate
			{
				manager.OnClick_KeybindButton(newButtonIndex);
			});
			KeyButtonIndexToKeyButton.Add(newButtonIndex, element);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				keyButton._keyBind = element.ButtonLabel.text;
			});
			manager.keyBindButtons = CollectionExtensions.AddToArray<KeyBindButton>(manager.keyBindButtons, keyButton);
		}

		public AtlyssTextField AddTextField(ConfigEntry<string> config, string placeholder = "Text...")
		{
			return AddTextField(((ConfigEntryBase)config).Definition.Key, config, placeholder);
		}

		public AtlyssTextField AddTextField(string label, ConfigEntry<string> config, string placeholder = "Text...")
		{
			AtlyssTextField atlyssTextField = AddTextField(label, config.Value, placeholder);
			atlyssTextField.OnValueChanged.AddListener((UnityAction<string>)delegate(string newValue)
			{
				config.Value = newValue;
			});
			return atlyssTextField;
		}

		public AtlyssTextField AddTextField(string label, string value = "", string placeholder = "Text...")
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			AtlyssTextField element = TemplateManager.CreateTextField(Content);
			Settings.OnCloseSettings.AddListener((UnityAction)delegate
			{
				element.Revert();
			});
			Settings.OnApplySettings.AddListener((UnityAction)delegate
			{
				element.Apply();
			});
			element.LabelText = label;
			if ((Object)(object)element.Placeholder != (Object)null)
			{
				element.Placeholder.text = placeholder;
			}
			element.InputField.SetTextWithoutNotify(value);
			element.Apply();
			((Component)element.Root).gameObject.SetActive(true);
			PushElement(element);
			return element;
		}

		private void PushElement(BaseAtlyssElement element)
		{
			ContentElements.Add(element);
			AtlyssSpace bottomSpace = BottomSpace;
			if (bottomSpace != null)
			{
				((Transform)bottomSpace.Root).SetSiblingIndex(((Transform)Content).childCount);
			}
		}
	}
	internal static class TemplateManager
	{
		internal static AtlyssTabButton TabTemplate;

		internal static AtlyssSpace SpaceTemplate;

		internal static AtlyssHeader HeaderTemplate;

		internal static AtlyssButton ButtonTemplate;

		internal static AtlyssToggle ToggleTemplate;

		internal static AtlyssSimpleSlider SimpleSliderTemplate;

		internal static AtlyssAdvancedSlider AdvancedSliderTemplate;

		internal static AtlyssDropdown DropdownTemplate;

		internal static AtlyssKeyButton KeyButtonTemplate;

		internal static AtlyssTextField TextFieldTemplate;

		internal static void Initialize()
		{
			FindTemplateElements();
		}

		private static void FindTemplateElements()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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
			SettingsManager val = Object.FindObjectOfType<SettingsManager>(true);
			Transform val2 = Utility.FindTabsContainer(val);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				EasySettingsPlugin.Logger.LogError((object)"Unable to find settings tabs container GameObject. EasySettings won't be available.");
				return;
			}
			RectTransform template = (RectTransform)val2.GetChild(0);
			TabTemplate = CreateTabButton((RectTransform)val2, template);
			((Component)TabTemplate.Root).gameObject.SetActive(false);
			SettingsTab modTab = Settings.ModTab;
			Transform val3 = Object.Instantiate<Transform>(((Component)val._videoTabElement).transform, ((Component)val._videoTabElement).transform.parent);
			modTab.Element = ((Component)val3).GetComponent<MenuElement>();
			modTab.Content = (RectTransform)((Component)((Component)val3).GetComponentInChildren<VerticalLayoutGroup>()).transform;
			InitializeTabContent(modTab.Content);
			RectTransform template2 = TextFieldPrefab.Create();
			TextFieldTemplate = CreateTextField(modTab.Content, template2);
			((Component)TextFieldTemplate.Root).gameObject.SetActive(false);
			RectTransform val4 = FindSpace(val);
			if (Object.op_Implicit((Object)(object)val4))
			{
				SpaceTemplate = CreateSpace(modTab.Content, val4);
				((Component)SpaceTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val5 = FindHeader(val);
			if (Object.op_Implicit((Object)(object)val5))
			{
				HeaderTemplate = CreateHeader(modTab.Content, val5);
				((Component)HeaderTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val6 = FindButton(val);
			if (Object.op_Implicit((Object)(object)val6))
			{
				ButtonTemplate = CreateButton(modTab.Content, val6);
				((Component)ButtonTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val7 = FindToggle(val);
			if (Object.op_Implicit((Object)(object)val7))
			{
				ToggleTemplate = CreateToggle(modTab.Content, val7);
				((Component)ToggleTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val8 = FindSimpleSlider(val);
			if (Object.op_Implicit((Object)(object)val8))
			{
				SimpleSliderTemplate = CreateSimpleSlider(modTab.Content, val8);
				((Component)SimpleSliderTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val9 = FindAdvancedSlider(val);
			if (Object.op_Implicit((Object)(object)val9))
			{
				AdvancedSliderTemplate = CreateAdvancedSlider(modTab.Content, val9);
				((Component)AdvancedSliderTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val10 = FindDropdown(val);
			if (Object.op_Implicit((Object)(object)val10))
			{
				DropdownTemplate = CreateDropdown(modTab.Content, val10);
				((Component)DropdownTemplate.Root).gameObject.SetActive(false);
			}
			RectTransform val11 = FindKeyButton(val);
			if (Object.op_Implicit((Object)(object)val11))
			{
				KeyButtonTemplate = CreateKeyButton(modTab.Content, val11);
				((Component)KeyButtonTemplate.Root).gameObject.SetActive(false);
			}
		}

		private static void InitializeTabContent(RectTransform tabContent)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			foreach (RectTransform item in (Transform)tabContent)
			{
				RectTransform val = item;
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
		}

		private static RectTransform[] GetVanillaTabs(SettingsManager manager)
		{
			return (RectTransform[])(object)new RectTransform[5]
			{
				manager._keyboardInputDollyObject.GetComponent<RectTransform>(),
				manager._videoTabContent,
				manager._audioTabContent,
				manager._inputTabContent,
				manager._networkTabContent
			};
		}

		private static RectTransform FindSpace(SettingsManager manager)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			RectTransform[] array = vanillaTabs;
			foreach (RectTransform val in array)
			{
				foreach (RectTransform item in (Transform)val)
				{
					RectTransform val2 = item;
					if (((Transform)val2).childCount == 0)
					{
						Component[] components = ((Component)val2).GetComponents<Component>();
						if (components.Length <= 1)
						{
							return val2;
						}
					}
				}
			}
			return null;
		}

		private static RectTransform FindHeader(SettingsManager manager)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			RectTransform[] array = vanillaTabs;
			foreach (RectTransform val in array)
			{
				foreach (RectTransform item in (Transform)val)
				{
					RectTransform val2 = item;
					Selectable componentInChildren = ((Component)val2).GetComponentInChildren<Selectable>(true);
					if (!Object.op_Implicit((Object)(object)componentInChildren))
					{
						Text componentInChildren2 = ((Component)val2).GetComponentInChildren<Text>(true);
						if (Object.op_Implicit((Object)(object)componentInChildren2))
						{
							return val2;
						}
					}
				}
			}
			return null;
		}

		private static RectTransform FindButton(SettingsManager manager)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			RectTransform[] array = vanillaTabs;
			foreach (RectTransform val in array)
			{
				foreach (RectTransform item in (Transform)val)
				{
					RectTransform val2 = item;
					Button componentInChildren = ((Component)val2).GetComponentInChildren<Button>(true);
					if (!Object.op_Implicit((Object)(object)componentInChildren))
					{
						continue;
					}
					Text[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Text>(true);
					if (componentsInChildren.Length <= 1 && ((Component)componentsInChildren[0]).transform.IsChildOf(((Component)componentInChildren).transform))
					{
						Selectable[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Selectable>(true);
						if (componentsInChildren2.Length <= 1)
						{
							return val2;
						}
					}
				}
			}
			return null;
		}

		private static RectTransform FindToggle(SettingsManager manager)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			Toggle jiggleBonesToggle = manager._jiggleBonesToggle;
			if (!Utility.TryGetElementRoot(vanillaTabs, ((Component)jiggleBonesToggle).transform, out var root))
			{
				return null;
			}
			List<Component> components = ((Component)root).gameObject.AddComponent<ComponentReferences>().components;
			components.Add((Component)(object)jiggleBonesToggle);
			return (RectTransform)root;
		}

		private static RectTransform FindSimpleSlider(SettingsManager manager)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			Slider masterVolumeSlider = manager._masterVolumeSlider;
			if (!Utility.TryGetElementRoot(vanillaTabs, ((Component)masterVolumeSlider).transform, out var root))
			{
				return null;
			}
			List<Component> components = ((Component)root).gameObject.AddComponent<ComponentReferences>().components;
			components.Add((Component)(object)masterVolumeSlider);
			return (RectTransform)root;
		}

		private static RectTransform FindAdvancedSlider(SettingsManager manager)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			Slider cameraFieldOfViewSlider = manager._cameraFieldOfViewSlider;
			Text cameraFieldOfViewText = manager._cameraFieldOfViewText;
			if (!Utility.TryGetElementRoot(vanillaTabs, ((Component)cameraFieldOfViewSlider).transform, out var root))
			{
				return null;
			}
			List<Component> components = ((Component)root).gameObject.AddComponent<ComponentReferences>().components;
			components.Add((Component)(object)cameraFieldOfViewSlider);
			components.Add((Component)(object)cameraFieldOfViewText);
			return (RectTransform)root;
		}

		private static RectTransform FindDropdown(SettingsManager manager)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			Dropdown fullScreenResolutionDropdown = manager._fullScreenResolutionDropdown;
			if (!Utility.TryGetElementRoot(vanillaTabs, ((Component)fullScreenResolutionDropdown).transform, out var root))
			{
				return null;
			}
			List<Component> components = ((Component)root).gameObject.AddComponent<ComponentReferences>().components;
			components.Add((Component)(object)fullScreenResolutionDropdown);
			return (RectTransform)root;
		}

		private static RectTransform FindKeyButton(SettingsManager manager)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			RectTransform[] vanillaTabs = GetVanillaTabs(manager);
			KeyBindButton[] keyBindButtons = manager.keyBindButtons;
			if (keyBindButtons == null || keyBindButtons.Length <= 0)
			{
				return null;
			}
			KeyBindButton[] array = keyBindButtons;
			foreach (KeyBindButton val in array)
			{
				if (val != null)
				{
					Button button = val._button;
					Text buttonLabel = val._buttonLabel;
					if (Utility.TryGetElementRoot(vanillaTabs, ((Component)button).transform, out var root))
					{
						List<Component> components = ((Component)root).gameObject.AddComponent<ComponentReferences>().components;
						components.Add((Component)(object)button);
						components.Add((Component)(object)buttonLabel);
						return (RectTransform)root;
					}
				}
			}
			return null;
		}

		internal static AtlyssTabButton CreateTabButton(RectTransform container)
		{
			return CreateTabButton(container, TabTemplate);
		}

		internal static AtlyssTabButton CreateTabButton(RectTransform container, AtlyssTabButton template)
		{
			return CreateTabButton(container, template.Root);
		}

		internal static AtlyssTabButton CreateTabButton(RectTransform container, RectTransform template)
		{
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			AtlyssTabButton atlyssTabButton = new AtlyssTabButton
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true),
				Button = ((Component)val).GetComponentInChildren<Button>(true)
			};
			atlyssTabButton.Initialize();
			return atlyssTabButton;
		}

		internal static AtlyssHeader CreateHeader(RectTransform container)
		{
			return CreateHeader(container, HeaderTemplate);
		}

		internal static AtlyssHeader CreateHeader(RectTransform container, AtlyssHeader template)
		{
			return CreateHeader(container, template.Root);
		}

		internal static AtlyssHeader CreateHeader(RectTransform container, RectTransform template)
		{
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			AtlyssHeader atlyssHeader = new AtlyssHeader
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true)
			};
			atlyssHeader.Initialize();
			return atlyssHeader;
		}

		internal static AtlyssButton CreateButton(RectTransform container)
		{
			return CreateButton(container, ButtonTemplate);
		}

		internal static AtlyssButton CreateButton(RectTransform container, AtlyssButton template)
		{
			return CreateButton(container, template.Root);
		}

		internal static AtlyssButton CreateButton(RectTransform container, RectTransform template)
		{
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			AtlyssButton atlyssButton = new AtlyssButton
			{
				Root = val,
				ButtonLabel = ((Component)val).GetComponentInChildren<Text>(true),
				Button = ((Component)val).GetComponentInChildren<Button>(true)
			};
			atlyssButton.Initialize();
			return atlyssButton;
		}

		internal static AtlyssToggle CreateToggle(RectTransform container)
		{
			return CreateToggle(container, ToggleTemplate);
		}

		internal static AtlyssToggle CreateToggle(RectTransform container, AtlyssToggle template)
		{
			return CreateToggle(container, template.Root);
		}

		internal static AtlyssToggle CreateToggle(RectTransform container, RectTransform template)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			AtlyssToggle atlyssToggle = new AtlyssToggle
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true),
				Toggle = (Toggle)((Component)val).GetComponentInChildren<ComponentReferences>(true).components[0]
			};
			atlyssToggle.Initialize();
			return atlyssToggle;
		}

		internal static AtlyssSimpleSlider CreateSimpleSlider(RectTransform container)
		{
			return CreateSimpleSlider(container, SimpleSliderTemplate);
		}

		internal static AtlyssSimpleSlider CreateSimpleSlider(RectTransform container, AtlyssSimpleSlider template)
		{
			return CreateSimpleSlider(container, template.Root);
		}

		internal static AtlyssSimpleSlider CreateSimpleSlider(RectTransform container, RectTransform template)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			List<Component> components = ((Component)val).GetComponentInChildren<ComponentReferences>(true).components;
			AtlyssSimpleSlider atlyssSimpleSlider = new AtlyssSimpleSlider
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true),
				Slider = (Slider)components[0]
			};
			atlyssSimpleSlider.Initialize();
			return atlyssSimpleSlider;
		}

		internal static AtlyssAdvancedSlider CreateAdvancedSlider(RectTransform container)
		{
			return CreateAdvancedSlider(container, AdvancedSliderTemplate);
		}

		internal static AtlyssAdvancedSlider CreateAdvancedSlider(RectTransform container, AtlyssAdvancedSlider template)
		{
			return CreateAdvancedSlider(container, template.Root);
		}

		internal static AtlyssAdvancedSlider CreateAdvancedSlider(RectTransform container, RectTransform template)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			List<Component> components = ((Component)val).GetComponentInChildren<ComponentReferences>(true).components;
			AtlyssAdvancedSlider atlyssAdvancedSlider = new AtlyssAdvancedSlider
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true),
				ValueText = (Text)components[1],
				Slider = (Slider)components[0],
				ResetButton = ((Component)val).GetComponentInChildren<Button>(true)
			};
			atlyssAdvancedSlider.Initialize();
			return atlyssAdvancedSlider;
		}

		internal static AtlyssDropdown CreateDropdown(RectTransform container)
		{
			return CreateDropdown(container, DropdownTemplate);
		}

		internal static AtlyssDropdown CreateDropdown(RectTransform container, AtlyssDropdown template)
		{
			return CreateDropdown(container, template.Root);
		}

		internal static AtlyssDropdown CreateDropdown(RectTransform container, RectTransform template)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			List<Component> components = ((Component)val).GetComponentInChildren<ComponentReferences>(true).components;
			AtlyssDropdown atlyssDropdown = new AtlyssDropdown
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true),
				Dropdown = (Dropdown)components[0]
			};
			atlyssDropdown.Initialize();
			return atlyssDropdown;
		}

		internal static AtlyssKeyButton CreateKeyButton(RectTransform container)
		{
			return CreateKeyButton(container, KeyButtonTemplate);
		}

		internal static AtlyssKeyButton CreateKeyButton(RectTransform container, AtlyssKeyButton template)
		{
			return CreateKeyButton(container, template.Root);
		}

		internal static AtlyssKeyButton CreateKeyButton(RectTransform container, RectTransform template)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			List<Component> components = ((Component)val).GetComponentInChildren<ComponentReferences>(true).components;
			AtlyssKeyButton atlyssKeyButton = new AtlyssKeyButton
			{
				Root = val,
				Label = ((Component)val).GetComponentInChildren<Text>(true),
				ButtonLabel = (Text)components[1],
				Button = (Button)components[0]
			};
			atlyssKeyButton.Initialize();
			return atlyssKeyButton;
		}

		internal static AtlyssSpace CreateSpace(RectTransform container)
		{
			return CreateSpace(container, SpaceTemplate);
		}

		internal static AtlyssSpace CreateSpace(RectTransform container, AtlyssSpace template)
		{
			return CreateSpace(container, template.Root);
		}

		internal static AtlyssSpace CreateSpace(RectTransform container, RectTransform template)
		{
			RectTransform root = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			return new AtlyssSpace
			{
				Root = root
			};
		}

		internal static AtlyssTextField CreateTextField(RectTransform container)
		{
			return CreateTextField(container, TextFieldTemplate);
		}

		internal static AtlyssTextField CreateTextField(RectTransform container, AtlyssTextField template)
		{
			return CreateTextField(container, template.Root);
		}

		internal static AtlyssTextField CreateTextField(RectTransform container, RectTransform template)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			RectTransform val = Object.Instantiate<RectTransform>(template, (Transform)(object)container);
			List<Component> components = ((Component)val).GetComponentInChildren<ComponentReferences>(true).components;
			InputField val2 = (InputField)components[0];
			Text label = (Text)components[1];
			AtlyssTextField atlyssTextField = new AtlyssTextField
			{
				Root = val,
				Label = label,
				Placeholder = (Text)val2.placeholder,
				InputField = val2
			};
			((Graphic)atlyssTextField.Placeholder).color = Color.gray;
			((Graphic)atlyssTextField.InputField.textComponent).color = Color.white;
			((Graphic)atlyssTextField.Label).color = Color.white;
			ColorBlock colors = ((Selectable)atlyssTextField.InputField).colors;
			((ColorBlock)(ref colors)).normalColor = new Color(0.7843f, 0.7843f, 0.7843f, 1f);
			((Selectable)atlyssTextField.InputField).colors = colors;
			atlyssTextField.InputField.characterLimit = 10000;
			atlyssTextField.Initialize();
			return atlyssTextField;
		}
	}
	public static class Utility
	{
		public static bool TryGetRelativeRoot(Transform relativeParent, Transform child, out Transform root)
		{
			root = child;
			while (Object.op_Implicit((Object)(object)root))
			{
				if ((Object)(object)root.parent == (Object)(object)relativeParent)
				{
					return true;
				}
				root = root.parent;
			}
			root = null;
			return false;
		}

		public static bool TryGetElementRoot(Transform[] contents, Transform elementChild, out Transform root)
		{
			foreach (Transform relativeParent in contents)
			{
				if (TryGetRelativeRoot(relativeParent, ((Component)elementChild).transform, out root))
				{
					return true;
				}
			}
			root = null;
			return false;
		}

		public static bool TryGetElementRoot(RectTransform[] contents, Transform elementChild, out Transform root)
		{
			foreach (RectTransform relativeParent in contents)
			{
				if (TryGetRelativeRoot((Transform)(object)relativeParent, ((Component)elementChild).transform, out root))
				{
					return true;
				}
			}
			root = null;
			return false;
		}

		public static Transform FindTabsContainer(SettingsManager instance)
		{
			Button[] componentsInChildren = ((Component)instance).GetComponentsInChildren<Button>(true);
			foreach (Button val in componentsInChildren)
			{
				foreach (PersistentCall call in ((UnityEventBase)val.onClick).m_PersistentCalls.m_Calls)
				{
					if (call == null || call.target != (Object)(object)instance || call.methodName != "Set_SettingMenuSelectionIndex")
					{
						continue;
					}
					return ((Component)val).transform.parent;
				}
			}
			return null;
		}

		public static Button FindCancelButton(SettingsManager instance)
		{
			Button[] componentsInChildren = ((Component)instance).GetComponentsInChildren<Button>(true);
			foreach (Button val in componentsInChildren)
			{
				foreach (PersistentCall call in ((UnityEventBase)val.onClick).m_PersistentCalls.m_Calls)
				{
					if (call == null || call.target != (Object)(object)instance || call.methodName != "Close_SettingsMenu")
					{
						continue;
					}
					return val;
				}
			}
			return null;
		}

		public static Button FindApplyButton(SettingsManager instance)
		{
			Button[] componentsInChildren = ((Component)instance).GetComponentsInChildren<Button>(true);
			foreach (Button val in componentsInChildren)
			{
				foreach (PersistentCall call in ((UnityEventBase)val.onClick).m_PersistentCalls.m_Calls)
				{
					if (call == null || call.target != (Object)(object)instance || call.methodName != "Save_SettingsData")
					{
						continue;
					}
					return val;
				}
			}
			return null;
		}

		public static bool IsKeyBound(SettingsManager instance, KeyCode key)
		{
			return IsKeyBound(instance, ((object)(KeyCode)(ref key)).ToString());
		}

		public static bool IsKeyBound(SettingsManager instance, string key)
		{
			KeyBindButton[] keyBindButtons = instance.keyBindButtons;
			foreach (KeyBindButton val in keyBindButtons)
			{
				if (val._keyBind == key)
				{
					return true;
				}
			}
			return false;
		}

		public static bool TryGetNextUnusedMenuIndex(SettingsManager settingsManager, out byte index)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected I4, but got Unknown
			MenuElement menusContainer = settingsManager._settingsMenuElement;
			MenuElement[] componentsInChildren = ((Component)menusContainer).GetComponentsInChildren<MenuElement>(true);
			MenuElement[] source = componentsInChildren.Where((MenuElement menu) => (Object)(object)menu != (Object)(object)menusContainer).ToArray();
			SettingsMenuSelection currentSettingsMenuSelection = settingsManager._currentSettingsMenuSelection;
			int i;
			for (i = 0; i <= 255; i++)
			{
				settingsManager.Set_SettingMenuSelectionIndex(i);
				if (!source.Any((MenuElement menu) => menu.isEnabled))
				{
					break;
				}
			}
			settingsManager.Set_SettingMenuSelectionIndex((int)currentSettingsMenuSelection);
			index = (byte)Math.Min(i, 255);
			return i <= 255;
		}

		public static bool TryGetNextUnusedMenuIndex(out byte index)
		{
			return TryGetNextUnusedMenuIndex(SettingsManager._current, out index);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EasySettings";

		public const string PLUGIN_NAME = "Easy Settings API";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}
namespace Nessie.ATLYSS.EasySettings.Prefabs
{
	internal static class TextFieldPrefab
	{
		private const string FONT_PATH = "_graphic/_font/terminal-grotesque";

		private const string BACKGROUND_SPRITE_PATH = "_graphic/_ui/bk_04";

		private const string INPUT_SPRITE_PATH = "_graphic/_ui/uiBox03";

		internal static RectTransform Create()
		{
			InputField inputField;
			Text label;
			GameObject val = CreateRoot(out inputField, out label);
			List<Component> components = val.AddComponent<ComponentReferences>().components;
			components.Add((Component)(object)inputField);
			components.Add((Component)(object)label);
			Transform transform = val.transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		private static GameObject CreateRoot(out InputField inputField, out Text label)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_001e: 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_004a: 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)
			GameObject val = new GameObject("EasySettings TextField");
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.anchorMin = new Vector2(0f, 1f);
			val2.anchorMax = new Vector2(0f, 1f);
			val2.SetSizeWithCurrentAnchors((Axis)0, 545f);
			val2.SetSizeWithCurrentAnchors((Axis)1, 30f);
			CanvasRenderer val3 = val.AddComponent<CanvasRenderer>();
			val3.cullTransparentMesh = true;
			Image val4 = val.AddComponent<Image>();
			((Graphic)val4).color = new Color(0.4622f, 0.4622f, 0.4622f);
			((Graphic)val4).raycastTarget = true;
			((MaskableGraphic)val4).maskable = true;
			val4.sprite = Resources.Load<Sprite>("_graphic/_ui/bk_04");
			val4.type = (Type)1;
			val4.fillCenter = true;
			val4.fillMethod = (FillMethod)4;
			val4.fillAmount = 1f;
			val4.fillClockwise = true;
			val4.pixelsPerUnitMultiplier = 1f;
			CreateInputField(val, out inputField);
			CreateLabel(val, out label);
			return val;
		}

		private static GameObject CreateInputField(GameObject root, out InputField inputField)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("InputField");
			val.transform.SetParent(root.transform);
			GameObject val2 = CreateText(val);
			GameObject val3 = CreatePlaceholder(val);
			RectTransform val4 = val.AddComponent<RectTransform>();
			val4.pivot = new Vector2(0.5f, 0.5f);
			val4.anchorMin = new Vector2(0.5f, 0.5f);
			val4.anchorMax = new Vector2(0.5f, 0.5f);
			val4.SetInsetAndSizeFromParentEdge((Edge)1, 0f, 180f);
			val4.SetSizeWithCurrentAnchors((Axis)1, 30f);
			CanvasRenderer val5 = val.AddComponent<CanvasRenderer>();
			val5.cullTransparentMesh = true;
			Image val6 = val.AddComponent<Image>();
			((Graphic)val6).color = new Color(0.5943f, 0.5943f, 0.5943f, 0.8078f);
			((Graphic)val6).raycastTarget = true;
			((MaskableGraphic)val6).maskable = true;
			val6.sprite = Resources.Load<Sprite>("_graphic/_ui/uiBox03");
			val6.type = (Type)1;
			val6.fillCenter = true;
			val6.fillMethod = (FillMethod)4;
			val6.fillAmount = 1f;
			val6.fillClockwise = true;
			val6.pixelsPerUnitMultiplier = 1f;
			inputField = val.AddComponent<InputField>();
			((Selectable)inputField).transition = (Transition)1;
			InputField obj = inputField;
			ColorBlock colors = default(ColorBlock);
			((ColorBlock)(ref colors)).normalColor = new Color(1f, 0.3632f, 0.3632f);
			((ColorBlock)(ref colors)).highlightedColor = new Color(0.9607f, 0.9607f, 0.9607f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.78431f, 0.78431f, 0.78431f);
			((ColorBlock)(ref colors)).selectedColor = new Color(0.9607f, 0.9607f, 0.9607f);
			((ColorBlock)(ref colors)).disabledColor = new Color(0.78431f, 0.78431f, 0.78431f);
			((ColorBlock)(ref colors)).colorMultiplier = 1f;
			((ColorBlock)(ref colors)).fadeDuration = 0.1f;
			((Selectable)obj).colors = colors;
			((Selectable)inputField).animationTriggers.normalTrigger = "Normal";
			((Selectable)inputField).animationTriggers.highlightedTrigger = "Highlighted";
			((Selectable)inputField).animationTriggers.pressedTrigger = "Pressed";
			((Selectable)inputField).animationTriggers.selectedTrigger = "Selected";
			((Selectable)inputField).animationTriggers.disabledTrigger = "Disabled";
			((Selectable)inputField).interactable = true;
			((Selectable)inputField).targetGraphic = (Graphic)(object)val6;
			inputField.textComponent = val2.GetComponent<Text>();
			inputField.placeholder = (Graphic)(object)val3.GetComponent<Text>();
			inputField.contentType = (ContentType)0;
			inputField.inputType = (InputType)0;
			inputField.asteriskChar = '*';
			inputField.keyboardType = (TouchScreenKeyboardType)0;
			inputField.lineType = (LineType)0;
			inputField.characterValidation = (CharacterValidation)0;
			inputField.characterLimit = 12;
			inputField.caretColor = new Color(0.6039f, 0.8431f, 0.9607f);
			inputField.customCaretColor = true;
			inputField.selectionColor = new Color(0.6588f, 0.8078f, 1f);
			inputField.caretBlinkRate = 4f;
			inputField.caretWidth = 5;
			inputField.readOnly = false;
			inputField.shouldActivateOnSelect = true;
			return val;
		}

		private static GameObject CreateLabel(GameObject root, out Text label)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Label");
			val.transform.SetParent(root.transform);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.pivot = new Vector2(0f, 0.5f);
			val2.anchorMin = new Vector2(0f, 0.5f);
			val2.anchorMax = new Vector2(0f, 0.5f);
			val2.SetInsetAndSizeFromParentEdge((Edge)0, 6f, 260f);
			val2.SetSizeWithCurrentAnchors((Axis)1, 30f);
			CanvasRenderer val3 = val.AddComponent<CanvasRenderer>();
			val3.cullTransparentMesh = true;
			Text val4 = (label = val.AddComponent<Text>());
			((Graphic)val4).color = new Color(1f, 0.5141f, 0.5141f);
			((MaskableGraphic)val4).maskable = true;
			val4.font = Resources.Load<Font>("_graphic/_font/terminal-grotesque");
			val4.fontSize = 22;
			val4.fontStyle = (FontStyle)0;
			val4.resizeTextMinSize = 10;
			val4.resizeTextMaxSize = 40;
			val4.alignment = (TextAnchor)3;
			val4.supportRichText = true;
			val4.horizontalOverflow = (HorizontalWrapMode)0;
			val4.verticalOverflow = (VerticalWrapMode)0;
			val4.lineSpacing = 1f;
			val4.text = "Label";
			return val;
		}

		private static GameObject CreateText(GameObject root)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Text");
			val.transform.SetParent(root.transform);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.pivot = new Vector2(0f, 0.5f);
			val2.anchorMin = new Vector2(0f, 0.5f);
			val2.anchorMax = new Vector2(0f, 0.5f);
			val2.SetInsetAndSizeFromParentEdge((Edge)0, 6f, 260f);
			val2.SetSizeWithCurrentAnchors((Axis)1, 30f);
			CanvasRenderer val3 = val.AddComponent<CanvasRenderer>();
			val3.cullTransparentMesh = true;
			Text val4 = val.AddComponent<Text>();
			((Graphic)val4).color = new Color(1f, 0.5137f, 0.5137f);
			((MaskableGraphic)val4).maskable = true;
			val4.font = Resources.Load<Font>("_graphic/_font/terminal-grotesque");
			val4.fontSize = 22;
			val4.fontStyle = (FontStyle)0;
			val4.resizeTextMinSize = 2;
			val4.resizeTextMaxSize = 42;
			val4.alignment = (TextAnchor)3;
			val4.supportRichText = false;
			val4.horizontalOverflow = (HorizontalWrapMode)1;
			val4.verticalOverflow = (VerticalWrapMode)1;
			val4.lineSpacing = 1f;
			val4.text = "Text";
			return val;
		}

		private static GameObject CreatePlaceholder(GameObject root)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Placeholder");
			val.transform.SetParent(root.transform);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.anchorMin = new Vector2(0.5f, 0.5f);
			val2.anchorMax = new Vector2(0.5f, 0.5f);
			val2.SetInsetAndSizeFromParentEdge((Edge)0, 6f, 180f);
			val2.SetSizeWithCurrentAnchors((Axis)1, 30f);
			CanvasRenderer val3 = val.AddComponent<CanvasRenderer>();
			val3.cullTransparentMesh = true;
			Text val4 = val.AddComponent<Text>();
			((Graphic)val4).color = new Color(0.8207f, 0.3677f, 0.3677f);
			((MaskableGraphic)val4).maskable = true;
			val4.font = Resources.Load<Font>("_graphic/_font/terminal-grotesque");
			val4.fontSize = 21;
			val4.fontStyle = (FontStyle)2;
			val4.resizeTextMinSize = 10;
			val4.resizeTextMaxSize = 40;
			val4.alignment = (TextAnchor)3;
			val4.supportRichText = true;
			val4.horizontalOverflow = (HorizontalWrapMode)1;
			val4.verticalOverflow = (VerticalWrapMode)1;
			val4.lineSpacing = 1f;
			val4.text = "Placeholder";
			return val;
		}
	}
}
namespace Nessie.ATLYSS.EasySettings.Extensions
{
	public static class EnumExtensions
	{
		public static int GetIndex<T>(this T enumValue) where T : Enum
		{
			Type type = enumValue.GetType();
			string[] names = Enum.GetNames(type);
			return Array.IndexOf<string>(names, Enum.GetName(type, enumValue));
		}

		public static T FromIndex<T>(int index) where T : Enum
		{
			Type typeFromHandle = typeof(T);
			Array values = Enum.GetValues(typeFromHandle);
			return (T)((index >= 0 && index < values.Length) ? values.GetValue(index) : ((object)(-1)));
		}
	}
	public static class UnityEventExtensions
	{
		public static void SetAllPersistentListenerStates(this UnityEventBase unityEvent, UnityEventCallState state)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < unityEvent.GetPersistentEventCount(); i++)
			{
				unityEvent.SetPersistentListenerState(i, state);
			}
		}

		public static void DisablePersistentListeners(this UnityEventBase unityEvent)
		{
			unityEvent.SetAllPersistentListenerStates((UnityEventCallState)0);
		}

		public static void RemoveAndDisableAllListeners(this UnityEventBase unityEvent)
		{
			unityEvent.RemoveAllListeners();
			unityEvent.DisablePersistentListeners();
		}
	}
}
namespace Nessie.ATLYSS.EasySettings.UIElements
{
	public class AtlyssAdvancedSlider : BaseAtlyssLabelElement, IValueElement
	{
		public Text ValueText;

		private Slider _slider;

		private Button _resetButton;

		public Slider Slider
		{
			get
			{
				return _slider;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)_slider))
				{
					((UnityEvent<float>)(object)_slider.onValueChanged).RemoveListener((UnityAction<float>)ValueChanged);
				}
				_slider = value;
				if (Object.op_Implicit((Object)(object)_slider))
				{
					((UnityEvent<float>)(object)_slider.onValueChanged).AddListener((UnityAction<float>)ValueChanged);
				}
			}
		}

		public Button ResetButton
		{
			get
			{
				return _resetButton;
			}
			set
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)_resetButton))
				{
					((UnityEvent)_resetButton.onClick).RemoveListener(new UnityAction(ResetClicked));
				}
				_resetButton = value;
				if (Object.op_Implicit((Object)(object)_resetButton))
				{
					((UnityEvent)_resetButton.onClick).AddListener(new UnityAction(ResetClicked));
				}
			}
		}

		public UnityEvent<float> OnValueChanged { get; } = new UnityEvent<float>();


		public UnityEvent OnResetClicked { get; } = new UnityEvent();


		public float AppliedValue { get; private set; }

		public void Initialize()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			base.LabelText = "Advanced Slider";
			ValueText.text = $"{AppliedValue}";
			((UnityEventBase)(object)Slider.onValueChanged).RemoveAndDisableAllListeners();
			((UnityEvent<float>)(object)Slider.onValueChanged).AddListener((UnityAction<float>)ValueChanged);
			Slider.wholeNumbers = false;
			Slider.minValue = 0f;
			Slider.maxValue = 1f;
			Slider.SetValueWithoutNotify(AppliedValue);
			((UnityEventBase)(object)ResetButton.onClick).RemoveAndDisableAllListeners();
			((UnityEvent)ResetButton.onClick).AddListener(new UnityAction(ResetClicked));
		}

		public void SetValue(float value)
		{
			_slider.value = value;
		}

		public void Apply()
		{
			AppliedValue = _slider.value;
		}

		public void Revert()
		{
			_slider.value = AppliedValue;
		}

		private void ValueChanged(float newValue)
		{
			OnValueChanged.Invoke(newValue);
		}

		private void ResetClicked()
		{
			OnResetClicked.Invoke();
		}
	}
	public abstract class BaseAtlyssElement
	{
		public RectTransform Root;
	}
	public abstract class BaseAtlyssLabelElement : BaseAtlyssElement
	{
		public Text Label { get; set; }

		public string LabelText
		{
			get
			{
				return Label.text;
			}
			set
			{
				Label.text = value;
			}
		}
	}
	public interface IValueElement
	{
		private void Apply()
		{
		}

		void Revert()
		{
		}
	}
	public class AtlyssButton : BaseAtlyssElement
	{
		public Text ButtonLabel;

		private Button _button;

		public Button Button
		{
			get
			{
				return _button;
			}
			set
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)_button))
				{
					((UnityEvent)_button.onClick).RemoveListener(new UnityAction(Clicked));
				}
				_button = value;
				if (Object.op_Implicit((Object)(object)_button))
				{
					((UnityEvent)_button.onClick).RemoveListener(new UnityAction(Clicked));
				}
			}
		}

		public UnityEvent OnClicked { get; } = new UnityEvent();


		public void Initialize()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			ButtonLabel.text = "Button";
			((UnityEventBase)(object)Button.onClick).RemoveAndDisableAllListeners();
			((UnityEvent)Button.onClick).AddListener(new UnityAction(Clicked));
		}

		private void Clicked()
		{
			OnClicked.Invoke();
		}
	}
	public class AtlyssDropdown : BaseAtlyssLabelElement, IValueElement
	{
		private Dropdown _dropdown;

		public Dropdown Dropdown
		{
			get
			{
				return _dropdown;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)_dropdown))
				{
					((UnityEvent<int>)(object)_dropdown.onValueChanged).RemoveListener((UnityAction<int>)ValueChanged);
				}
				_dropdown = value;
				if (Object.op_Implicit((Object)(object)_dropdown))
				{
					((UnityEvent<int>)(object)_dropdown.onValueChanged).AddListener((UnityAction<int>)ValueChanged);
				}
			}
		}

		public UnityEvent<int> OnValueChanged { get; } = new UnityEvent<int>();


		public int AppliedValue { get; private set; }

		public void Initialize()
		{
			base.LabelText = "Dropdown";
			((UnityEventBase)(object)Dropdown.onValueChanged).RemoveAndDisableAllListeners();
			((UnityEvent<int>)(object)Dropdown.onValueChanged).AddListener((UnityAction<int>)ValueChanged);
			Dropdown.options.Clear();
			Dropdown.SetValueWithoutNotify(AppliedValue);
		}

		public void Apply()
		{
			AppliedValue = Dropdown.value;
		}

		public void Revert()
		{
			Dropdown.value = AppliedValue;
		}

		private void ValueChanged(int newValue)
		{
			OnValueChanged.Invoke(newValue);
		}
	}
	public class AtlyssHeader : BaseAtlyssLabelElement
	{
		public void Initialize()
		{
			base.LabelText = "Header";
		}
	}
	public class AtlyssKeyButton : BaseAtlyssLabelElement, IValueElement
	{
		public Text ButtonLabel;

		private Button _button;

		private KeyCode _value;

		public Button Button
		{
			get
			{
				return _button;
			}
			set
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)_button))
				{
					((UnityEvent)_button.onClick).RemoveListener(new UnityAction(Clicked));
				}
				_button = value;
				if (Object.op_Implicit((Object)(object)_button))
				{
					((UnityEvent)_button.onClick).RemoveListener(new UnityAction(Clicked));
				}
			}
		}

		public UnityEvent<KeyCode> OnValueChanged { get; } = new UnityEvent<KeyCode>();


		public UnityEvent OnClicked { get; } = new UnityEvent();


		public KeyCode AppliedValue { get; private set; }

		public void Initialize()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			base.LabelText = "Key Button";
			_value = AppliedValue;
			Text buttonLabel = ButtonLabel;
			KeyCode appliedValue = AppliedValue;
			buttonLabel.text = ((object)(KeyCode)(ref appliedValue)).ToString();
			((UnityEventBase)(object)Button.onClick).RemoveAndDisableAllListeners();
			((UnityEvent)Button.onClick).AddListener(new UnityAction(Clicked));
		}

		public void SetValue(KeyCode key)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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 = key;
			ButtonLabel.text = ((object)(KeyCode)(ref key)).ToString();
			ValueChanged(key);
		}

		public void Apply()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			AppliedValue = _value;
		}

		public void Revert()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			SetValue(AppliedValue);
		}

		private void ValueChanged(KeyCode newValue)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			OnValueChanged.Invoke(newValue);
		}

		private void Clicked()
		{
			OnClicked.Invoke();
		}
	}
	public class AtlyssSimpleSlider : BaseAtlyssLabelElement, IValueElement
	{
		private Slider _slider;

		public Slider Slider
		{
			get
			{
				return _slider;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)_slider))
				{
					((UnityEvent<float>)(object)_slider.onValueChanged).RemoveListener((UnityAction<float>)ValueChanged);
				}
				_slider = value;
				if (Object.op_Implicit((Object)(object)_slider))
				{
					((UnityEvent<float>)(object)_slider.onValueChanged).AddListener((UnityAction<float>)ValueChanged);
				}
			}
		}

		public UnityEvent<float> OnValueChanged { get; } = new UnityEvent<float>();


		public float AppliedValue { get; private set; }

		public void Initialize()
		{
			base.LabelText = "Slider";
			((UnityEventBase)(object)Slider.onValueChanged).RemoveAndDisableAllListeners();
			((UnityEvent<float>)(object)Slider.onValueChanged).AddListener((UnityAction<float>)ValueChanged);
			Slider.wholeNumbers = false;
			Slider.minValue = 0f;
			Slider.maxValue = 1f;
			Slider.SetValueWithoutNotify(AppliedValue);
		}

		public void Apply()
		{
			AppliedValue = _slider.value;
		}

		public void Revert()
		{
			_slider.value = AppliedValue;
		}

		private void ValueChanged(float newValue)
		{
			OnValueChanged.Invoke(newValue);
		}
	}
	public class AtlyssSpace : BaseAtlyssElement
	{
	}
	public class AtlyssTabButton : BaseAtlyssElement
	{
		public Text Label;

		private Button _resetButton;

		public Button Button
		{
			get
			{
				return _resetButton;
			}
			set
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)_resetButton))
				{
					((UnityEvent)_resetButton.onClick).RemoveListener(new UnityAction(Clicked));
				}
				_resetButton = value;
				if (Object.op_Implicit((Object)(object)_resetButton))
				{
					((UnityEvent)_resetButton.onClick).AddListener(new UnityAction(Clicked));
				}
			}
		}

		public UnityEvent OnClicked { get; } = new UnityEvent();


		public void Initialize()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			Label.text = "Tab";
			((UnityEventBase)Button.onClick).RemoveAllListeners();
			((UnityEvent)Button.onClick).AddListener(new UnityAction(Clicked));
		}

		private void Clicked()
		{
			OnClicked.Invoke();
		}
	}
	public class AtlyssTextField : BaseAtlyssLabelElement, IValueElement
	{
		private InputField _inputField;

		public Text Placeholder;

		public InputField InputField
		{
			get
			{
				return _inputField;
			}
			set
			{
				if ((Object)(object)_inputField != (Object)null)
				{
					((UnityEvent<string>)(object)_inputField.onEndEdit).RemoveListener((UnityAction<string>)ValueChanged);
				}
				_inputField = value;
				if ((Object)(object)_inputField != (Object)null)
				{
					((UnityEvent<string>)(object)_inputField.onEndEdit).AddListener((UnityAction<string>)ValueChanged);
					_inputField.text = AppliedValue;
				}
			}
		}

		public UnityEvent<string> OnValueChanged { get; } = new UnityEvent<string>();


		public string AppliedValue { get; private set; } = string.Empty;


		public void Initialize()
		{
			base.LabelText = "Text Field";
			if ((Object)(object)InputField != (Object)null)
			{
				((UnityEvent<string>)(object)InputField.onEndEdit).RemoveListener((UnityAction<string>)ValueChanged);
				((UnityEvent<string>)(object)InputField.onEndEdit).AddListener((UnityAction<string>)ValueChanged);
				InputField.text = AppliedValue;
			}
		}

		public void SetValue(string value)
		{
			if ((Object)(object)InputField != (Object)null)
			{
				InputField.text = value;
			}
		}

		public void Apply()
		{
			AppliedValue = InputField.text;
		}

		public void Revert()
		{
			InputField.text = AppliedValue;
		}

		private void ValueChanged(string newValue)
		{
			OnValueChanged.Invoke(newValue);
		}
	}
	public class AtlyssToggle : BaseAtlyssLabelElement, IValueElement
	{
		private Toggle _toggle;

		public Toggle Toggle
		{
			get
			{
				return _toggle;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)_toggle))
				{
					((UnityEvent<bool>)(object)_toggle.onValueChanged).RemoveListener((UnityAction<bool>)ValueChanged);
				}
				_toggle = value;
				if (Object.op_Implicit((Object)(object)_toggle))
				{
					((UnityEvent<bool>)(object)_toggle.onValueChanged).AddListener((UnityAction<bool>)ValueChanged);
				}
			}
		}

		public UnityEvent<bool> OnValueChanged { get; } = new UnityEvent<bool>();


		public bool AppliedValue { get; private set; }

		public void Initialize()
		{
			base.LabelText = "Toggle";
			((UnityEventBase)(object)Toggle.onValueChanged).RemoveAndDisableAllListeners();
			((UnityEvent<bool>)(object)Toggle.onValueChanged).AddListener((UnityAction<bool>)ValueChanged);
			Toggle.SetIsOnWithoutNotify(AppliedValue);
		}

		public void Apply()
		{
			AppliedValue = _toggle.isOn;
		}

		public void Revert()
		{
			_toggle.isOn = AppliedValue;
		}

		private void ValueChanged(bool newValue)
		{
			OnValueChanged.Invoke(newValue);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}