Decompiled source of Risk Of Options v2.7.1

RiskOfOptions/RiskOfOptions.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.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using JetBrains.Annotations;
using LeTai.Asset.TranslucentImage;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using RiskOfOptions.Components.AssetResolution;
using RiskOfOptions.Components.AssetResolution.Data;
using RiskOfOptions.Components.ColorPicker;
using RiskOfOptions.Components.Misc;
using RiskOfOptions.Components.Options;
using RiskOfOptions.Components.Panel;
using RiskOfOptions.Components.RuntimePrefabs;
using RiskOfOptions.Containers;
using RiskOfOptions.Lib;
using RiskOfOptions.Lib.EnumVariants;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RiskOfOptions.Resources;
using RiskOfOptions.Utils;
using RoR2;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.TextCore;
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("RiskOfOptions")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RiskOfOptions")]
[assembly: AssemblyTitle("RiskOfOptions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RiskOfOptions
{
	internal static class ExtensionMethods
	{
		internal static ModMetaData GetModMetaData(this Assembly assembly)
		{
			ModMetaData result = default(ModMetaData);
			Type[] exportedTypes = assembly.GetExportedTypes();
			for (int i = 0; i < exportedTypes.Length; i++)
			{
				BepInPlugin customAttribute = ((MemberInfo)exportedTypes[i]).GetCustomAttribute<BepInPlugin>();
				if (customAttribute != null)
				{
					result.Guid = customAttribute.GUID;
					result.Name = customAttribute.Name;
				}
			}
			return result;
		}

		internal static float Remap(this float value, float fromMin, float fromMax, float toMin, float toMax)
		{
			float num = value - fromMin;
			float num2 = fromMax - fromMin;
			float num3 = num / num2;
			return Mathf.Clamp((toMax - toMin) * num3 + toMin, toMin, toMax);
		}

		internal static T GetCopyOf<T>(this Component comp, T other) where T : Component
		{
			Type type = ((object)comp).GetType();
			if (type != ((object)other).GetType())
			{
				return default(T);
			}
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			PropertyInfo[] properties = type.GetProperties(bindingAttr);
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.CanWrite)
				{
					try
					{
						propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
					}
					catch
					{
					}
				}
			}
			FieldInfo[] fields = type.GetFields(bindingAttr);
			foreach (FieldInfo fieldInfo in fields)
			{
				fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		internal static T AddComponent<T>(this GameObject go, T toAdd) where T : Component
		{
			return ((Component)(object)go.AddComponent<T>()).GetCopyOf(toAdd);
		}

		internal static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
		{
			T val = gameObject.GetComponent<T>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = gameObject.AddComponent<T>();
			}
			return val;
		}

		internal static bool CloseEnough(Vector2 a, Vector2 b)
		{
			//IL_0000: 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)
			//IL_0019: 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)
			if (Mathf.Abs(a.x - b.x) < 0.0001f)
			{
				return Mathf.Abs(a.y - b.y) < 0.0001f;
			}
			return false;
		}

		internal static bool CloseEnough(Color a, Color b)
		{
			//IL_0000: 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)
			//IL_0019: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			if (Mathf.Abs(a.r - b.r) < 0.0001f && Mathf.Abs(a.g - b.g) < 0.0001f && Mathf.Abs(a.b - b.b) < 0.0001f)
			{
				return Mathf.Abs(a.a - b.a) < 0.0001f;
			}
			return false;
		}

		internal static bool CloseEnough(Color[] a, Color b)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < a.Length; i++)
			{
				_ = ref a[i];
				if (!CloseEnough(a[i], b))
				{
					return false;
				}
			}
			return true;
		}

		internal static Vector2 SmoothStep(Vector2 a, Vector2 b, float t)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector2 zero = Vector2.zero;
			zero.x = Mathf.SmoothStep(a.x, b.x, t);
			zero.y = Mathf.SmoothStep(a.y, b.y, t);
			return zero;
		}

		internal static double Abs(double num)
		{
			if (!(num < 0.0))
			{
				return num;
			}
			return -1.0 * num;
		}

		internal static double RoundUpToDecimalPlace(this double num, int place)
		{
			float num2 = Mathf.Pow(10f, (float)place);
			num2 = ((num2 == 0f) ? 1f : num2);
			return Mathf.Ceil((float)num * num2) / num2;
		}
	}
	public static class KeyboardShortcutExtensions
	{
		public static bool IsPressedInclusive(this KeyboardShortcut key)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ((KeyboardShortcut)(ref key)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey);
			return Input.GetKey(((KeyboardShortcut)(ref key)).MainKey) && flag;
		}
	}
	internal static class LanguageTokens
	{
		public static readonly string OptionRebindDialogTitle = "RISK_OF_OPTIONS".ToUpper() + "_OPTION_REBIND_DIALOG_TITLE_TOKEN";

		public static readonly string OptionRebindDialogDescription = "RISK_OF_OPTIONS".ToUpper() + "_OPTION_REBIND_DIALOG_DESCRIPTION_TOKEN";

		public static readonly string LeftPageButton = "RISK_OF_OPTIONS".ToUpper() + "_LEFT_PAGE_BUTTON_TEXT_TOKEN;";

		public static readonly string RightPageButton = "RISK_OF_OPTIONS".ToUpper() + "_RIGHT_PAGE_BUTTON_TEXT_TOKEN;";

		public const string HeaderToken = "RISK_OF_OPTIONS_MOD_OPTIONS_HEADER_BUTTON_TEXT";

		public const string NoModsHeaderToken = "RISK_OF_OPTIONS_NO_MODS_HEADER_TEXT";

		public const string NoModsDescriptionToken = "RISK_OF_OPTIONS_NO_MODS_DESCRIPTION_TEXT";

		public const string ModsHeaderToken = "RISK_OF_OPTIONS_MODS_HEADER_TEXT";

		public const string ModsDescriptionToken = "RISK_OF_OPTIONS_DESCRIPTION_TEXT";

		public const string DialogButtonToken = "RISK_OF_OPTIONS_NO_MODS_BUTTON_TEXT";

		public static void Register()
		{
			LanguageApi.Add(OptionRebindDialogTitle, "Rebind Control...");
			LanguageApi.Add(LeftPageButton, "<");
			LanguageApi.Add(RightPageButton, ">");
			LanguageApi.Add("RISK_OF_OPTIONS_NO_MODS_HEADER_TEXT", "No Supported Mods Installed");
			LanguageApi.Add("RISK_OF_OPTIONS_NO_MODS_DESCRIPTION_TEXT", "No mods implementing RiskOfOptions found.\nThis mod doesn't do anything if you don't have any mods installed that supports RiskOfOptions.\nThis won't show again.");
			LanguageApi.Add("RISK_OF_OPTIONS_MODS_HEADER_TEXT", "You can configure your mods in game!");
			LanguageApi.Add("RISK_OF_OPTIONS_DESCRIPTION_TEXT", "Mods with support for RiskOfOptions found!\nYou can configure them in the \"MOD OPTIONS\" panel.\nThis won't show again");
			LanguageApi.Add("RISK_OF_OPTIONS_NO_MODS_BUTTON_TEXT", "Ok");
		}
	}
	public static class ModSettingsManager
	{
		private static Hook _pauseHook;

		internal static readonly ModIndexedOptionCollection OptionCollection = new ModIndexedOptionCollection();

		internal const string StartingText = "RISK_OF_OPTIONS";

		internal const int StartingTextLength = 15;

		internal static bool disablePause = false;

		internal static readonly List<string> RestartRequiredOptions = new List<string>();

		internal static void Init()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			LanguageApi.Init();
			Assets.LoadAssets();
			Prefabs.Init();
			LanguageTokens.Register();
			SettingsModifier.Init();
			MethodInfo? method = typeof(PauseManager).GetMethod("CCTogglePause", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method2 = typeof(ModSettingsManager).GetMethod("PauseManagerOnCCTogglePause", BindingFlags.Static | BindingFlags.NonPublic);
			_pauseHook = new Hook((MethodBase)method, method2);
		}

		private static void PauseManagerOnCCTogglePause(Action<ConCommandArgs> orig, ConCommandArgs args)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (!disablePause)
			{
				orig(args);
			}
		}

		public static void SetModDescription(string description)
		{
			ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
			SetModDescription(description, modMetaData.Guid, modMetaData.Name);
		}

		public static void SetModDescription(string description, string modGuid, string modName)
		{
			EnsureContainerExists(modGuid, modName);
			OptionCollection[modGuid].SetDescriptionText(description);
		}

		public static void SetModDescriptionToken(string descriptionToken)
		{
			ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
			SetModDescriptionToken(descriptionToken, modMetaData.Guid, modMetaData.Name);
		}

		public static void SetModDescriptionToken(string descriptionToken, string modGuid, string modName)
		{
			EnsureContainerExists(modGuid, modName);
			OptionCollection[modGuid].DescriptionToken = descriptionToken;
		}

		public static void SetModIcon(Sprite iconSprite)
		{
			ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
			SetModIcon(iconSprite, modMetaData.Guid, modMetaData.Name);
		}

		public static void SetModIcon(Sprite iconSprite, string modGuid, string modName)
		{
			EnsureContainerExists(modGuid, modName);
			OptionCollection[modGuid].icon = iconSprite;
		}

		public static void SetModIcon(GameObject iconPrefab)
		{
			ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
			SetModIcon(iconPrefab, modMetaData.Guid, modMetaData.Name);
		}

		public static void SetModIcon(GameObject iconPrefab, string modGuid, string modName)
		{
			EnsureContainerExists(modGuid, modName);
			OptionCollection[modGuid].iconPrefab = iconPrefab;
		}

		public static void AddOption(BaseOption option)
		{
			ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
			AddOption(option, modMetaData.Guid, modMetaData.Name);
		}

		public static void AddOption(BaseOption option, string modGuid, string modName)
		{
			option.SetProperties();
			option.ModGuid = modGuid;
			option.ModName = modName;
			option.Identifier = (modGuid + "." + option.Category + "." + option.Name + "." + option.OptionTypeName).Replace(" ", "_").ToUpper();
			option.RegisterTokens();
			OptionCollection.AddOption(ref option);
		}

		private static void EnsureContainerExists(string modGuid, string modName)
		{
			if (!OptionCollection.ContainsModGuid(modGuid))
			{
				OptionCollection[modGuid] = new OptionCollection(modName, modGuid);
			}
		}
	}
	[BepInPlugin("com.rune580.riskofoptions", "Risk Of Options", "2.7.1")]
	public sealed class RiskOfOptionsPlugin : BaseUnityPlugin
	{
		private const string ModName = "Risk Of Options";

		private const string Author = "rune580";

		private const string Guid = "com.rune580.riskofoptions";

		private const string Version = "2.7.1";

		internal static ConfigEntry<bool>? seenNoMods;

		internal static ConfigEntry<bool>? seenMods;

		public static ConfigEntry<DecimalSeparator>? decimalSeparator;

		private void Awake()
		{
			seenNoMods = ((BaseUnityPlugin)this).Config.Bind<bool>("One Time Stuff", "Has seen the no mods prompt", false, (ConfigDescription)null);
			seenMods = ((BaseUnityPlugin)this).Config.Bind<bool>("One Time Stuff", "Has seen the mods prompt", false, (ConfigDescription)null);
			decimalSeparator = ((BaseUnityPlugin)this).Config.Bind<DecimalSeparator>("Display", "DecimalSeparator", DecimalSeparator.Period, "Changes how numbers are displayed across RoO.\nPeriod: 1,000.00\nComma: 1.000,00");
			ModSettingsManager.Init();
			ModSettingsManager.SetModIcon(Prefabs.animatedIcon);
			ModSettingsManager.AddOption(new ChoiceOption((ConfigEntryBase)(object)decimalSeparator));
		}
	}
	internal static class SettingsModifier
	{
		public static void Init()
		{
			//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)
			GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/PauseScreen.prefab").WaitForCompletion();
			if ((Object)(object)obj == (Object)null)
			{
				throw new Exception("Couldn't initialize Risk Of Options! Continue at your own risk!");
			}
			obj.GetComponentInChildren<PauseScreenController>().settingsPanelPrefab.AddComponent<ModOptionPanelController>();
			LanguageApi.Add("RISK_OF_OPTIONS_MOD_OPTIONS_HEADER_BUTTON_TEXT", "MOD OPTIONS");
			RuntimePrefabManager.Register<ModOptionsPanelPrefab>();
			RuntimePrefabManager.Register<CheckBoxPrefab>();
			RuntimePrefabManager.Register<SliderPrefab>();
			RuntimePrefabManager.Register<StepSliderPrefab>();
			RuntimePrefabManager.Register<IntSliderPrefab>();
			RuntimePrefabManager.Register<KeyBindPrefab>();
			RuntimePrefabManager.Register<InputFieldPrefab>();
			RuntimePrefabManager.Register<ChoicePrefab>();
			RuntimePrefabManager.Register<GenericButtonPrefab>();
		}
	}
}
namespace RiskOfOptions.v3
{
	public class CategoryBuilder
	{
	}
	[Obsolete("WIP")]
	public class ModOptionsBuilder
	{
		private ModMetaData? _modMetaData;

		private Sprite? _iconSprite;

		private StringOrToken? _name;

		private StringOrToken? _description;

		public ModOptionsBuilder DetermineModMetaDataFromCaller()
		{
			_modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
			return this;
		}

		public ModOptionsBuilder SetModMetaData<TBepInPlugin>()
		{
			Type typeFromHandle = typeof(TBepInPlugin);
			return SetModMetaData(typeFromHandle);
		}

		public ModOptionsBuilder SetModMetaData(Type pluginType)
		{
			_modMetaData = pluginType.Assembly.GetModMetaData();
			return this;
		}

		public ModOptionsBuilder SetModMetaData(ModMetaData metaData)
		{
			_modMetaData = metaData;
			return this;
		}

		public ModOptionsBuilder SetIcon(Sprite iconSprite)
		{
			_iconSprite = iconSprite;
			return this;
		}

		public ModOptionsBuilder SetName(string name)
		{
			_name = StringOrToken.String(name);
			return this;
		}

		public ModOptionsBuilder SetNameToken(string nameToken)
		{
			_name = StringOrToken.Token(nameToken);
			return this;
		}

		public ModOptionsBuilder SetDescription(string descriptionText)
		{
			_description = StringOrToken.String(descriptionText);
			return this;
		}

		public ModOptionsBuilder SetDescriptionToken(string descriptionToken)
		{
			_description = StringOrToken.Token(descriptionToken);
			return this;
		}
	}
}
namespace RiskOfOptions.v3.Options
{
	public class CheckBoxBuilder
	{
	}
}
namespace RiskOfOptions.v3.Dom
{
	public class Node
	{
	}
}
namespace RiskOfOptions.Utils
{
	public class ColorPickerUtil : MonoBehaviour
	{
		[Serializable]
		public class ColorChangedEvent : UnityEvent<Color>
		{
		}

		public RooColorHue hueController;

		public RooColorPicker colorPicker;

		public RgbaSliderController rgbaSliders;

		public Image preview;

		public TMP_InputField hexField;

		public string hexFormatString = "{0:X6}";

		private Action<Color> _onColorSelected;

		private float _hue;

		private float _saturation;

		private float _value;

		private int _hexValue;

		private Color _color = Color.white;

		public void Awake()
		{
			((UnityEvent<float>)hueController.onHueChanged).AddListener((UnityAction<float>)UpdateHue);
			((UnityEvent<float, float>)colorPicker.onValueChanged).AddListener((UnityAction<float, float>)UpdateSatAndVal);
			((UnityEvent<string>)(object)hexField.onSubmit).AddListener((UnityAction<string>)HexFieldSubmit);
			((UnityEvent<string>)(object)hexField.onEndEdit).AddListener((UnityAction<string>)HexFieldSubmit);
			((UnityEvent<Color>)rgbaSliders.onColorChanged).AddListener((UnityAction<Color>)SetColor);
		}

		public void SetColor(Color newColor)
		{
			//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_0042: Unknown result type (might be due to invalid IL or missing references)
			_color = newColor;
			float value = default(float);
			Color.RGBToHSV(_color, ref value, ref _saturation, ref _value);
			_hue = value.Remap(0f, 1f, 0f, 6.28f);
			_hexValue = _color.ToRGBHex();
			UpdateControls();
			UpdateHandles();
		}

		private void UpdateHue(float hue)
		{
			_hue = hue;
			colorPicker.SetHue(_hue);
			UpdateColorFromHSV();
		}

		private void UpdateSatAndVal(float saturation, float value)
		{
			_saturation = saturation;
			_value = value;
			UpdateColorFromHSV();
		}

		private void HexFieldSubmit(string text)
		{
			//IL_001d: 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)
			if (int.TryParse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var result))
			{
				_hexValue = result;
			}
			SetColor(_color.FromRGBHex(_hexValue));
		}

		private void UpdateColorFromHSV()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			Color color = ColorExtensions.ColorFromHSV(_hue, _saturation, _value);
			color.a = _color.a;
			_color = color;
			_hexValue = _color.ToRGBHex();
			rgbaSliders.inPicker = true;
			UpdateControls();
			rgbaSliders.inPicker = false;
		}

		private void UpdateHandles()
		{
			//IL_0023: 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)
			hueController.SetHue(_hue);
			colorPicker.SetHue(_hue);
			if (_color != Color.black)
			{
				colorPicker.SetValues(_saturation, _value);
			}
		}

		private void UpdateControls()
		{
			//IL_0007: 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)
			((Graphic)preview).color = _color;
			hexField.text = string.Format(CultureInfo.InvariantCulture, hexFormatString, _hexValue);
			rgbaSliders.SetSliders(_color);
		}

		public void Accept()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			_onColorSelected(_color);
			Close();
		}

		public void Close()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			RoR2Application.unscaledTimeTimers.CreateTimer(0.1f, (Action)delegate
			{
				DestroyPicker(((Component)this).gameObject);
			});
		}

		private static void DestroyPicker(GameObject gameObject)
		{
			Object.DestroyImmediate((Object)(object)gameObject);
		}

		public static void OpenColorPicker(Action<Color> onColorSelected, Color currentColor)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			ColorPickerUtil component = Object.Instantiate<GameObject>(Prefabs.colorPickerOverlay).GetComponent<ColorPickerUtil>();
			component._onColorSelected = onColorSelected;
			component.SetColor(currentColor);
		}
	}
	public class KeyBindUtil : MonoBehaviour
	{
		private MPEventSystem _mpEventSystem;

		private SimpleDialogBox _dialogBox;

		private Action<KeyboardShortcut> _onBind;

		private float _timeoutTimer;

		private string _keyBindName;

		private bool _finished;

		private readonly List<KeyCode> _heldKeys = new List<KeyCode>();

		private readonly List<KeyCode> _keySequence = new List<KeyCode>();

		public void StartListening()
		{
			if (ModSettingsManager.disablePause || _finished)
			{
				Object.DestroyImmediate((Object)(object)((Component)this).gameObject);
				return;
			}
			ModSettingsManager.disablePause = true;
			_dialogBox = SimpleDialogBox.Create(_mpEventSystem);
			LanguageApi.AddDelegate(LanguageTokens.OptionRebindDialogDescription, ControlRebindingHook);
		}

		public void StopListening()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			_finished = true;
			if (Object.op_Implicit((Object)(object)_dialogBox) && Object.op_Implicit((Object)(object)_dialogBox.rootObject))
			{
				Object.DestroyImmediate((Object)(object)_dialogBox.rootObject);
				_dialogBox = null;
			}
			LanguageApi.RemoveDelegate(LanguageTokens.OptionRebindDialogDescription);
			RoR2Application.unscaledTimeTimers.CreateTimer(0.3f, (Action)Finish);
			Object.Destroy((Object)(object)((Component)this).gameObject, 0.5f);
		}

		private void Update()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (!_finished)
			{
				_timeoutTimer -= Time.unscaledDeltaTime;
				ExtraKeyDown();
				ExtraKeyUp();
				if (_timeoutTimer < 0f || !Object.op_Implicit((Object)(object)_dialogBox))
				{
					StopListening();
					return;
				}
				_dialogBox.headerToken = new TokenParamsPair
				{
					token = LanguageTokens.OptionRebindDialogTitle,
					formatParams = Array.Empty<object>()
				};
				_dialogBox.descriptionToken = new TokenParamsPair
				{
					token = LanguageTokens.OptionRebindDialogDescription,
					formatParams = new object[2]
					{
						LanguageTokens.OptionRebindDialogDescription,
						_timeoutTimer
					}
				};
			}
		}

		public void OnGUI()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Invalid comparison between Unknown and I4
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Invalid comparison between Unknown and I4
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (_finished)
			{
				return;
			}
			bool flag = !Event.current.isKey;
			EventType type;
			if (!flag)
			{
				type = Event.current.type;
				bool flag2 = type - 4 <= 1;
				flag = !flag2;
			}
			if (flag || (int)Event.current.keyCode == 0)
			{
				return;
			}
			if ((int)Event.current.keyCode == 27)
			{
				SetKeyBind((KeyCode)0);
				return;
			}
			type = Event.current.type;
			if ((int)type != 4)
			{
				if ((int)type != 5)
				{
					throw new ArgumentOutOfRangeException();
				}
				KeyUp(Event.current.keyCode);
			}
			else
			{
				KeyDown(Event.current.keyCode);
			}
		}

		private void ExtraKeyDown()
		{
			if (Input.GetKeyDown((KeyCode)304))
			{
				KeyDown((KeyCode)304);
			}
			else if (Input.GetKeyDown((KeyCode)303))
			{
				KeyDown((KeyCode)303);
			}
			else if (Input.GetKeyDown((KeyCode)323))
			{
				KeyDown((KeyCode)323);
			}
			else if (Input.GetKeyDown((KeyCode)324))
			{
				KeyDown((KeyCode)324);
			}
			else if (Input.GetKeyDown((KeyCode)325))
			{
				KeyDown((KeyCode)325);
			}
			else if (Input.GetKeyDown((KeyCode)326))
			{
				KeyDown((KeyCode)326);
			}
			else if (Input.GetKeyDown((KeyCode)327))
			{
				KeyDown((KeyCode)327);
			}
		}

		private void ExtraKeyUp()
		{
			if (Input.GetKeyUp((KeyCode)304))
			{
				KeyUp((KeyCode)304);
			}
			else if (Input.GetKeyUp((KeyCode)303))
			{
				KeyUp((KeyCode)303);
			}
			else if (Input.GetKeyUp((KeyCode)323))
			{
				KeyUp((KeyCode)323);
			}
			else if (Input.GetKeyUp((KeyCode)324))
			{
				KeyUp((KeyCode)324);
			}
			else if (Input.GetKeyUp((KeyCode)325))
			{
				KeyUp((KeyCode)325);
			}
			else if (Input.GetKeyUp((KeyCode)326))
			{
				KeyUp((KeyCode)326);
			}
			else if (Input.GetKeyUp((KeyCode)327))
			{
				KeyUp((KeyCode)327);
			}
		}

		private void KeyDown(KeyCode keyCode)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!_heldKeys.Contains(keyCode))
			{
				_heldKeys.Add(keyCode);
			}
		}

		private void KeyUp(KeyCode keyCode)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected I4, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (!_heldKeys.Contains(keyCode))
			{
				return;
			}
			_heldKeys.Remove(keyCode);
			if (_keySequence.Contains(keyCode))
			{
				return;
			}
			_keySequence.Add(keyCode);
			if (_heldKeys.Count != 0)
			{
				return;
			}
			KeyboardShortcut keyBind = default(KeyboardShortcut);
			if (_keySequence.Count > 1)
			{
				KeyCode[] array = (KeyCode[])(object)new KeyCode[_keySequence.Count - 1];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = (KeyCode)(int)_keySequence[i + 1];
				}
				((KeyboardShortcut)(ref keyBind))..ctor(_keySequence[0], array);
			}
			else
			{
				((KeyboardShortcut)(ref keyBind))..ctor(_keySequence[0], Array.Empty<KeyCode>());
			}
			SetKeyBind(keyBind);
		}

		private void SetKeyBind(KeyCode keyCode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			SetKeyBind(new KeyboardShortcut(keyCode, Array.Empty<KeyCode>()));
		}

		private void SetKeyBind(KeyboardShortcut keyBind)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			_onBind(keyBind);
			StopListening();
		}

		private string ControlRebindingHook()
		{
			int num = Mathf.RoundToInt(_timeoutTimer);
			return $"Press the button(s) you wish to assign for {_keyBindName}.\n{num} second(s) remaining.";
		}

		private void Finish()
		{
			ModSettingsManager.disablePause = false;
		}

		public static void StartBinding(Action<KeyboardShortcut> onBind, string keyBindName, float timeoutTimer = 5f, MPEventSystem mpEventSystem = null)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			KeyBindUtil component = new GameObject("KeyBindUtil instance", new Type[1] { typeof(KeyBindUtil) }).GetComponent<KeyBindUtil>();
			component._onBind = onBind;
			component._timeoutTimer = timeoutTimer;
			component._mpEventSystem = mpEventSystem;
			component._keyBindName = keyBindName;
			component.StartListening();
		}
	}
}
namespace RiskOfOptions.Resources
{
	internal static class Assets
	{
		private static AssetBundle _mainAssetBundle;

		internal static T Load<T>(string asset) where T : Object
		{
			return _mainAssetBundle.LoadAsset<T>(asset);
		}

		internal static void LoadAssets()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RiskOfOptions.Resources.riskofoptions");
			_mainAssetBundle = AssetBundle.LoadFromStream(stream);
		}
	}
	public static class Prefabs
	{
		private static AssetBundle _uiBundle;

		public static GameObject animatedIcon;

		public static GameObject modOptionsPanel;

		public static GameObject modListPanel;

		public static GameObject modListButton;

		public static GameObject modDescriptionPanel;

		public static GameObject modOptionDescriptionPanel;

		public static GameObject modOptionCategories;

		public static GameObject boolButton;

		public static GameObject sliderButton;

		public static GameObject stepSliderButton;

		public static GameObject intSliderButton;

		public static GameObject inputFieldButton;

		public static GameObject colorPickerButton;

		public static GameObject colorPickerOverlay;

		internal static void Init()
		{
			_uiBundle = LoadBundle("uielements");
			animatedIcon = LoadPrefab("RoO-Icon.prefab");
			modOptionsPanel = LoadPrefab("Options Panel.prefab");
			modListPanel = LoadPrefab("Mod List Panel.prefab");
			modListButton = LoadPrefab("Mod List Button.prefab");
			modDescriptionPanel = LoadPrefab("Mod Description Panel.prefab");
			modOptionDescriptionPanel = LoadPrefab("Option Description Panel.prefab");
			modOptionCategories = LoadPrefab("Category Headers.prefab");
			boolButton = LoadPrefab("ModSettingsButton, Bool.prefab");
			sliderButton = LoadPrefab("ModSettingsButton, Slider.prefab");
			stepSliderButton = LoadPrefab("ModSettingsButton, Step Slider.prefab");
			intSliderButton = LoadPrefab("ModSettingsButton, Int Slider.prefab");
			inputFieldButton = LoadPrefab("ModSettingsButton, InputField.prefab");
			colorPickerButton = LoadPrefab("ModSettingsButton, ColorPicker.prefab");
			colorPickerOverlay = LoadPrefab("Color Picker Overlay.prefab");
		}

		private static GameObject LoadPrefab(string path)
		{
			GameObject val = _uiBundle.LoadAsset<GameObject>("assets/roo/prefabs/" + path);
			AssetResolver[] componentsInChildren = val.GetComponentsInChildren<AssetResolver>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].AttemptResolve();
			}
			return val;
		}

		private static AssetBundle LoadBundle(string name)
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RiskOfOptions.Resources.AssetBundles." + name);
			return AssetBundle.LoadFromStream(stream);
		}
	}
}
namespace RiskOfOptions.Options
{
	public abstract class BaseOption
	{
		public abstract string OptionTypeName { get; protected set; }

		public string Identifier { get; internal set; }

		public string ModGuid { get; internal set; }

		public string ModName { get; internal set; }

		public string Category { get; internal set; }

		public string Name { get; internal set; }

		public string Description { get; internal set; }

		internal abstract ConfigEntryBase ConfigEntry { get; }

		public virtual void SetCategoryName(string fallback, BaseOptionConfig config)
		{
			if (!string.IsNullOrEmpty(config.category))
			{
				Category = config.category;
			}
			else
			{
				Category = fallback;
			}
		}

		public virtual void SetName(string fallback, BaseOptionConfig config)
		{
			if (!string.IsNullOrEmpty(config.name))
			{
				Name = config.name;
			}
			else
			{
				Name = fallback;
			}
		}

		public virtual void SetDescription(string fallback, BaseOptionConfig config)
		{
			if (!string.IsNullOrEmpty(config.description))
			{
				Description = config.description;
			}
			else
			{
				Description = fallback;
			}
		}

		internal virtual void RegisterTokens()
		{
			LanguageApi.Add(GetNameToken(), Name);
			LanguageApi.Add(GetDescriptionToken(), Description);
		}

		public string GetNameToken()
		{
			return ("RISK_OF_OPTIONS." + ModGuid + "." + Category + "." + Name + "." + OptionTypeName + ".name").Replace(" ", "_").ToUpper();
		}

		public string GetDescriptionToken()
		{
			return ("RISK_OF_OPTIONS." + ModGuid + "." + Category + "." + Name + "." + OptionTypeName + ".description").Replace(" ", "_").ToUpper();
		}

		public abstract GameObject CreateOptionGameObject(GameObject prefab, Transform parent);

		public abstract BaseOptionConfig GetConfig();

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (obj is BaseOption other)
			{
				return Equals(other);
			}
			return false;
		}

		private bool Equals(BaseOption other)
		{
			return string.Equals(Identifier, other.Identifier, StringComparison.InvariantCulture);
		}

		public override int GetHashCode()
		{
			if (Identifier == null)
			{
				return 0;
			}
			return StringComparer.InvariantCulture.GetHashCode(Identifier);
		}

		protected internal virtual void SetProperties()
		{
			if (ConfigEntry != null)
			{
				BaseOptionConfig config = GetConfig();
				SetCategoryName(ConfigEntry.Definition.Section, config);
				SetName(ConfigEntry.Definition.Key, config);
				SetDescription(ConfigEntry.Description.Description, config);
			}
		}
	}
	public class CheckBoxOption : BaseOption, ITypedValueHolder<bool>
	{
		protected readonly bool originalValue;

		private readonly ConfigEntry<bool> _configEntry;

		protected readonly CheckBoxConfig config;

		public override string OptionTypeName { get; protected set; } = "checkbox";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual bool Value
		{
			get
			{
				return _configEntry.Value;
			}
			set
			{
				_configEntry.Value = value;
			}
		}

		public CheckBoxOption(ConfigEntry<bool> configEntry)
			: this(configEntry, new CheckBoxConfig())
		{
		}

		public CheckBoxOption(ConfigEntry<bool> configEntry, bool restartRequired)
			: this(configEntry, new CheckBoxConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public CheckBoxOption(ConfigEntry<bool> configEntry, CheckBoxConfig config)
			: this(config, configEntry.Value)
		{
			_configEntry = configEntry;
		}

		protected CheckBoxOption(CheckBoxConfig config, bool originalValue)
		{
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			ModSettingsBool componentInChildren = obj.GetComponentInChildren<ModSettingsBool>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			((Object)obj).name = "Mod Option CheckBox, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			return Value != GetOriginalValue();
		}

		public bool GetOriginalValue()
		{
			return originalValue;
		}
	}
	public class ChoiceOption : BaseOption, ITypedValueHolder<object>
	{
		protected readonly object originalValue;

		private readonly ConfigEntryBase _configEntry;

		protected readonly ChoiceConfig config;

		private string[] _nameTokens;

		public override string OptionTypeName { get; protected set; } = "choice";


		internal override ConfigEntryBase ConfigEntry => _configEntry;

		public virtual object Value
		{
			get
			{
				return _configEntry.BoxedValue;
			}
			set
			{
				_configEntry.BoxedValue = Enum.Parse(_configEntry.SettingType, value.ToString());
			}
		}

		public ChoiceOption(ConfigEntryBase configEntry)
			: this(configEntry, new ChoiceConfig())
		{
		}

		public ChoiceOption(ConfigEntryBase configEntry, bool restartRequired)
			: this(configEntry, new ChoiceConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public ChoiceOption(ConfigEntryBase configEntry, ChoiceConfig config)
			: this(config, configEntry.BoxedValue)
		{
			if (!configEntry.SettingType.IsEnum)
			{
				throw new InvalidCastException("T in configEntry<T> must be of type Enum, Type found: " + configEntry.SettingType.Name);
			}
			_configEntry = configEntry;
		}

		protected ChoiceOption(ChoiceConfig config, object originalValue)
		{
			this.originalValue = originalValue;
			this.config = config;
		}

		internal override void RegisterTokens()
		{
			base.RegisterTokens();
			string[] names = Enum.GetNames(Value.GetType());
			_nameTokens = new string[names.Length];
			for (int i = 0; i < names.Length; i++)
			{
				string text = ("RISK_OF_OPTIONS." + base.ModGuid + "." + base.Category + "." + base.Name + "." + OptionTypeName + ".item." + names[i]).Replace(" ", "_").ToUpper();
				_nameTokens[i] = text;
				LanguageApi.Add(text, names[i]);
			}
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			DropDownController componentInChildren = obj.GetComponentInChildren<DropDownController>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			((Object)obj).name = "Mod Option Choice, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			return !Value.Equals(originalValue);
		}

		public object GetOriginalValue()
		{
			return originalValue;
		}

		internal string[] GetNameTokens()
		{
			return _nameTokens;
		}
	}
	public class ColorOption : BaseOption, ITypedValueHolder<Color>
	{
		protected readonly Color originalValue;

		private readonly ConfigEntry<Color> _configEntry;

		protected readonly ColorOptionConfig config;

		public override string OptionTypeName { get; protected set; } = "color";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual Color Value
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return _configEntry.Value;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				_configEntry.Value = value;
			}
		}

		public ColorOption(ConfigEntry<Color> configEntry)
			: this(configEntry, new ColorOptionConfig())
		{
		}

		public ColorOption(ConfigEntry<Color> configEntry, bool restartRequired)
			: this(configEntry, new ColorOptionConfig
			{
				restartRequired = true
			})
		{
		}

		public ColorOption(ConfigEntry<Color> configEntry, ColorOptionConfig config)
			: this(config, configEntry.Value)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			_configEntry = configEntry;
		}

		protected ColorOption(ColorOptionConfig config, Color originalValue)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			ModSettingsColor componentInChildren = obj.GetComponentInChildren<ModSettingsColor>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			((Object)obj).name = "Mod Option Color, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return Value != GetOriginalValue();
		}

		public Color GetOriginalValue()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return originalValue;
		}
	}
	public enum DecimalSeparator
	{
		Period,
		Comma
	}
	public static class DecimalSeparatorExtensions
	{
		private static CultureInfo? _commaCultureInstance;

		private static CultureInfo CommaCulture
		{
			get
			{
				if (_commaCultureInstance == null)
				{
					_commaCultureInstance = (CultureInfo)CultureInfo.InvariantCulture.Clone();
					_commaCultureInstance.NumberFormat.NumberDecimalSeparator = ",";
					_commaCultureInstance.NumberFormat.NumberGroupSeparator = ".";
				}
				return _commaCultureInstance;
			}
		}

		public static char Char(this DecimalSeparator separator)
		{
			return separator switch
			{
				DecimalSeparator.Period => '.', 
				DecimalSeparator.Comma => ',', 
				_ => throw new ArgumentOutOfRangeException("separator", separator, null), 
			};
		}

		public static CultureInfo GetCultureInfo(this DecimalSeparator separator)
		{
			return separator switch
			{
				DecimalSeparator.Period => CultureInfo.InvariantCulture, 
				DecimalSeparator.Comma => CommaCulture, 
				_ => throw new ArgumentOutOfRangeException("separator", separator, null), 
			};
		}
	}
	public class GenericButtonOption : BaseOption
	{
		internal readonly GenericButtonConfig config;

		internal override ConfigEntryBase ConfigEntry => null;

		public override string OptionTypeName { get; protected set; } = "generic_button";


		public GenericButtonOption(string name, string category, UnityAction onButtonPressed)
			: this(name, category, "", "Open", onButtonPressed)
		{
		}

		public GenericButtonOption(string name, string category, string description, string buttonText, UnityAction onButtonPressed)
		{
			config = new GenericButtonConfig(name, category, description, buttonText, onButtonPressed);
			base.Category = category;
			base.Name = name;
			base.Description = description;
		}

		internal override void RegisterTokens()
		{
			base.RegisterTokens();
			LanguageApi.Add(GetButtonLabelToken(), config.ButtonText);
		}

		public string GetButtonLabelToken()
		{
			return ("RISK_OF_OPTIONS." + base.ModGuid + "." + base.Category + "." + base.Name + "." + OptionTypeName + ".sub_button.name").Replace(" ", "_").ToUpper();
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			GenericButtonController componentInChildren = obj.GetComponentInChildren<GenericButtonController>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			componentInChildren.buttonToken = GetButtonLabelToken();
			componentInChildren.OnButtonPressed = config.OnButtonPressed;
			((Object)obj).name = "Mod Option GenericButton, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}
	}
	public class IntSliderOption : BaseOption, ITypedValueHolder<int>
	{
		protected readonly int originalValue;

		private readonly ConfigEntry<int> _configEntry;

		protected readonly IntSliderConfig config;

		public override string OptionTypeName { get; protected set; } = "int_slider";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual int Value
		{
			get
			{
				return _configEntry.Value;
			}
			set
			{
				_configEntry.Value = value;
			}
		}

		public IntSliderOption(ConfigEntry<int> configEntry)
			: this(configEntry, new IntSliderConfig())
		{
		}

		public IntSliderOption(ConfigEntry<int> configEntry, bool restartRequired)
			: this(configEntry, new IntSliderConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public IntSliderOption(ConfigEntry<int> configEntry, IntSliderConfig config)
			: this(config, configEntry.Value)
		{
			_configEntry = configEntry;
		}

		protected IntSliderOption(IntSliderConfig config, int originalValue)
		{
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			ModSettingsIntSlider componentInChildren = obj.GetComponentInChildren<ModSettingsIntSlider>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			componentInChildren.minValue = config.min;
			componentInChildren.maxValue = config.max;
			componentInChildren.formatString = config.formatString;
			((Object)obj).name = "Mod Options Int Slider, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			return Value != GetOriginalValue();
		}

		public int GetOriginalValue()
		{
			return originalValue;
		}
	}
	public interface ITypedValueHolder<T>
	{
		T Value { get; set; }

		T GetOriginalValue();

		bool ValueChanged();
	}
	public class KeyBindOption : BaseOption, ITypedValueHolder<KeyboardShortcut>
	{
		protected readonly KeyboardShortcut originalValue;

		private readonly ConfigEntry<KeyboardShortcut> _configEntry;

		protected readonly KeyBindConfig config;

		public override string OptionTypeName { get; protected set; } = "key_bind";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual KeyboardShortcut Value
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return _configEntry.Value;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				_configEntry.Value = value;
			}
		}

		public KeyBindOption(ConfigEntry<KeyboardShortcut> configEntry)
			: this(configEntry, new KeyBindConfig())
		{
		}

		public KeyBindOption(ConfigEntry<KeyboardShortcut> configEntry, bool restartRequired)
			: this(configEntry, new KeyBindConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public KeyBindOption(ConfigEntry<KeyboardShortcut> configEntry, KeyBindConfig config)
			: this(config, configEntry.Value)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			_configEntry = configEntry;
		}

		protected KeyBindOption(KeyBindConfig config, KeyboardShortcut originalValue)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00a5: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(prefab, parent);
			KeyBindController controller = val.GetComponentInChildren<KeyBindController>();
			controller.nameToken = GetNameToken();
			controller.settingToken = base.Identifier;
			((TMP_Text)((Component)val.transform.Find("ButtonText")).GetComponent<HGTextMeshProUGUI>()).SetText(base.Name, true);
			((Object)val).name = "Mod Option KeyBind, " + base.Name;
			HGButton[] componentsInChildren = val.GetComponentsInChildren<HGButton>();
			UnityAction val2 = default(UnityAction);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				ButtonClickedEvent onClick = ((Button)componentsInChildren[i]).onClick;
				UnityAction obj = val2;
				if (obj == null)
				{
					UnityAction val3 = delegate
					{
						controller.StartListening();
					};
					UnityAction val4 = val3;
					val2 = val3;
					obj = val4;
				}
				((UnityEvent)onClick).AddListener(obj);
			}
			return val;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			//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)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			KeyboardShortcut value = Value;
			return !((object)(KeyboardShortcut)(ref value)).Equals((object?)GetOriginalValue());
		}

		public KeyboardShortcut GetOriginalValue()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return originalValue;
		}
	}
	public class SliderOption : BaseOption, ITypedValueHolder<float>
	{
		protected readonly float originalValue;

		private readonly ConfigEntry<float> _configEntry;

		protected readonly SliderConfig config;

		public override string OptionTypeName { get; protected set; } = "slider";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual float Value
		{
			get
			{
				return _configEntry.Value;
			}
			set
			{
				_configEntry.Value = value;
			}
		}

		public SliderOption(ConfigEntry<float> configEntry)
			: this(configEntry, new SliderConfig())
		{
		}

		public SliderOption(ConfigEntry<float> configEntry, bool restartRequired)
			: this(configEntry, new SliderConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public SliderOption(ConfigEntry<float> configEntry, SliderConfig config)
			: this(config, configEntry.Value)
		{
			_configEntry = configEntry;
		}

		protected SliderOption(SliderConfig config, float originalValue)
		{
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			ModSettingsSlider componentInChildren = obj.GetComponentInChildren<ModSettingsSlider>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			componentInChildren.minValue = config.min;
			componentInChildren.maxValue = config.max;
			componentInChildren.formatString = config.formatString;
			((Object)obj).name = "Mod Option Slider, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			return Value != GetOriginalValue();
		}

		public float GetOriginalValue()
		{
			return originalValue;
		}
	}
	public class StepSliderOption : BaseOption, ITypedValueHolder<float>
	{
		protected readonly float originalValue;

		private readonly ConfigEntry<float> _configEntry;

		protected readonly StepSliderConfig config;

		public override string OptionTypeName { get; protected set; } = "step_slider";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual float Value
		{
			get
			{
				return _configEntry.Value;
			}
			set
			{
				_configEntry.Value = value;
			}
		}

		public StepSliderOption(ConfigEntry<float> configEntry)
			: this(configEntry, new StepSliderConfig())
		{
		}

		public StepSliderOption(ConfigEntry<float> configEntry, bool restartRequired)
			: this(configEntry, new StepSliderConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public StepSliderOption(ConfigEntry<float> configEntry, StepSliderConfig config)
			: this(config, configEntry.Value)
		{
			_configEntry = configEntry;
		}

		protected StepSliderOption(StepSliderConfig config, float originalValue)
		{
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			ModSettingsStepSlider componentInChildren = obj.GetComponentInChildren<ModSettingsStepSlider>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			componentInChildren.increment = config.increment;
			componentInChildren.minValue = config.min;
			componentInChildren.maxValue = config.max;
			componentInChildren.formatString = config.formatString;
			int num = (int)Math.Round(Math.Abs(config.min - config.max) / config.increment);
			componentInChildren.slider.minValue = 0f;
			componentInChildren.slider.maxValue = num;
			componentInChildren.slider.wholeNumbers = true;
			((Object)obj).name = "Mod Option Step Slider, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			return Value != GetOriginalValue();
		}

		public float GetOriginalValue()
		{
			return originalValue;
		}
	}
	public class StringInputFieldOption : BaseOption, ITypedValueHolder<string>
	{
		protected readonly string originalValue;

		private readonly ConfigEntry<string> _configEntry;

		protected readonly InputFieldConfig config;

		public override string OptionTypeName { get; protected set; } = "string_input_field";


		internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry;

		public virtual string Value
		{
			get
			{
				return _configEntry.Value;
			}
			set
			{
				_configEntry.Value = value;
			}
		}

		public StringInputFieldOption(ConfigEntry<string> configEntry)
			: this(configEntry, new InputFieldConfig())
		{
		}

		public StringInputFieldOption(ConfigEntry<string> configEntry, bool restartRequired)
			: this(configEntry, new InputFieldConfig
			{
				restartRequired = restartRequired
			})
		{
		}

		public StringInputFieldOption(ConfigEntry<string> configEntry, InputFieldConfig config)
			: this(config, configEntry.Value)
		{
			_configEntry = configEntry;
		}

		protected StringInputFieldOption(InputFieldConfig config, string originalValue)
		{
			this.originalValue = originalValue;
			this.config = config;
		}

		public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
			InputFieldController componentInChildren = obj.GetComponentInChildren<InputFieldController>();
			componentInChildren.nameToken = GetNameToken();
			componentInChildren.settingToken = base.Identifier;
			componentInChildren.submitOn = config.submitOn;
			componentInChildren.lineType = config.lineType;
			componentInChildren.characterValidation = (CharacterValidation)0;
			((Object)obj).name = "Mod Option Input Field, " + base.Name;
			return obj;
		}

		public override BaseOptionConfig GetConfig()
		{
			return config;
		}

		public bool ValueChanged()
		{
			return !string.Equals(_configEntry.Value, originalValue, StringComparison.InvariantCulture);
		}

		public string GetOriginalValue()
		{
			return originalValue;
		}
	}
}
namespace RiskOfOptions.OptionConfigs
{
	public class BaseOptionConfig
	{
		public delegate bool IsDisabledDelegate();

		public string name = "";

		public string description = "";

		public string category = "";

		public bool restartRequired;

		[Obsolete("Not yet implemented")]
		public bool hidden;

		public IsDisabledDelegate checkIfDisabled;
	}
	public class CheckBoxConfig : BaseOptionConfig
	{
	}
	public class ChoiceConfig : BaseOptionConfig
	{
	}
	public class ColorOptionConfig : BaseOptionConfig
	{
	}
	public class GenericButtonConfig : BaseOptionConfig
	{
		public readonly UnityAction OnButtonPressed;

		public readonly string ButtonText;

		public GenericButtonConfig(string name, string category, string description, string buttonText, UnityAction onButtonPressed)
		{
			base.name = name;
			base.category = category;
			base.description = description;
			ButtonText = buttonText;
			OnButtonPressed = onButtonPressed;
		}
	}
	public class InputFieldConfig : BaseOptionConfig
	{
		[Flags]
		public enum SubmitEnum
		{
			OnChar = 1,
			OnSubmit = 2,
			OnExit = 4,
			OnExitOrSubmit = 6,
			All = 7
		}

		public SubmitEnum submitOn = SubmitEnum.OnChar;

		public LineType lineType = (LineType)1;
	}
	public class IntSliderConfig : BaseOptionConfig
	{
		public int min;

		public int max = 100;

		public string formatString = "{0}";
	}
	public class KeyBindConfig : BaseOptionConfig
	{
	}
	public class SliderConfig : BaseOptionConfig
	{
		public float min;

		public float max = 100f;

		public string formatString = "{0:0}%";
	}
	public class StepSliderConfig : BaseOptionConfig
	{
		public float increment = 1f;

		public float min;

		public float max = 100f;

		public string formatString = "{0}";
	}
}
namespace RiskOfOptions.Lib
{
	public static class ColorExtensions
	{
		private const float Scale = 255f;

		public static Color FromRGBHex(this Color orig, int hex)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			int num = (hex & 0xFF0000) >> 16;
			int num2 = (hex & 0xFF00) >> 8;
			int num3 = hex & 0xFF;
			return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, orig.a);
		}

		public static int ToRGBHex(this Color orig)
		{
			//IL_0000: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			int num = (int)(orig.r * 255f) << 16;
			int num2 = (int)(orig.g * 255f) << 8;
			int num3 = (int)(orig.b * 255f);
			return num | num2 | num3;
		}

		internal static Color ColorFromHSV(float hue, float sat, float val)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			float num = val * sat;
			float num2 = MathF.PI / 3f;
			float num3 = num * (1f - Mathf.Abs((float)((double)(hue / num2) % 2.0 - 1.0)));
			float num4 = val - num;
			if (hue < 1f * num2)
			{
				return new Color(num4 + num, num4 + num3, num4 + 0f, 1f);
			}
			if (hue < 2f * num2)
			{
				return new Color(num4 + num3, num4 + num, num4 + 0f, 1f);
			}
			if (hue < 3f * num2)
			{
				return new Color(num4 + 0f, num4 + num, num4 + num3, 1f);
			}
			if (hue < 4f * num2)
			{
				return new Color(num4 + 0f, num4 + num3, num4 + num, 1f);
			}
			if (hue < 5f * num2)
			{
				return new Color(num4 + num3, num4 + 0f, num4 + num, 1f);
			}
			return new Color(num4 + num, num4 + 0f, num4 + num3, 1f);
		}

		internal static void ToHSV(this Color orig, float inHue, out float outHue, out float saturation, out float value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			outHue = 0f;
			float num = Mathf.Min(orig.r, Mathf.Min(orig.g, orig.b));
			float num2 = Mathf.Max(orig.r, Mathf.Max(orig.g, orig.b));
			float num3 = num2 - num;
			value = num2;
			if (num3 == 0f)
			{
				saturation = 0f;
				outHue = inHue.Remap(0f, 6.28f, 0f, 1f);
			}
			else
			{
				saturation = num3 / num2;
				float num4 = ((num2 - orig.r) / 6f + num3 / 2f) / num3;
				float num5 = ((num2 - orig.g) / 6f + num3 / 2f) / num3;
				float num6 = ((num2 - orig.b) / 6f + num3 / 2f) / num3;
				if (orig.r == num3)
				{
					outHue = num6 - num5;
				}
				else if (orig.g == num3)
				{
					outHue = 1f / 3f + num4 - num6;
				}
				else if (orig.b == num3)
				{
					outHue = 2f / 3f + num5 - num4;
				}
				if (outHue < 0f)
				{
					outHue += 1f;
				}
				if (outHue > 1f)
				{
					outHue -= 1f;
				}
			}
			outHue = outHue.Remap(0f, 1f, 0f, 6.28f);
		}
	}
	internal static class CursorController
	{
		private static Hook _controllerHook;

		private static CursorSet _origMouse;

		private static CursorSet _origGamepad;

		private static CursorSet _cursorSet = default(CursorSet);

		private static CursorIndicatorController _indicatorControllerInstance;

		internal static readonly Dictionary<string, GameObject> Cursors = new Dictionary<string, GameObject>();

		private static CursorIndicatorController IndicatorController
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_indicatorControllerInstance))
				{
					_indicatorControllerInstance = ((IEnumerable<MPEventSystem>)MPEventSystem.readOnlyInstancesList).FirstOrDefault((Func<MPEventSystem, bool>)((MPEventSystem instance) => (Object)(object)instance.cursorIndicatorController != (Object)null))?.cursorIndicatorController;
				}
				return _indicatorControllerInstance;
			}
		}

		internal static void Init()
		{
			InitHooks();
			LoadCursors();
			ModifyCursorIndicatorController();
		}

		private static void InitHooks()
		{
			MethodInfo method = typeof(CursorController).GetMethod("SetCursorOverride", BindingFlags.Static | BindingFlags.NonPublic);
			_controllerHook = HookHelper.NewHook<CursorIndicatorController>("SetCursor", method);
		}

		private static void LoadCursors()
		{
		}

		private static void ModifyCursorIndicatorController()
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//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)
			GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/CursorIndicator.prefab").WaitForCompletion();
			obj.AddComponent<AddCursorsToController>();
			CursorIndicatorController component = obj.GetComponent<CursorIndicatorController>();
			_origMouse = component.mouseCursorSet;
			_origGamepad = component.gamepadCursorSet;
		}

		private static void SetCursorOverride(Action<CursorIndicatorController, CursorSet, CursorImage, Color> orig, CursorIndicatorController self, CursorSet set, CursorImage image, Color color)
		{
			//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_0004: Unknown result type (might be due to invalid IL or missing references)
			orig(self, set, image, color);
		}
	}
	internal static class HookHelper
	{
		private const BindingFlags TargetFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private const BindingFlags DestFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		internal static Hook NewHook<TTarget, TDest>(string targetMethodName, string destMethodName, TDest instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			MethodInfo? method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method2 = typeof(TDest).GetMethod(destMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method, method2, (object)instance);
		}

		internal static Hook NewHook<TTarget>(string targetMethodName, MethodInfo destMethod)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return new Hook((MethodBase)typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), destMethod);
		}
	}
	internal static class KeyValuePairExtensions
	{
		internal static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> keyValuePair, out TKey key, out TValue value)
		{
			key = keyValuePair.Key;
			value = keyValuePair.Value;
		}
	}
	internal static class LanguageApi
	{
		internal delegate string LanguageStringDelegate();

		private static readonly Dictionary<string, string> LanguageEntries = new Dictionary<string, string>();

		private static readonly Dictionary<string, LanguageStringDelegate> DynamicLanguageEntries = new Dictionary<string, LanguageStringDelegate>();

		private static Hook _languageHook;

		internal static void Init()
		{
			MethodInfo method = typeof(LanguageApi).GetMethod("GetLocalizedStringByToken", BindingFlags.Static | BindingFlags.NonPublic);
			_languageHook = HookHelper.NewHook<Language>("GetLocalizedStringByToken", method);
		}

		internal static void Add(string token, string entry)
		{
			LanguageEntries[token] = entry;
		}

		internal static void AddDelegate(string token, LanguageStringDelegate stringDelegate)
		{
			DynamicLanguageEntries[token] = stringDelegate;
		}

		internal static void RemoveDelegate(string token)
		{
			DynamicLanguageEntries.Remove(token);
		}

		private static string GetLocalizedStringByToken(Func<Language, string, string> orig, Language self, string token)
		{
			if (token.Length > 15)
			{
				if (token.Substring(0, 15) != "RISK_OF_OPTIONS")
				{
					return orig(self, token);
				}
				if (LanguageEntries.TryGetValue(token, out string value))
				{
					return value;
				}
				if (DynamicLanguageEntries.TryGetValue(token, out LanguageStringDelegate value2))
				{
					return value2();
				}
			}
			return orig(self, token);
		}
	}
	public struct ModMetaData
	{
		public string Guid;

		public string Name;
	}
	public struct OneOf<A, B>
	{
		public object BoxedValue;

		private OneOf(A asA)
		{
			BoxedValue = asA;
		}

		private OneOf(B asB)
		{
			BoxedValue = asB;
		}

		public A AsA()
		{
			return (A)BoxedValue;
		}

		public B AsB()
		{
			return (B)BoxedValue;
		}

		public bool IsA()
		{
			return typeof(A) == BoxedValue.GetType();
		}

		public bool IsB()
		{
			return typeof(B) == BoxedValue.GetType();
		}

		public void Match(Action<A> matchA, Action<B> matchB)
		{
			object boxedValue = BoxedValue;
			if (!(boxedValue is A obj))
			{
				if (boxedValue is B)
				{
					B obj2 = (B)boxedValue;
					matchB(obj2);
				}
			}
			else
			{
				matchA(obj);
			}
		}

		public static implicit operator A(OneOf<A, B> oneOf)
		{
			return oneOf.AsA();
		}

		public static implicit operator B(OneOf<A, B> oneOf)
		{
			return oneOf.AsB();
		}

		public static implicit operator OneOf<A, B>(A asA)
		{
			return new OneOf<A, B>(asA);
		}

		public static implicit operator OneOf<A, B>(B asB)
		{
			return new OneOf<A, B>(asB);
		}
	}
}
namespace RiskOfOptions.Lib.EnumVariants
{
	public abstract class EnumVariant<TValue, TEnum> : IComparable, IEquatable<EnumVariant<TValue, TEnum>> where TValue : IEquatable<TValue> where TEnum : Enum
	{
		public TValue Value { get; protected set; }

		public TEnum Variant { get; protected set; }

		protected EnumVariant(TValue value, TEnum variant)
		{
			Value = value;
			Variant = variant;
		}

		public virtual int CompareTo(object other)
		{
			return Variant.CompareTo(((EnumVariant<TValue, TEnum>)other).Variant);
		}

		public bool Equals(EnumVariant<TValue, TEnum>? other)
		{
			if (other == null)
			{
				return false;
			}
			if (this == other)
			{
				return true;
			}
			if (EqualityComparer<TValue>.Default.Equals(Value, other.Value))
			{
				return EqualityComparer<TEnum>.Default.Equals(Variant, other.Variant);
			}
			return false;
		}

		public override bool Equals(object? obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (this == obj)
			{
				return true;
			}
			if (obj.GetType() == GetType())
			{
				return Equals((EnumVariant<TValue, TEnum>)obj);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return (EqualityComparer<TValue>.Default.GetHashCode(Value) * 397) ^ EqualityComparer<TEnum>.Default.GetHashCode(Variant);
		}
	}
	public class StringOrToken : EnumVariant<string, StringOrToken.ValueType>
	{
		public enum ValueType
		{
			String,
			Token
		}

		private StringOrToken(string value, ValueType variant)
			: base(value, variant)
		{
		}

		public static StringOrToken String(string value)
		{
			return new StringOrToken(value, ValueType.String);
		}

		public static StringOrToken Token(string value)
		{
			return new StringOrToken(value, ValueType.Token);
		}
	}
}
namespace RiskOfOptions.Containers
{
	internal class Category
	{
		public readonly string name;

		private readonly List<BaseOption> _options = new List<BaseOption>();

		private readonly Dictionary<string, int> _identifierOptionMap = new Dictionary<string, int>();

		public string ModGuid { get; }

		internal string NameToken => ("RISK_OF_OPTIONS." + ModGuid + ".category." + name).Replace(" ", "_").ToUpper();

		internal int OptionCount => _options.Count;

		internal BaseOption this[int index] => _options[index];

		internal Category(string name, string modGuid)
		{
			this.name = name;
			ModGuid = modGuid;
			LanguageApi.Add(NameToken, name);
		}

		internal void AddOption(ref BaseOption option)
		{
			int count = _options.Count;
			_options.Add(option);
			_identifierOptionMap.Add(option.Identifier, count);
		}

		internal BaseOption GetOption(string identifier)
		{
			return _options[_identifierOptionMap[identifier]];
		}

		private bool Equals(Category other)
		{
			return name == other.name;
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (this == obj)
			{
				return true;
			}
			if (obj.GetType() == GetType())
			{
				return Equals((Category)obj);
			}
			return false;
		}

		public override int GetHashCode()
		{
			if (name == null)
			{
				return 0;
			}
			return name.GetHashCode();
		}

		public static bool operator ==(Category left, Category right)
		{
			if ((object)right != null && (object)left != null)
			{
				return left.name == right.name;
			}
			return false;
		}

		public static bool operator !=(Category left, Category right)
		{
			return !(left == right);
		}
	}
	internal class ModIndexedOptionCollection : IEnumerable<OptionCollection>, IEnumerable
	{
		private class OptionCollectionEnumerator : IEnumerator<OptionCollection>, IEnumerator, IDisposable
		{
			private readonly OptionCollection[] _optionCollections;

			private int _position = -1;

			public OptionCollection Current
			{
				get
				{
					try
					{
						return _optionCollections[_position];
					}
					catch (IndexOutOfRangeException)
					{
						throw new InvalidOperationException();
					}
				}
			}

			object IEnumerator.Current => Current;

			internal OptionCollectionEnumerator(OptionCollection[] optionCollections)
			{
				_optionCollections = optionCollections;
			}

			public bool MoveNext()
			{
				_position++;
				return _position < _optionCollections.Length;
			}

			public void Reset()
			{
				_position = -1;
			}

			public void Dispose()
			{
			}
		}

		private readonly Dictionary<string, OptionCollection> _optionCollections = new Dictionary<string, OptionCollection>();

		private readonly Dictionary<string, string> _identifierModGuidMap = new Dictionary<string, string>();

		internal OptionCollection this[string modGuid]
		{
			get
			{
				return _optionCollections[modGuid];
			}
			set
			{
				_optionCollections[modGuid] = value;
			}
		}

		internal int Count => _optionCollections.Count;

		internal void AddOption(ref BaseOption option)
		{
			if (!_optionCollections.ContainsKey(option.ModGuid))
			{
				_optionCollections[option.ModGuid] = new OptionCollection(option.ModName, option.ModGuid);
			}
			_optionCollections[option.ModGuid].AddOption(ref option);
			_identifierModGuidMap[option.Identifier] = option.ModGuid;
		}

		internal BaseOption GetOption(string identifier)
		{
			string key = _identifierModGuidMap[identifier];
			return _optionCollections[key].GetOption(identifier);
		}

		internal bool ContainsModGuid(string modGuid)
		{
			return _optionCollections.ContainsKey(modGuid);
		}

		public IEnumerator<OptionCollection> GetEnumerator()
		{
			return new OptionCollectionEnumerator(_optionCollections.Values.ToArray());
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	internal class OptionCollection
	{
		private readonly List<Category> _categories = new List<Category>();

		private readonly Dictionary<string, int> _nameCategoryMap = new Dictionary<string, int>();

		private readonly Dictionary<string, string> _identifierCategoryNameMap = new Dictionary<string, string>();

		public Sprite? icon;

		public GameObject? iconPrefab;

		private string? _descriptionToken;

		public string ModName { get; }

		public string ModGuid { get; }

		internal int CategoryCount => _categories.Count;

		internal string NameToken => ("RISK_OF_OPTIONS." + ModGuid + ".mod_list_button.name").Replace(" ", "_").ToUpper();

		internal string DescriptionToken
		{
			get
			{
				if (_descriptionToken == null)
				{
					_descriptionToken = ("RISK_OF_OPTIONS." + ModGuid + ".mod_list_button.description").Replace(" ", "_").ToUpper();
				}
				return _descriptionToken;
			}
			set
			{
				_descriptionToken = value;
			}
		}

		internal Category this[int index] => _categories[index];

		internal Category this[string categoryName] => _categories[_nameCategoryMap[categoryName]];

		internal OptionCollection(string modName, string modGuid)
		{
			ModName = modName;
			ModGuid = modGuid;
			LanguageApi.Add(NameToken, ModName);
		}

		internal void SetDescriptionText(string descriptionText)
		{
			LanguageApi.Add(DescriptionToken, descriptionText);
		}

		internal void AddOption(ref BaseOption option)
		{
			if (!_nameCategoryMap.ContainsKey(option.Category))
			{
				int count = _categories.Count;
				_categories.Add(new Category(option.Category, ModGuid));
				_nameCategoryMap[option.Category] = count;
			}
			_categories[_nameCategoryMap[option.Category]].AddOption(ref option);
			_identifierCategoryNameMap[option.Identifier] = option.Category;
		}

		internal BaseOption GetOption(string identifier)
		{
			_ = _identifierCategoryNameMap[identifier];
			return _categories[_nameCategoryMap[_identifierCategoryNameMap[identifier]]].GetOption(identifier);
		}
	}
}
namespace RiskOfOptions.Components.RuntimePrefabs
{
	public class CheckBoxPrefab : IRuntimePrefab
	{
		public GameObject CheckBoxButton { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			CheckBoxButton = Object.Instantiate<GameObject>(Prefabs.boolButton);
			GameObject val = Object.Instantiate<GameObject>(((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio")
				.Find("Scroll View")
				.Find("Viewport")
				.Find("VerticalLayout")
				.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject);
			CarouselController componentInChildren = val.GetComponentInChildren<CarouselController>();
			ModSettingsBool component = CheckBoxButton.GetComponent<ModSettingsBool>();
			component.checkBoxFalse = componentInChildren.choices[0].customSprite;
			component.checkBoxTrue = componentInChildren.choices[1].customSprite;
			CheckBoxButton.GetComponent<HGButton>().hoverLanguageTextMeshController = val.GetComponent<HGButton>().hoverLanguageTextMeshController;
			Object.DestroyImmediate((Object)(object)val);
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)CheckBoxButton);
		}
	}
	public class ChoicePrefab : IRuntimePrefab
	{
		public GameObject ChoiceButton { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Expected O, but got Unknown
			GameObject gameObject = ((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio")
				.Find("Scroll View")
				.Find("Viewport")
				.Find("VerticalLayout")
				.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject;
			ChoiceButton = Object.Instantiate<GameObject>(((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Video")
				.Find("Scroll View")
				.Find("Viewport")
				.Find("VerticalLayout")
				.Find("Option, Resolution")).gameObject);
			Transform obj = ChoiceButton.transform.Find("CarouselRect");
			Object.DestroyImmediate((Object)(object)((Component)obj).GetComponent<ResolutionControl>());
			Object.DestroyImmediate((Object)(object)((Component)obj.Find("RefreshRateDropdown")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)obj.Find("ApplyButton")).gameObject);
			Object.DestroyImmediate((Object)(object)ChoiceButton.GetComponent<SelectableDescriptionUpdater>());
			Object.DestroyImmediate((Object)(object)ChoiceButton.GetComponent<PanelSkinController>());
			Object.DestroyImmediate((Object)(object)ChoiceButton.GetComponent<Image>());
			Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("BaseOutline")).gameObject, ChoiceButton.transform);
			GameObject val = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("HoverOutline")).gameObject, ChoiceButton.transform);
			ChoiceButton.SetActive(false);
			HGButton obj2 = ChoiceButton.AddComponent<HGButton>(gameObject.GetComponent<HGButton>());
			obj2.imageOnHover = val.GetComponent<Image>();
			ChoiceButton.AddComponent<ButtonSkinController>(gameObject.GetComponent<ButtonSkinController>());
			Image targetGraphic = ChoiceButton.AddComponent<Image>(gameObject.GetComponent<Image>());
			((Selectable)obj2).targetGraphic = (Graphic)(object)targetGraphic;
			((Selectable)obj2).navigation = default(Navigation);
			((UnityEventBase)((Button)obj2).onClick).RemoveAllListeners();
			ChoiceButton.AddComponent<DropDownController>().nameLabel = ((Component)ChoiceButton.transform.Find("Text, Name")).GetComponent<LanguageTextMeshController>();
			GameObject gameObject2 = ((Component)ChoiceButton.transform.Find("CarouselRect").Find("ResolutionDropdown")).gameObject;
			((Object)gameObject2).name = "Dropdown";
			LayoutElement component = gameObject2.GetComponent<LayoutElement>();
			component.minWidth = 300f;
			component.preferredWidth = 300f;
			Object.DestroyImmediate((Object)(object)gameObject2.GetComponent<MPDropdown>());
			((Component)gameObject2.transform.Find("Label")).gameObject.AddComponent<LanguageTextMeshController>();
			RooDropdown rooDropdown = gameObject2.AddComponent<RooDropdown>();
			rooDropdown.defaultColors = ((Selectable)gameObject.GetComponent<HGButton>()).colors;
			Object.DestroyImmediate((Object)(object)((Component)gameObject2.transform.Find("Template")).gameObject);
			GameObject val2 = Object.Instantiate<GameObject>(gameObject, ChoiceButton.transform);
			((Object)val2).name = "Choice Item Prefab";
			val2.SetActive(false);
			HGButton component2 = val2.GetComponent<HGButton>();
			((UnityEventBase)((Button)component2).onClick).RemoveAllListeners();
			((MPButton)component2).disablePointerClick = false;
			Object.DestroyImmediate((Object)(object)val2.GetComponent<CarouselController>());
			Object.DestroyImmediate((Object)(object)((Component)val2.transform.Find("CarouselRect")).gameObject);
			LayoutElement component3 = val2.GetComponent<LayoutElement>();
			component3.minHeight = 40f;
			component3.preferredHeight = 40f;
			rooDropdown.choiceItemPrefab = val2;
			GameObject val3 = Object.Instantiate<GameObject>(((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio")).gameObject, gameObject2.transform);
			((Object)val3).name = "Drop Down Parent";
			val3.SetActive(false);
			Transform obj3 = val3.transform.Find("Scroll View").Find("Viewport").Find("VerticalLayout");
			Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Slider (Master Volume)")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Slider (SFX Volume)")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Slider (MSX Volume)")).gameObject);
			Object.DestroyImmediate((Object)(object)val3.GetComponent<SettingsPanelController>());
			Object.DestroyImmediate((Object)(object)val3.GetComponent<HGButtonHistory>());
			Object.DestroyImmediate((Object)(object)val3.GetComponent<OnEnableEvent>());
			Object.DestroyImmediate((Object)(object)val3.GetComponent<UIJuice>());
			Canvas orAddComponent = val3.GetOrAddComponent<Canvas>();
			orAddComponent.overrideSorting = true;
			orAddComponent.sortingOrder = 30000;
			val3.GetOrAddComponent<GraphicRaycaster>();
			val3.GetOrAddComponent<CanvasGroup>();
			RectTransform component4 = val3.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0f);
			component4.anchorMax = new Vector2(1f, 0f);
			component4.pivot = new Vector2(0.5f, 1f);
			component4.sizeDelta = new Vector2(0f, 300f);
			component4.anchoredPosition = Vector2.zero;
			RectTransform component5 = ((Component)val3.transform.Find("Scroll View").Find("Scrollbar Vertical")).GetComponent<RectTransform>();
			component5.anchorMin = new Vector2(1f, 0.02f);
			component5.anchorMax = new Vector2(1f, 0.98f);
			component5.sizeDelta = new Vector2(24f, 0f);
			component5.anchoredPosition = new Vector2(-26f, 0f);
			GameObject gameObject3 = ((Component)val3.transform.Find("Scroll View").Find("Viewport").Find("VerticalLayout")).gameObject;
			((LayoutGroup)gameObject3.GetComponent<VerticalLayoutGroup>()).padding = new RectOffset(4, 18, 4, 4);
			rooDropdown.content = gameObject3;
			rooDropdown.template = val3;
			((Object)ChoiceButton).name = "Mod Option Prefab, Choice";
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)ChoiceButton);
		}
	}
	public class GenericButtonPrefab : IRuntimePrefab
	{
		public GameObject GenericButton { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			Transform val = settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio")
				.Find("Scroll View")
				.Find("Viewport")
				.Find("VerticalLayout");
			GenericButton = Object.Instantiate<GameObject>(((Component)val.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject);
			((Object)GenericButton).name = "Mod Option Prefab, GenericButton";
			GenericButton.SetActive(false);
			Object.DestroyImmediate((Object)(object)GenericButton.GetComponentInChildren<CarouselController>());
			Object.DestroyImmediate((Object)(object)((Component)GenericButton.transform.Find("CarouselRect")).gameObject);
			GenericButton.AddComponent<GenericButtonController>();
			GameObject val2 = new GameObject("ButtonContainer", new Type[3]
			{
				typeof(RectTransform),
				typeof(HorizontalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			val2.transform.SetParent(GenericButton.transform);
			HorizontalLayoutGroup component = val2.GetComponent<HorizontalLayoutGroup>();
			((LayoutGroup)component).childAlignment = (TextAnchor)5;
			((LayoutGroup)component).padding = new RectOffset(8, 8, 0, 0);
			((HorizontalOrVerticalLayoutGroup)component).spacing = 8f;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(1f, 0.5f);
			component2.anchoredPosition = new Vector2(-6f, 0f);
			ContentSizeFitter component3 = val2.GetComponent<ContentSizeFitter>();
			component3.horizontalFit = (FitMode)2;
			component3.verticalFit = (FitMode)1;
			GameObject obj = Object.Instantiate<GameObject>(((Component)val.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject, val2.transform);
			((Object)obj).name = "Button";
			Object.DestroyImmediate((Object)(object)obj.GetComponentInChildren<CarouselController>());
			Object.DestroyImmediate((Object)(object)((Component)obj.transform.Find("CarouselRect")).gameObject);
			obj.GetComponent<LayoutElement>().minHeight = 48f;
			HGButton component4 = obj.GetComponent<HGButton>();
			((MPButton)component4).disablePointerClick = false;
			((UnityEventBase)((Button)component4).onClick).RemoveAllListeners();
			HGTextMeshProUGUI componentInChildren = obj.GetComponentInChildren<HGTextMeshProUGUI>();
			((TMP_Text)componentInChildren).enableAutoSizing = false;
			((TMP_Text)componentInChildren).fontSizeMin = ((TMP_Text)componentInChildren).fontSize;
			((TMP_Text)componentInChildren).fontSizeMax = ((TMP_Text)componentInChildren).fontSize;
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)GenericButton);
		}
	}
	public class InputFieldPrefab : IRuntimePrefab
	{
		public GameObject InputField { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			InputField = Object.Instantiate<GameObject>(Prefabs.inputFieldButton);
			InputField.SetActive(false);
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)InputField);
		}
	}
	public class IntSliderPrefab : IRuntimePrefab
	{
		public GameObject IntSlider { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			IntSlider = Object.Instantiate<GameObject>(Prefabs.intSliderButton);
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)IntSlider);
		}
	}
	public interface IRuntimePrefab
	{
		void Instantiate(GameObject settingsPanel);

		void Destroy();
	}
	public class KeyBindPrefab : IRuntimePrefab
	{
		public GameObject KeyBind { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			GameObject gameObject = ((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Controls (M&KB)")
				.Find("Scroll View")
				.Find("Viewport")
				.Find("VerticalLayout")
				.Find("SettingsEntryButton, Binding (Jump)")).gameObject;
			KeyBind = Object.Instantiate<GameObject>(gameObject);
			((Object)KeyBind).name = "Mod Option Prefab, KeyBind";
			InputBindingControl componentInChildren = KeyBind.GetComponentInChildren<InputBindingControl>();
			KeyBind.AddComponent<KeyBindController>().nameLabel = componentInChildren.nameLabel;
			Object.DestroyImmediate((Object)(object)componentInChildren);
			Object.DestroyImmediate((Object)(object)KeyBind.GetComponentInChildren<InputBindingDisplayController>());
			HGButton[] componentsInChildren = KeyBind.GetComponentsInChildren<HGButton>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((UnityEventBase)((Button)componentsInChildren[i]).onClick).RemoveAllListeners();
			}
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)KeyBind);
		}
	}
	public class ModOptionsPanelPrefab : IRuntimePrefab
	{
		[CanBeNull]
		private GameObject _optionsPanel;

		[CanBeNull]
		private GameObject _genericDescriptionPanel;

		private GameObject _audioVerticalLayout;

		[CanBeNull]
		private GameObject _emptyButton;

		public GameObject ModListButton { get; private set; }

		public GameObject ModOptionsHeaderButton { get; private set; }

		public GameObject Canvas { get; private set; }

		public GameObject ModListPanel { get; private set; }

		public GameObject ModListHighlight { get; private set; }

		public GameObject ModDescriptionPanel { get; private set; }

		public GameObject CategoryHeader { get; private set; }

		public GameObject CategoryHeaderButton { get; private set; }

		public GameObject CategoryHeaderHighlight { get; private set; }

		public GameObject CategoryPageIndicators { get; private set; }

		public GameObject CategoryPageIndicator { get; private set; }

		public GameObject CategoryPageIndicatorOutline { get; private set; }

		public GameObject CategoryLeftButton { get; private set; }

		public GameObject CategoryRightButton { get; private set; }

		public GameObject ModOptionsPanel { get; private set; }

		public GameObject ModOptionsDescriptionPanel { get; private set; }

		public GameObject WarningPanel { get; private set; }

		public void Instantiate(GameObject settingsPanel)
		{
			Transform transform = settingsPanel.transform;
			Transform subPanelArea = transform.Find("SafeArea").Find("SubPanelArea");
			Transform headerArea = transform.Find("SafeArea").Find("HeaderContainer").Find("Header (JUICED)");
			CreateOptionsPanel(subPanelArea);
			CreateGenericDescriptionPanel(subPanelArea);
			CreateModOptionsHeaderButton(headerArea);
			CreateVerticalLayout(subPanelArea);
			CreateModListButton();
			CreateEmptyButton();
			CreateCanvas();
			CreateModListPanel(settingsPanel);
			CreateModDescriptionPanel();
			CreateCategoryHeader();
			CreateAdditionalCategoryStuff();
			CreateModOptionsPanel();
			Object.DestroyImmediate((Object)(object)_emptyButton);
			Object.DestroyImmediate((Object)(object)_optionsPanel);
			CreateModOptionsDescriptionPanel();
			CreateWarningPanel();
			Object.DestroyImmediate((Object)(object)_genericDescriptionPanel);
		}

		public void Destroy()
		{
			Object.DestroyImmediate((Object)(object)ModOptionsHeaderButton);
			Object.DestroyImmediate((Object)(object)_emptyButton);
			Object.DestroyImmediate((Object)(object)Canvas);
			Object.DestroyImmediate((Object)(object)ModListPanel);
			Object.DestroyImmediate((Object)(object)ModListHighlight);
			Object.DestroyImmediate((Object)(object)ModDescriptionPanel);
			Object.DestroyImmediate((Object)(object)CategoryPageIndicators);
			Object.DestroyImmediate((Object)(object)CategoryPageIndicator);
			Object.DestroyImmediate((Object)(object)CategoryPageIndicatorOutline);
			Object.DestroyImmediate((Object)(object)CategoryLeftButton);
			Object.DestroyImmediate((Object)(object)CategoryRightButton);
			Object.DestroyImmediate((Object)(object)CategoryHeader);
			Object.DestroyImmediate((Object)(object)CategoryHeaderButton);
			Object.DestroyImmediate((Object)(object)CategoryHeaderHighlight);
			Object.DestroyImmediate((Object)(object)ModOptionsPanel);
			Object.DestroyImmediate((Object)(object)ModOptionsDescriptionPanel);
			Object.DestroyImmediate((Object)(object)WarningPanel);
		}

		private void CreateOptionsPanel(Transform subPanelArea)
		{
			GameObject gameObject = ((Component)subPanelArea.Find("SettingsSubPanel, Audio")).gameObject;
			_optionsPanel = Object.Instantiate<GameObject>(gameObject, subPanelArea);
			((Object)_optionsPanel).name = "Empty Panel";
			Object.DestroyImmediate((Object)(object)_optionsPanel.GetComponent<SettingsPanelController>());
			Transform val = _optionsPanel.transform.Find("Scroll View").Find("Viewport").Find("VerticalLayout");
			while (val.childCount > 0)
			{
				Object.DestroyImmediate((Object)(object)((Component)val.GetChild(0)).gameObject);
			}
		}

		private void CreateGenericDescriptionPanel(Transform subPanelArea)
		{
			_genericDescriptionPanel = Object.Instantiate<GameObject>(((Component)subPanelArea.Find("GenericDescriptionPanel")).gameObject);
			Object.DestroyImmediate((Object)(object)_genericDescriptionPanel.GetComponentInChildren<DisableIfTextIsEmpty>());
			Object.DestroyImmediate((Object)(object)_genericDescriptionPanel.GetComponentInChildren<LanguageTextMeshController>());
			Object.DestroyImmediate((Object)(object)((Component)_genericDescriptionPanel.transform.Find("ContentSizeFitter").Find("BlurPanel")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)_genericDescriptionPanel.transform.Find("ContentSizeFitter").Find("CornerRect")).gameObject);
		}

		private void CreateModOptionsHeaderButton(Transform headerArea)
		{
			ModOptionsHeaderButton = Object.Instantiate<GameObject>(((Component)headerArea.Find("GenericHeaderButton (Audio)")).gameObject);
			((Object)ModOptionsHeaderButton).name = "GenericHeaderButton (Mod Options)";
			ModOptionsHeaderButton.GetComponentInChildren<LanguageTextMeshController>().token = "RISK_OF_OPTIONS_MOD_OPTIONS_HEADER_BUTTON_TEXT";
			((UnityEventBase)((Button)ModOptionsHeaderButton.GetComponentInChildren<HGButton>()).onClick).RemoveAllListeners();
		}

		private void CreateVerticalLayout(Transform subPanelArea)
		{
			_audioVerticalLayout = ((Component)subPanelArea.Find("SettingsSubPanel, Audio").Find("Scroll View").Find("Viewport")
				.Find("VerticalLayout")).gameObject;
		}

		private void CreateModListButton()
		{
			ModListButton = Prefabs.modListButton;
		}

		private void CreateEmptyButton()
		{
			_emptyButton = Object.Instantiate<GameObject>(((Component)_audioVerticalLayout.transform.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject);
			((Object)_emptyButton).name = "Mod Options Prefab, Empty Button";
			Object.DestroyImmediate((Object)(object)_emptyButton.GetComponentInChildren<CarouselController>());
			Object.DestroyImmediate((Object)(object)_emptyButton.GetComponentInChildren<ButtonSkinController>());
			Object.DestroyImmediate((Object)(object)((Component)_emptyButton.transform.Find("CarouselRect")).gameObject);
		}

		private void CreateCanvas()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Canvas = Object.Instantiate<GameObject>(_optionsPanel, _optionsPanel.transform.parent);
			Canvas.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
			Object.DestroyImmediate((Object)(object)Canvas.GetComponent<SettingsPanelController>());
			Object.DestroyImmediate((Object)(object)Canvas.GetComponent<Image>());
			Object.DestroyImmediate((Object)(object)Canvas.GetComponent<HGButtonHistory>());
			Object.DestroyImmediate((Object)(object)((Component)Canvas.transform.Find("Scroll View")).gameObject);
			Canvas.AddComponent<GenericDescriptionController>();
			((Object)Canvas).name = "SettingsSubPanel, (Mod Options)";
		}

		private void CreateModListPanel(GameObject parent)
		{
			ModListPanel = Object.Instantiate<GameObject>(Prefabs.modListPanel, Canvas.transform);
		}

		private void CreateModDescriptionPanel()
		{
			ModDescriptionPanel = Object.Instantiate<GameObject>(Prefabs.modDescriptionPanel, Canvas.transform);
		}

		private void CreateCategoryHeader()
		{
			CategoryHeader = Object.Instantiate<GameObject>(Prefabs.modOptionCategories, Canvas.transform);
			CategoryHeaderHighlight = CategoryHeader.GetComponentInChildren<HGHeaderNavigationController>().headerHighlightObject;
		}

		private void CreateAdditionalCategoryStuff()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00be: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)