Decompiled source of Obeliskial Essentials v2.0.1

BepInEx/patchers/BepInExConfigManager.Mono.Patcher.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Mono.Cecil;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BepInExConfigManager.Patcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BepInExConfigManager.Patcher")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("beabe9b7-0c1c-4071-a99c-1ced983287e9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
public static class Patcher
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class ConfigFile_ctor
	{
		internal static void Postfix(ConfigFile __instance, BepInPlugin ownerMetadata)
		{
			CachedConfigFile cachedConfigFile = new CachedConfigFile(__instance, ownerMetadata);
			ConfigFiles.Add(cachedConfigFile);
			ConfigFileCreated?.Invoke(cachedConfigFile);
		}
	}

	internal const string GUID = "com.sinai.bepinexconfigmanager.patcher";

	public static Action<CachedConfigFile> ConfigFileCreated;

	public static List<CachedConfigFile> ConfigFiles { get; }

	public static IEnumerable<string> TargetDLLs { get; }

	public static void Patch(AssemblyDefinition _)
	{
	}

	static Patcher()
	{
		ConfigFiles = new List<CachedConfigFile>();
		TargetDLLs = Enumerable.Empty<string>();
		Init();
	}

	internal static void Init()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("com.sinai.bepinexconfigmanager.patcher").PatchAll();
	}
}
public class CachedConfigFile
{
	public readonly ConfigFile configFile;

	public readonly BepInPlugin metadata;

	public CachedConfigFile(ConfigFile configFile, BepInPlugin metadata)
	{
		this.configFile = configFile;
		this.metadata = metadata;
	}
}

BepInEx/plugins/BepInExConfigManager.Mono.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ConfigManager.UI;
using ConfigManager.UI.InteractiveValues;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using UniverseLib;
using UniverseLib.Config;
using UniverseLib.Input;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Panels;
using UniverseLib.UI.Widgets;
using UniverseLib.Utility;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BepInExConfigManager")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BepInExConfigManager")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("51308bd5-5872-4a72-85d2-6194673c8a5f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ConfigManager
{
	[BepInPlugin("com.sinai.BepInExConfigManager", "BepInExConfigManager", "1.3.0")]
	public class ConfigManager : BaseUnityPlugin
	{
		public const string GUID = "com.sinai.BepInExConfigManager";

		public const string NAME = "BepInExConfigManager";

		public const string AUTHOR = "Sinai";

		public const string VERSION = "1.3.0";

		internal const string CTG_ID = "BepInExConfigManager";

		internal static string CTG = "Settings";

		internal static ConfigEntry<KeyCode> Main_Menu_Toggle;

		internal static ConfigEntry<bool> Auto_Save_Configs;

		internal static ConfigEntry<float> Startup_Delay;

		internal static ConfigEntry<bool> Disable_EventSystem_Override;

		public static ConfigManager Instance { get; private set; }

		public static ManualLogSource LogSource => ((BaseUnityPlugin)Instance).Logger;

		internal static Harmony Harmony { get; } = new Harmony("com.sinai.BepInExConfigManager");


		internal void Awake()
		{
			Instance = this;
			Init();
		}

		internal void Update()
		{
			DoUpdate();
		}

		public static void Init()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			InitConfig();
			Universe.Init(Startup_Delay.Value, (Action)LateInit, (Action<string, LogType>)LogHandler, new UniverseLibConfig
			{
				Disable_EventSystem_Override = Disable_EventSystem_Override.Value,
				Force_Unlock_Mouse = true,
				Unhollowed_Modules_Folder = Path.Combine(Paths.BepInExRootPath, "unhollowed")
			});
		}

		private static void LateInit()
		{
			UIManager.Init();
		}

		public static void DoUpdate()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (UIManager.uiBase != null && InputManager.GetKeyDown(Main_Menu_Toggle.Value))
			{
				UIManager.ShowMenu = !UIManager.ShowMenu;
			}
		}

		public static void InitConfig()
		{
			//IL_0015: 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_0035: Expected O, but got Unknown
			//IL_0035: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_006a: Expected O, but got Unknown
			Main_Menu_Toggle = ((BaseUnityPlugin)Instance).Config.Bind<KeyCode>(new ConfigDefinition(CTG, "Main Menu Toggle"), (KeyCode)286, new ConfigDescription("The toggle for the Config Manager menu", (AcceptableValueBase)null, new object[0]));
			Auto_Save_Configs = ((BaseUnityPlugin)Instance).Config.Bind<bool>(new ConfigDefinition(CTG, "Auto-save settings"), false, new ConfigDescription("Automatically save settings after changing them? This will mean the undo feature will be unavailable.", (AcceptableValueBase)null, new object[0]));
			Auto_Save_Configs.SettingChanged += Auto_Save_Configs_SettingChanged;
			Startup_Delay = ((BaseUnityPlugin)Instance).Config.Bind<float>(CTG, "Startup Delay", 1f, "Delays the core startup process. Adjust it if you experience issues.");
			Disable_EventSystem_Override = ((BaseUnityPlugin)Instance).Config.Bind<bool>(CTG, "Disable EventSystem Override", false, "Disables the overriding of the EventSystem from the game, if you experience issues with UI Input.");
			Disable_EventSystem_Override.SettingChanged += Disable_EventSystem_Override_SettingChanged;
		}

		private static void Disable_EventSystem_Override_SettingChanged(object sender, EventArgs e)
		{
			bool disable_EventSystem_Override = (bool)((SettingChangedEventArgs)((e is SettingChangedEventArgs) ? e : null)).ChangedSetting.BoxedValue;
			ConfigManager.Disable_EventSystem_Override = disable_EventSystem_Override;
		}

		private static void Auto_Save_Configs_SettingChanged(object sender, EventArgs e)
		{
			bool flag = (bool)((SettingChangedEventArgs)((e is SettingChangedEventArgs) ? e : null)).ChangedSetting.BoxedValue;
			((Component)UIManager.saveButton.Component).gameObject.SetActive(!flag);
		}

		private static void LogHandler(string log, LogType logType)
		{
			//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_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)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected I4, but got Unknown
			switch ((int)logType)
			{
			case 3:
				LogSource.LogMessage((object)log);
				break;
			case 1:
			case 2:
				LogSource.LogWarning((object)log);
				break;
			case 0:
			case 4:
				LogSource.LogError((object)log);
				break;
			}
		}
	}
}
namespace ConfigManager.UI
{
	public class CachedConfigEntry
	{
		public InteractiveValue IValue;

		public bool UIConstructed;

		public GameObject parentContent;

		public GameObject ContentGroup;

		public RectTransform ContentRect;

		public GameObject SubContentGroup;

		public Text mainLabel;

		internal GameObject UIroot;

		internal GameObject undoButton;

		public ConfigEntryBase RefConfig { get; }

		public object EditedValue { get; internal set; }

		public Type FallbackType => RefConfig.SettingType;

		public CachedConfigEntry(ConfigEntryBase config, GameObject parent)
		{
			RefConfig = config;
			parentContent = parent;
			EditedValue = config.BoxedValue;
			CreateIValue(config.BoxedValue, FallbackType);
		}

		internal void OnSettingChanged(object sender, EventArgs e)
		{
			object value = (EditedValue = ((SettingChangedEventArgs)((e is SettingChangedEventArgs) ? e : null)).ChangedSetting.BoxedValue);
			IValue.Value = value;
			IValue.OnValueUpdated();
		}

		public void CreateIValue(object value, Type fallbackType)
		{
			ConfigDescription description = RefConfig.Description;
			if (((description != null) ? description.AcceptableValues : null) != null && ((object)RefConfig.Description.AcceptableValues).GetType().Name.StartsWith("AcceptableValueList"))
			{
				Type actualType = ReflectionExtensions.GetActualType(value);
				IValue = new InteractiveValueList(value, actualType);
			}
			else
			{
				IValue = InteractiveValue.Create(value, fallbackType);
			}
			IValue.Owner = this;
			IValue.mainContentParent = ContentGroup;
			IValue.subContentParent = SubContentGroup;
		}

		public void UpdateValue()
		{
			IValue.Value = RefConfig.BoxedValue;
			EditedValue = RefConfig.BoxedValue;
			IValue.OnValueUpdated();
			IValue.RefreshSubContentState();
		}

		public void SetValueFromIValue()
		{
			if (RefConfig.Description.AcceptableValues != null)
			{
				IValue.Value = RefConfig.Description.AcceptableValues.Clamp(IValue.Value);
			}
			object editedValue = EditedValue;
			if ((editedValue == null && IValue.Value == null) || (editedValue != null && editedValue.Equals(IValue.Value)))
			{
				return;
			}
			if (ConfigManager.Auto_Save_Configs.Value)
			{
				RefConfig.BoxedValue = IValue.Value;
				if (!RefConfig.ConfigFile.SaveOnConfigSet)
				{
					RefConfig.ConfigFile.Save();
				}
				UpdateValue();
			}
			else
			{
				EditedValue = IValue.Value;
				UIManager.OnEntryEdit(this);
				undoButton.SetActive(true);
			}
		}

		public void UndoEdits()
		{
			EditedValue = RefConfig.BoxedValue;
			IValue.Value = EditedValue;
			IValue.OnValueUpdated();
			OnSaveOrUndo();
		}

		public void RevertToDefault()
		{
			RefConfig.BoxedValue = RefConfig.DefaultValue;
			UpdateValue();
			OnSaveOrUndo();
		}

		internal void OnSaveOrUndo()
		{
			undoButton.SetActive(false);
			UIManager.OnEntrySaveOrUndo(this);
		}

		public void Enable()
		{
			if (!UIConstructed)
			{
				ConstructUI();
				UpdateValue();
			}
			UIroot.SetActive(true);
			UIroot.transform.SetAsLastSibling();
		}

		public void Disable()
		{
			if (Object.op_Implicit((Object)(object)UIroot))
			{
				UIroot.SetActive(false);
			}
		}

		public void Destroy()
		{
			if (Object.op_Implicit((Object)(object)UIroot))
			{
				Object.Destroy((Object)(object)UIroot);
			}
		}

		internal void ConstructUI()
		{
			//IL_001b: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			UIConstructed = true;
			UIroot = UIFactory.CreateVerticalGroup(parentContent, "CacheObjectBase.MainContent", true, false, true, true, 0, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)null);
			ContentRect = UIroot.GetComponent<RectTransform>();
			ContentRect.SetSizeWithCurrentAnchors((Axis)1, 25f);
			GameObject uIroot = UIroot;
			int? num = 25;
			int? num2 = 9999;
			UIFactory.SetLayoutElement(uIroot, (int?)200, num, (int?)5000, num2, (int?)null, (int?)null, (bool?)null);
			ContentGroup = UIFactory.CreateVerticalGroup(UIroot, "ConfigHolder", true, false, true, true, 5, new Vector4(2f, 2f, 5f, 5f), new Color(0.12f, 0.12f, 0.12f), (TextAnchor?)null);
			GameObject val = UIFactory.CreateHorizontalGroup(ContentGroup, "ConfigEntryHolder", false, false, true, true, 5, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)(TextAnchor)3);
			num2 = 30;
			num = 0;
			UIFactory.SetLayoutElement(val, (int?)null, num2, (int?)null, num, (int?)null, (int?)null, (bool?)null);
			mainLabel = UIFactory.CreateLabel(val, "ConfigLabel", RefConfig.Definition.Key, (TextAnchor)3, new Color(0.9f, 0.9f, 0.7f), true, 14);
			Text obj = mainLabel;
			obj.text = obj.text + " <i>(" + SignatureHighlighter.Parse(RefConfig.SettingType, false, (MemberInfo)null) + ")</i>";
			UIFactory.SetLayoutElement(((Component)mainLabel).gameObject, (int?)200, (int?)22, (int?)9999, (int?)0, (int?)null, (int?)null, (bool?)null);
			ButtonRef val2 = UIFactory.CreateButton(val, "UndoButton", "Undo", (Color?)new Color(0.3f, 0.3f, 0.3f));
			val2.OnClick = (Action)Delegate.Combine(val2.OnClick, new Action(UndoEdits));
			undoButton = ((Component)val2.Component).gameObject;
			undoButton.SetActive(false);
			UIFactory.SetLayoutElement(undoButton, (int?)80, (int?)22, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null);
			ButtonRef val3 = UIFactory.CreateButton(val, "DefaultButton", "Default", (Color?)new Color(0.3f, 0.3f, 0.3f));
			val3.OnClick = (Action)Delegate.Combine(val3.OnClick, new Action(RevertToDefault));
			UIFactory.SetLayoutElement(((Component)val3.Component).gameObject, (int?)80, (int?)22, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null);
			if (RefConfig.Description != null && !string.IsNullOrEmpty(RefConfig.Description.Description))
			{
				Text val4 = UIFactory.CreateLabel(ContentGroup, "Description", "<i>" + RefConfig.Description.Description + "</i>", (TextAnchor)3, Color.grey, true, 14);
				UIFactory.SetLayoutElement(((Component)val4).gameObject, (int?)250, (int?)18, (int?)9999, (int?)0, (int?)null, (int?)null, (bool?)null);
			}
			SubContentGroup = UIFactory.CreateVerticalGroup(ContentGroup, "CacheObjectBase.SubContent", true, false, true, true, 0, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)null);
			GameObject subContentGroup = SubContentGroup;
			num = 30;
			num2 = 9999;
			UIFactory.SetLayoutElement(subContentGroup, (int?)125, num, (int?)9000, num2, (int?)null, (int?)null, (bool?)null);
			SubContentGroup.SetActive(false);
			if (IValue != null)
			{
				IValue.mainContentParent = ContentGroup;
				IValue.subContentParent = SubContentGroup;
			}
		}
	}
	internal class ConfigFileInfo
	{
		public ConfigFile RefConfigFile;

		public BepInPlugin Meta;

		private List<EntryInfo> entries = new List<EntryInfo>();

		internal bool isCompletelyHidden;

		internal ButtonRef listButton;

		internal GameObject contentObj;

		internal IEnumerable<GameObject> HiddenEntries => from it in Entries
			where it.IsHidden
			select it.content;

		internal List<EntryInfo> Entries
		{
			get
			{
				return entries;
			}
			set
			{
				entries = value;
			}
		}
	}
	internal class EntryInfo
	{
		public ConfigEntryBase RefEntry;

		internal GameObject content;

		public CachedConfigEntry Cached { get; }

		public bool IsHidden { get; internal set; }

		public EntryInfo(CachedConfigEntry cached)
		{
			Cached = cached;
		}
	}
	public class UIManager : PanelBase
	{
		private static readonly Dictionary<string, ConfigFileInfo> ConfigFiles = new Dictionary<string, ConfigFileInfo>();

		private static readonly Dictionary<ConfigEntryBase, CachedConfigEntry> configsToCached = new Dictionary<ConfigEntryBase, CachedConfigEntry>();

		private static ConfigFileInfo currentCategory;

		private static readonly HashSet<CachedConfigEntry> editingEntries = new HashSet<CachedConfigEntry>();

		internal static ButtonRef saveButton;

		internal static UIBase uiBase;

		internal static GameObject CategoryListContent;

		internal static GameObject ConfigEditorContent;

		private static string currentFilter;

		private static Color normalInactiveColor = new Color(0.38f, 0.34f, 0.34f);

		private static Color normalActiveColor = UnityHelpers.ToColor("c2b895");

		public static UIManager Instance { get; internal set; }

		public override string Name => "<b>BepInExConfigManager</b> <i>1.3.0</i>";

		public override int MinWidth => 750;

		public override int MinHeight => 750;

		public override Vector2 DefaultAnchorMin => new Vector2(0.2f, 0.02f);

		public override Vector2 DefaultAnchorMax => new Vector2(0.8f, 0.98f);

		public static bool ShowMenu
		{
			get
			{
				return uiBase != null && uiBase.Enabled;
			}
			set
			{
				if (uiBase != null && Object.op_Implicit((Object)(object)uiBase.RootObject) && uiBase.Enabled != value)
				{
					UniversalUI.SetUIActive("com.sinai.BepInExConfigManager", value);
					((UIModel)Instance).SetActive(value);
				}
			}
		}

		public static bool ShowHiddenConfigs { get; internal set; }

		internal static string Filter => currentFilter ?? "";

		public UIManager(UIBase owner)
			: base(owner)
		{
			Instance = this;
		}

		internal static void Init()
		{
			uiBase = UniversalUI.RegisterUI("com.sinai.BepInExConfigManager", (Action)null);
			CreateMenu();
			Canvas.ForceUpdateCanvases();
			ShowMenu = false;
			SetupCategories();
		}

		internal static void SetupCategories()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			ConfigFile val = (ConfigFile)AccessTools.Property(typeof(ConfigFile), "CoreConfig").GetValue(null, null);
			if (val != null)
			{
				SetupCategory(val, null, new BepInPlugin("bepinex.core.config", "BepInEx", "1.0"), isCoreConfig: true, forceAdvanced: true);
			}
			foreach (CachedConfigFile configFile in Patcher.ConfigFiles)
			{
				ProcessConfigFile(configFile);
			}
			Patcher.ConfigFileCreated = (Action<CachedConfigFile>)Delegate.Combine(Patcher.ConfigFileCreated, new Action<CachedConfigFile>(ProcessConfigFile));
		}

		private static void ProcessConfigFile(CachedConfigFile cachedConfig)
		{
			RuntimeHelper.StartCoroutine(DelayedProcess(cachedConfig));
		}

		private static IEnumerator DelayedProcess(CachedConfigFile cachedConfig)
		{
			yield return null;
			SetupCategory(cachedConfig.configFile, null, cachedConfig.metadata, isCoreConfig: false);
			cachedConfig.configFile.SettingChanged += ConfigFile_SettingChanged;
		}

		private static void ConfigFile_SettingChanged(object sender, SettingChangedEventArgs e)
		{
			try
			{
				configsToCached[(ConfigEntryBase)((sender is ConfigEntryBase) ? sender : null)].OnSettingChanged(sender, (EventArgs)(object)e);
			}
			catch (Exception ex)
			{
				ConfigManager.LogSource.LogWarning((object)ex);
			}
		}

		internal static void SetupCategory(ConfigFile configFile, object plugin, BepInPlugin meta, bool isCoreConfig, bool forceAdvanced = false)
		{
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string GUID = ((meta != null) ? meta.GUID : null) ?? Path.GetFileNameWithoutExtension(configFile.ConfigFilePath);
				string text = ((meta != null) ? meta.Name : null) ?? GUID;
				BaseUnityPlugin val = (BaseUnityPlugin)((plugin is BaseUnityPlugin) ? plugin : null);
				if (!forceAdvanced && (Object)(object)val != (Object)null)
				{
					Type type = ((object)val).GetType();
					if (type.GetCustomAttributes(typeof(BrowsableAttribute), inherit: false).Cast<BrowsableAttribute>().Any((BrowsableAttribute it) => !it.Browsable))
					{
						forceAdvanced = true;
					}
				}
				ConfigFileInfo configFileInfo = new ConfigFileInfo
				{
					RefConfigFile = configFile,
					Meta = meta
				};
				ButtonRef val2 = UIFactory.CreateButton(CategoryListContent, "BUTTON_" + GUID, text, (Color?)null);
				val2.OnClick = (Action)Delegate.Combine(val2.OnClick, (Action)delegate
				{
					SetActiveCategory(GUID);
				});
				GameObject gameObject = ((Component)val2.Component).gameObject;
				int? num = 9999;
				int? num2 = 30;
				int? num3 = 0;
				UIFactory.SetLayoutElement(gameObject, (int?)null, num2, num, num3, (int?)null, (int?)null, (bool?)null);
				RuntimeHelper.SetColorBlock((Selectable)(object)val2.Component, (Color?)normalInactiveColor, (Color?)new Color(0.6f, 0.55f, 0.45f), (Color?)new Color(0.2f, 0.18f, 0.15f), (Color?)null);
				configFileInfo.listButton = val2;
				GameObject val3 = UIFactory.CreateVerticalGroup(ConfigEditorContent, "CATEGORY_" + GUID, true, false, true, true, 4, default(Vector4), new Color(0.05f, 0.05f, 0.05f), (TextAnchor?)null);
				Dictionary<string, List<ConfigEntryBase>> dictionary = new Dictionary<string, List<ConfigEntryBase>> { 
				{
					"",
					new List<ConfigEntryBase>()
				} };
				foreach (ConfigDefinition key in configFile.Keys)
				{
					string text2 = key.Section;
					if (text2 == null)
					{
						text2 = "";
					}
					if (!dictionary.ContainsKey(text2))
					{
						dictionary.Add(text2, new List<ConfigEntryBase>());
					}
					dictionary[text2].Add(configFile[key]);
				}
				foreach (KeyValuePair<string, List<ConfigEntryBase>> item in dictionary)
				{
					if (!string.IsNullOrEmpty(item.Key))
					{
						GameObject val4 = UIFactory.CreateHorizontalGroup(val3, "TitleBG", true, true, true, true, 0, default(Vector4), new Color(0.07f, 0.07f, 0.07f), (TextAnchor?)null);
						Text val5 = UIFactory.CreateLabel(val4, "Title_" + item.Key, item.Key, (TextAnchor)4, default(Color), true, 17);
						GameObject gameObject2 = ((Component)val5).gameObject;
						num3 = 30;
						UIFactory.SetLayoutElement(gameObject2, (int?)200, num3, (int?)9999, (int?)null, (int?)null, (int?)null, (bool?)null);
					}
					foreach (ConfigEntryBase item2 in item.Value)
					{
						CachedConfigEntry cachedConfigEntry = new CachedConfigEntry(item2, val3);
						cachedConfigEntry.Enable();
						configsToCached.Add(item2, cachedConfigEntry);
						GameObject uIroot = cachedConfigEntry.UIroot;
						bool flag = forceAdvanced;
						if (!flag)
						{
							ConfigDescription description = item2.Description;
							object[] array = ((description != null) ? description.Tags : null);
							if (array != null && array.Any())
							{
								if (array.Any((object it) => it is string text3 && text3 == "Advanced"))
								{
									flag = true;
								}
								else
								{
									object obj = array.FirstOrDefault((object it) => it.GetType().Name == "ConfigurationManagerAttributes");
									if (obj != null)
									{
										flag = (bool?)obj.GetType().GetField("IsAdvanced")?.GetValue(obj) == true;
									}
								}
							}
						}
						configFileInfo.Entries.Add(new EntryInfo(cachedConfigEntry)
						{
							RefEntry = item2,
							content = uIroot,
							IsHidden = flag
						});
					}
				}
				if (!configFileInfo.Entries.Any((EntryInfo it) => !it.IsHidden))
				{
					((Component)val2.Component).gameObject.SetActive(false);
					configFileInfo.isCompletelyHidden = true;
				}
				val3.SetActive(false);
				configFileInfo.contentObj = val3;
				ConfigFiles.Add(GUID, configFileInfo);
			}
			catch (Exception arg)
			{
				if (meta != null)
				{
					ConfigManager.LogSource.LogWarning((object)$"Exception setting up category '{meta.GUID}'!\r\n{arg}");
					return;
				}
				string arg2;
				try
				{
					arg2 = Path.GetFileNameWithoutExtension(configFile.ConfigFilePath);
				}
				catch
				{
					arg2 = "UNKNOWN";
				}
				ConfigManager.LogSource.LogWarning((object)$"Exception setting up category (no meta): {arg2}\n{arg}");
			}
		}

		internal static void CreateMenu()
		{
			if (Instance != null)
			{
				ConfigManager.LogSource.LogWarning((object)"An instance of ConfigurationEditor already exists, cannot create another!");
			}
			else
			{
				new UIManager(uiBase);
			}
		}

		public static void OnEntryEdit(CachedConfigEntry entry)
		{
			if (!editingEntries.Contains(entry))
			{
				editingEntries.Add(entry);
			}
			if (!((Selectable)saveButton.Component).interactable)
			{
				((Selectable)saveButton.Component).interactable = true;
			}
		}

		public static void OnEntrySaveOrUndo(CachedConfigEntry entry)
		{
			if (editingEntries.Contains(entry))
			{
				editingEntries.Remove(entry);
			}
			if (!editingEntries.Any())
			{
				((Selectable)saveButton.Component).interactable = false;
			}
		}

		public static void SavePreferences()
		{
			foreach (ConfigFileInfo value in ConfigFiles.Values)
			{
				foreach (EntryInfo entry in value.Entries)
				{
					entry.RefEntry.BoxedValue = entry.Cached.EditedValue;
				}
				ConfigFile refConfigFile = value.RefConfigFile;
				if (!refConfigFile.SaveOnConfigSet)
				{
					refConfigFile.Save();
				}
			}
			for (int num = editingEntries.Count - 1; num >= 0; num--)
			{
				editingEntries.ElementAt(num).OnSaveOrUndo();
			}
			editingEntries.Clear();
			((Selectable)saveButton.Component).interactable = false;
		}

		public static void SetHiddenConfigVisibility(bool show)
		{
			if (ShowHiddenConfigs == show)
			{
				return;
			}
			ShowHiddenConfigs = show;
			foreach (KeyValuePair<string, ConfigFileInfo> configFile in ConfigFiles)
			{
				ConfigFileInfo value = configFile.Value;
				if (value.isCompletelyHidden)
				{
					((Component)value.listButton.Component).gameObject.SetActive(ShowHiddenConfigs);
				}
			}
			if (currentCategory != null && !ShowHiddenConfigs && currentCategory.isCompletelyHidden)
			{
				UnsetActiveCategory();
			}
			RefreshFilter();
		}

		public static void FilterConfigs(string search)
		{
			currentFilter = search.ToLower();
			RefreshFilter();
		}

		internal static void RefreshFilter()
		{
			if (currentCategory == null)
			{
				return;
			}
			using List<EntryInfo>.Enumerator enumerator = currentCategory.Entries.GetEnumerator();
			EntryInfo current;
			int num;
			bool active;
			for (; enumerator.MoveNext(); active = (byte)num != 0, current.content.SetActive(active))
			{
				current = enumerator.Current;
				if (!string.IsNullOrEmpty(currentFilter) && !current.RefEntry.Definition.Key.ToLower().Contains(currentFilter))
				{
					ConfigDescription description = current.RefEntry.Description;
					if (!((description == null) ? null : description.Description?.Contains(currentFilter)).GetValueOrDefault())
					{
						num = 0;
						continue;
					}
				}
				num = ((!current.IsHidden || ShowHiddenConfigs) ? 1 : 0);
			}
		}

		public static void SetActiveCategory(string categoryIdentifier)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigFiles.ContainsKey(categoryIdentifier))
			{
				UnsetActiveCategory();
				ConfigFileInfo configFileInfo = (currentCategory = ConfigFiles[categoryIdentifier]);
				GameObject contentObj = configFileInfo.contentObj;
				contentObj.SetActive(true);
				ButtonRef listButton = configFileInfo.listButton;
				RuntimeHelper.SetColorBlock((Selectable)(object)listButton.Component, (Color?)normalActiveColor, (Color?)null, (Color?)null, (Color?)null);
				RefreshFilter();
			}
		}

		internal static void UnsetActiveCategory()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (currentCategory != null)
			{
				RuntimeHelper.SetColorBlock((Selectable)(object)currentCategory.listButton.Component, (Color?)normalInactiveColor, (Color?)null, (Color?)null, (Color?)null);
				currentCategory.contentObj.SetActive(false);
				currentCategory = null;
			}
		}

		protected override void ConstructPanelContent()
		{
			UIFactory.SetLayoutGroup<VerticalLayoutGroup>(((PanelBase)this).ContentRoot, (bool?)true, (bool?)false, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
			ConstructTitleBar();
			ConstructSaveButton();
			ConstructToolbar();
			ConstructEditorViewport();
		}

		protected override void OnClosePanelClicked()
		{
			((PanelBase)this).OnClosePanelClicked();
			ShowMenu = false;
		}

		private void ConstructTitleBar()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Text component = ((Component)((PanelBase)this).TitleBar.transform.GetChild(0)).GetComponent<Text>();
			component.text = "<b><color=#8b736b>BepInExConfigManager</color></b> <i><color=#ffe690>v1.3.0</color></i>";
			Button componentInChildren = ((PanelBase)this).TitleBar.GetComponentInChildren<Button>();
			RuntimeHelper.SetColorBlock((Selectable)(object)componentInChildren, (Color?)new Color(1f, 0.2f, 0.2f), (Color?)new Color(1f, 0.6f, 0.6f), (Color?)new Color(0.3f, 0.1f, 0.1f), (Color?)null);
			Text componentInChildren2 = ((Component)componentInChildren).GetComponentInChildren<Text>();
			((Graphic)componentInChildren2).color = Color.white;
			componentInChildren2.resizeTextForBestFit = true;
			componentInChildren2.resizeTextMinSize = 8;
			componentInChildren2.resizeTextMaxSize = 14;
		}

		private void ConstructSaveButton()
		{
			//IL_00c0: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			saveButton = UIFactory.CreateButton(((PanelBase)this).ContentRoot, "SaveButton", "Save Preferences", (Color?)null);
			ButtonRef obj = saveButton;
			obj.OnClick = (Action)Delegate.Combine(obj.OnClick, new Action(SavePreferences));
			GameObject gameObject = ((Component)saveButton.Component).gameObject;
			int? num = 35;
			int? num2 = 0;
			int? num3 = 9999;
			UIFactory.SetLayoutElement(gameObject, (int?)null, num, num3, num2, (int?)null, (int?)null, (bool?)null);
			RuntimeHelper.SetColorBlock((Selectable)(object)saveButton.Component, (Color?)new Color(0.1f, 0.3f, 0.1f), (Color?)new Color(0.2f, 0.5f, 0.2f), (Color?)new Color(0.1f, 0.2f, 0.1f), (Color?)new Color(0.2f, 0.2f, 0.2f));
			((Selectable)saveButton.Component).interactable = false;
			((Component)saveButton.Component).gameObject.SetActive(!ConfigManager.Auto_Save_Configs.Value);
		}

		private void ConstructToolbar()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GameObject val2 = UIFactory.CreateHorizontalGroup(((PanelBase)this).ContentRoot, "Toolbar", false, false, true, true, 4, new Vector4(3f, 3f, 3f, 3f), new Color(0.1f, 0.1f, 0.1f), (TextAnchor?)null);
			Toggle val3 = default(Toggle);
			Text val4 = default(Text);
			GameObject val5 = UIFactory.CreateToggle(val2, "HiddenConfigsToggle", ref val3, ref val4, default(Color), 20, 20);
			val3.isOn = false;
			((UnityEvent<bool>)(object)val3.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				SetHiddenConfigVisibility(val);
			});
			val4.text = "Show Advanced Settings";
			int? num = 280;
			int? num2 = 25;
			int? num3 = 0;
			UIFactory.SetLayoutElement(val5, num, num2, (int?)0, num3, (int?)null, (int?)null, (bool?)null);
			InputFieldRef val6 = UIFactory.CreateInputField(val2, "FilterInput", "Search...");
			GameObject gameObject = ((Component)val6.Component).gameObject;
			num3 = 9999;
			int? num4 = 25;
			UIFactory.SetLayoutElement(gameObject, (int?)null, num4, num3, (int?)null, (int?)null, (int?)null, (bool?)null);
			val6.OnValueChanged += FilterConfigs;
		}

		private void ConstructEditorViewport()
		{
			//IL_0013: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UIFactory.CreateHorizontalGroup(((PanelBase)this).ContentRoot, "Main", true, true, true, true, 2, default(Vector4), new Color(0.08f, 0.08f, 0.08f), (TextAnchor?)null);
			GameObject val2 = default(GameObject);
			AutoSliderScrollbar val3 = default(AutoSliderScrollbar);
			GameObject val4 = UIFactory.CreateScrollView(val, "CategoryList", ref val2, ref val3, new Color(0.1f, 0.1f, 0.1f));
			int? num = 300;
			int? num2 = 0;
			UIFactory.SetLayoutElement(val4, num, (int?)null, num2, (int?)null, (int?)null, (int?)null, (bool?)null);
			CategoryListContent = val2;
			GameObject obj = val2;
			num2 = 3;
			UIFactory.SetLayoutGroup<VerticalLayoutGroup>(obj, (bool?)null, (bool?)null, (bool?)null, (bool?)null, num2, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
			GameObject configEditorContent = default(GameObject);
			GameObject val5 = UIFactory.CreateScrollView(val, "ConfigEditor", ref configEditorContent, ref val3, new Color(0.05f, 0.05f, 0.05f));
			num2 = 9999;
			UIFactory.SetLayoutElement(val5, (int?)null, (int?)null, num2, (int?)null, (int?)null, (int?)null, (bool?)null);
			ConfigEditorContent = configEditorContent;
		}
	}
}
namespace ConfigManager.UI.InteractiveValues
{
	public class InteractiveBool : InteractiveValue
	{
		internal Toggle toggle;

		private Text labelText;

		public InteractiveBool(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return (object)type == typeof(bool);
		}

		public override void RefreshUIForValue()
		{
			bool flag = (bool)Value;
			if (!((Component)toggle).gameObject.activeSelf)
			{
				((Component)toggle).gameObject.SetActive(true);
			}
			if (flag != toggle.isOn)
			{
				toggle.isOn = flag;
			}
			string arg = (flag ? "6bc981" : "c96b6b");
			labelText.text = $"<color=#{arg}>{flag}</color>";
		}

		internal void OnToggleValueChanged(bool val)
		{
			Value = val;
			RefreshUIForValue();
			Owner.SetValueFromIValue();
		}

		public override void ConstructUI(GameObject parent)
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			base.ConstructUI(parent);
			bool flag = false;
			Text val2 = default(Text);
			while (!flag)
			{
				GameObject val = null;
				try
				{
					val = UIFactory.CreateToggle(mainContent, "InteractiveBoolToggle", ref toggle, ref val2, new Color(0.1f, 0.1f, 0.1f), 20, 20);
					UIFactory.SetLayoutElement(val, (int?)24, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
					((UnityEvent<bool>)(object)toggle.onValueChanged).AddListener((UnityAction<bool>)OnToggleValueChanged);
					flag = true;
				}
				catch
				{
					if (Object.op_Implicit((Object)(object)val))
					{
						Object.Destroy((Object)(object)val);
					}
				}
			}
			labelText = UIFactory.CreateLabel(mainContent, "TrueFalseLabel", "False", (TextAnchor)3, default(Color), true, 14);
			UIFactory.SetLayoutElement(((Component)labelText).gameObject, (int?)60, (int?)25, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
			RefreshUIForValue();
		}
	}
	public class InteractiveColor : InteractiveValue
	{
		private Image colorImage;

		private readonly InputField[] inputs = (InputField[])(object)new InputField[4];

		private readonly Slider[] sliders = (Slider[])(object)new Slider[4];

		private static readonly string[] fieldNames = new string[4] { "R", "G", "B", "A" };

		public InteractiveColor(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return (object)type == typeof(Color) || (object)type == typeof(Color32);
		}

		public override void RefreshUIForValue()
		{
			base.RefreshUIForValue();
			RefreshColorUI();
		}

		private void RefreshColorUI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			if (Value is Color32 val)
			{
				inputs[0].text = val.r.ToString();
				inputs[1].text = val.g.ToString();
				inputs[2].text = val.b.ToString();
				inputs[3].text = val.a.ToString();
				if (Object.op_Implicit((Object)(object)colorImage))
				{
					((Graphic)colorImage).color = Color32.op_Implicit(val);
				}
				return;
			}
			object value = Value;
			if (!(value is Color))
			{
				return;
			}
			Color color = (Color)value;
			if (true)
			{
				inputs[0].text = color.r.ToString();
				inputs[1].text = color.g.ToString();
				inputs[2].text = color.b.ToString();
				inputs[3].text = color.a.ToString();
				if (Object.op_Implicit((Object)(object)colorImage))
				{
					((Graphic)colorImage).color = color;
				}
			}
		}

		protected internal override void OnToggleSubcontent(bool toggle)
		{
			base.OnToggleSubcontent(toggle);
			RefreshColorUI();
		}

		public override void ConstructUI(GameObject parent)
		{
			//IL_001b: 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_0037: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			base.ConstructUI(parent);
			GameObject val = UIFactory.CreateHorizontalGroup(mainContent, "ColorEditor", false, false, true, true, 5, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)(TextAnchor)3);
			GameObject val2 = UIFactory.CreateVerticalGroup(val, "ImgHolder", true, true, true, true, 0, new Vector4(1f, 1f, 1f, 1f), new Color(0.08f, 0.08f, 0.08f), (TextAnchor?)null);
			UIFactory.SetLayoutElement(val2, (int?)50, (int?)25, (int?)999, (int?)0, (int?)null, (int?)null, (bool?)null);
			GameObject val3 = UIFactory.CreateUIObject("ColorImageHelper", val2, new Vector2(100f, 25f));
			colorImage = val3.AddComponent<Image>();
			((Graphic)colorImage).color = (Color)((Value is Color) ? ((Color)Value) : Color32.op_Implicit((Color32)Value));
			GameObject val4 = UIFactory.CreateVerticalGroup(val, "EditorsGroup", false, false, true, true, 3, new Vector4(3f, 3f, 3f, 3f), new Color(1f, 1f, 1f, 0f), (TextAnchor?)null);
			GameObject val5 = UIFactory.CreateGridGroup(val4, "Grid", new Vector2(140f, 25f), new Vector2(2f, 2f), new Color(1f, 1f, 1f, 0f));
			UIFactory.SetLayoutElement(val5, (int?)580, (int?)25, (int?)900, (int?)null, (int?)null, (int?)null, (bool?)null);
			for (int i = 0; i < 4; i++)
			{
				AddEditorRow(i, val5);
			}
			RefreshUIForValue();
		}

		internal void AddEditorRow(int index, GameObject groupObj)
		{
			//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)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UIFactory.CreateHorizontalGroup(groupObj, "EditorRow_" + fieldNames[index], false, true, true, true, 5, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)null);
			Text val2 = UIFactory.CreateLabel(val, "RowLabel", fieldNames[index] + ":", (TextAnchor)5, Color.cyan, true, 14);
			GameObject gameObject = ((Component)val2).gameObject;
			int? num = 17;
			int? num2 = 0;
			UIFactory.SetLayoutElement(gameObject, num, (int?)25, num2, (int?)null, (int?)null, (int?)null, (bool?)null);
			InputFieldRef inputField = UIFactory.CreateInputField(val, "InputField", "...");
			UIFactory.SetLayoutElement(((Component)inputField.Component).gameObject, (int?)40, (int?)25, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null);
			inputs[index] = inputField.Component;
			inputField.Component.characterValidation = (CharacterValidation)((!(Value is Color)) ? 1 : 2);
			inputField.OnValueChanged += delegate(string value)
			{
				if (Value is Color)
				{
					float num3 = float.Parse(value);
					SetValueToColor(num3);
					sliders[index].value = num3;
				}
				else
				{
					byte b = byte.Parse(value);
					SetValueToColor32(b);
					sliders[index].value = (int)b;
				}
			};
			Slider val3 = default(Slider);
			GameObject val4 = UIFactory.CreateSlider(val, "Slider", ref val3);
			sliders[index] = val3;
			num2 = 25;
			UIFactory.SetLayoutElement(val4, (int?)70, num2, (int?)999, (int?)0, (int?)null, (int?)null, (bool?)null);
			val3.minValue = 0f;
			if (Value is Color)
			{
				val3.maxValue = 1f;
				val3.value = GetValueFromColor();
			}
			else
			{
				val3.maxValue = 255f;
				val3.value = (int)GetValueFromColor32();
			}
			((UnityEvent<float>)(object)val3.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
			{
				try
				{
					if (Value is Color32)
					{
						string text = ((byte)value).ToString();
						inputField.Text = text;
						SetValueToColor32((byte)value);
						inputs[index].text = text;
					}
					else
					{
						inputField.Text = value.ToString();
						SetValueToColor(value);
						inputs[index].text = value.ToString();
					}
				}
				catch (Exception ex)
				{
					ConfigManager.LogSource.LogMessage((object)ex.ToString());
				}
			});
			float GetValueFromColor()
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				Color val6 = (Color)Value;
				if (1 == 0)
				{
				}
				float result2 = index switch
				{
					0 => val6.r, 
					1 => val6.g, 
					2 => val6.b, 
					3 => val6.a, 
					_ => throw new NotImplementedException(), 
				};
				if (1 == 0)
				{
				}
				return result2;
			}
			byte GetValueFromColor32()
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				Color32 val5 = (Color32)Value;
				if (1 == 0)
				{
				}
				byte result = index switch
				{
					0 => val5.r, 
					1 => val5.g, 
					2 => val5.b, 
					3 => val5.a, 
					_ => throw new NotImplementedException(), 
				};
				if (1 == 0)
				{
				}
				return result;
			}
			void SetValueToColor(float floatValue)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				Color val8 = (Color)Value;
				switch (index)
				{
				case 0:
					val8.r = floatValue;
					break;
				case 1:
					val8.g = floatValue;
					break;
				case 2:
					val8.b = floatValue;
					break;
				case 3:
					val8.a = floatValue;
					break;
				}
				Value = val8;
				((Graphic)colorImage).color = val8;
				Owner.SetValueFromIValue();
			}
			void SetValueToColor32(byte byteValue)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				Color32 val7 = (Color32)Value;
				switch (index)
				{
				case 0:
					val7.r = byteValue;
					break;
				case 1:
					val7.g = byteValue;
					break;
				case 2:
					val7.b = byteValue;
					break;
				case 3:
					val7.a = byteValue;
					break;
				}
				Value = val7;
				((Graphic)colorImage).color = Color32.op_Implicit(val7);
				Owner.SetValueFromIValue();
			}
		}
	}
	public class InteractiveEnum : InteractiveValue
	{
		internal static Dictionary<Type, KeyValuePair<long, string>[]> enumNamesCache = new Dictionary<Type, KeyValuePair<long, string>[]>();

		internal KeyValuePair<long, string>[] values = new KeyValuePair<long, string>[0];

		internal Dictionary<string, OptionData> dropdownOptions = new Dictionary<string, OptionData>();

		internal Dropdown dropdown;

		public InteractiveEnum(object value, Type valueType)
			: base(value, valueType)
		{
			if (value != null)
			{
				GetNames();
			}
		}

		public override bool SupportsType(Type type)
		{
			return type.IsEnum;
		}

		internal void GetNames()
		{
			Type type = Value?.GetType() ?? FallbackType;
			if (!enumNamesCache.ContainsKey(type))
			{
				Array array = Enum.GetValues(type);
				List<KeyValuePair<long, string>> list = new List<KeyValuePair<long, string>>();
				HashSet<string> hashSet = new HashSet<string>();
				foreach (object item in array)
				{
					string text = item.ToString();
					if (!hashSet.Contains(text))
					{
						hashSet.Add(text);
						Type underlyingType = Enum.GetUnderlyingType(type);
						long key;
						try
						{
							object value = Convert.ChangeType(item, underlyingType);
							key = (long)Convert.ChangeType(value, typeof(long));
						}
						catch (Exception ex)
						{
							ConfigManager.LogSource.LogWarning((object)("[InteractiveEnum] Could not Unbox underlying type " + underlyingType.Name + " from " + type.FullName));
							ConfigManager.LogSource.LogMessage((object)ex.ToString());
							continue;
						}
						list.Add(new KeyValuePair<long, string>(key, text));
					}
				}
				enumNamesCache.Add(type, list.ToArray());
			}
			values = enumNamesCache[type];
		}

		public override void OnValueUpdated()
		{
			GetNames();
			base.OnValueUpdated();
		}

		public override void RefreshUIForValue()
		{
			base.RefreshUIForValue();
			if (!(this is InteractiveFlags))
			{
				string key = Value.ToString();
				if (dropdownOptions.ContainsKey(key))
				{
					dropdown.value = dropdown.options.IndexOf(dropdownOptions[key]);
				}
			}
		}

		private void SetValueFromDropdown()
		{
			Type type = Value?.GetType() ?? FallbackType;
			int value = dropdown.value;
			object obj = Enum.Parse(type, enumNamesCache[type][value].Value);
			if (obj != null)
			{
				Value = obj;
				Owner.SetValueFromIValue();
				RefreshUIForValue();
			}
		}

		public override void ConstructUI(GameObject parent)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			base.ConstructUI(parent);
			if (!(this is InteractiveFlags))
			{
				GameObject val2 = UIFactory.CreateDropdown(mainContent, "InteractiveDropdown", ref dropdown, "", 14, (Action<int>)null, (string[])null);
				UIFactory.SetLayoutElement(val2, (int?)400, (int?)25, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
				((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate
				{
					SetValueFromDropdown();
				});
				KeyValuePair<long, string>[] array = values;
				for (int i = 0; i < array.Length; i++)
				{
					KeyValuePair<long, string> keyValuePair = array[i];
					OptionData val3 = new OptionData
					{
						text = keyValuePair.Value
					};
					dropdown.options.Add(val3);
					dropdownOptions.Add(keyValuePair.Value, val3);
				}
			}
		}
	}
	public class InteractiveFlags : InteractiveEnum
	{
		internal bool[] enabledFlags;

		internal Toggle[] toggles;

		private bool refreshingToggleStates;

		public override bool HasSubContent => true;

		public override bool SubContentWanted => true;

		public InteractiveFlags(object value, Type valueType)
			: base(value, valueType)
		{
			toggles = (Toggle[])(object)new Toggle[values.Length];
			enabledFlags = new bool[values.Length];
		}

		public override bool SupportsType(Type type)
		{
			return type.IsEnum && type.GetCustomAttributes(inherit: true).Any((object it) => it is FlagsAttribute);
		}

		public override void OnValueUpdated()
		{
			List<string> list = new List<string>();
			IEnumerable<string> enumerable = (from it in Value?.ToString().Split(new char[1] { ',' })
				select it.Trim());
			if (enumerable != null)
			{
				list.AddRange(enumerable);
			}
			for (int i = 0; i < values.Length; i++)
			{
				enabledFlags[i] = list.Contains(values[i].Value);
			}
			base.OnValueUpdated();
		}

		public override void RefreshUIForValue()
		{
			base.RefreshUIForValue();
			if (!subContentConstructed)
			{
				return;
			}
			refreshingToggleStates = true;
			for (int i = 0; i < values.Length; i++)
			{
				Toggle val = toggles[i];
				if (val.isOn != enabledFlags[i])
				{
					val.isOn = enabledFlags[i];
				}
			}
			refreshingToggleStates = false;
		}

		private void SetValueFromToggles()
		{
			string text = "";
			for (int i = 0; i < values.Length; i++)
			{
				if (enabledFlags[i])
				{
					if (text != "")
					{
						text += ", ";
					}
					text += values[i].Value;
				}
			}
			if (!string.IsNullOrEmpty(text))
			{
				Type enumType = Value?.GetType() ?? FallbackType;
				Value = Enum.Parse(enumType, text);
				RefreshUIForValue();
				Owner.SetValueFromIValue();
			}
		}

		protected internal override void OnToggleSubcontent(bool toggle)
		{
			base.OnToggleSubcontent(toggle);
			RefreshUIForValue();
		}

		public override void ConstructUI(GameObject parent)
		{
			base.ConstructUI(parent);
		}

		public override void ConstructSubcontent()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			subContentConstructed = true;
			GameObject groupObj = UIFactory.CreateVerticalGroup(subContentParent, "InteractiveFlagsContent", false, true, true, true, 5, new Vector4(3f, 3f, 3f, 3f), new Color(1f, 1f, 1f, 0f), (TextAnchor?)null);
			for (int i = 0; i < values.Length; i++)
			{
				AddToggle(i, groupObj);
			}
		}

		internal void AddToggle(int index, GameObject groupObj)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			KeyValuePair<long, string> keyValuePair = values[index];
			Toggle val2 = default(Toggle);
			Text val3 = default(Text);
			GameObject val4 = UIFactory.CreateToggle(groupObj, "FlagToggle", ref val2, ref val3, new Color(0.1f, 0.1f, 0.1f), 20, 20);
			int? num = 100;
			int? num2 = 2000;
			UIFactory.SetLayoutElement(val4, num, (int?)25, num2, (int?)null, (int?)null, (int?)null, (bool?)null);
			toggles[index] = val2;
			((UnityEvent<bool>)(object)val2.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				if (!refreshingToggleStates)
				{
					enabledFlags[index] = val;
					SetValueFromToggles();
					RefreshUIForValue();
				}
			});
			val3.text = keyValuePair.Value;
		}
	}
	public class InteractiveFloatStruct : InteractiveValue
	{
		public class StructInfo
		{
			private readonly FieldInfo[] fields;

			public string[] FieldNames { get; }

			public StructInfo(Type type)
			{
				fields = (from it in type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
					where !it.IsLiteral
					select it).ToArray();
				FieldNames = fields.Select((FieldInfo it) => it.Name).ToArray();
			}

			public object SetValue(ref object instance, int fieldIndex, float val)
			{
				fields[fieldIndex].SetValue(instance, val);
				return instance;
			}

			public float GetValue(object instance, int fieldIndex)
			{
				return (float)fields[fieldIndex].GetValue(instance);
			}

			public void RefreshUI(InputField[] inputs, object instance)
			{
				try
				{
					for (int i = 0; i < fields.Length; i++)
					{
						FieldInfo fieldInfo = fields[i];
						float num = (float)fieldInfo.GetValue(instance);
						inputs[i].text = num.ToString();
					}
				}
				catch (Exception ex)
				{
					ConfigManager.LogSource.LogMessage((object)ex);
				}
			}
		}

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

		public StructInfo structInfo;

		internal Type lastStructType;

		internal InputField[] inputs;

		public static bool IsTypeSupported(Type type)
		{
			if (!type.IsValueType)
			{
				return false;
			}
			if (_typeSupportCache.TryGetValue(type.AssemblyQualifiedName, out var value))
			{
				return value;
			}
			value = true;
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				if (!fieldInfo.IsLiteral && !typeof(float).IsAssignableFrom(fieldInfo.FieldType))
				{
					value = false;
					break;
				}
			}
			_typeSupportCache.Add(type.AssemblyQualifiedName, value);
			return value;
		}

		public InteractiveFloatStruct(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return IsTypeSupported(type);
		}

		public override void RefreshUIForValue()
		{
			InitializeStructInfo();
			base.RefreshUIForValue();
			structInfo.RefreshUI(inputs, Value);
		}

		internal void InitializeStructInfo()
		{
			Type type = Value?.GetType() ?? FallbackType;
			if (structInfo == null || (object)type != lastStructType)
			{
				lastStructType = type;
				structInfo = new StructInfo(type);
			}
		}

		public override void ConstructUI(GameObject parent)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				InitializeStructInfo();
				base.ConstructUI(parent);
				GameObject val = UIFactory.CreateGridGroup(mainContent, "EditorContent", new Vector2(150f, 25f), new Vector2(5f, 5f), new Color(1f, 1f, 1f, 0f));
				int? num = 300;
				int? num2 = 9999;
				UIFactory.SetLayoutElement(val, num, (int?)null, num2, (int?)null, (int?)null, (int?)null, (bool?)null);
				inputs = (InputField[])(object)new InputField[structInfo.FieldNames.Length];
				for (int i = 0; i < structInfo.FieldNames.Length; i++)
				{
					AddEditorRow(i, val);
				}
				RefreshUIForValue();
			}
			catch (Exception ex)
			{
				ConfigManager.LogSource.LogMessage((object)ex);
			}
		}

		internal void AddEditorRow(int index, GameObject groupObj)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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)
			try
			{
				GameObject val2 = UIFactory.CreateHorizontalGroup(groupObj, "EditorRow", false, true, true, true, 5, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)null);
				string text = structInfo.FieldNames[index];
				if (text.StartsWith("m_"))
				{
					text = text.Substring(2, text.Length - 2);
				}
				if (text.Length > 1)
				{
					text = text.Substring(0, 1);
				}
				Text val3 = UIFactory.CreateLabel(val2, "RowLabel", text + ":", (TextAnchor)5, Color.cyan, true, 14);
				GameObject gameObject = ((Component)val3).gameObject;
				int? num = 30;
				int? num2 = 0;
				UIFactory.SetLayoutElement(gameObject, num, (int?)25, num2, (int?)null, (int?)null, (int?)null, (bool?)null);
				InputFieldRef val4 = UIFactory.CreateInputField(val2, "InputField", "...");
				UIFactory.SetLayoutElement(((Component)val4.Component).gameObject, (int?)120, (int?)25, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null);
				inputs[index] = val4.Component;
				val4.OnValueChanged += delegate(string val)
				{
					try
					{
						float val5 = float.Parse(val);
						Value = structInfo.SetValue(ref Value, index, val5);
						Owner.SetValueFromIValue();
					}
					catch
					{
					}
				};
			}
			catch (Exception ex)
			{
				ConfigManager.LogSource.LogMessage((object)ex);
			}
		}
	}
	public class InteractiveKeycode : InteractiveValue
	{
		internal Text labelText;

		internal ButtonRef rebindButton;

		internal ButtonRef confirmButton;

		internal ButtonRef cancelButton;

		private readonly bool isInputSystem;

		public InteractiveKeycode(object value, Type valueType)
			: base(value, valueType)
		{
			isInputSystem = !(value is KeyCode);
		}

		public override bool SupportsType(Type type)
		{
			return (object)type == typeof(KeyCode) || type.FullName == "UnityEngine.InputSystem.Key";
		}

		public override void RefreshUIForValue()
		{
			base.RefreshUIForValue();
			labelText.text = Value.ToString();
		}

		public override void OnValueUpdated()
		{
			base.OnValueUpdated();
		}

		public void BeginRebind()
		{
			((Component)rebindButton.Component).gameObject.SetActive(false);
			((Component)confirmButton.Component).gameObject.SetActive(true);
			((Selectable)confirmButton.Component).interactable = false;
			((Component)cancelButton.Component).gameObject.SetActive(true);
			labelText.text = "<i>Press a key...</i>";
			InputManager.BeginRebind((Action<KeyCode>)OnRebindKeyPressed, (Action<KeyCode?>)OnKeycodeConfirmed);
		}

		private void OnRebindKeyPressed(KeyCode kc)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (!isInputSystem)
			{
				labelText.text = "<i>" + ((object)(KeyCode)(ref kc)).ToString() + "</i>";
			}
			else
			{
				object obj = InputSystem.KeyCodeToKeyEnum(kc);
				labelText.text = "<i>" + obj.ToString() + "</i>";
			}
			((Selectable)confirmButton.Component).interactable = true;
		}

		private void OnKeycodeConfirmed(KeyCode? kc)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (kc.HasValue)
			{
				if (!isInputSystem)
				{
					Value = kc;
				}
				else
				{
					Value = InputSystem.KeyCodeToKeyEnum(kc.Value);
				}
			}
			Owner.SetValueFromIValue();
			RefreshUIForValue();
		}

		public void ConfirmEndRebind()
		{
			InputManager.EndRebind();
			OnRebindEnd();
		}

		public void CancelEndRebind()
		{
			InputManager.LastRebindKey = null;
			InputManager.EndRebind();
			OnRebindEnd();
		}

		internal void OnRebindEnd()
		{
			((Component)rebindButton.Component).gameObject.SetActive(true);
			((Component)confirmButton.Component).gameObject.SetActive(false);
			((Component)cancelButton.Component).gameObject.SetActive(false);
		}

		public override void ConstructUI(GameObject parent)
		{
			//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)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			base.ConstructUI(parent);
			labelText = UIFactory.CreateLabel(mainContent, "Label", Value?.ToString() ?? "<notset>", (TextAnchor)3, default(Color), true, 14);
			UIFactory.SetLayoutElement(((Component)labelText).gameObject, (int?)150, (int?)25, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
			rebindButton = UIFactory.CreateButton(mainContent, "RebindButton", "Rebind", (Color?)null);
			ButtonRef obj = rebindButton;
			obj.OnClick = (Action)Delegate.Combine(obj.OnClick, new Action(BeginRebind));
			GameObject gameObject = ((Component)rebindButton.Component).gameObject;
			int? num = 25;
			UIFactory.SetLayoutElement(gameObject, (int?)100, num, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
			confirmButton = UIFactory.CreateButton(mainContent, "ConfirmButton", "Confirm", (Color?)new Color(0.1f, 0.4f, 0.1f));
			ButtonRef obj2 = confirmButton;
			obj2.OnClick = (Action)Delegate.Combine(obj2.OnClick, new Action(ConfirmEndRebind));
			GameObject gameObject2 = ((Component)confirmButton.Component).gameObject;
			num = 25;
			UIFactory.SetLayoutElement(gameObject2, (int?)100, num, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
			((Component)confirmButton.Component).gameObject.SetActive(false);
			Button component = confirmButton.Component;
			Color? val = new Color(0.3f, 0.3f, 0.3f);
			RuntimeHelper.SetColorBlock((Selectable)(object)component, (Color?)null, (Color?)null, (Color?)null, val);
			cancelButton = UIFactory.CreateButton(mainContent, "EndButton", "Cancel", (Color?)new Color(0.4f, 0.1f, 0.1f));
			ButtonRef obj3 = cancelButton;
			obj3.OnClick = (Action)Delegate.Combine(obj3.OnClick, new Action(CancelEndRebind));
			GameObject gameObject3 = ((Component)cancelButton.Component).gameObject;
			num = 25;
			UIFactory.SetLayoutElement(gameObject3, (int?)100, num, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
			((Component)cancelButton.Component).gameObject.SetActive(false);
		}
	}
	public class InteractiveNumber : InteractiveValue
	{
		internal InputFieldRef valueInput;

		private Slider slider;

		private MethodInfo parseMethod;

		public MethodInfo ParseMethod => parseMethod ?? (parseMethod = Value.GetType().GetMethod("Parse", new Type[1] { typeof(string) }));

		public InteractiveNumber(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return (type.IsPrimitive && (object)type != typeof(bool)) || (object)type == typeof(decimal);
		}

		public override void RefreshUIForValue()
		{
			valueInput.Text = Value.ToString();
			if (!((Component)valueInput.Component).gameObject.activeSelf)
			{
				((Component)valueInput.Component).gameObject.SetActive(true);
			}
			if (Object.op_Implicit((Object)(object)slider))
			{
				slider.value = (float)Convert.ChangeType(Value, typeof(float));
			}
		}

		internal void SetValueFromInput()
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Value = ParseMethod.Invoke(null, new object[1] { valueInput.Text });
				ConfigDescription description = Owner.RefConfig.Description;
				AcceptableValueBase val = ((description != null) ? description.AcceptableValues : null);
				if (val != null && !val.IsValid(Value))
				{
					throw new Exception();
				}
				Owner.SetValueFromIValue();
				RefreshUIForValue();
				((Graphic)valueInput.Component.textComponent).color = Color.white;
			}
			catch
			{
				((Graphic)valueInput.Component.textComponent).color = Color.red;
			}
		}

		public override void ConstructUI(GameObject parent)
		{
			base.ConstructUI(parent);
			valueInput = UIFactory.CreateInputField(mainContent, "InteractiveNumberInput", "...");
			UIFactory.SetLayoutElement(((Component)valueInput.Component).gameObject, (int?)120, (int?)25, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null);
			((Component)valueInput.Component).gameObject.SetActive(false);
			valueInput.OnValueChanged += delegate
			{
				SetValueFromInput();
			};
			AcceptableValueBase acceptableValues = Owner.RefConfig.Description.AcceptableValues;
			if (acceptableValues != null)
			{
				Type type = typeof(AcceptableValueRange<>).MakeGenericType(acceptableValues.ValueType);
				object value = AccessTools.Property(type, "MinValue").GetValue(acceptableValues, null);
				object value2 = AccessTools.Property(type, "MaxValue").GetValue(acceptableValues, null);
				Text mainLabel = Owner.mainLabel;
				mainLabel.text = mainLabel.text + " <color=grey><i>[" + value.ToString() + " - " + value2.ToString() + "]</i></color>";
				GameObject val2 = UIFactory.CreateSlider(mainContent, "ValueSlider", ref slider);
				UIFactory.SetLayoutElement(val2, (int?)250, (int?)25, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
				slider.minValue = (float)Convert.ChangeType(value, typeof(float));
				slider.maxValue = (float)Convert.ChangeType(value2, typeof(float));
				slider.value = (float)Convert.ChangeType(Value, typeof(float));
				((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float val)
				{
					Value = Convert.ChangeType(val, FallbackType);
					Owner.SetValueFromIValue();
					valueInput.Text = Value.ToString();
				});
			}
		}
	}
	public class InteractiveString : InteractiveValue
	{
		internal InputFieldRef valueInput;

		internal GameObject hiddenObj;

		internal Text placeholderText;

		public InteractiveString(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return (object)type == typeof(string);
		}

		public override void RefreshUIForValue()
		{
			if (!hiddenObj.gameObject.activeSelf)
			{
				hiddenObj.gameObject.SetActive(true);
			}
			if (!string.IsNullOrEmpty((string)Value))
			{
				string text = (string)Value;
				if (text.Length > 15000)
				{
					text = text.Substring(0, 15000);
				}
				valueInput.Text = text;
				placeholderText.text = text;
			}
			else
			{
				string text2 = ((Value == null) ? "null" : "empty");
				valueInput.Text = "";
				placeholderText.text = text2;
			}
		}

		internal void SetValueFromInput()
		{
			Value = valueInput.Text;
			Owner.SetValueFromIValue();
		}

		public override void ConstructUI(GameObject parent)
		{
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			base.ConstructUI(parent);
			hiddenObj = ((Component)UIFactory.CreateLabel(mainContent, "HiddenLabel", "", (TextAnchor)3, default(Color), true, 14)).gameObject;
			hiddenObj.SetActive(false);
			Text hiddenText = hiddenObj.GetComponent<Text>();
			((Graphic)hiddenText).color = Color.clear;
			hiddenText.fontSize = 14;
			((Graphic)hiddenText).raycastTarget = false;
			hiddenText.supportRichText = false;
			ContentSizeFitter val2 = hiddenObj.AddComponent<ContentSizeFitter>();
			val2.verticalFit = (FitMode)2;
			GameObject obj = hiddenObj;
			int? num = 25;
			int? num2 = 500;
			UIFactory.SetLayoutElement(obj, (int?)250, num, (int?)9000, num2, (int?)null, (int?)null, (bool?)null);
			UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hiddenObj, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
			valueInput = UIFactory.CreateInputField(hiddenObj, "StringInputField", "...");
			UIFactory.SetLayoutElement(((Component)valueInput.Component).gameObject, (int?)120, (int?)25, (int?)5000, (int?)5000, (int?)null, (int?)null, (bool?)null);
			valueInput.Component.lineType = (LineType)2;
			placeholderText = ((Component)valueInput.Component.placeholder).GetComponent<Text>();
			placeholderText.supportRichText = false;
			valueInput.Component.textComponent.supportRichText = false;
			valueInput.OnValueChanged += delegate(string val)
			{
				hiddenText.text = val ?? "";
				LayoutRebuilder.ForceRebuildLayoutImmediate(Owner.ContentRect);
				SetValueFromInput();
			};
			RefreshUIForValue();
		}
	}
	public class InteractiveTomlObject : InteractiveValue
	{
		internal InputFieldRef valueInput;

		internal GameObject hiddenObj;

		internal Text placeholderText;

		public InteractiveTomlObject(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return true;
		}

		public override void OnValueUpdated()
		{
			base.OnValueUpdated();
			try
			{
				valueInput.Text = TomlTypeConverter.ConvertToString(Value, FallbackType);
				placeholderText.text = valueInput.Text;
			}
			catch
			{
				ConfigManager.LogSource.LogWarning((object)("Unable to edit entry '" + Owner.RefConfig.Definition.Key + "' due to an error with the Toml converter!"));
			}
		}

		internal void SetValueFromInput()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Value = TomlTypeConverter.ConvertToValue(valueInput.Text, FallbackType);
				Owner.SetValueFromIValue();
				((Graphic)valueInput.Component.textComponent).color = Color.white;
			}
			catch
			{
				((Graphic)valueInput.Component.textComponent).color = Color.red;
			}
		}

		public override void RefreshUIForValue()
		{
			if (!hiddenObj.gameObject.activeSelf)
			{
				hiddenObj.gameObject.SetActive(true);
			}
		}

		public override void ConstructUI(GameObject parent)
		{
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			base.ConstructUI(parent);
			hiddenObj = ((Component)UIFactory.CreateLabel(mainContent, "HiddenLabel", "", (TextAnchor)3, default(Color), true, 14)).gameObject;
			hiddenObj.SetActive(false);
			Text hiddenText = hiddenObj.GetComponent<Text>();
			((Graphic)hiddenText).color = Color.clear;
			hiddenText.fontSize = 14;
			((Graphic)hiddenText).raycastTarget = false;
			hiddenText.supportRichText = false;
			ContentSizeFitter val2 = hiddenObj.AddComponent<ContentSizeFitter>();
			val2.verticalFit = (FitMode)2;
			GameObject obj = hiddenObj;
			int? num = 25;
			int? num2 = 500;
			UIFactory.SetLayoutElement(obj, (int?)250, num, (int?)9000, num2, (int?)null, (int?)null, (bool?)null);
			UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hiddenObj, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
			valueInput = UIFactory.CreateInputField(hiddenObj, "StringInputField", "...");
			UIFactory.SetLayoutElement(((Component)valueInput.Component).gameObject, (int?)120, (int?)25, (int?)5000, (int?)5000, (int?)null, (int?)null, (bool?)null);
			valueInput.Component.lineType = (LineType)2;
			placeholderText = ((Component)valueInput.Component.placeholder).GetComponent<Text>();
			placeholderText.supportRichText = false;
			valueInput.Component.textComponent.supportRichText = false;
			OnValueUpdated();
			valueInput.OnValueChanged += delegate(string val)
			{
				hiddenText.text = val ?? "";
				LayoutRebuilder.ForceRebuildLayoutImmediate(Owner.ContentRect);
				SetValueFromInput();
			};
		}
	}
	public abstract class InteractiveValue
	{
		private static readonly HashSet<Type> customIValueTypes = new HashSet<Type>();

		private static readonly List<InteractiveValue> customIValueInstances = new List<InteractiveValue>();

		public CachedConfigEntry Owner;

		public object Value;

		public readonly Type FallbackType;

		public bool UIConstructed;

		protected internal GameObject mainContentParent;

		protected internal GameObject subContentParent;

		protected internal GameObject mainContent;

		protected internal ButtonRef subExpandBtn;

		protected internal bool subContentConstructed;

		public virtual bool HasSubContent => false;

		public virtual bool SubContentWanted => false;

		public static void RegisterIValueType<T>() where T : InteractiveValue
		{
			if (!customIValueTypes.Contains(typeof(T)))
			{
				customIValueInstances.Add((T)Activator.CreateInstance(typeof(T), null, typeof(object)));
				customIValueTypes.Add(typeof(T));
			}
		}

		public static Type GetIValueForType(Type type)
		{
			if ((object)type == typeof(bool))
			{
				return typeof(InteractiveBool);
			}
			if (type.IsPrimitive || typeof(decimal).IsAssignableFrom(type))
			{
				return typeof(InteractiveNumber);
			}
			if ((object)type == typeof(string))
			{
				return typeof(InteractiveString);
			}
			if ((object)type == typeof(KeyCode) || type.FullName == "UnityEngine.InputSystem.Key")
			{
				return typeof(InteractiveKeycode);
			}
			if (typeof(Enum).IsAssignableFrom(type))
			{
				object[] customAttributes = type.GetCustomAttributes(typeof(FlagsAttribute), inherit: true);
				if (customAttributes != null && customAttributes.Any())
				{
					return typeof(InteractiveFlags);
				}
				return typeof(InteractiveEnum);
			}
			if ((object)type == typeof(Color) || (object)type == typeof(Color32))
			{
				return typeof(InteractiveColor);
			}
			if (InteractiveFloatStruct.IsTypeSupported(type))
			{
				return typeof(InteractiveFloatStruct);
			}
			InteractiveValue interactiveValue = customIValueInstances.FirstOrDefault((InteractiveValue it) => it.SupportsType(type));
			if (interactiveValue != null)
			{
				return interactiveValue.GetType();
			}
			return typeof(InteractiveTomlObject);
		}

		public static InteractiveValue Create(object value, Type fallbackType)
		{
			Type type = ReflectionExtensions.GetActualType(value) ?? fallbackType;
			Type iValueForType = GetIValueForType(type);
			return (InteractiveValue)Activator.CreateInstance(iValueForType, value, type);
		}

		public InteractiveValue(object value, Type valueType)
		{
			Value = value;
			FallbackType = valueType;
		}

		public virtual bool SupportsType(Type type)
		{
			return true;
		}

		public virtual void OnValueUpdated()
		{
			if (!UIConstructed)
			{
				ConstructUI(mainContentParent);
			}
			RefreshUIForValue();
		}

		public virtual void RefreshUIForValue()
		{
		}

		public void RefreshSubContentState()
		{
			if (HasSubContent)
			{
				if (((Component)subExpandBtn.Component).gameObject.activeSelf != SubContentWanted)
				{
					((Component)subExpandBtn.Component).gameObject.SetActive(SubContentWanted);
				}
				if (!SubContentWanted && subContentParent.activeSelf)
				{
					ToggleSubcontent();
				}
			}
		}

		public virtual void ConstructSubcontent()
		{
			subContentConstructed = true;
		}

		public virtual void DestroySubContent()
		{
			if (Object.op_Implicit((Object)(object)subContentParent) && HasSubContent)
			{
				for (int i = 0; i < subContentParent.transform.childCount; i++)
				{
					Transform child = subContentParent.transform.GetChild(i);
					if (Object.op_Implicit((Object)(object)child))
					{
						Object.Destroy((Object)(object)((Component)child).gameObject);
					}
				}
			}
			subContentConstructed = false;
		}

		public void ToggleSubcontent()
		{
			if (!subContentParent.activeSelf)
			{
				subContentParent.SetActive(true);
				subContentParent.transform.SetAsLastSibling();
				subExpandBtn.ButtonText.text = "▼ Click to hide";
			}
			else
			{
				subContentParent.SetActive(false);
				subExpandBtn.ButtonText.text = "▲ Expand to edit";
			}
			OnToggleSubcontent(subContentParent.activeSelf);
			RefreshSubContentState();
		}

		protected internal virtual void OnToggleSubcontent(bool toggle)
		{
			if (!subContentConstructed)
			{
				ConstructSubcontent();
			}
		}

		public virtual void ConstructUI(GameObject parent)
		{
			//IL_0026: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			UIConstructed = true;
			mainContent = UIFactory.CreateHorizontalGroup(parent, "InteractiveValue_" + GetType().Name, false, false, true, true, 4, default(Vector4), new Color(1f, 1f, 1f, 0f), (TextAnchor?)(TextAnchor)0);
			RectTransform component = mainContent.GetComponent<RectTransform>();
			component.SetSizeWithCurrentAnchors((Axis)1, 25f);
			GameObject obj = mainContent;
			int? num = 9000;
			UIFactory.SetLayoutElement(obj, (int?)175, (int?)25, num, (int?)0, (int?)null, (int?)null, (bool?)null);
			if (HasSubContent)
			{
				subExpandBtn = UIFactory.CreateButton(mainContent, "ExpandSubcontentButton", "▲ Expand to edit", (Color?)new Color(0.3f, 0.3f, 0.3f));
				ButtonRef obj2 = subExpandBtn;
				obj2.OnClick = (Action)Delegate.Combine(obj2.OnClick, new Action(ToggleSubcontent));
				GameObject gameObject = ((Component)subExpandBtn.Component).gameObject;
				num = 25;
				UIFactory.SetLayoutElement(gameObject, (int?)120, num, (int?)0, (int?)0, (int?)null, (int?)null, (bool?)null);
			}
		}
	}
	public class InteractiveValueList : InteractiveValue
	{
		internal IEnumerable<object> acceptableValues;

		internal Dropdown dropdown;

		internal Dictionary<object, OptionData> dropdownOptions = new Dictionary<object, OptionData>();

		public InteractiveValueList(object value, Type valueType)
			: base(value, valueType)
		{
		}

		public override bool SupportsType(Type type)
		{
			return type.IsEnum;
		}

		internal void GetAcceptableValues()
		{
			if (acceptableValues == null)
			{
				AcceptableValueBase val = Owner.RefConfig.Description.AcceptableValues;
				PropertyInfo property = ((object)val).GetType().GetProperty("AcceptableValues");
				acceptableValues = (property.GetValue(val, null) as IList).Cast<object>();
			}
		}

		public override void OnValueUpdated()
		{
			GetAcceptableValues();
			base.OnValueUpdated();
		}

		public override void RefreshUIForValue()
		{
			base.RefreshUIForValue();
			if (dropdownOptions.ContainsKey(Value))
			{
				dropdown.value = dropdown.options.IndexOf(dropdownOptions[Value]);
			}
		}

		private void SetValueFromDropdown()
		{
			object obj = acceptableValues.ElementAt(dropdown.value);
			if (obj != null)
			{
				Value = obj;
				Owner.SetValueFromIValue();
				RefreshUIForValue();
			}
		}

		public override void ConstructUI(GameObject parent)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			base.ConstructUI(parent);
			GameObject val2 = UIFactory.CreateDropdown(mainContent, "InteractiveValueList", ref dropdown, "", 14, (Action<int>)null, (string[])null);
			UIFactory.SetLayoutElement(val2, (int?)400, (int?)25, (int?)null, (int?)null, (int?)null, (int?)null, (bool?)null);
			((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate
			{
				SetValueFromDropdown();
			});
			foreach (object acceptableValue in acceptableValues)
			{
				OptionData val3 = new OptionData
				{
					text = acceptableValue.ToString()
				};
				dropdown.options.Add(val3);
				dropdownOptions.Add(acceptableValue, val3);
			}
		}
	}
}
namespace ConfigManager.Utility
{
	internal sealed class ConfigurationManagerAttributes
	{
		public bool? ShowRangeAsPercent;

		public Action<ConfigEntryBase> CustomDrawer;

		public bool? Browsable;

		public string Category;

		public object DefaultValue;

		public bool? HideDefaultButton;

		public bool? HideSettingName;

		public string Description;

		public string DispName;

		public int? Order;

		public bool? ReadOnly;

		public bool? IsAdvanced;

		public Func<object, string> ObjToStr;

		public Func<string, object> StrToObj;
	}
}

BepInEx/plugins/com.stiffmeds.obeliskialessentials.dll

Decompiled 2 weeks 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 System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cards;
using Cards.Utility;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Paradox;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UniverseLib;
using UniverseLib.Config;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Panels;
using UniverseLib.UI.Widgets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.stiffmeds.obeliskialessentials")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Essential reference classes and methods for Across the Obelisk modding.")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+8eaa4a27d318a4f052356948fda8b131b7b29000")]
[assembly: AssemblyProduct("Obeliskial_Essentials")]
[assembly: AssemblyTitle("com.stiffmeds.obeliskialessentials")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
public class SnapshotCamera : MonoBehaviour
{
	private struct GameObjectStateSnapshot
	{
		private GameObject gameObject;

		private Vector3 position;

		private Quaternion rotation;

		private Vector3 scale;

		private Dictionary<GameObject, int> layers;

		public GameObjectStateSnapshot(GameObject gameObject)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			this.gameObject = gameObject;
			position = gameObject.transform.position;
			rotation = gameObject.transform.rotation;
			scale = gameObject.transform.localScale;
			layers = new Dictionary<GameObject, int>();
			Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				layers.Add(((Component)val).gameObject, ((Component)val).gameObject.layer);
			}
		}

		public void Restore()
		{
			//IL_000d: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			gameObject.transform.position = position;
			gameObject.transform.rotation = rotation;
			gameObject.transform.localScale = scale;
			foreach (KeyValuePair<GameObject, int> layer in layers)
			{
				layer.Key.layer = layer.Value;
			}
		}
	}

	private Camera cam;

	private int layer;

	public Vector3 defaultPositionOffset = new Vector3(0f, 0f, 1f);

	public Vector3 defaultRotation = new Vector3(0f, 0f, 0f);

	public Vector3 defaultScale = new Vector3(1f, 1f, 1f);

	private SnapshotCamera()
	{
	}//IL_0010: 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_002a: Unknown result type (might be due to invalid IL or missing references)
	//IL_002f: Unknown result type (might be due to invalid IL or missing references)
	//IL_0044: Unknown result type (might be due to invalid IL or missing references)
	//IL_0049: Unknown result type (might be due to invalid IL or missing references)


	public static SnapshotCamera MakeSnapshotCamera(string layer, string name = "Snapshot Camera")
	{
		return MakeSnapshotCamera(LayerMask.NameToLayer(layer), name);
	}

	public static SnapshotCamera MakeSnapshotCamera(int layer = 5, string name = "Snapshot Camera")
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		if (layer < 0 || layer > 31)
		{
			throw new ArgumentOutOfRangeException("layer", "layer argument must specify a valid layer between 0 and 31");
		}
		GameObject val = new GameObject(name);
		Camera val2 = val.AddComponent<Camera>();
		val2.cullingMask = 1 << layer;
		val2.orthographic = true;
		val2.orthographicSize = 1f;
		val2.clearFlags = (CameraClearFlags)2;
		val2.backgroundColor = Color.clear;
		val2.nearClipPlane = 0.1f;
		((Behaviour)val2).enabled = false;
		SnapshotCamera snapshotCamera = val.AddComponent<SnapshotCamera>();
		snapshotCamera.cam = val2;
		snapshotCamera.layer = layer;
		return snapshotCamera;
	}

	private static string SanitizeFilename(string dirty)
	{
		string arg = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
		string pattern = string.Format("([{0}]*\\.+$)|([{0}]+)", arg);
		return Regex.Replace(dirty, pattern, "_");
	}

	public static FileInfo SavePNG(byte[] bytes, string filename = "", string directory = "")
	{
		directory = ((directory != "") ? Directory.CreateDirectory(directory).FullName : Directory.CreateDirectory(Path.Combine(Application.dataPath, "../Snapshots")).FullName);
		filename = ((filename != "") ? (SanitizeFilename(filename) + ".png") : (DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ffff") + ".png"));
		string text = Path.Combine(directory, filename);
		File.WriteAllBytes(text, bytes);
		return new FileInfo(text);
	}

	public static FileInfo SavePNG(Texture2D tex, string filename = "", string directory = "")
	{
		return SavePNG(ImageConversion.EncodeToPNG(tex), filename, directory);
	}

	private void SetLayersRecursively(GameObject gameObject)
	{
		Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			((Component)val).gameObject.layer = layer;
		}
	}

	private GameObjectStateSnapshot PrepareObject(GameObject gameObject, Vector3 positionOffset, Quaternion rotation, Vector3 scale)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		GameObjectStateSnapshot result = new GameObjectStateSnapshot(gameObject);
		gameObject.transform.position = ((Component)this).transform.position + positionOffset;
		gameObject.transform.rotation = rotation;
		gameObject.transform.localScale = scale;
		SetLayersRecursively(gameObject);
		return result;
	}

	private GameObject PreparePrefab(GameObject prefab, Vector3 positionOffset, Quaternion rotation, Vector3 scale)
	{
		//IL_0008: 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_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)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position + positionOffset, rotation);
		val.transform.localScale = scale;
		SetLayersRecursively(val);
		return val;
	}

	public Texture2D TakeObjectSnapshot(GameObject gameObject, int width = 128, int height = 128)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		return TakeObjectSnapshot(gameObject, Color.clear, defaultPositionOffset, Quaternion.Euler(defaultRotation), defaultScale, width, height);
	}

	public Texture2D TakeObjectSnapshot(GameObject gameObject, Color backgroundColor, int width = 128, int height = 128)
	{
		//IL_0003: 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_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		return TakeObjectSnapshot(gameObject, backgroundColor, defaultPositionOffset, Quaternion.Euler(defaultRotation), defaultScale, width, height);
	}

	public Texture2D TakeObjectSnapshot(GameObject gameObject, Vector3 positionOffset, Quaternion rotation, Vector3 scale, int width = 128, int height = 128)
	{
		//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return TakeObjectSnapshot(gameObject, Color.clear, positionOffset, rotation, scale, width, height);
	}

	public Texture2D TakeObjectSnapshot(GameObject gameObject, Color backgroundColor, Vector3 positionOffset, Quaternion rotation, Vector3 scale, int width = 128, int height = 128)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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)
		if ((Object)(object)gameObject == (Object)null)
		{
			throw new ArgumentNullException("gameObject");
		}
		Scene scene = gameObject.scene;
		if (((Scene)(ref scene)).name == null)
		{
			throw new ArgumentException("gameObject parameter must be an instantiated GameObject! If you want to use a prefab directly, use TakePrefabSnapshot instead.", "gameObject");
		}
		GameObjectStateSnapshot gameObjectStateSnapshot = PrepareObject(gameObject, positionOffset, rotation, scale);
		Texture2D result = TakeSnapshot(backgroundColor, width, height);
		gameObjectStateSnapshot.Restore();
		return result;
	}

	public Texture2D TakePrefabSnapshot(GameObject prefab, int width = 128, int height = 128)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		return TakePrefabSnapshot(prefab, Color.clear, defaultPositionOffset, Quaternion.Euler(defaultRotation), defaultScale, width, height);
	}

	public Texture2D TakePrefabSnapshot(GameObject prefab, Color backgroundColor, int width = 128, int height = 128)
	{
		//IL_0003: 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_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		return TakePrefabSnapshot(prefab, backgroundColor, defaultPositionOffset, Quaternion.Euler(defaultRotation), defaultScale, width, height);
	}

	public Texture2D TakePrefabSnapshot(GameObject prefab, Vector3 positionOffset, Quaternion rotation, Vector3 scale, int width = 128, int height = 128)
	{
		//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return TakePrefabSnapshot(prefab, Color.clear, positionOffset, rotation, scale, width, height);
	}

	public Texture2D TakePrefabSnapshot(GameObject prefab, Color backgroundColor, Vector3 positionOffset, Quaternion rotation, Vector3 scale, int width = 128, int height = 128)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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)
		if ((Object)(object)prefab == (Object)null)
		{
			throw new ArgumentNullException("prefab");
		}
		Scene scene = prefab.scene;
		if (((Scene)(ref scene)).name != null)
		{
			throw new ArgumentException("prefab parameter must be a prefab! If you want to use an instance, use TakeObjectSnapshot instead.", "prefab");
		}
		GameObject val = PreparePrefab(prefab, positionOffset, rotation, scale);
		Texture2D result = TakeSnapshot(backgroundColor, width, height);
		Object.DestroyImmediate((Object)(object)val);
		return result;
	}

	private Texture2D TakeSnapshot(Color backgroundColor, int width, int height)
	{
		//IL_0007: 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_006e: Expected O, but got Unknown
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		cam.backgroundColor = backgroundColor;
		cam.targetTexture = RenderTexture.GetTemporary(width, height, 24);
		cam.Render();
		RenderTexture active = RenderTexture.active;
		RenderTexture.active = cam.targetTexture;
		Texture2D val = new Texture2D(((Texture)cam.targetTexture).width, ((Texture)cam.targetTexture).height, (TextureFormat)5, false);
		val.ReadPixels(new Rect(0f, 0f, (float)((Texture)cam.targetTexture).width, (float)((Texture)cam.targetTexture).height), 0, 0);
		val.Apply(false);
		RenderTexture.active = active;
		cam.targetTexture = null;
		RenderTexture.ReleaseTemporary(cam.targetTexture);
		return val;
	}
}
namespace Obeliskial_Essentials
{
	[HarmonyPatch]
	public class CardDescriptionNew
	{
		public enum TextLocation
		{
			Beginning,
			AfterAddDiscardDraw,
			AfterDispelSummonBeforeTransfer,
			AfterTransferIncreaseACBeforeDamage,
			AfterDamageBeforeHeal,
			AfterHealBeforeAuras,
			AfterAurasBeforeCurses,
			AfterCurseBeforeSpecialValue,
			AfterSpecialBeforeRepeat,
			ItemBeginning,
			ItemAfterHPResistsBeforeStats,
			ItemAfterStatsBeforeDamageBonus,
			ItemAfterDamageBonusBeforeHeal,
			ItemAfterHealBonusBeforeACBonus,
			ItemAfterACBonusBeforeMiscText,
			ItemEnchantBeforeCast,
			ItemBeforeActivation,
			ItemAfterActivationBeforeEvent,
			ItemActivationBeforeGoldShards,
			ItemActivationAfterGoldBeforeHeal,
			ItemActivationAfterHealBeforeDamage,
			ItemActivationAfterDamageBeforeAC,
			ItemActivationAfterACBeforeMiscText,
			ItemActivationAfterMiscText,
			ItemActivationAfterACBeforeSelf,
			ItemActivationAfterSelfBeforeAddCard,
			ItemActivationAfterAddCardBeforeReduceCost,
			ItemActivationAfterAllActivationBeforeDestroyConditions,
			End
		}

		public static string medsColorUpgradePlain = "5E3016";

		public static string medsColorUpgradeGold = "875700";

		public static string medsColorUpgradeBlue = "215382";

		public static string medsColorUpgradeRare = "7F15A6";

		public static Dictionary<TextLocation, Dictionary<string, List<string>>> TextToAddAtLocations;

		public static HashSet<string> ModifiedCards;

		public static string medsNumFormatItem(int num, bool plus = false, bool percent = false)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(" <nobr>");
			if (num > 0)
			{
				stringBuilder.Append("<color=#263ABC><size=+.1>");
				if (plus)
				{
					stringBuilder.Append("+");
				}
			}
			else
			{
				stringBuilder.Append("<color=#720070><size=+.1>");
				if (plus)
				{
					stringBuilder.Append("-");
				}
			}
			stringBuilder.Append(Mathf.Abs(num));
			if (percent)
			{
				stringBuilder.Append("%");
			}
			stringBuilder.Append("</color></size></nobr>");
			return stringBuilder.ToString();
		}

		public static string medsNumFormat(int oldNum)
		{
			int num = oldNum;
			if (num < 0)
			{
				num = 0;
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("<size=+.1>");
			stringBuilder.Append(num);
			stringBuilder.Append("</size>");
			return stringBuilder.ToString();
		}

		public static string medsColorTextArray(string type, params string[] text)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("<nobr>");
			if (type == null || type.Length != 0)
			{
				switch (type)
				{
				case "damage":
					stringBuilder.Append("<color=#B00A00>");
					break;
				case "heal":
					stringBuilder.Append("<color=#1E650F>");
					break;
				case "aura":
					stringBuilder.Append("<color=#263ABC>");
					break;
				case "curse":
					stringBuilder.Append("<color=#720070>");
					break;
				case "system":
					stringBuilder.Append("<color=#5E3016>");
					break;
				default:
					stringBuilder.Append("<color=#5E3016");
					stringBuilder.Append(">");
					break;
				}
			}
			int num = 0;
			foreach (string value in text)
			{
				if (num > 0)
				{
					stringBuilder.Append(" ");
				}
				stringBuilder.Append(value);
				num++;
			}
			if (type != "")
			{
				stringBuilder.Append("</color>");
			}
			stringBuilder.Append("</nobr> ");
			return stringBuilder.ToString();
		}

		public static string medsSpriteText(string sprite)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string text = sprite.ToLower().Replace(" ", "");
			if (text == "stealthbonus")
			{
				text = "stealth";
			}
			switch (text)
			{
			case "block":
			case "card":
				stringBuilder.Append("<space=.2>");
				break;
			case "piercing":
				stringBuilder.Append("<space=.4>");
				break;
			case "bleed":
				stringBuilder.Append("<space=.1>");
				break;
			case "bless":
				stringBuilder.Append("<space=.1>");
				break;
			default:
				stringBuilder.Append("<space=.3>");
				break;
			}
			stringBuilder.Append("<size=+.1><sprite name=");
			stringBuilder.Append(text);
			stringBuilder.Append("></size>");
			switch (text)
			{
			case "bleed":
				stringBuilder.Append("<space=-.4>");
				break;
			case "reinforce":
			case "fire":
				break;
			case "card":
				stringBuilder.Append("<space=-.2>");
				break;
			case "powerful":
			case "fury":
				stringBuilder.Append("<space=-.1>");
				break;
			default:
				stringBuilder.Append("<space=-.2>");
				break;
			}
			return stringBuilder.ToString();
		}

		public static int medsGetFinalAuraCharges(CardClass _cardClass, string acId, int charges, Character character = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return (character == null) ? charges : (charges + character.GetAuraCurseQuantityModification(acId, _cardClass));
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CardRealtimeData), "SetTarget")]
		public static bool SetTargetPrefix(ref CardRealtimeData __instance, ref string ___target)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Invalid comparison between Unknown and I4
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Invalid comparison between Unknown and I4
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Invalid comparison between Unknown and I4
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Invalid comparison between Unknown and I4
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Invalid comparison between Unknown and I4
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Invalid comparison between Unknown and I4
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Invalid comparison between Unknown and I4
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Invalid comparison between Unknown and I4
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Invalid comparison between Unknown and I4
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Invalid comparison between Unknown and I4
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Invalid comparison between Unknown and I4
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Invalid comparison between Unknown and I4
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Invalid comparison between Unknown and I4
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Invalid comparison between Unknown and I4
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Invalid comparison between Unknown and I4
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Invalid comparison between Unknown and I4
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Invalid comparison between Unknown and I4
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Invalid comparison between Unknown and I4
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Invalid comparison between Unknown and I4
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Invalid comparison between Unknown and I4
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Invalid comparison between Unknown and I4
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Invalid comparison between Unknown and I4
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Invalid comparison between Unknown and I4
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Invalid comparison between Unknown and I4
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Invalid comparison between Unknown and I4
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Invalid comparison between Unknown and I4
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Invalid comparison between Unknown and I4
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Invalid comparison between Unknown and I4
			//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Invalid comparison between Unknown and I4
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Invalid comparison between Unknown and I4
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Invalid comparison between Unknown and I4
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Invalid comparison between Unknown and I4
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0718: Invalid comparison between Unknown and I4
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Invalid comparison between Unknown and I4
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Invalid comparison between Unknown and I4
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Invalid comparison between Unknown and I4
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_073b: Invalid comparison between Unknown and I4
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Invalid comparison between Unknown and I4
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Invalid comparison between Unknown and I4
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Invalid comparison between Unknown and I4
			//IL_0758: Unknown result type (might be due to invalid IL or missing references)
			//IL_075e: Invalid comparison between Unknown and I4
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Invalid comparison between Unknown and I4
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Invalid comparison between Unknown and I4
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Invalid comparison between Unknown and I4
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_077e: Invalid comparison between Unknown and I4
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Invalid comparison between Unknown and I4
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Invalid comparison between Unknown and I4
			//IL_0798: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Invalid comparison between Unknown and I4
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Invalid comparison between Unknown and I4
			//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07be: Invalid comparison between Unknown and I4
			if (__instance.AutoplayDraw)
			{
				___target = Texts.Instance.GetText("onDraw", "");
			}
			else if (__instance.AutoplayEndTurn)
			{
				___target = Texts.Instance.GetText("onEndTurn", "");
			}
			else if ((int)__instance.TargetType == 1 && (int)__instance.TargetSide == 2)
			{
				___target = Texts.Instance.GetText("global", "");
			}
			else if ((int)__instance.TargetSide == 3)
			{
				___target = Texts.Instance.GetText("self", "");
			}
			else if ((int)__instance.TargetSide == 2 && (int)__instance.TargetPosition == 2)
			{
				___target = Texts.Instance.GetText("random", "");
			}
			else if ((int)__instance.TargetType == 0 && (int)__instance.TargetSide == 2 && (int)__instance.TargetPosition == 0)
			{
				___target = Texts.Instance.GetText("anyone", "");
			}
			else if ((int)__instance.CardClass != 5)
			{
				if ((int)__instance.TargetSide == 1)
				{
					if ((int)__instance.TargetType == 1)
					{
						___target = Texts.Instance.GetText("allHeroes", "");
					}
					else if ((int)__instance.TargetPosition == 2)
					{
						___target = Texts.Instance.GetText("randomHero", "");
					}
					else if ((int)__instance.TargetPosition == 1)
					{
						___target = Texts.Instance.GetText("frontHero", "");
					}
					else if ((int)__instance.TargetPosition == 3)
					{
						___target = Texts.Instance.GetText("backHero", "");
					}
					else if ((int)__instance.TargetPosition == 4)
					{
						___target = Texts.Instance.GetText("middleHero", "");
					}
					else if ((int)__instance.TargetPosition == 5)
					{
						___target = Texts.Instance.GetText("slowestHero", "");
					}
					else if ((int)__instance.TargetPosition == 6)
					{
						___target = Texts.Instance.GetText("fastestHero", "");
					}
					else if ((int)__instance.TargetPosition == 8)
					{
						___target = Texts.Instance.GetText("mostHPHero", "");
					}
					else if ((int)__instance.TargetPosition == 7)
					{
						___target = Texts.Instance.GetText("leastHPHero", "");
					}
					else
					{
						___target = Texts.Instance.GetText("hero", "");
					}
				}
				else if ((int)__instance.TargetSide == 4)
				{
					___target = (((int)__instance.TargetType == 1) ? "All Other Heroes" : Texts.Instance.GetText("otherHero", ""));
				}
				else if ((int)__instance.TargetSide == 0)
				{
					if ((int)__instance.TargetType == 1)
					{
						___target = Texts.Instance.GetText("allMonsters", "");
					}
					else if ((int)__instance.TargetPosition == 2)
					{
						___target = Texts.Instance.GetText("randomMonster", "");
					}
					else if ((int)__instance.TargetPosition == 1)
					{
						___target = Texts.Instance.GetText("frontMonster", "");
					}
					else if ((int)__instance.TargetPosition == 3)
					{
						___target = Texts.Instance.GetText("backMonster", "");
					}
					else if ((int)__instance.TargetPosition == 8)
					{
						___target = Texts.Instance.GetText("mostHPMonster", "");
					}
					else if ((int)__instance.TargetPosition == 7)
					{
						___target = Texts.Instance.GetText("leastHPMonster", "");
					}
					else if ((int)__instance.TargetPosition == 4)
					{
						___target = Texts.Instance.GetText("middleMonster", "");
					}
					else if ((int)__instance.TargetPosition == 5)
					{
						___target = Texts.Instance.GetText("slowestMonster", "");
					}
					else if ((int)__instance.TargetPosition == 6)
					{
						___target = Texts.Instance.GetText("fastestMonster", "");
					}
					else
					{
						___target = Texts.Instance.GetText("monster", "");
					}
				}
			}
			else if ((int)__instance.CardClass == 5)
			{
				if ((int)__instance.TargetSide == 1)
				{
					___target = (((int)__instance.TargetType == 1) ? Texts.Instance.GetText("allMonsters", "") : (((int)__instance.TargetPosition == 2) ? Texts.Instance.GetText("randomMonster", "") : (((int)__instance.TargetPosition == 1) ? Texts.Instance.GetText("frontMonster", "") : (((int)__instance.TargetPosition == 3) ? Texts.Instance.GetText("backMonster", "") : (((int)__instance.TargetPosition == 4) ? Texts.Instance.GetText("middleMonster", "") : (((int)__instance.TargetPosition == 5) ? Texts.Instance.GetText("slowestMonster", "") : (((int)__instance.TargetPosition == 6) ? Texts.Instance.GetText("fastestMonster", "") : (((int)__instance.TargetPosition == 7) ? Texts.Instance.GetText("leastHPMonster", "") : (((int)__instance.TargetPosition != 8) ? Texts.Instance.GetText("monster", "") : Texts.Instance.GetText("mostHPMonster", ""))))))))));
				}
				else if ((int)__instance.TargetSide == 4)
				{
					___target = Texts.Instance.GetText("otherMonster", "");
				}
				else if ((int)__instance.TargetSide == 0)
				{
					___target = (((int)__instance.TargetType == 1) ? Texts.Instance.GetText("allHeroes", "") : (((int)__instance.TargetPosition == 2) ? Texts.Instance.GetText("randomHero", "") : (((int)__instance.TargetPosition == 1) ? Texts.Instance.GetText("frontHero", "") : (((int)__instance.TargetPosition == 3) ? Texts.Instance.GetText("backHero", "") : (((int)__instance.TargetPosition == 4) ? Texts.Instance.GetText("middleHero", "") : (((int)__instance.TargetPosition == 5) ? Texts.Instance.GetText("slowestHero", "") : (((int)__instance.TargetPosition == 6) ? Texts.Instance.GetText("fastestHero", "") : (((int)__instance.TargetPosition == 7) ? Texts.Instance.GetText("leastHPHero", "") : (((int)__instance.TargetPosition != 8) ? Texts.Instance.GetText("hero", "") : Texts.Instance.GetText("mostHPHero", ""))))))))));
				}
			}
			Globals.Instance.IncludeInSearch(__instance.Target, __instance.Id, true);
			return false;
		}

		public static void BinbinNormalizeDescription(ref CardRealtimeData __instance, StringBuilder stringBuilder1, bool includeInSearch)
		{
			stringBuilder1.Replace("<c>", "<color=#5E3016>");
			stringBuilder1.Replace("</c>", "</color>");
			stringBuilder1.Replace("<nb>", "<nobr>");
			stringBuilder1.Replace("</nb>", "</nobr>");
			stringBuilder1.Replace("<br1>", "<br><line-height=15%><br></line-height>");
			stringBuilder1.Replace("<br2>", "<br><line-height=30%><br></line-height>");
			stringBuilder1.Replace("<br3>", "<br><line-height=50%><br></line-height>");
			__instance.DescriptionNormalized = stringBuilder1.ToString();
			__instance.DescriptionNormalized = Regex.Replace(__instance.DescriptionNormalized, "[,][ ]*(<(.*?)>)*(.)", (Match m) => m.ToString().ToLower());
			__instance.DescriptionNormalized = Regex.Replace(__instance.DescriptionNormalized, "<br>\\w", (Match m) => m.ToString().ToUpper());
			Globals.Instance.CardsDescriptionNormalized[__instance.Id] = stringBuilder1.ToString();
			if (includeInSearch)
			{
				Globals.Instance.IncludeInSearch(Regex.Replace(Regex.Replace(__instance.DescriptionNormalized, "<sprite name=(.*?)>", (Match m) => Texts.Instance.GetText(m.Groups[1].Value, "")), "(<(.*?)>)*", ""), __instance.Id, false);
			}
		}

		public static void BinbinCustomText(TextLocation location, ref StringBuilder stringBuilder, string card)
		{
			if (TextToAddAtLocations == null)
			{
				TextToAddAtLocations = new Dictionary<TextLocation, Dictionary<string, List<string>>>();
			}
			if (!TextToAddAtLocations.TryGetValue(location, out var value) || !value.TryGetValue(card, out var value2))
			{
				return;
			}
			foreach (string item in value2)
			{
				stringBuilder.Append(item);
				stringBuilder.Append(item.EndsWith("\n") ? "" : "\n");
			}
		}

		public static void AddTextToCardDescription(string text, TextLocation location, string card, bool includeAB = false, bool includeRare = false)
		{
			if (TextToAddAtLocations == null)
			{
				TextToAddAtLocations = new Dictionary<TextLocation, Dictionary<string, List<string>>>();
			}
			if (!TextToAddAtLocations.ContainsKey(location))
			{
				TextToAddAtLocations[location] = new Dictionary<string, List<string>>();
			}
			Dictionary<string, List<string>> cardsToAddTextTo = TextToAddAtLocations[location];
			AddCardToDict(text, location, card, cardsToAddTextTo);
			if (includeAB)
			{
				AddCardToDict(text, location, card + "a", cardsToAddTextTo);
				AddCardToDict(text, location, card + "b", cardsToAddTextTo);
			}
			if (includeRare)
			{
				AddCardToDict(text, location, card + "rare", cardsToAddTextTo);
			}
		}

		public static void AddCardToDict(string text, TextLocation location, string card, Dictionary<string, List<string>> cardsToAddTextTo, bool refreshDescription = false)
		{
			if (!cardsToAddTextTo.ContainsKey(card))
			{
				cardsToAddTextTo[card] = new List<string>();
			}
			cardsToAddTextTo[card].Add(text);
			Globals instance = Globals.Instance;
			if (instance != null)
			{
				CardRealtimeData cardData = instance.GetCardData(card, false);
				if (cardData != null)
				{
					CardDescriptionExtension.SetDescriptionNew(cardData, true, (Character)null, true);
				}
			}
			TextToAddAtLocations[location] = cardsToAddTextTo;
			if (ModifiedCards == null)
			{
				ModifiedCards = new HashSet<string>();
			}
			ModifiedCards.Add(card);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CardItem), "SetCard")]
		public static void SetCardPostfix(ref CardItem __instance, ref TMP_Text ___descriptionTextTM, string id, bool deckScale = true, Hero _theHero = null, NPC _theNPC = null, bool GetFromGlobal = false, bool _generated = false)
		{
			if ((Object)(object)__instance == (Object)null && __instance.CardData == (CardRealtimeData)null)
			{
				return;
			}
			string text = id.Split("_")[0];
			HashSet<string> modifiedCards = ModifiedCards;
			if (modifiedCards == null || !modifiedCards.Contains(text))
			{
				return;
			}
			if (Globals.Instance.CardsDescriptionNormalized.TryGetValue(text, out var value))
			{
				if (!Utility.IsNullOrWhiteSpace(value))
				{
					___descriptionTextTM.text = value;
				}
			}
			else
			{
				Essentials.LogError("SetCardPostfix - Missing CardDescription for " + text + " with internalId " + __instance.CardData.Id, "SetCardPostfix");
			}
		}
	}
	[Serializable]
	public class DataText
	{
	}
	[Serializable]
	public class SubClassDataText : DataText
	{
		public string ActionSound;

		public string[] Cards;

		public string ChallengePack0;

		public string ChallengePack1;

		public string ChallengePack2;

		public string ChallengePack3;

		public string ChallengePack4;

		public string ChallengePack5;

		public string ChallengePack6;

		public string CharacterDescription;

		public string CharacterDescriptionStrength;

		public string CharacterName;

		public int Energy;

		public int EnergyTurn;

		public bool ExpansionCharacter;

		public bool Female;

		public float FluffOffsetX;

		public float FluffOffsetY;

		public string HeroClass;

		public string HeroClassSecondary;

		public string HitSound;

		public int HP;

		public string ID;

		public string Item;

		public int[] MaxHP;

		public int OrderInList;

		public int ResistSlashing;

		public int ResistBlunt;

		public int ResistPiercing;

		public int ResistFire;

		public int ResistCold;

		public int ResistLightning;

		public int ResistHoly;

		public int ResistShadow;

		public int ResistMind;

		public int Speed;

		public string SpriteBorderLocked;

		public string StickerBase;

		public string StickerAngry;

		public string StickerIndifferent;

		public string StickerLove;

		public string StickerSurprise;

		public float StickerOffsetX;

		public string SubclassName;

		public string Trait0;

		public string Trait1A;

		public string Trait1B;

		public string Trait2A;

		public string Trait2B;

		public string Trait3A;

		public string Trait3B;

		public string Trait4A;

		public string Trait4B;

		public bool AutoUnlock;

		public string SourceCharacterName;

		public string[] CardsSingularity;
	}
	[Serializable]
	public class HeroCardsText : DataText
	{
		public int UnitsInDeck;

		public string Card;
	}
	[Serializable]
	public class TraitDataText : DataText
	{
		public string Activation;

		public bool ActivateOnRuneTypeAdded;

		public string AuraCurseBonus1;

		public string AuraCurseBonus2;

		public string AuraCurseBonus3;

		public int AuraCurseBonusValue1;

		public int AuraCurseBonusValue2;

		public int AuraCurseBonusValue3;

		public string AuraCurseImmune1;

		public string AuraCurseImmune2;

		public string AuraCurseImmune3;

		public string CharacterStatModified;

		public int CharacterStatModifiedValue;

		public string DamageBonusFlat;

		public string DamageBonusFlat2;

		public string DamageBonusFlat3;

		public int DamageBonusFlatValue;

		public int DamageBonusFlatValue2;

		public int DamageBonusFlatValue3;

		public string DamageBonusPercent;

		public string DamageBonusPercent2;

		public string DamageBonusPercent3;

		public float DamageBonusPercentValue;

		public float DamageBonusPercentValue2;

		public float DamageBonusPercentValue3;

		public string Description;

		public int HealFlatBonus;

		public float HealPercentBonus;

		public int HealReceivedFlatBonus;

		public float HealReceivedPercentBonus;

		public string ID;

		public int MaxBleedDamagePerTurn;

		public string ResistModified1;

		public string ResistModified2;

		public string ResistModified3;

		public int ResistModifiedValue1;

		public int ResistModifiedValue2;

		public int ResistModifiedValue3;

		public int TimesPerRound;

		public int TimesPerTurn;

		public string TraitCard;

		public string TraitCardForAllHeroes;

		public string TraitName;

		public bool TryActivateOnEveryEvent;
	}
	[Serializable]
	public class CardDataNewText : DataText
	{
		public string AcEnergyBonus;

		public string AcEnergyBonus2;

		public int AcEnergyBonusQuantity;

		public int AcEnergyBonus2Quantity;

		public int AddCard;

		public int AddCardChoose;

		public bool AddCardCostTurn;

		public string AddCardFrom;

		public string AddCardId;

		public string[] AddCardList;

		public string AddCardPlace;

		public int AddCardReducedCost;

		public string AddCardType;

		public string[] AddCardTypeAux;

		public bool AddCardVanish;

		public bool AddCardOnlyCheckAuxTypes;

		public string[] AddCardTypeBasedOnHeroClass;

		public string[] AddCardListBasedOnHeroClass;

		public bool AddVanishToDeck;

		public string[] Auras;

		public string Aura;

		public string Aura2;

		public string Aura3;

		public int AuraCharges;

		public bool AuraChargesSpecialValue1;

		public bool AuraChargesSpecialValue2;

		public bool AuraChargesSpecialValueGlobal;

		public int AuraCharges2;

		public bool AuraCharges2SpecialValue1;

		public bool AuraCharges2SpecialValue2;

		public bool AuraCharges2SpecialValueGlobal;

		public int AuraCharges3;

		public bool AuraCharges3SpecialValue1;

		public bool AuraCharges3SpecialValue2;

		public bool AuraCharges3SpecialValueGlobal;

		public string AuraSelf;

		public string AuraSelf2;

		public string AuraSelf3;

		public bool AutoplayDraw;

		public bool AutoplayEndTurn;

		public string BaseCard;

		public string CardClass;

		public string CardName;

		public int CardNumber;

		public string CardRarity;

		public string CardType;

		public string[] CardTypeAux;

		public string[] CardTypeList;

		public string CardUpgraded;

		public bool ChooseOneOfAvailableAuras;

		public string CopyConfig;

		public bool Corrupted;

		public string[] Curses;

		public string Curse;

		public string Curse2;

		public string Curse3;

		public int CurseCharges;

		public int CurseChargesSides;

		public bool CurseChargesSpecialValue1;

		public bool CurseChargesSpecialValue2;

		public bool CurseChargesSpecialValueGlobal;

		public int CurseCharges2;

		public bool CurseCharges2SpecialValue1;

		public bool CurseCharges2SpecialValue2;

		public bool CurseCharges2SpecialValueGlobal;

		public int CurseCharges3;

		public bool CurseCharges3SpecialValue1;

		public bool CurseCharges3SpecialValue2;

		public bool CurseCharges3SpecialValueGlobal;

		public string CurseSelf;

		public string CurseSelf2;

		public string CurseSelf3;

		public int Damage;

		public bool DamageSpecialValue1;

		public bool DamageSpecialValue2;

		public bool DamageSpecialValueGlobal;

		public int Damage2;

		public bool Damage2SpecialValue1;

		public bool Damage2SpecialValue2;

		public bool Damage2SpecialValueGlobal;

		public int DamageEnergyBonus;

		public int DamageSelf;

		public int DamageSelf2;

		public int DamageSides;

		public int DamageSides2;

		public string DamageType;

		public string DamageType2;

		public string Description;

		public string DescriptionID;

		public string medsCustomDescription;

		public int DiscardCard;

		public bool DiscardCardAutomatic;

		public string DiscardCardPlace;

		public string DiscardCardType;

		public string[] DiscardCardTypeAux;

		public int DispelAuras;

		public int DrawCard;

		public bool DrawCardSpecialValueGlobal;

		public bool EffectCastCenter;

		public string EffectCaster;

		public bool EffectCasterRepeat;

		public float EffectPostCastDelay;

		public float EffectPostTargetDelay;

		public string EffectPreAction;

		public int EffectRepeat;

		public float EffectRepeatDelay;

		public int EffectRepeatEnergyBonus;

		public int EffectRepeatMaxBonus;

		public int EffectRepeatModificator;

		public string EffectRepeatTarget;

		public string EffectRequired;

		public string EffectTarget;

		public string EffectTrail;

		public string EffectTrailAngle;

		public bool EffectTrailRepeat;

		public float EffectTrailSpeed;

		public bool EndTurn;

		public int EnergyCost;

		public int EnergyCostForShow;

		public int EnergyRecharge;

		public bool EnergyRechargeSpecialValueGlobal;

		public int EnergyReductionPermanent;

		public int EnergyReductionTemporal;

		public bool EnergyReductionToZeroPermanent;

		public bool EnergyReductionToZeroTemporal;

		public int ExhaustCounter;

		public bool FlipSprite;

		public string Fluff;

		public float FluffPercent;

		public int GoldGainQuantity;

		public int Heal;

		public string HealAuraCurseName;

		public string HealAuraCurseName2;

		public string HealAuraCurseName3;

		public string HealAuraCurseName4;

		public string HealAuraCurseSelf;

		public int HealCurses;

		public int HealEnergyBonus;

		public int HealSelf;

		public float HealSelfPerDamageDonePercent;

		public bool HealSelfSpecialValue1;

		public bool HealSelfSpecialValue2;

		public bool HealSelfSpecialValueGlobal;

		public int HealSides;

		public bool HealSpecialValue1;

		public bool HealSpecialValue2;

		public bool HealSpecialValueGlobal;

		public string ID;

		public bool IgnoreBlock;

		public bool IgnoreBlock2;

		public int IncreaseAuras;

		public int IncreaseCurses;

		public bool Innate;

		public bool IsPetAttack;

		public bool IsPetCast;

		public string Item;

		public string ItemEnchantment;

		public bool KillPet;

		public bool Lazy;

		public int LookCards;

		public int LookCardsDiscardUpTo;

		public int LookCardsVanishUpTo;

		public int MaxInDeck;

		public bool ModifiedByTrait;

		public bool MoveToCenter;

		public bool OnlyInWeekly;

		public bool PetFront;

		public bool PetInvert;

		public string PetModel;

		public string PetOffset;

		public string PetSize;

		public bool PetTemporal;

		public bool PetTemporalAttack;

		public bool PetTemporalCast;

		public bool PetTemporalMoveToCenter;

		public bool PetTemporalMoveToBack;

		public float PetTemporalFadeOutDelay;

		public bool Playable;

		public int PullTarget;

		public int PushTarget;

		public int ReduceAuras;

		public int ReduceCurses;

		public string RelatedCard;

		public string RelatedCard2;

		public string RelatedCard3;

		public int SelfHealthLoss;

		public bool SelfHealthLossSpecialGlobal;

		public bool SelfHealthLossSpecialValue1;

		public bool SelfHealthLossSpecialValue2;

		public float SelfKillHiddenSeconds;

		public int ShardsGainQuantity;

		public bool ShowInTome;

		public string Sku;

		public string Sound;

		public string SoundPreAction;

		public string SoundPreActionFemale;

		public string SpecialAuraCurseName1;

		public string SpecialAuraCurseName2;

		public string SpecialAuraCurseNameGlobal;

		public string SpecialValue1;

		public string SpecialValue2;

		public string SpecialValueGlobal;

		public float SpecialValueModifier1;

		public float SpecialValueModifier2;

		public float SpecialValueModifierGlobal;

		public string Sprite;

		public bool Starter;

		public int StealAuras;

		public string SummonAura;

		public string SummonAura2;

		public string SummonAura3;

		public int SummonAuraCharges;

		public int SummonAuraCharges2;

		public int SummonAuraCharges3;

		public string SummonUnit;

		public int SummonUnitNum;

		public string TargetPosition;

		public string TargetSide;

		public string TargetType;

		public int TransferCurses;

		public string UpgradedFrom;

		public string UpgradesTo1;

		public string UpgradesTo2;

		public string UpgradesToRare;

		public bool Vanish;

		public bool Visible;
	}
	[Serializable]
	public class PerkDataText : DataText
	{
		public int AdditionalCurrency;

		public int AdditionalShards;

		public string AuraCurseBonus;

		public int AuraCurseBonusValue;

		public string CardClass;

		public string CustomDescription;

		public string DamageFlatBonus;

		public int DamageFlatBonusValue;

		public int EnergyBegin;

		public int HealQuantity;

		public string Icon;

		public string IconTextValue;

		public string ID;

		public int Level;

		public bool MainPerk;

		public int MaxHealth;

		public bool ObeliskPerk;

		public string ResistModified;

		public int ResistModifiedValue;

		public int Row;

		public int SpeedQuantity;
	}
	[Serializable]
	public class AuraCurseDataText : DataText
	{
		public string ACName;

		public string ACBonusData;

		public int AuraConsumed;

		public int AuraDamageIncreasedPercent;

		public int AuraDamageIncreasedPercent2;

		public int AuraDamageIncreasedPercent3;

		public int AuraDamageIncreasedPercent4;

		public float AuraDamageIncreasedPercentPerStack;

		public float AuraDamageIncreasedPercentPerStack2;

		public float AuraDamageIncreasedPercentPerStack3;

		public float AuraDamageIncreasedPercentPerStack4;

		public float AuraDamageIncreasedPercentPerStackPerEnergy;

		public float AuraDamageIncreasedPercentPerStackPerEnergy2;

		public float AuraDamageIncreasedPercentPerStackPerEnergy3;

		public float AuraDamageIncreasedPercentPerStackPerEnergy4;

		public float AuraDamageIncreasedPerStack;

		public float AuraDamageIncreasedPerStack2;

		public float AuraDamageIncreasedPerStack3;

		public float AuraDamageIncreasedPerStack4;

		public int AuraDamageIncreasedTotal;

		public int AuraDamageIncreasedTotal2;

		public int AuraDamageIncreasedTotal3;

		public int AuraDamageIncreasedTotal4;

		public string AuraDamageType;

		public string AuraDamageType2;

		public string AuraDamageType3;

		public string AuraDamageType4;

		public string AuraDamageChargesBasedOnACCharges;

		public string AuraDamageConditionalBonuses;

		public string ConsumedDamageChargesBasedOnACCharges;

		public string ConsumeDamageChargesIfACApplied;

		public int BlockChargesGainedPerStack;

		public int CardsDrawPerStack;

		public bool CharacterStatAbsolute;

		public int CharacterStatAbsoluteValue;

		public int CharacterStatAbsoluteValuePerStack;

		public int CharacterStatChargesMultiplierNeededForOne;

		public string CharacterStatModified;

		public int CharacterStatModifiedValue;

		public float CharacterStatModifiedValuePerStack;

		public float ChargesAuxNeedForOne1;

		public int ChargesAuxNeedForOne2;

		public int ChargesMultiplierDescription;

		public int ChargesPreReqForDamageReflection;

		public int ChargesPreReqForGrantBlockToTeamForAmountOfDamageBlocked;

		public bool CombatlogShow;

		public bool ConsumeAll;

		public bool ConsumedAtCast;

		public bool ConsumedAtRound;

		public bool ConsumedAtRoundBegin;

		public bool ConsumedAtTurn;

		public bool ConsumedAtTurnBegin;

		public int CursePreventedPerStack;

		public int DamagePreventedPerStack;

		public int DamageReflectedConsumeCharges;

		public string DamageReflectedType;

		public string DamageReflectedModifierType;

		public int DamageReflectedMultiplier;

		public int DamageSidesWhenConsumed;

		public int DamageSidesWhenConsumedPerCharge;

		public string DamageTypeWhenConsumed;

		public int DamageWhenConsumed;

		public float DamageWhenConsumedPerCharge;

		public string Description;

		public bool DieWhenConsumedAll;

		public string[] DisabledCardTypes;

		public int DoubleDamageIfCursesLessThan;

		public string EffectTick;

		public string EffectTickSides;

		public int ExplodeAtStacks;

		public int HealTotalOnExplode;

		public float HealPerChargeOnExplode;

		public string HealTargetOnExplode;

		public string ACOnExplode;

		public int ACTotalChargesOnExplode;

		public int ACChargesPerStackChargeOnExplodeOnExplode;

		public string GainAuraCurseConsumption;

		public string GainAuraCurseConsumption2;

		public int GainAuraCurseConsumptionPerCharge;

		public int GainAuraCurseConsumptionPerCharge2;

		public bool GainCharges;

		public string GainChargesFromThisAuraCurse;

		public string GainChargesFromThisAuraCurse2;

		public bool GrantBlockToTeamForAmountOfDamageBlocked;

		public int HealAttackerConsumeCharges;

		public int HealAttackerPerStack;

		public int HealDonePercent;

		public int HealDonePercentPerStack;

		public int HealDonePercentPerStackPerEnergy;

		public int HealDonePerStack;

		public int HealReceivedTotal;

		public int HealSidesWhenConsumed;

		public float HealSidesWhenConsumedPerCharge;

		public int HealWhenConsumed;

		public float HealWhenConsumedPerCharge;

		public bool IconShow;

		public string ID;

		public string IncreasedDamageReceivedType;

		public string IncreasedDamageReceivedType2;

		public int IncreasedDirectDamageChargesMultiplierNeededForOne;

		public int IncreasedDirectDamageChargesMultiplierNeededForOne2;

		public float IncreasedDirectDamageReceivedPerStack;

		public float IncreasedDirectDamageReceivedPerStack2;

		public int IncreasedDirectDamageReceivedPerTurn;

		public int IncreasedDirectDamageReceivedPerTurn2;

		public int IncreasedPercentDamageReceivedPerStack;

		public int IncreasedPercentDamageReceivedPerStack2;

		public int IncreasedPercentDamageReceivedPerTurn;

		public int IncreasedPercentDamageReceivedPerTurn2;

		public bool Invulnerable;

		public bool IsAura;

		public int MaxCharges;

		public int MaxMadnessCharges;

		public int ModifyCardCostPerChargeNeededForOne;

		public bool NoRemoveBlockAtTurnEnd;

		public bool Preventable;

		public string PreventedAuraCurse;

		public int PreventedAuraCurseStackPerStack;

		public int PreventedDamagePerStack;

		public string PreventedDamageTypePerStack;

		public int PriorityOnConsumption;

		public bool ProduceDamageWhenConsumed;

		public bool ProduceHealWhenConsumed;

		public bool Removable;

		public string RemoveAuraCurse;

		public string RemoveAuraCurse2;

		public string ResistModified;

		public string ResistModified2;

		public string ResistModified3;

		public float ResistModifiedPercentagePerStack;

		public float ResistModifiedPercentagePerStack2;

		public float ResistModifiedPercentagePerStack3;

		public float ResistModifiedValue;

		public float ResistModifiedValue2;

		public float ResistModifiedValue3;

		public int RevealCardsPerCharge;

		public bool SkipsNextTurn;

		public string Sound;

		public string Sprite;

		public bool Stealth;

		public bool Taunt;
	}
	[Serializable]
	public class NPCDataText : DataText
	{
		public string[] AICards;

		public string[] AuraCurseImmune;

		public string BaseMonster;

		public bool BigModel;

		public int CardsInHand;

		public string Description;

		public int Difficulty;

		public int Energy;

		public int EnergyTurn;

		public int ExperienceReward;

		public bool Female;

		public bool FinishCombatOnDead;

		public float FluffOffsetX;

		public float FluffOffsetY;

		public string GameObjectAnimated;

		public string GameObjectAnimatedAlternate;

		public int GoldReward;

		public string HellModeMob;

		public string HitSound;

		public int HP;

		public bool OnlyKillBossWhenHpZero;

		public string ID;

		public bool IsBoss;

		public bool IsNamed;

		public string NgPlusMob;

		public string NPCName;

		public float PosBottom;

		public string PreferredPosition;

		public int ResistBlunt;

		public int ResistCold;

		public int ResistFire;

		public int ResistHoly;

		public int ResistLightning;

		public int ResistMind;

		public int ResistPiercing;

		public int ResistShadow;

		public int ResistSlashing;

		public string ScriptableObjectName;

		public int Speed;

		public string Sprite;

		public string SpritePortrait;

		public string SpriteSpeed;

		public string SpriteSpeedAlternate;

		public string SpritePortraitAlternate;

		public string TierMob;

		public string TierReward;

		public string UpgradedMob;

		public bool GameObjectFlip;

		public bool GameObjectMakeBig;

		public string GameObjectReplaceTexture;
	}
	[Serializable]
	public class AICardsText : DataText
	{
		public int AddCardRound;

		public string AuraCurseCastIf;

		public string Card;

		public string OnlyCastIf;

		public float PercentToCast;

		public int Priority;

		public int StartsAtObeliskMadnessLevel;

		public int StartsAtSingularityMadnessLevel;

		public string SpecialSecondTargetID;

		public string SecondOnlyCastIf;

		public float SecondValueCastIf;

		public string TargetCast;

		public int UnitsInDeck;

		public float ValueCastIf;
	}
	[Serializable]
	public class NodeDataText : DataText
	{
		public int CombatPercent;

		public string Description;

		public bool DisableCorruption;

		public bool DisableRandom;

		public int EventPercent;

		public int ExistsPercent;

		public string ExistsSku;

		public bool GoToTown;

		public string NodeBackgroundImg;

		public string[] NodeCombat;

		public string NodeCombatTier;

		public string[] NodeEvent;

		public int[] NodeEventPercent;

		public int[] NodeEventPriority;

		public string NodeEventTier;

		public string NodeGround;

		public string NodeId;

		public string NodeName;

		public string NodeRequirement;

		public string[] NodesConnected;

		public string[] NodesConnectedRequirement;

		public string NodeZone;

		public bool TravelDestination;

		public bool VisibleIfNotRequirement;

		public float medsPosX;

		public float medsPosY;

		public string SourceNodeName;
	}
	[Serializable]
	public class LootDataText : DataText
	{
		public bool AllowDropOnlyItems;

		public float DefaultPercentEpic;

		public float DefaultPercentMythic;

		public float DefaultPercentRare;

		public float DefaultPercentUncommon;

		public int GoldQuantity;

		public string ID;

		public string[] LootItemTable;

		public int NumItems;

		public string ShadyModel;

		public float ShadyScaleX;

		public float ShadyScaleY;

		public float ShadyOffsetX;

		public float ShadyOffsetY;
	}
	[Serializable]
	public class LootItemText : DataText
	{
		public string LootCard;

		public float LootPercent;

		public string LootRarity;

		public string LootType;

		public string LootMisc;
	}
	[Serializable]
	public class PerkNodeDataText : DataText
	{
		public int Column;

		public string Cost;

		public string ID;

		public bool LockedInTown;

		public bool NotStack;

		public string Perk;

		public string PerkRequired;

		public string[] PerksConnected;

		public int Row;

		public string Sprite;

		public int Type;
	}
	[Serializable]
	public class ChallengeDataText : DataText
	{
		public string Boss1;

		public string Boss2;

		public string BossCombat;

		public string[] CorruptionList;

		public string Hero1;

		public string Hero2;

		public string Hero3;

		public string Hero4;

		public string ID;

		public string IDSteam;

		public string Loot;

		public string Seed;

		public string[] Traits;

		public int Week;
	}
	[Serializable]
	public class ChallengeTraitText : DataText
	{
		public string Icon;

		public string ID;

		public bool IsMadnessTrait;

		public bool IsSingularityTrait;

		public string Name;

		public int Order;

		public int OrderSingularity;
	}
	[Serializable]
	public class CombatDataText : DataText
	{
		public string CinematicData;

		public string CombatBackground;

		public string[] CombatEffect;

		public string CombatID;

		public string CombatMusic;

		public string CombatTier;

		public string Description;

		public string EventData;

		public string EventRequirementData;

		public bool HealHeroes;

		public string[] NPCList;

		public int NPCRemoveInMadness0Index;

		public string NPCToSummonOnNpcKilled;

		public bool RandomizeNpcPosition;

		public string StepSound;

		public string ThermometerTierData;

		public bool IsRift;
	}
	[Serializable]
	public class CombatEffectText : DataText
	{
		public string AuraCurse;

		public int AuraCurseCharges;

		public string AuraCurseTarget;
	}
	[Serializable]
	public class EventDataText : DataText
	{
		public string medsNode;

		public int medsPercent;

		public int medsPriority;

		public string Description;

		public string DescriptionAction;

		public string EventIconShader;

		public string EventID;

		public string EventName;

		public string EventSpriteBook;

		public string EventSpriteDecor;

		public string EventSpriteMap;

		public string EventTier;

		public string EventUniqueID;

		public bool HistoryMode;

		public int ReplyRandom;

		public string[] Replies;

		public string RequiredClass;

		public string Requirement;
	}
	[Serializable]
	public class EventRequirementDataText : DataText
	{
		public bool AssignToPlayerAtBegin;

		public string Description;

		public string ItemSprite;

		public string RequirementID;

		public string RequirementName;

		public bool RequirementTrack;

		public string TrackSprite;

		public string TrackCard;

		public bool ItemTrack;

		public string RequirementZoneFinishTrack;
	}
	[Serializable]
	public class EventReplyDataText : DataText
	{
		public string medsEvent;

		public string medsTempID;

		public int DustCost;

		public int GoldCost;

		public int IndexForAnswerTranslation;

		public bool RepeatForAllCharacters;

		public bool RepeatForAllWarriors;

		public bool RepeatForAllScouts;

		public bool RepeatForAllMages;

		public bool RepeatForAllHealers;

		public string ReplyActionText;

		public string ReplyShowCard;

		public string ReplyText;

		public string RequiredClass;

		public string Requirement;

		public string RequirementBlocked;

		public string[] RequirementCard;

		public string RequirementItem;

		public bool RequirementMultiplayer;

		public string RequirementSku;

		public string SSAddCard1;

		public string SSAddCard2;

		public string SSAddCard3;

		public string SSAddItem;

		public bool SSCardPlayerGame;

		public string SSCardPlayerGamePackData;

		public bool SSCardPlayerPairsGame;

		public string SSCardPlayerPairsGamePackData;

		public string SSCharacterReplacement;

		public int SSCharacterReplacementPosition;

		public string SSCombat;

		public bool SSCorruptionUI;

		public bool SSItemCorruptionUI;

		public string SSCorruptItemSlot;

		public bool SSCraftUI;

		public string SSCraftUIMaxType;

		public int SSDiscount;

		public int SSDustReward;

		public string SSEvent;

		public int SSExperienceReward;

		public bool SSFinishEarlyAccess;

		public bool SSFinishGame;

		public bool SSFinishObeliskMap;

		public int SSGoldReward;

		public bool SSHealerUI;

		public string SSLootList;

		public int SSMaxQuantity;

		public bool SSMerchantUI;

		public string SSNodeTravel;

		public string SSPerkData;

		public string SSPerkData1;

		public string SSRemoveItemSlot;

		public string SSRequirementLock;

		public string SSRequirementLock2;

		public string SSRequirementUnlock;

		public string SSRequirementUnlock2;

		public int SSRewardHealthFlat;

		public float SSRewardHealthPercent;

		public string SSRewardText;

		public string SSRewardTier;

		public bool SSRoll;

		public string SSRollCard;

		public string SSRollMode;

		public int SSRollNumber;

		public int SSRollNumberCritical;

		public int SSRollNumberCriticalFail;

		public string SSRollTarget;

		public string SSShopList;

		public string SSSteamStat;

		public int SSSupplyReward;

		public string SSUnlockClass;

		public string SSUnlockSkin;

		public string SSUnlockSteamAchievement;

		public bool SSUpgradeRandomCard;

		public bool SSUpgradeUI;

		public string SSCAddCard1;

		public string SSCAddCard2;

		public string SSCAddCard3;

		public string SSCAddItem;

		public bool SSCCardPlayerGame;

		public string SSCCardPlayerGamePackData;

		public bool SSCCardPlayerPairsGame;

		public string SSCCardPlayerPairsGamePackData;

		public string SSCCombat;

		public bool SSCCorruptionUI;

		public bool SSCItemCorruptionUI;

		public string SSCCorruptItemSlot;

		public bool SSCCraftUI;

		public string SSCCraftUIMaxType;

		public int SSCDiscount;

		public int SSCDustReward;

		public string SSCEvent;

		public int SSCExperienceReward;

		public bool SSCFinishEarlyAccess;

		public bool SSCFinishGame;

		public int SSCGoldReward;

		public bool SSCHealerUI;

		public string SSCLootList;

		public int SSCMaxQuantity;

		public bool SSCMerchantUI;

		public string SSCNodeTravel;

		public string SSCRemoveItemSlot;

		public string SSCRequirementLock;

		public string SSCRequirementUnlock;

		public string SSCRequirementUnlock2;

		public int SSCRewardHealthFlat;

		public float SSCRewardHealthPercent;

		public string SSCRewardText;

		public string SSCRewardTier;

		public string SSCShopList;

		public int SSCSupplyReward;

		public string SSCUnlockClass;

		public string SSCUnlockSteamAchievement;

		public bool SSCUpgradeRandomCard;

		public bool SSCUpgradeUI;

		public string FLAddCard1;

		public string FLAddCard2;

		public string FLAddCard3;

		public string FLAddItem;

		public bool FLCardPlayerGame;

		public string FLCardPlayerGamePackData;

		public bool FLCardPlayerPairsGame;

		public string FLCardPlayerPairsGamePackData;

		public string FLCombat;

		public bool FLCorruptionUI;

		public bool FLItemCorruptionUI;

		public string FLCorruptItemSlot;

		public bool FLCraftUI;

		public string FLCraftUIMaxType;

		public int FLDiscount;

		public int FLDustReward;

		public string FLEvent;

		public int FLExperienceReward;

		public int FLGoldReward;

		public bool FLHealerUI;

		public string FLLootList;

		public int FLMaxQuantity;

		public bool FLMerchantUI;

		public string FLNodeTravel;

		public string FLRemoveItemSlot;

		public string FLRequirementLock;

		public string FLRequirementUnlock;

		public string FLRequirementUnlock2;

		public int FLRewardHealthFlat;

		public float FLRewardHealthPercent;

		public string FLRewardText;

		public string FLRewardTier;

		public string FLShopList;

		public int FLSupplyReward;

		public string FLUnlockClass;

		public string FLUnlockSteamAchievement;

		public bool FLUpgradeRandomCard;

		public bool FLUpgradeUI;

		public string FLCAddCard1;

		public string FLCAddCard2;

		public string FLCAddCard3;

		public string FLCAddItem;

		public bool FLCCardPlayerGame;

		public string FLCCardPlayerGamePackData;

		public bool FLCCardPlayerPairsGame;

		public string FLCCardPlayerPairsGamePackData;

		public string FLCCombat;

		public bool FLCCorruptionUI;

		public bool FLCItemCorruptionUI;

		public string FLCCorruptItemSlot;

		public bool FLCCraftUI;

		public string FLCCraftUIMaxType;

		public int FLCDiscount;

		public int FLCDustReward;

		public string FLCEvent;

		public int FLCExperienceReward;

		public int FLCGoldReward;

		public bool FLCHealerUI;

		public string FLCLootList;

		public int FLCMaxQuantity;

		public bool FLCMerchantUI;

		public string FLCNodeTravel;

		public string FLCRemoveItemSlot;

		public string FLCRequirementLock;

		public string FLCRequirementUnlock;

		public string FLCRequirementUnlock2;

		public int FLCRewardHealthFlat;

		public float FLCRewardHealthPercent;

		public string FLCRewardText;

		public string FLCRewardTier;

		public string FLCShopList;

		public int FLCSupplyReward;

		public string FLCUnlockClass;

		public string FLCUnlockSteamAchievement;

		public bool FLCUpgradeRandomCard;

		public bool FLCUpgradeUI;
	}
	[Serializable]
	public class ZoneDataText : DataText
	{
		public bool ChangeTeamOnEntrance;

		public bool DisableExperienceOnThisZone;

		public bool DisableMadnessOnThisZone;

		public string[] NewTeam;

		public bool ObeliskFinal;

		public bool ObeliskHigh;

		public bool ObeliskLow;

		public bool RestoreTeamOnExit;

		public string ZoneID;

		public string ZoneName;

		public string BackgroundImg;

		public string TransitionImg;

		public string MainZoneID;

		public string ReplaceMapGOSprite;

		public string ReplaceMapGOSpriteWith;

		public string BackgroundImg2;

		public string BackgroundImg3;

		public string BackgroundImg2Req;

		public string BackgroundImg3Req;
	}
	[Serializable]
	public class KeyNotesDataText : DataText
	{
		public string Description;

		public string DescriptionExtended;

		public string ID;

		public string KeynoteName;
	}
	[Serializable]
	public class PackDataText : DataText
	{
		public string Card0;

		public string Card1;

		public string Card2;

		public string Card3;

		public string Card4;

		public string Card5;

		public string CardSpecial0;

		public string CardSpecial1;

		public string PackClass;

		public string PackID;

		public string PackName;

		public string[] PerkList;

		public string RequiredClass;
	}
	[Serializable]
	public class ItemDataText : DataText
	{
		public bool ACG1MultiplyByEnergyUsed;

		public bool ACG2MultiplyByEnergyUsed;

		public bool ACG3MultiplyByEnergyUsed;

		public string Activation;

		public bool ActivationOnlyOnHeroes;

		public bool AddVanishToDeck;

		public string AuraCurseBonus1;

		public string AuraCurseBonus2;

		public int AuraCurseBonusValue1;

		public int AuraCurseBonusValue2;

		public string AuraCurseCustomAC;

		public int AuraCurseCustomModValue1;

		public int AuraCurseCustomModValue2;

		public string AuraCurseCustomString;

		public string AuraCurseGain1;

		public string AuraCurseGain2;

		public string AuraCurseGain3;

		public int AuraCurseGainValue1;

		public int AuraCurseGainValue2;

		public int AuraCurseGainValue3;

		public string AuraCurseGainSelf1;

		public string AuraCurseGainSelf2;

		public string AuraCurseGainSelf3;

		public int AuraCurseGainSelfValue1;

		public int AuraCurseGainSelfValue2;

		public int AuraCurseGainSelfValue3;

		public string AuraCurseGain1SpecialValue;

		public string AuraCurseGain2SpecialValue;

		public string AuraCurseGain3SpecialValue;

		public string AuraCurseHeal1;

		public string AuraCurseHeal2;

		public string AuraCurseHeal3;

		public string AuraCurseImmune1;

		public string AuraCurseImmune2;

		public int AuraCurseNumForOneEvent;

		public string AuraCurseSetted;

		public string AuraCurseSetted2;

		public string AuraCurseSetted3;

		public int CardNum;

		public string CardPlace;

		public int CardsReduced;

		public string CardToGain;

		public string[] CardToGainList;

		public string CardToGainType;

		public string CardToReduceType;

		public string CastedCardType;

		public bool CastEnchantmentOnFinishSelfCast;

		public int ChanceToDispel;

		public int ChanceToDispelNum;

		public int ChanceToPurge;

		public int ChanceToPurgeNum;

		public int ChanceToDispelSelf;

		public int ChanceToDispelNumSelf;

		public string CharacterStatModified;

		public string CharacterStatModified2;

		public string CharacterStatModified3;

		public int CharacterStatModifiedValue;

		public int CharacterStatModifiedValue2;

		public int CharacterStatModifiedValue3;

		public bool ChooseOneACToGain;

		public bool CostReducePermanent;

		public int CostReduceReduction;

		public int CostReduceEnergyRequirement;

		public int CostReduction;

		public bool CostZero;

		public bool CursedItem;

		public string DamageFlatBonus;

		public string DamageFlatBonus2;

		public string DamageFlatBonus3;

		public int DamageFlatBonusValue;

		public int DamageFlatBonusValue2;

		public int DamageFlatBonusValue3;

		public string DamagePercentBonus;

		public string DamagePercentBonus2;

		public string DamagePercentBonus3;

		public float DamagePercentBonusValue;

		public float DamagePercentBonusValue2;

		public float DamagePercentBonusValue3;

		public int DamageToTarget;

		public string DamageToTargetType;

		public string DttSpecialValues1;

		public int DamageToTarget2;

		public string DamageToTargetType2;

		public string DttSpecialValues2;

		public bool DestroyAfterUse;

		public int DestroyAfterUses;

		public bool DestroyEndOfTurn;

		public bool DestroyStartOfTurn;

		public bool DontTargetBoss;

		public int DrawCards;

		public bool DrawMultiplyByEnergyUsed;

		public bool DropOnly;

		public bool DTTMultiplyByEnergyUsed;

		public bool DuplicateActive;

		public string EffectCaster;

		public string EffectItemOwner;

		public string EffectTarget;

		public float EffectCasterDelay;

		public float EffectTargetDelay;

		public bool EmptyHand;

		public int EnergyQuantity;

		public int ExactRound;

		public int HealFlatBonus;

		public float HealPercentBonus;

		public int HealPercentQuantity;

		public int HealPercentQuantitySelf;

		public int HealQuantity;

		public string HealQuantitySpecialValue;

		public int HealReceivedFlatBonus;

		public float HealReceivedPercentBonus;

		public bool HealSelfTeamPerDamageDonePercent;

		public int HealBasedOnAuraCurse;

		public string ID;

		public bool IsEnchantment;

		public string ItemSound;

		public string ItemTarget;

		public float LowerOrEqualPercentHP;

		public int MaxHealth;

		public string ModifiedDamageType;

		public bool NotShowCharacterBonus;

		public bool OnlyAddItemToNPCs;

		public bool PassSingleAndCharacterRolls;

		public int PercentDiscountShop;

		public int PercentRetentionEndGame;

		public bool Permanent;

		public bool QuestItem;

		public bool ReduceHighestCost;

		public string ResistModified1;

		public string ResistModified2;

		public string ResistModified3;

		public int ResistModifiedValue1;

		public int ResistModifiedValue2;

		public int ResistModifiedValue3;

		public int RoundCycle;

		public string SpriteBossDrop;

		public int TimesPerCombat;

		public int TimesPerTurn;

		public bool UsedEnergy;

		public bool UseTheNextInsteadWhenYouPlay;

		public bool Vanish;
	}
	[Serializable]
	public class CorruptionPackDataText : DataText
	{
		public string[] HighPack;

		public string[] LowPack;

		public string PackClass;

		public string PackName;

		public int PackTier;
	}
	[Serializable]
	public class CardPlayerPairsPackDataText : DataText
	{
		public string PackId;

		public string Card0;

		public string Card1;

		public string Card2;

		public string Card3;

		public string Card4;

		public string Card5;
	}
	[Serializable]
	public class CardPlayerPackDataText : DataText
	{
		public string Card0;

		public bool Card0RandomBoon;

		public bool Card0RandomInjury;

		public string Card1;

		public bool Card1RandomBoon;

		public bool Card1RandomInjury;

		public string Card2;

		public bool Card2RandomBoon;

		public bool Card2RandomInjury;

		public string Card3;

		public bool Card3RandomBoon;

		public bool Card3RandomInjury;

		public int ModIterations;

		public int ModSpeed;

		public string PackId;
	}
	[Serializable]
	public class NodesConnectedRequirementText : DataText
	{
		public string NodeData;

		public string ConnectionRequirement;

		public string ConnectionIfNotNode;
	}
	[Serializable]
	public class CardbackDataText : DataText
	{
		public int AdventureLevel;

		public bool BaseCardback;

		public string CardbackID;

		public string CardbackName;

		public int CardbackOrder;

		public string CardbackSprite;

		public string CardbackSubclass;

		public string CardbackTextId;

		public bool Locked;

		public int ObeliskLevel;

		public bool PdxAccountRequired;

		public int RankLevel;

		public bool ShowIfLocked;

		public int SingularityLevel;

		public string Sku;

		public string SteamStat;
	}
	[Serializable]
	public class SkinDataText : DataText
	{
		public bool BaseSkin;

		public int PerkLevel;

		public string SkinGO;

		public string SkinID;

		public string SkinName;

		public int SkinOrder;

		public string SkinSubclass;

		public string SkinTextId;

		public string Sku;

		public string SpritePortrait;

		public string SpritePortraitGrande;

		public string SpriteSilueta;

		public string SpriteSiluetaGrande;

		public string SteamStat;
	}
	[Serializable]
	public class CinematicDataText : DataText
	{
		public string CinematicBSO;

		public string CinematicCombat;

		public bool CinematicEndAdventure;

		public string CinematicEvent;

		public string CinematicGo;

		public string CinematicID;
	}
	[Serializable]
	public class TierRewardDataText : DataText
	{
		public int tierNum;

		public int common;

		public int uncommon;

		public int rare;

		public int epic;

		public int mythic;

		public int dust;
	}
	[Serializable]
	public class GameObjectRetexture
	{
		public string NewGameObjectID;

		public string BaseGameObjectID;

		public string SpriteToUse;

		public float ScaleX;

		public float ScaleY;

		public bool Flip;
	}
	[Serializable]
	public class PrestigeDeck
	{
		public string ID;

		public string Name;

		public string[] Traits;

		public string[] Cards;
	}
	[Serializable]
	public class Mod
	{
		public string Name;

		public string Description;

		public string Version;

		public int Date;

		public string Link;

		public string[] Dependencies;

		public string Author;

		public string ContentFolder;

		public int Priority;

		public string[] Type;

		public string Comment;

		public bool Enabled;

		public Mod(string _name, string _author = "", string _description = "", string _version = "1.0.0", int _date = 19920101, string _link = "", string[] _dependencies = null, string _contentFolder = "", int _priority = 100, string[] _type = null, string _comment = "", bool _enabled = true)
		{
			Name = _name;
			Author = _author;
			Description = _description;
			Version = _version;
			Date = _date;
			Link = _link;
			Dependencies = _dependencies ?? new string[0];
			ContentFolder = _contentFolder;
			Priority = _priority;
			Type = _type ?? new string[0];
			Comment = _comment;
			Enabled = _enabled;
		}
	}
	[Serializable]
	public class PlayerProfileDataText : DataText
	{
		public string SteamUserID;

		public string[] LastUsedTeam;

		public int TownTutorialStep;

		public List<string> TutorialWatched;

		public List<string> UnlockedNodes;

		public List<string> UnlockedHeroes;

		public List<string> UnlockedCards;

		public List<string> UnlockedCardbacks;

		public List<string> PlayerRuns;

		public int PlayerRankProgress;

		public List<string> TreasuresClaimed;

		public bool NgUnlocked;

		public int NgLevel;

		public int MaxAdventureMadnessLevel;

		public int ObeliskMadnessLevel;

		public int BossesKilled;

		public List<string> BossesKilledName;

		public int MonstersKilled;

		public int ExpGained;

		public int CardsCrafted;

		public int CardsUpgraded;

		public int GoldGained;

		public int DustGained;

		public int BestScore;

		public int SupplyGained;

		public int SupplyActual;

		public List<string> SupplyBought;

		public int PurchasedItems;

		public int CorruptionsCompleted;

		public Dictionary<string, string> SkinUsed;

		public Dictionary<string, string> CardbackUsed;

		public Dictionary<string, List<string>> UnlockedCardsByGame;

		public string[] TeamHeroes;

		public string[] TeamNPCs;

		public Dictionary<string, int> HeroProgress;

		public Dictionary<string, List<string>> HeroPerks;

		public string[] GameTeamHeroes;

		public PlayerDeckDataText PlayerSavedDeck;

		public PlayerPerkDataText PlayerSavedPerk;

		public List<string> AchievementsSent;
	}
	[Serializable]
	public class PlayerDeckDataText : DataText
	{
		public List<HeroDeckDataText> Heroes;
	}
	[Serializable]
	public class HeroDeckDataText : DataText
	{
		public string SubclassID;

		public List<SavedDeckDataText> SavedDecks;
	}
	public class SavedDeckDataText : DataText
	{
		public string Title;

		public List<string> Cards;
	}
	[Serializable]
	public class PlayerPerkDataText : DataText
	{
		public List<HeroPerkDataText> Heroes;
	}
	[Serializable]
	public class HeroPerkDataText : DataText
	{
		public string SubclassID;

		public List<SavedPerkDataText> SavedPerks;
	}
	public class SavedPerkDataText : DataText
	{
		public string Title;

		public List<string> Perks;

		public int Points;
	}
	[Serializable]
	public class CurseDebuffsText : DataText
	{
		public string curse;

		public string curseSelf;

		public int curseCharges;

		public int curseChargesSides;

		public bool curseChargesSpecialValueGlobal;

		public bool curseChargesSpecialValue1;

		public bool curseChargesSpecialValue2;
	}
	[Serializable]
	public class AuraBuffsText : DataText
	{
		public string aura;

		public string auraSelf;

		public int auraCharges;

		public bool auraChargesSpecialValueGlobal;

		public bool auraChargesSpecialValue1;

		public bool auraChargesSpecialValue2;
	}
	[Serializable]
	public class CardToGainTypeBasedOnHeroClassText : DataText
	{
		public string heroClass;

		public string[] cardTypes;
	}
	[Serializable]
	public class CardToGainListBasedOnHeroClassText : DataText
	{
		public string heroClass;

		public string[] cardsList;
	}
	[Serializable]
	public class SpecialValuesText : DataText
	{
		public string Name;

		public bool Use;

		public float Multiplier;
	}
	[Serializable]
	public class CopyConfigText : DataText
	{
		public bool CopyNameFromOriginal;

		public bool CopyImageFromOriginal;

		public bool CopyCardUpgradedFromOriginal;

		public bool CopyCardTypeFromOriginal;
	}
	public class DataTextConvert
	{
		private class MemberCache
		{
			public List<PropertyInfo> Properties = new List<PropertyInfo>();

			public List<FieldInfo> Fields = new List<FieldInfo>();
		}

		private class ExportContext
		{
			public object Root;

			public Type RootType;

			public string RootId;

			public string CardClass;

			public bool Full;

			public readonly HashSet<object> Visiting = new HashSet<object>(ReferenceEqualityComparer.Instance);
		}

		private sealed class ReferenceEqualityComparer : IEqualityComparer<object>
		{
			public static readonly ReferenceEqualityComparer Instance = new ReferenceEqualityComparer();

			public new bool Equals(object x, object y)
			{
				return x == y;
			}

			public int GetHashCode(object obj)
			{
				return RuntimeHelpers.GetHashCode(obj);
			}
		}

		private static readonly Dictionary<Type, string> ExportFolders = new Dictionary<Type, string>
		{
			{
				typeof(SubClassData),
				"subclass"
			},
			{
				typeof(TraitData),
				"trait"
			},
			{
				typeof(CardRealtimeData),
				"card"
			},
			{
				typeof(CardDataNew),
				"card"
			},
			{
				typeof(PerkData),
				"perk"
			},
			{
				typeof(AuraCurseData),
				"auraCurse"
			},
			{
				typeof(NPCData),
				"npc"
			},
			{
				typeof(NodeData),
				"node"
			},
			{
				typeof(LootData),
				"loot"
			},
			{
				typeof(PerkNodeData),
				"perkNode"
			},
			{
				typeof(ChallengeData),
				"challengeData"
			},
			{
				typeof(ChallengeTrait),
				"challengeTrait"
			},
			{
				typeof(CombatData),
				"combatData"
			},
			{
				typeof(EventData),
				"event"
			},
			{
				typeof(EventReplyData),
				"eventReply"
			},
			{
				typeof(EventReplyDataText),
				"eventReply"
			},
			{
				typeof(EventRequirementData),
				"eventRequirement"
			},
			{
				typeof(ZoneData),
				"zone"
			},
			{
				typeof(KeyNotesData),
				"keynote"
			},
			{
				typeof(PackData),
				"pack"
			},
			{
				typeof(CardPlayerPackData),
				"cardPlayerPack"
			},
			{
				typeof(CardPlayerPairsPackData),
				"pairsPack"
			},
			{
				typeof(ItemData),
				"item"
			},
			{
				typeof(CardbackData),
				"cardback"
			},
			{
				typeof(SkinData),
				"skin"
			},
			{
				typeof(CorruptionPackData),
				"corruptionPack"
			},
			{
				typeof(CinematicData),
				"cinematic"
			},
			{
				typeof(TierRewardData),
				"tierReward"
			}
		};

		private static readonly string[] IdPropertyNames = new string[13]
		{
			"Id", "ID", "NodeId", "CombatId", "EventId", "ZoneId", "RequirementId", "CardbackId", "SkinId", "PackId",
			"CinematicId", "PackName", "medsTempID"
		};

		private static readonly Dictionary<Type, MemberCache> MemberCaches = new Dictionary<Type, MemberCache>();

		public static string GetExportFolder(object data)
		{
			if (data == null)
			{
				return "unknown";
			}
			if (data is Dictionary<string, object>)
			{
				return "eventReply";
			}
			Type type = data.GetType();
			if (ExportFolders.TryGetValue(type, out var value))
			{
				return value;
			}
			return type.Name;
		}

		public static Dictionary<string, object> ToText(object data)
		{
			return ConvertRoot(data, full: false);
		}

		public static Dictionary<string, object> ToFULLText(NodeData data)
		{
			return ConvertRoot(data, full: true);
		}

		public static Dictionary<string, object> ToText(PlayerDeck data)
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			List<object> list = new List<object>();
			if (data?.DeckTitle != null)
			{
				foreach (string key in data.DeckTitle.Keys)
				{
					Dictionary<string, object> dictionary2 = new Dictionary<string, object> { { "SubclassID", key } };
					List<object> list2 = new List<object>();
					for (int i = 0; i < data.DeckTitle[key].Length; i++)
					{
						list2.Add(new Dictionary<string, object>
						{
							{
								"Title",
								data.DeckTitle[key][i]
							},
							{
								"Cards",
								ToObjectList(data.DeckCards[key][i])
							}
						});
					}
					dictionary2["SavedDecks"] = list2;
					list.Add(dictionary2);
				}
			}
			dictionary["Heroes"] = list;
			return dictionary;
		}

		public static Dictionary<string, object> ToText(PlayerPerk data)
		{
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			List<object> list = new List<object>();
			if (data?.PerkConfigTitle != null)
			{
				foreach (string key in data.PerkConfigTitle.Keys)
				{
					Dictionary<string, object> dictionary2 = new Dictionary<string, object> { { "SubclassID", key } };
					List<object> list2 = new List<object>();
					for (int i = 0; i < data.PerkConfigTitle[key].Length; i++)
					{
						list2.Add(new Dictionary<string, object>
						{
							{
								"Title",
								data.PerkConfigTitle[key][i]
							},
							{
								"Perks",
								ToObjectList(data.PerkConfigPerks[key][i])
							},
							{
								"Points",
								data.PerkConfigPoints[key][i]
							}
						});
					}
					dictionary2["SavedPerks"] = list2;
					list.Add(dictionary2);
				}
			}
			dictionary["Heroes"] = list;
			return dictionary;
		}

		private static List<object> ToObjectList(IEnumerable values)
		{
			List<object> list = new List<object>();
			if (values == null)
			{
				return list;
			}
			foreach (object value in values)
			{
				list.Add(value);
			}
			return list;
		}

		public static string ToString(object data)
		{
			return GetReferenceId(data);
		}

		public static string ToJson(object value, bool pretty = true)
		{
			StringBuilder stringBuilder = new StringBuilder();
			WriteJson(stringBuilder, value, pretty, 0);
			return stringBuilder.ToString();
		}

		private static Dictionary<string, object> ConvertRoot(object data, bool full)
		{
			if (data == null)
			{
				return new Dictionary<string, object>();
			}
			if (data is Dictionary<string, object> result)
			{
				return result;
			}
			PlayerDeck val = (PlayerDeck)((data is PlayerDeck) ? data : null);
			if (val != null)
			{
				return ToText(val);
			}
			PlayerPerk val2 = (PlayerPerk)((data is PlayerPerk) ? data : null);
			if (val2 != null)
			{
				return ToText(val2);
			}
			ExportContext exportContext = new ExportContext
			{
				Root = data,
				RootType = data.GetType(),
				RootId = GetReferenceId(data),
				Full = full
			};
			exportContext.CardClass = GetMemberString(data, "CardClass");
			object obj = ConvertValue(data, exportContext, isRoot: true);
			return (obj as Dictionary<string, object>) ?? new Dictionary<string, object>();
		}

		private static object ConvertValue(object value, ExportContext ctx, bool isRoot = false)
		{
			if (value == null)
			{
				return null;
			}
			Object val = (Object)((value is Object) ? value : null);
			if (val != null && val == (Object)null)
			{
				return "";
			}
			Type type = value.GetType();
			if (type.IsEnum)
			{
				return Enum.GetName(type, value) ?? value.ToString();
			}
			if (IsPrimitiveJsonValue(type))
			{
				return value;
			}
			if (value is string || value is char || value is Guid)
			{
				return value.ToString();
			}
			if (value is Vector2 || value is Vector3 || value is Vector4)
			{
				return value.ToString();
			}
			if (value is Dictionary<string, object> result)
			{
				return result;
			}
			if (!isRoot)
			{
				Object val2 = (Object)((value is Object) ? value : null);
				if (val2 != null)
				{
					return ConvertUnityObject(val2, ctx);
				}
			}
			if (value is IDictionary dictionary)
			{
				return ConvertDictionary(dictionary, ctx);
			}
			if (value is IEnumerable enumerable && !(value is string) && !(value is Object))
			{
				return ConvertEnumerable(enumerable, ctx);
			}
			if (ShouldSkipNestedType(type))
			{
				return type.Name;
			}
			return ConvertObject(value, ctx, isRoot);
		}

		private static object ConvertUnityObject(Object value, ExportContext ctx)
		{
			Sprite val = (Sprite)(object)((value is Sprite) ? value : null);
			if (val != null)
			{
				MaybeExportSprite(val, ctx);
			}
			else
			{
				GameObject val2 = (GameObject)(object)((value is GameObject) ? value : null);
				if (val2 != null)
				{
					MaybeExportGameObjectSprites(val2, ctx);
				}
			}
			if (ShouldEmbedUnityObject(value, ctx))
			{
				return ConvertObject(value, ctx, isRoot: false);
			}
			return GetReferenceId(value);
		}

		private static bool ShouldEmbedUnityObject(Object value, ExportContext ctx)
		{
			if (value is Sprite || value is AudioClip || value is GameObject || value is Component || value is Texture)
			{
				return false;
			}
			if (value is ItemData)
			{
				return true;
			}
			if (ctx.Full && value is EventData)
			{
				return true;
			}
			return false;
		}

		private static Dictionary<string, object> ConvertDictionary(IDictionary dictionary, ExportContext ctx)
		{
			Dictionary<string, object> dictionary2 = new Dictionary<string, object>();
			foreach (DictionaryEntry item in dictionary)
			{
				string key = item.Key?.ToString() ?? "";
				dictionary2[key] = ConvertValue(item.Value, ctx);
			}
			return dictionary2;
		}

		private static List<object> ConvertEnumerable(IEnumerable enumerable, ExportContext ctx)
		{
			List<object> list = new List<object>();
			foreach (object item in enumerable)
			{
				list.Add(ConvertValue(item, ctx));
			}
			return list;
		}

		private static Dictionary<string, object> ConvertObject(object data, ExportContext ctx, bool isRoot)
		{
			if (!data.GetType().IsValueType && !ctx.Visiting.Add(data))
			{
				return new Dictionary<string, object> { 
				{
					"_cycle",
					GetReferenceId(data)
				} };
			}
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			try
			{
				MemberCache members = GetMembers(data.GetType());
				foreach (PropertyInfo property in members.Properties)
				{
					object value;
					try
					{
						value = property.GetValue(data);
					}
					catch (Exception ex)
					{
						Essentials.LogDebug("DataTextConvert skipped property " + data.GetType().Name + "." + property.Name + ": " + ex.Message, "ConvertObject");
						continue;
					}
					dictionary[property.Name] = ConvertValue(value, ctx);
				}
				foreach (FieldInfo field in members.Fields)
				{
					object value2;
					try
					{
						value2 = field.GetValue(data);
					}
					catch (Exception ex2)
					{
						Essentials.LogDebug("DataTextConvert skipped field " + data.GetType().Name + "." + field.Name + ": " + ex2.Message, "ConvertObject");
						continue;
					}
					dictionary[ToPascalCase(field.Name)] = ConvertValue(value2, ctx);
				}
				Enrich(data, dictionary, ctx, isRoot);
			}
			finally
			{
				if (!data.GetType().IsValueType)
				{
					ctx.Visiting.Remove(data);
				}
			}
			return dictionary;
		}

		private static void Enrich(object data, Dictionary<string, object> result, ExportContext ctx, bool isRoot)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			NodeData val = (NodeData)((data is NodeData) ? data : null);
			if (val != null)
			{
				if (Essentials.medsNodeSource != null && !string.IsNullOrEmpty(val.NodeId) && Essentials.medsNodeSource.ContainsKey(val.NodeId))
				{
					Vector3 position = ((Component)Essentials.medsNodeSource[val.NodeId]).transform.position;
					result["medsPosX"] = position.x;
					result["medsPosY"] = position.y;
				}
			}
			else
			{
				EventData val2 = (EventData)((data is EventData) ? data : null);
				if (val2 != null)
				{
					string text = val2.EventId ?? "";
					result["medsNode"] = ((Essentials.medsNodeEvent != null && Essentials.medsNodeEvent.ContainsKey(text)) ? Essentials.medsNodeEvent[text] : "");
					result["medsPercent"] = ((Essentials.medsNodeEventPercent != null && Essentials.medsNodeEventPercent.ContainsKey(text)) ? Essentials.medsNodeEventPercent[text] : 100);
					result["medsPriority"] = ((Essentials.medsNodeEventPriority != null && Essentials.medsNodeEventPriority.ContainsKey(text)) ? Essentials.medsNodeEventPriority[text] : 0);
					RegisterEventReplies(val2, result, text);
				}
				else
				{
					EventRequirementData val3 = (EventRequirementData)((data is EventRequirementData) ? data : null);
					if (val3 != null && !result.ContainsKey("RequirementZoneFinishTrack"))
					{
						try
						{
							object value = Traverse.Create((object)val3).Field("requirementZoneFinishTrack").GetValue();
							result["RequirementZoneFinishTrack"] = ConvertValue(value, ctx);
						}
						catch
						{
						}
					}
				}
			}
			if (!isRoot)
			{
				return;
			}
			SubClassData val4 = (SubClassData)((data is SubClassData) ? data : null);
			if (val4 == null)
			{
				return;
			}
			try
			{
				AudioClip hitSound = val4.GetHitSound(0);
				if (!result.ContainsKey("HitSound") || string.IsNullOrEmpty(result["HitSound"] as string))
				{
					result["HitSound"] = GetReferenceId(hitSound);
				}
			}
			catch
			{
			}
		}

		private static void RegisterEventReplies(EventData ev, Dictionary<string, object> result, string eventId)
		{
			if (ev.Replys == null)
			{
				return;
			}
			string text = (result.ContainsKey("Replys") ? "Replys" : (result.ContainsKey("Replies") ? "Replies" : null));
			if (text == null || !(result[text] is List<object> list))
			{
				return;
			}
			for (int i = 0; i < list.Count && i < ev.Replys.Length; i++)
			{
				if (list[i] is Dictionary<string, object> dictionary)
				{
					string text2 = eventId + "_" + i;
					dictionary["medsEvent"] = eventId;
					dictionary["medsTempID"] = text2;
					Essentials.medsEventReplyDataText[text2] = dictionary;
				}
			}
		}

		private static MemberCache GetMembers(Type type)
		{
			lock (MemberCaches)
			{
				if (MemberCaches.TryGetValue(type, out var value))
				{
					return value;
				}
			}
			MemberCache memberCache = new MemberCache();
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			Type type2 = type;
			while (type2 != null && type2 != typeof(object) && type2 != typeof(ValueType) && !(type2 == typeof(Object)) && !(type2 == typeof(ScriptableObject)) && !(type2 == typeof(Component)))
			{
				PropertyInfo[] properties = type2.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
				foreach (PropertyInfo propertyInfo in properties)
				{
					if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0)
					{
						MethodInfo getMethod = propertyInfo.GetGetMethod();
						if (!(getMethod == null) && getMethod.IsPublic && !ShouldSkipMember(propertyInfo.Name, propertyInfo.PropertyType) && hashSet.Add(propertyInfo.Name))
						{
							memberCache.Properties.Add(propertyInfo);
						}
					}
				}
				FieldInfo[] fields = type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (FieldInfo fieldInfo in fields)
				{
					if (!fieldInfo.Name.Contains("k__BackingField") && !fieldInfo.Name.Contains("<") && !ShouldSkipMember(fieldInfo.Name, fieldInfo.FieldType) && (fieldInfo.IsPublic || ((MemberInfo)fieldInfo).GetCustomAttribute<SerializeField>() != null) && !hashSet.Contains(fieldInfo.Name) && !hashSet.Contains(ToPascalCase(fieldInfo.Name)))
					{
						hashSet.Add(fieldInfo.Name);
						memberCache.Fields.Add(fieldInfo);
					}
				}
				type2 = type2.BaseType;
			}
			memberCache.Properties.Sort((PropertyInfo a, PropertyInfo b) => string.CompareOrdinal(a.Name, b.Name));
			memberCache.Fields.Sort((FieldInfo a, FieldInfo b) => string.CompareOrdinal(a.Name, b.Name));
			lock (MemberCaches)
			{
				MemberCaches[type] = memberCache;
			}
			return memberCache;
		}

		private static bool ShouldSkipMember(string name, Type memberType)
		{
			if (string.IsNullOrEmpty(name) || name[0] == '<')
			{
				return true;
			}
			if (ShouldSkipNestedType(memberType))
			{
				return true;
			}
			return false;
		}

		private static bool ShouldSkipNestedType(Type type)
		{
			if (type == null)
			{
				return true;
			}
			if (typeof(Delegate).IsAssignableFrom(type) || typeof(Pointer).IsAssignableFrom(type))
			{
				return true;
			}
			if (type == typeof(IntPtr) || type == typeof(UIntPtr) || type == typeof(Type))
			{
				return true;
			}
			if (typeof(Exception).IsAssignableFrom(type) || typeof(MemberInfo).IsAssignableFrom(type))
			{
				return true;
			}
			string name = type.Name;
			if (name.Contains("<") || name.Contains("Resolver") || name.Contains("Validator"))
			{
				return true;
			}
			if (typeof(UnityEventBase).IsAssignableFrom(type))
			{
				return true;
			}
			if (type.Namespace != null && (type.Namespace.StartsWith("System.Reflection") || type.Namespace.StartsWith("System.Linq.Expressions")))
			{
				return true;
			}
			return false;
		}

		private static bool IsPrimitiveJsonValue(Type type)
		{
			type = Nullable.GetUnderlyingType(type) ?? type;
			return type.IsPrimitive || type == typeof(decimal);
		}

		private static string GetMemberString(object data, string name)
		{
			if (data == null)
			{
				return "";
			}
			PropertyInfo property = data.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
			if (property != null && property.CanRead)
			{
				try
				{
					object value = property.GetValue(data);
					return (value is Enum) ? Enum.GetName(value.GetType(), value) : (value?.ToString() ?? "");
				}
				catch
				{
					return "";
				}
			}
			return "";
		}

		private static string GetReferenceId(object data)
		{
			if (data == null)
			{
				return "";
			}
			Object val = (Object)((data is Object) ? data : null);
			if (val != null && val == (Object)null)
			{
				return "";
			}
			if (data is string result)
			{
				return result;
			}
			if (data is Dictionary<string, object> dictionary)
			{
				string[] idPropertyNames = IdPropertyNames;
				foreach (string key in idPropertyNames)
				{
					if (dictionary.TryGetValue(key, out var value) && value != null)
					{
						return value.ToString();
					}
				}
				return "";
			}
			if (data is Enum)
			{
				return Enum.GetName(data.GetType(), data) ?? data.ToString();
			}
			if (data is EventReplyDataText eventReplyDataText)
			{
				return eventReplyDataText.medsTempID ?? "";
			}
			Type type = data.GetType();
			string[] idPropertyNames2 = IdPropertyNames;
			foreach (string name in idPropertyNames2)
			{
				PropertyInfo property = type.GetProperty(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public);
				if (property == null || !property.CanRead)
				{
					continue;
				}
				try
				{
					object value2 = property.GetValue(data);
					if (value2 != null)
					{
						return value2.ToString();
					}
				}
				catch
				{
				}
			}
			PropertyInfo property2 = type.GetProperty("TierNum", BindingFlags.Instance | BindingFlags.Public);
			if (property2 != null)
			{
				try
				{
					object value3 = property2.GetValue(data);
					if (value3 != null)
					{
						return value3.ToString();
					}
				}
				catch
				{
				}
			}
			Object val2 = (Object)((data is Object) ? data : null);
			if (val2 != null)
			{
				return val2.name ?? "";
			}
			return "";
		}

		private static string ToPascalCase(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return name;
			}
			if (name.StartsWith("_") && name.Length > 1)
			{
				name = name.Substring(1);
			}
			return char.ToUpperInvariant(name[0]) + name.Substring(1);
		}

		private static void MaybeExportSprite(Sprite sprite, ExportContext ctx)
		{
			if (!((Object)(object)sprite == (Object)null) && Essentials.medsExportJSON.Value && Essentials.medsExportSprites.Value)
			{

BepInEx/plugins/UniverseLib.Mono.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using HarmonyLib;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UniverseLib.Config;
using UniverseLib.Input;
using UniverseLib.Runtime;
using UniverseLib.Runtime.Mono;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.ObjectPool;
using UniverseLib.UI.Panels;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UniverseLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sinai")]
[assembly: AssemblyProduct("UniverseLib")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b21dbde3-5d6f-4726-93ab-cc3cc68bae7d")]
[assembly: AssemblyFileVersion("1.5.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.1.0")]
[module: UnverifiableCode]
public static class MonoExtensions
{
	private static PropertyInfo p_childControlHeight = AccessTools.Property(typeof(HorizontalOrVerticalLayoutGroup), "childControlHeight");

	private static PropertyInfo p_childControlWidth = AccessTools.Property(typeof(HorizontalOrVerticalLayoutGroup), "childControlWidth");

	public static void AddListener(this UnityEvent _event, Action listener)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		_event.AddListener(new UnityAction(listener.Invoke));
	}

	public static void AddListener<T>(this UnityEvent<T> _event, Action<T> listener)
	{
		_event.AddListener((UnityAction<T>)listener.Invoke);
	}

	public static void RemoveListener(this UnityEvent _event, Action listener)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		_event.RemoveListener(new UnityAction(listener.Invoke));
	}

	public static void RemoveListener<T>(this UnityEvent<T> _event, Action<T> listener)
	{
		_event.RemoveListener((UnityAction<T>)listener.Invoke);
	}

	public static void Clear(this StringBuilder sb)
	{
		sb.Remove(0, sb.Length);
	}

	public static void SetChildControlHeight(this HorizontalOrVerticalLayoutGroup group, bool value)
	{
		p_childControlHeight?.SetValue(group, value, null);
	}

	public static void SetChildControlWidth(this HorizontalOrVerticalLayoutGroup group, bool value)
	{
		p_childControlWidth?.SetValue(group, value, null);
	}
}
namespace UniverseLib
{
	public static class ReflectionExtensions
	{
		public static Type GetActualType(this object obj)
		{
			return ReflectionUtility.Instance.Internal_GetActualType(obj);
		}

		public static object TryCast(this object obj)
		{
			return ReflectionUtility.Instance.Internal_TryCast(obj, ReflectionUtility.Instance.Internal_GetActualType(obj));
		}

		public static object TryCast(this object obj, Type castTo)
		{
			return ReflectionUtility.Instance.Internal_TryCast(obj, castTo);
		}

		public static T TryCast<T>(this object obj)
		{
			try
			{
				return (T)ReflectionUtility.Instance.Internal_TryCast(obj, typeof(T));
			}
			catch
			{
				return default(T);
			}
		}

		[Obsolete("This method is no longer necessary, just use Assembly.GetTypes().", false)]
		public static IEnumerable<Type> TryGetTypes(this Assembly asm)
		{
			return asm.GetTypes();
		}

		public static bool ReferenceEqual(this object objA, object objB)
		{
			if (objA == objB)
			{
				return true;
			}
			Object val = (Object)((objA is Object) ? objA : null);
			if (val != null)
			{
				Object val2 = (Object)((objB is Object) ? objB : null);
				if (val2 != null && Object.op_Implicit(val) && Object.op_Implicit(val2) && val.m_CachedPtr == val2.m_CachedPtr)
				{
					return true;
				}
			}
			return false;
		}

		public static string ReflectionExToString(this Exception e, bool innerMost = true)
		{
			if (e == null)
			{
				return "The exception was null.";
			}
			if (innerMost)
			{
				e = e.GetInnerMostException();
			}
			return $"{e.GetType()}: {e.Message}";
		}

		public static Exception GetInnerMostException(this Exception e)
		{
			while (e != null && e.InnerException != null)
			{
				e = e.InnerException;
			}
			return e;
		}
	}
	internal static class ReflectionPatches
	{
		internal static void Init()
		{
			Universe.Patch(typeof(Assembly), "GetTypes", (MethodType)0, new Type[0], null, null, AccessTools.Method(typeof(ReflectionPatches), "Finalizer_Assembly_GetTypes", (Type[])null, (Type[])null));
		}

		public static Exception Finalizer_Assembly_GetTypes(Assembly __instance, Exception __exception, ref Type[] __result)
		{
			if (__exception != null)
			{
				if (__exception is ReflectionTypeLoadException e)
				{
					__result = ReflectionUtility.TryExtractTypesFromException(e);
				}
				else
				{
					try
					{
						__result = __instance.GetExportedTypes();
					}
					catch (ReflectionTypeLoadException e2)
					{
						__result = ReflectionUtility.TryExtractTypesFromException(e2);
					}
					catch
					{
						__result = ArgumentUtility.EmptyTypes;
					}
				}
			}
			return null;
		}
	}
	public class ReflectionUtility
	{
		public static bool Initializing;

		public const BindingFlags FLAGS = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		public static readonly SortedDictionary<string, Type> AllTypes = new SortedDictionary<string, Type>(StringComparer.OrdinalIgnoreCase);

		public static readonly List<string> AllNamespaces = new List<string>();

		private static readonly HashSet<string> uniqueNamespaces = new HashSet<string>();

		private static string[] allTypeNamesArray;

		private static readonly Dictionary<string, Type> shorthandToType = new Dictionary<string, Type>
		{
			{
				"object",
				typeof(object)
			},
			{
				"string",
				typeof(string)
			},
			{
				"bool",
				typeof(bool)
			},
			{
				"byte",
				typeof(byte)
			},
			{
				"sbyte",
				typeof(sbyte)
			},
			{
				"char",
				typeof(char)
			},
			{
				"decimal",
				typeof(decimal)
			},
			{
				"double",
				typeof(double)
			},
			{
				"float",
				typeof(float)
			},
			{
				"int",
				typeof(int)
			},
			{
				"uint",
				typeof(uint)
			},
			{
				"long",
				typeof(long)
			},
			{
				"ulong",
				typeof(ulong)
			},
			{
				"short",
				typeof(short)
			},
			{
				"ushort",
				typeof(ushort)
			},
			{
				"void",
				typeof(void)
			}
		};

		internal static readonly Dictionary<string, Type[]> baseTypes = new Dictionary<string, Type[]>();

		internal static ReflectionUtility Instance { get; private set; }

		public static event Action<Type> OnTypeLoaded;

		internal static void Init()
		{
			ReflectionPatches.Init();
			Instance = new ReflectionUtility();
			Instance.Initialize();
		}

		protected virtual void Initialize()
		{
			SetupTypeCache();
			Initializing = false;
		}

		public static string[] GetTypeNameArray()
		{
			if (allTypeNamesArray == null || allTypeNamesArray.Length != AllTypes.Count)
			{
				allTypeNamesArray = new string[AllTypes.Count];
				int num = 0;
				foreach (string key in AllTypes.Keys)
				{
					allTypeNamesArray[num] = key;
					num++;
				}
			}
			return allTypeNamesArray;
		}

		private static void SetupTypeCache()
		{
			if (Universe.Context == RuntimeContext.Mono)
			{
				ForceLoadManagedAssemblies();
			}
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly asm in assemblies)
			{
				CacheTypes(asm);
			}
			AppDomain.CurrentDomain.AssemblyLoad += AssemblyLoaded;
		}

		private static void AssemblyLoaded(object sender, AssemblyLoadEventArgs args)
		{
			if ((object)args.LoadedAssembly != null && !(args.LoadedAssembly.GetName().Name == "completions"))
			{
				CacheTypes(args.LoadedAssembly);
			}
		}

		private static void ForceLoadManagedAssemblies()
		{
			string path = Path.Combine(Application.dataPath, "Managed");
			if (!Directory.Exists(path))
			{
				return;
			}
			string[] files = Directory.GetFiles(path, "*.dll");
			foreach (string path2 in files)
			{
				try
				{
					Assembly assembly = Assembly.LoadFile(path2);
					assembly.GetTypes();
				}
				catch
				{
				}
			}
		}

		internal static void CacheTypes(Assembly asm)
		{
			Type[] types = asm.GetTypes();
			foreach (Type type in types)
			{
				if (!string.IsNullOrEmpty(type.Namespace) && !uniqueNamespaces.Contains(type.Namespace))
				{
					uniqueNamespaces.Add(type.Namespace);
					int j;
					for (j = 0; j < AllNamespaces.Count && type.Namespace.CompareTo(AllNamespaces[j]) >= 0; j++)
					{
					}
					AllNamespaces.Insert(j, type.Namespace);
				}
				AllTypes[type.FullName] = type;
				ReflectionUtility.OnTypeLoaded?.Invoke(type);
			}
		}

		public static Type GetTypeByName(string fullName)
		{
			return Instance.Internal_GetTypeByName(fullName);
		}

		internal virtual Type Internal_GetTypeByName(string fullName)
		{
			if (shorthandToType.TryGetValue(fullName, out var value))
			{
				return value;
			}
			AllTypes.TryGetValue(fullName, out var value2);
			if ((object)value2 == null)
			{
				value2 = Type.GetType(fullName);
			}
			return value2;
		}

		internal virtual Type Internal_GetActualType(object obj)
		{
			return obj?.GetType();
		}

		internal virtual object Internal_TryCast(object obj, Type castTo)
		{
			return obj;
		}

		public static string ProcessTypeInString(Type type, string theString)
		{
			return Instance.Internal_ProcessTypeInString(theString, type);
		}

		internal virtual string Internal_ProcessTypeInString(string theString, Type type)
		{
			return theString;
		}

		public static void FindSingleton(string[] possibleNames, Type type, BindingFlags flags, List<object> instances)
		{
			Instance.Internal_FindSingleton(possibleNames, type, flags, instances);
		}

		internal virtual void Internal_FindSingleton(string[] possibleNames, Type type, BindingFlags flags, List<object> instances)
		{
			foreach (string name in possibleNames)
			{
				FieldInfo field = type.GetField(name, flags);
				if ((object)field != null)
				{
					object value = field.GetValue(null);
					if (value != null)
					{
						instances.Add(value);
						break;
					}
				}
			}
		}

		public static Type[] TryExtractTypesFromException(ReflectionTypeLoadException e)
		{
			try
			{
				return e.Types.Where((Type it) => (object)it != null).ToArray();
			}
			catch
			{
				return ArgumentUtility.EmptyTypes;
			}
		}

		public static Type[] GetAllBaseTypes(object obj)
		{
			return GetAllBaseTypes(obj?.GetActualType());
		}

		public static Type[] GetAllBaseTypes(Type type)
		{
			if ((object)type == null)
			{
				throw new ArgumentNullException("type");
			}
			string assemblyQualifiedName = type.AssemblyQualifiedName;
			if (baseTypes.TryGetValue(assemblyQualifiedName, out var value))
			{
				return value;
			}
			List<Type> list = new List<Type>();
			while ((object)type != null)
			{
				list.Add(type);
				type = type.BaseType;
			}
			value = list.ToArray();
			baseTypes.Add(assemblyQualifiedName, value);
			return value;
		}

		public static void GetImplementationsOf(Type baseType, Action<HashSet<Type>> onResultsFetched, bool allowAbstract, bool allowGeneric, bool allowEnum)
		{
			RuntimeHelper.StartCoroutine(DoGetImplementations(onResultsFetched, baseType, allowAbstract, allowGeneric, allowEnum));
		}

		private static IEnumerator DoGetImplementations(Action<HashSet<Type>> onResultsFetched, Type baseType, bool allowAbstract, bool allowGeneric, bool allowEnum)
		{
			List<Type> resolvedTypes = new List<Type>();
			OnTypeLoaded += ourListener;
			HashSet<Type> set = new HashSet<Type>();
			IEnumerator coro2 = GetImplementationsAsync(baseType, set, allowAbstract, allowGeneric, allowEnum, DefaultTypesEnumerator());
			while (coro2.MoveNext())
			{
				yield return null;
			}
			OnTypeLoaded -= ourListener;
			if (resolvedTypes.Count > 0)
			{
				coro2 = GetImplementationsAsync(baseType, set, allowAbstract, allowGeneric, allowEnum, resolvedTypes.GetEnumerator());
				while (coro2.MoveNext())
				{
					yield return null;
				}
			}
			onResultsFetched(set);
			void ourListener(Type t)
			{
				resolvedTypes.Add(t);
			}
		}

		private static IEnumerator<Type> DefaultTypesEnumerator()
		{
			string[] names = GetTypeNameArray();
			foreach (string name in names)
			{
				yield return AllTypes[name];
			}
		}

		private static IEnumerator GetImplementationsAsync(Type baseType, HashSet<Type> set, bool allowAbstract, bool allowGeneric, bool allowEnum, IEnumerator<Type> enumerator)
		{
			Stopwatch sw = new Stopwatch();
			sw.Start();
			bool isGenericParam = baseType?.IsGenericParameter ?? false;
			while (enumerator.MoveNext())
			{
				if (sw.ElapsedMilliseconds > 10)
				{
					yield return null;
					sw.Reset();
					sw.Start();
				}
				try
				{
					Type type = enumerator.Current;
					if (set.Contains(type) || (!allowAbstract && type.IsAbstract) || (!allowGeneric && type.IsGenericType) || (!allowEnum && type.IsEnum) || type.FullName.Contains("PrivateImplementationDetails") || type.FullName.Contains("DisplayClass") || Enumerable.Contains(type.FullName, '<'))
					{
						continue;
					}
					if (!isGenericParam)
					{
						if ((object)baseType == null || baseType.IsAssignableFrom(type))
						{
							goto IL_0269;
						}
					}
					else if ((!type.IsClass || !MiscUtility.HasFlag(baseType.GenericParameterAttributes, GenericParameterAttributes.NotNullableValueTypeConstraint)) && (!type.IsValueType || !MiscUtility.HasFlag(baseType.GenericParameterAttributes, GenericParameterAttributes.ReferenceTypeConstraint)) && !baseType.GetGenericParameterConstraints().Any((Type it) => !it.IsAssignableFrom(type)))
					{
						goto IL_0269;
					}
					goto end_IL_009f;
					IL_0269:
					set.Add(type);
					end_IL_009f:;
				}
				catch
				{
				}
			}
		}

		public static bool IsEnumerable(Type type)
		{
			return Instance.Internal_IsEnumerable(type);
		}

		protected virtual bool Internal_IsEnumerable(Type type)
		{
			return typeof(IEnumerable).IsAssignableFrom(type);
		}

		public static bool TryGetEnumerator(object ienumerable, out IEnumerator enumerator)
		{
			return Instance.Internal_TryGetEnumerator(ienumerable, out enumerator);
		}

		protected virtual bool Internal_TryGetEnumerator(object list, out IEnumerator enumerator)
		{
			enumerator = (list as IEnumerable).GetEnumerator();
			return true;
		}

		public static bool TryGetEntryType(Type enumerableType, out Type type)
		{
			return Instance.Internal_TryGetEntryType(enumerableType, out type);
		}

		protected virtual bool Internal_TryGetEntryType(Type enumerableType, out Type type)
		{
			if (enumerableType.IsArray)
			{
				type = enumerableType.GetElementType();
				return true;
			}
			Type[] interfaces = enumerableType.GetInterfaces();
			foreach (Type type2 in interfaces)
			{
				if (type2.IsGenericType)
				{
					Type genericTypeDefinition = type2.GetGenericTypeDefinition();
					if ((object)genericTypeDefinition == typeof(IEnumerable<>) || (object)genericTypeDefinition == typeof(IList<>) || (object)genericTypeDefinition == typeof(ICollection<>))
					{
						type = type2.GetGenericArguments()[0];
						return true;
					}
				}
			}
			type = typeof(object);
			return false;
		}

		public static bool IsDictionary(Type type)
		{
			return Instance.Internal_IsDictionary(type);
		}

		protected virtual bool Internal_IsDictionary(Type type)
		{
			return typeof(IDictionary).IsAssignableFrom(type);
		}

		public static bool TryGetDictEnumerator(object dictionary, out IEnumerator<DictionaryEntry> dictEnumerator)
		{
			return Instance.Internal_TryGetDictEnumerator(dictionary, out dictEnumerator);
		}

		protected virtual bool Internal_TryGetDictEnumerator(object dictionary, out IEnumerator<DictionaryEntry> dictEnumerator)
		{
			dictEnumerator = EnumerateDictionary((IDictionary)dictionary);
			return true;
		}

		private IEnumerator<DictionaryEntry> EnumerateDictionary(IDictionary dict)
		{
			IDictionaryEnumerator enumerator = dict.GetEnumerator();
			while (enumerator.MoveNext())
			{
				yield return new DictionaryEntry(enumerator.Key, enumerator.Value);
			}
		}

		public static bool TryGetEntryTypes(Type dictionaryType, out Type keys, out Type values)
		{
			return Instance.Internal_TryGetEntryTypes(dictionaryType, out keys, out values);
		}

		protected virtual bool Internal_TryGetEntryTypes(Type dictionaryType, out Type keys, out Type values)
		{
			Type[] interfaces = dictionaryType.GetInterfaces();
			foreach (Type type in interfaces)
			{
				if (type.IsGenericType && (object)type.GetGenericTypeDefinition() == typeof(IDictionary<, >))
				{
					Type[] genericArguments = type.GetGenericArguments();
					keys = genericArguments[0];
					values = genericArguments[1];
					return true;
				}
			}
			keys = typeof(object);
			values = typeof(object);
			return false;
		}
	}
	public abstract class RuntimeHelper
	{
		internal static RuntimeHelper Instance { get; private set; }

		internal static void Init()
		{
			Instance = new MonoProvider();
			Instance.OnInitialize();
		}

		protected internal abstract void OnInitialize();

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			return Instance.Internal_StartCoroutine(routine);
		}

		protected internal abstract Coroutine Internal_StartCoroutine(IEnumerator routine);

		public static void StopCoroutine(Coroutine coroutine)
		{
			Instance.Internal_StopCoroutine(coroutine);
		}

		protected internal abstract void Internal_StopCoroutine(Coroutine coroutine);

		public static T AddComponent<T>(GameObject obj, Type type) where T : Component
		{
			return Instance.Internal_AddComponent<T>(obj, type);
		}

		protected internal abstract T Internal_AddComponent<T>(GameObject obj, Type type) where T : Component;

		public static ScriptableObject CreateScriptable(Type type)
		{
			return Instance.Internal_CreateScriptable(type);
		}

		protected internal abstract ScriptableObject Internal_CreateScriptable(Type type);

		public static string LayerToName(int layer)
		{
			return Instance.Internal_LayerToName(layer);
		}

		protected internal abstract string Internal_LayerToName(int layer);

		public static T[] FindObjectsOfTypeAll<T>() where T : Object
		{
			return Instance.Internal_FindObjectsOfTypeAll<T>();
		}

		public static Object[] FindObjectsOfTypeAll(Type type)
		{
			return Instance.Internal_FindObjectsOfTypeAll(type);
		}

		protected internal abstract T[] Internal_FindObjectsOfTypeAll<T>() where T : Object;

		protected internal abstract Object[] Internal_FindObjectsOfTypeAll(Type type);

		public static void GraphicRaycast(GraphicRaycaster raycaster, PointerEventData data, List<RaycastResult> list)
		{
			Instance.Internal_GraphicRaycast(raycaster, data, list);
		}

		protected internal abstract void Internal_GraphicRaycast(GraphicRaycaster raycaster, PointerEventData data, List<RaycastResult> list);

		public static GameObject[] GetRootGameObjects(Scene scene)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Instance.Internal_GetRootGameObjects(scene);
		}

		protected internal abstract GameObject[] Internal_GetRootGameObjects(Scene scene);

		public static int GetRootCount(Scene scene)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Instance.Internal_GetRootCount(scene);
		}

		protected internal abstract int Internal_GetRootCount(Scene scene);

		public static void SetColorBlockAuto(Selectable selectable, Color baseColor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			Instance.Internal_SetColorBlock(selectable, baseColor, baseColor * 1.2f, baseColor * 0.8f);
		}

		public static void SetColorBlock(Selectable selectable, ColorBlock colors)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Instance.Internal_SetColorBlock(selectable, colors);
		}

		protected internal abstract void Internal_SetColorBlock(Selectable selectable, ColorBlock colors);

		public static void SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null, Color? disabled = null)
		{
			Instance.Internal_SetColorBlock(selectable, normal, highlighted, pressed, disabled);
		}

		protected internal abstract void Internal_SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null, Color? disabled = null);
	}
	internal class UniversalBehaviour : MonoBehaviour
	{
		internal static UniversalBehaviour Instance { get; private set; }

		internal static void Setup()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("UniverseLibBehaviour");
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
			Instance = val.AddComponent<UniversalBehaviour>();
		}

		internal void Update()
		{
			Universe.Update();
		}
	}
	public class Universe
	{
		public enum GlobalState
		{
			WaitingToSetup,
			SettingUp,
			SetupCompleted
		}

		public const string NAME = "UniverseLib";

		public const string VERSION = "1.5.1";

		public const string AUTHOR = "Sinai";

		public const string GUID = "com.sinai.universelib";

		private static float startupDelay;

		private static Action<string, LogType> logHandler;

		public static RuntimeContext Context { get; } = RuntimeContext.Mono;


		public static GlobalState CurrentGlobalState { get; private set; }

		internal static Harmony Harmony { get; } = new Harmony("com.sinai.universelib");


		private static event Action OnInitialized;

		public static void Init(Action onInitialized = null, Action<string, LogType> logHandler = null)
		{
			Init(1f, onInitialized, logHandler, default(UniverseLibConfig));
		}

		public static void Init(float startupDelay, Action onInitialized, Action<string, LogType> logHandler, UniverseLibConfig config)
		{
			if (CurrentGlobalState == GlobalState.SetupCompleted)
			{
				InvokeOnInitialized(onInitialized);
				return;
			}
			if (startupDelay > Universe.startupDelay)
			{
				Universe.startupDelay = startupDelay;
			}
			ConfigManager.LoadConfig(config);
			OnInitialized += onInitialized;
			if (logHandler != null && Universe.logHandler == null)
			{
				Universe.logHandler = logHandler;
			}
			if (CurrentGlobalState == GlobalState.WaitingToSetup)
			{
				CurrentGlobalState = GlobalState.SettingUp;
				Log("UniverseLib 1.5.1 initializing...");
				UniversalBehaviour.Setup();
				ReflectionUtility.Init();
				RuntimeHelper.Init();
				RuntimeHelper.Instance.Internal_StartCoroutine(SetupCoroutine());
				Log("Finished UniverseLib initial setup.");
			}
		}

		internal static void Update()
		{
			UniversalUI.Update();
		}

		private static IEnumerator SetupCoroutine()
		{
			yield return null;
			Stopwatch sw = new Stopwatch();
			sw.Start();
			while (ReflectionUtility.Initializing || (float)sw.ElapsedMilliseconds * 0.001f < startupDelay)
			{
				yield return null;
			}
			InputManager.Init();
			UniversalUI.Init();
			Log("UniverseLib 1.5.1 initialized.");
			CurrentGlobalState = GlobalState.SetupCompleted;
			InvokeOnInitialized(Universe.OnInitialized);
		}

		private static void InvokeOnInitialized(Action onInitialized)
		{
			if (onInitialized == null)
			{
				return;
			}
			Delegate[] invocationList = onInitialized.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				try
				{
					@delegate.DynamicInvoke();
				}
				catch (Exception arg)
				{
					LogWarning($"Exception invoking onInitialized callback! {arg}");
				}
			}
		}

		internal static void Log(object message)
		{
			Log(message, (LogType)3);
		}

		internal static void LogWarning(object message)
		{
			Log(message, (LogType)2);
		}

		internal static void LogError(object message)
		{
			Log(message, (LogType)0);
		}

		private static void Log(object message, LogType logType)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			logHandler("[UniverseLib] " + (message?.ToString() ?? string.Empty), logType);
		}

		internal static bool Patch(Type type, string methodName, MethodType methodType, Type[] arguments = null, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			try
			{
				string text = (((int)methodType == 1) ? "get_" : (((int)methodType != 2) ? string.Empty : "set_"));
				string text2 = text;
				MethodInfo methodInfo = ((arguments == null) ? type.GetMethod(text2 + methodName, AccessTools.all) : type.GetMethod(text2 + methodName, AccessTools.all, null, arguments, null));
				if ((object)methodInfo == null)
				{
					return false;
				}
				PatchProcessor val = Harmony.CreateProcessor((MethodBase)methodInfo);
				if ((object)prefix != null)
				{
					val.AddPrefix(new HarmonyMethod(prefix));
				}
				if ((object)postfix != null)
				{
					val.AddPostfix(new HarmonyMethod(postfix));
				}
				if ((object)finalizer != null)
				{
					val.AddFinalizer(new HarmonyMethod(finalizer));
				}
				val.Patch();
				return true;
			}
			catch (Exception arg)
			{
				LogWarning($"\t Exception patching {type.FullName}.{methodName}: {arg}");
				return false;
			}
		}

		internal static bool Patch(Type type, string[] possibleNames, MethodType methodType, Type[] arguments = null, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			foreach (string methodName in possibleNames)
			{
				if (Patch(type, methodName, methodType, arguments, prefix, postfix, finalizer))
				{
					return true;
				}
			}
			return false;
		}

		internal static bool Patch(Type type, string[] possibleNames, MethodType methodType, Type[][] possibleArguments, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			foreach (string methodName in possibleNames)
			{
				foreach (Type[] arguments in possibleArguments)
				{
					if (Patch(type, methodName, methodType, arguments, prefix, postfix, finalizer))
					{
						return true;
					}
				}
			}
			return false;
		}

		internal static bool Patch(Type type, string methodName, MethodType methodType, Type[][] possibleArguments, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			foreach (Type[] arguments in possibleArguments)
			{
				if (Patch(type, methodName, methodType, arguments, prefix, postfix, finalizer))
				{
					return true;
				}
			}
			return false;
		}
	}
}
namespace UniverseLib.Utility
{
	public static class ArgumentUtility
	{
		public static readonly Type[] EmptyTypes = new Type[0];

		public static readonly object[] EmptyArgs = new object[0];

		public static readonly Type[] ParseArgs = new Type[1] { typeof(string) };
	}
	public static class IOUtility
	{
		private static readonly char[] invalidDirectoryCharacters = Path.GetInvalidPathChars();

		private static readonly char[] invalidFilenameCharacters = Path.GetInvalidFileNameChars();

		public static string EnsureValidFilePath(string fullPathWithFile)
		{
			fullPathWithFile = string.Concat(fullPathWithFile.Split(invalidDirectoryCharacters));
			Directory.CreateDirectory(Path.GetDirectoryName(fullPathWithFile));
			return fullPathWithFile;
		}

		public static string EnsureValidFilename(string filename)
		{
			return string.Concat(filename.Split(invalidFilenameCharacters));
		}
	}
	public static class MiscUtility
	{
		public static bool ContainsIgnoreCase(this string _this, string s)
		{
			return CultureInfo.CurrentCulture.CompareInfo.IndexOf(_this, s, CompareOptions.IgnoreCase) >= 0;
		}

		public static bool HasFlag(this Enum flags, Enum value)
		{
			try
			{
				ulong num = Convert.ToUInt64(value);
				return (Convert.ToUInt64(flags) & num) == num;
			}
			catch
			{
				long num2 = Convert.ToInt64(value);
				return (Convert.ToInt64(flags) & num2) == num2;
			}
		}

		public static bool EndsWith(this StringBuilder sb, string _string)
		{
			int length = _string.Length;
			if (sb.Length < length)
			{
				return false;
			}
			int num = 0;
			int num2 = sb.Length - length;
			while (num2 < sb.Length)
			{
				if (sb[num2] != _string[num])
				{
					return false;
				}
				num2++;
				num++;
			}
			return true;
		}
	}
	public static class ParseUtility
	{
		internal delegate object ParseMethod(string input);

		internal delegate string ToStringMethod(object obj);

		public static readonly string NumberFormatString = "0.####";

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

		private static readonly HashSet<Type> nonPrimitiveTypes = new HashSet<Type>
		{
			typeof(string),
			typeof(decimal),
			typeof(DateTime)
		};

		private static readonly HashSet<Type> formattedTypes = new HashSet<Type>
		{
			typeof(float),
			typeof(double),
			typeof(decimal)
		};

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

		private static readonly Dictionary<string, ParseMethod> customTypes = new Dictionary<string, ParseMethod>
		{
			{
				typeof(Vector2).FullName,
				TryParseVector2
			},
			{
				typeof(Vector3).FullName,
				TryParseVector3
			},
			{
				typeof(Vector4).FullName,
				TryParseVector4
			},
			{
				typeof(Quaternion).FullName,
				TryParseQuaternion
			},
			{
				typeof(Rect).FullName,
				TryParseRect
			},
			{
				typeof(Color).FullName,
				TryParseColor
			},
			{
				typeof(Color32).FullName,
				TryParseColor32
			},
			{
				typeof(LayerMask).FullName,
				TryParseLayerMask
			}
		};

		private static readonly Dictionary<string, ToStringMethod> customTypesToString = new Dictionary<string, ToStringMethod>
		{
			{
				typeof(Vector2).FullName,
				Vector2ToString
			},
			{
				typeof(Vector3).FullName,
				Vector3ToString
			},
			{
				typeof(Vector4).FullName,
				Vector4ToString
			},
			{
				typeof(Quaternion).FullName,
				QuaternionToString
			},
			{
				typeof(Rect).FullName,
				RectToString
			},
			{
				typeof(Color).FullName,
				ColorToString
			},
			{
				typeof(Color32).FullName,
				Color32ToString
			},
			{
				typeof(LayerMask).FullName,
				LayerMaskToString
			}
		};

		public static string FormatDecimalSequence(params object[] numbers)
		{
			if (numbers.Length == 0)
			{
				return null;
			}
			return string.Format(CultureInfo.CurrentCulture, GetSequenceFormatString(numbers.Length), numbers);
		}

		internal static string GetSequenceFormatString(int count)
		{
			if (count <= 0)
			{
				return null;
			}
			if (numSequenceStrings.ContainsKey(count))
			{
				return numSequenceStrings[count];
			}
			string[] array = new string[count];
			for (int i = 0; i < count; i++)
			{
				array[i] = $"{{{i}:{NumberFormatString}}}";
			}
			string text = string.Join(" ", array);
			numSequenceStrings.Add(count, text);
			return text;
		}

		public static bool CanParse(Type type)
		{
			return !string.IsNullOrEmpty(type?.FullName) && (type.IsPrimitive || type.IsEnum || nonPrimitiveTypes.Contains(type) || customTypes.ContainsKey(type.FullName));
		}

		public static bool CanParse<T>()
		{
			return CanParse(typeof(T));
		}

		public static bool TryParse<T>(string input, out T obj, out Exception parseException)
		{
			object obj2;
			bool result = TryParse(input, typeof(T), out obj2, out parseException);
			if (obj2 != null)
			{
				obj = (T)obj2;
			}
			else
			{
				obj = default(T);
			}
			return result;
		}

		public static bool TryParse(string input, Type type, out object obj, out Exception parseException)
		{
			obj = null;
			parseException = null;
			if ((object)type == null)
			{
				return false;
			}
			if ((object)type == typeof(string))
			{
				obj = input;
				return true;
			}
			if (type.IsEnum)
			{
				try
				{
					obj = Enum.Parse(type, input);
					return true;
				}
				catch (Exception e)
				{
					parseException = e.GetInnerMostException();
					return false;
				}
			}
			try
			{
				if (customTypes.ContainsKey(type.FullName))
				{
					obj = customTypes[type.FullName](input);
				}
				else
				{
					obj = AccessTools.Method(type, "Parse", ArgumentUtility.ParseArgs, (Type[])null).Invoke(null, new object[1] { input });
				}
				return true;
			}
			catch (Exception e2)
			{
				Exception innerMostException = e2.GetInnerMostException();
				parseException = innerMostException;
			}
			return false;
		}

		public static string ToStringForInput<T>(object obj)
		{
			return ToStringForInput(obj, typeof(T));
		}

		public static string ToStringForInput(object obj, Type type)
		{
			if ((object)type == null || obj == null)
			{
				return null;
			}
			if ((object)type == typeof(string))
			{
				return obj as string;
			}
			if (type.IsEnum)
			{
				return Enum.IsDefined(type, obj) ? Enum.GetName(type, obj) : obj.ToString();
			}
			try
			{
				if (customTypes.ContainsKey(type.FullName))
				{
					return customTypesToString[type.FullName](obj);
				}
				if (formattedTypes.Contains(type))
				{
					return AccessTools.Method(type, "ToString", new Type[2]
					{
						typeof(string),
						typeof(IFormatProvider)
					}, (Type[])null).Invoke(obj, new object[2]
					{
						NumberFormatString,
						CultureInfo.CurrentCulture
					}) as string;
				}
				return obj.ToString();
			}
			catch (Exception arg)
			{
				Universe.LogWarning($"Exception formatting object for input: {arg}");
				return null;
			}
		}

		public static string GetExampleInput<T>()
		{
			return GetExampleInput(typeof(T));
		}

		public static string GetExampleInput(Type type)
		{
			if (!typeInputExamples.ContainsKey(type.AssemblyQualifiedName))
			{
				try
				{
					if (type.IsEnum)
					{
						typeInputExamples.Add(type.AssemblyQualifiedName, Enum.GetNames(type).First());
					}
					else
					{
						object obj = Activator.CreateInstance(type);
						typeInputExamples.Add(type.AssemblyQualifiedName, ToStringForInput(obj, type));
					}
				}
				catch (Exception message)
				{
					Universe.LogWarning("Exception generating default instance for example input for '" + type.FullName + "'");
					Universe.Log(message);
					return "";
				}
			}
			return typeInputExamples[type.AssemblyQualifiedName];
		}

		internal static object TryParseVector2(string input)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			string[] array = input.Split(new char[1] { ' ' });
			val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			return val;
		}

		internal static string Vector2ToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Vector2 val) || 1 == 0)
			{
				return null;
			}
			return FormatDecimalSequence(val.x, val.y);
		}

		internal static object TryParseVector3(string input)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			string[] array = input.Split(new char[1] { ' ' });
			val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			val.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
			return val;
		}

		internal static string Vector3ToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Vector3 val) || 1 == 0)
			{
				return null;
			}
			return FormatDecimalSequence(val.x, val.y, val.z);
		}

		internal static object TryParseVector4(string input)
		{
			//IL_0003: 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)
			Vector4 val = default(Vector4);
			string[] array = input.Split(new char[1] { ' ' });
			val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			val.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
			val.w = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture);
			return val;
		}

		internal static string Vector4ToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Vector4 val) || 1 == 0)
			{
				return null;
			}
			return FormatDecimalSequence(val.x, val.y, val.z, val.w);
		}

		internal static object TryParseQuaternion(string input)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			string[] array = input.Split(new char[1] { ' ' });
			if (array.Length == 4)
			{
				Quaternion val2 = default(Quaternion);
				val2.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
				val2.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
				val2.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
				val2.w = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture);
				return val2;
			}
			val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			val.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
			return Quaternion.Euler(val);
		}

		internal static string QuaternionToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Quaternion val) || 1 == 0)
			{
				return null;
			}
			Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles;
			return FormatDecimalSequence(eulerAngles.x, eulerAngles.y, eulerAngles.z);
		}

		internal static object TryParseRect(string input)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			string[] array = input.Split(new char[1] { ' ' });
			((Rect)(ref val)).x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			((Rect)(ref val)).y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			((Rect)(ref val)).width = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
			((Rect)(ref val)).height = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture);
			return val;
		}

		internal static string RectToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Rect val) || 1 == 0)
			{
				return null;
			}
			return FormatDecimalSequence(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height);
		}

		internal static object TryParseColor(string input)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			string[] array = input.Split(new char[1] { ' ' });
			val.r = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			val.g = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			val.b = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
			if (array.Length > 3)
			{
				val.a = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture);
			}
			else
			{
				val.a = 1f;
			}
			return val;
		}

		internal static string ColorToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Color val) || 1 == 0)
			{
				return null;
			}
			return FormatDecimalSequence(val.r, val.g, val.b, val.a);
		}

		internal static object TryParseColor32(string input)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Color32 val = default(Color32);
			string[] array = input.Split(new char[1] { ' ' });
			val.r = byte.Parse(array[0].Trim(), CultureInfo.CurrentCulture);
			val.g = byte.Parse(array[1].Trim(), CultureInfo.CurrentCulture);
			val.b = byte.Parse(array[2].Trim(), CultureInfo.CurrentCulture);
			if (array.Length > 3)
			{
				val.a = byte.Parse(array[3].Trim(), CultureInfo.CurrentCulture);
			}
			else
			{
				val.a = byte.MaxValue;
			}
			return val;
		}

		internal static string Color32ToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is Color32 val) || 1 == 0)
			{
				return null;
			}
			return $"{val.r} {val.g} {val.b} {val.a}";
		}

		internal static object TryParseLayerMask(string input)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return LayerMask.op_Implicit(int.Parse(input));
		}

		internal static string LayerMaskToString(object obj)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (!(obj is LayerMask val) || 1 == 0)
			{
				return null;
			}
			return ((LayerMask)(ref val)).value.ToString();
		}
	}
	public static class SignatureHighlighter
	{
		public const string NAMESPACE = "#a8a8a8";

		public const string CONST = "#92c470";

		public const string CLASS_STATIC = "#3a8d71";

		public const string CLASS_INSTANCE = "#2df7b2";

		public const string STRUCT = "#0fba3a";

		public const string INTERFACE = "#9b9b82";

		public const string FIELD_STATIC = "#8d8dc6";

		public const string FIELD_INSTANCE = "#c266ff";

		public const string METHOD_STATIC = "#b55b02";

		public const string METHOD_INSTANCE = "#ff8000";

		public const string PROP_STATIC = "#588075";

		public const string PROP_INSTANCE = "#55a38e";

		public const string LOCAL_ARG = "#a6e9e9";

		public const string OPEN_COLOR = "<color=";

		public const string CLOSE_COLOR = "</color>";

		public const string OPEN_ITALIC = "<i>";

		public const string CLOSE_ITALIC = "</i>";

		public static readonly Regex ArrayTokenRegex = new Regex("\\[,*?\\]");

		private static readonly Regex colorTagRegex = new Regex("<color=#?[\\d|\\w]*>");

		public static readonly Color StringOrange = new Color(0.83f, 0.61f, 0.52f);

		public static readonly Color EnumGreen = new Color(0.57f, 0.76f, 0.43f);

		public static readonly Color KeywordBlue = new Color(0.3f, 0.61f, 0.83f);

		public static readonly string keywordBlueHex = KeywordBlue.ToHex();

		public static readonly Color NumberGreen = new Color(0.71f, 0.8f, 0.65f);

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

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

		private static readonly Dictionary<Type, string> builtInTypesToShorthand = new Dictionary<Type, string>
		{
			{
				typeof(object),
				"object"
			},
			{
				typeof(string),
				"string"
			},
			{
				typeof(bool),
				"bool"
			},
			{
				typeof(byte),
				"byte"
			},
			{
				typeof(sbyte),
				"sbyte"
			},
			{
				typeof(char),
				"char"
			},
			{
				typeof(decimal),
				"decimal"
			},
			{
				typeof(double),
				"double"
			},
			{
				typeof(float),
				"float"
			},
			{
				typeof(int),
				"int"
			},
			{
				typeof(uint),
				"uint"
			},
			{
				typeof(long),
				"long"
			},
			{
				typeof(ulong),
				"ulong"
			},
			{
				typeof(short),
				"short"
			},
			{
				typeof(ushort),
				"ushort"
			},
			{
				typeof(void),
				"void"
			}
		};

		public static string Parse(Type type, bool includeNamespace, MemberInfo memberInfo = null)
		{
			if ((object)type == null)
			{
				throw new ArgumentNullException("type");
			}
			if (memberInfo is MethodInfo method)
			{
				return ParseMethod(method);
			}
			if (memberInfo is ConstructorInfo ctor)
			{
				return ParseConstructor(ctor);
			}
			StringBuilder stringBuilder = new StringBuilder();
			if (type.IsByRef)
			{
				AppendOpenColor(stringBuilder, "#" + keywordBlueHex).Append("ref ").Append("</color>");
			}
			Type type2 = type;
			while (type2.HasElementType)
			{
				type2 = type2.GetElementType();
			}
			includeNamespace &= !builtInTypesToShorthand.ContainsKey(type2);
			if (!type.IsGenericParameter && (!type.HasElementType || !type.GetElementType().IsGenericParameter) && includeNamespace && TryGetNamespace(type, out var ns))
			{
				AppendOpenColor(stringBuilder, "#a8a8a8").Append(ns).Append("</color>").Append('.');
			}
			stringBuilder.Append(ProcessType(type));
			if ((object)memberInfo != null)
			{
				stringBuilder.Append('.');
				int index = stringBuilder.Length - 1;
				AppendOpenColor(stringBuilder, GetMemberInfoColor(memberInfo, out var isStatic)).Append(memberInfo.Name).Append("</color>");
				if (isStatic)
				{
					stringBuilder.Insert(index, "<i>");
					stringBuilder.Append("</i>");
				}
			}
			return stringBuilder.ToString();
		}

		private static string ProcessType(Type type)
		{
			string key = type.ToString();
			if (typeToRichType.ContainsKey(key))
			{
				return typeToRichType[key];
			}
			StringBuilder stringBuilder = new StringBuilder();
			if (!type.IsGenericParameter)
			{
				int length = stringBuilder.Length;
				Type declaringType = type.DeclaringType;
				while ((object)declaringType != null)
				{
					stringBuilder.Insert(length, HighlightType(declaringType) + ".");
					declaringType = declaringType.DeclaringType;
				}
				stringBuilder.Append(HighlightType(type));
				if (type.IsGenericType)
				{
					ProcessGenericArguments(type, stringBuilder);
				}
			}
			else
			{
				stringBuilder.Append("<color=").Append("#92c470").Append('>')
					.Append(type.Name)
					.Append("</color>");
			}
			string text = stringBuilder.ToString();
			typeToRichType.Add(key, text);
			return text;
		}

		internal static string GetClassColor(Type type)
		{
			if (type.IsAbstract && type.IsSealed)
			{
				return "#3a8d71";
			}
			if (type.IsEnum || type.IsGenericParameter)
			{
				return "#92c470";
			}
			if (type.IsValueType)
			{
				return "#0fba3a";
			}
			if (type.IsInterface)
			{
				return "#9b9b82";
			}
			return "#2df7b2";
		}

		private static bool TryGetNamespace(Type type, out string ns)
		{
			return !string.IsNullOrEmpty(ns = type.Namespace?.Trim());
		}

		private static StringBuilder AppendOpenColor(StringBuilder sb, string color)
		{
			return sb.Append("<color=").Append(color).Append('>');
		}

		private static string HighlightType(Type type)
		{
			StringBuilder stringBuilder = new StringBuilder();
			if (type.IsByRef)
			{
				type = type.GetElementType();
			}
			int num = 0;
			Match match = ArrayTokenRegex.Match(type.Name);
			if (match != null && match.Success)
			{
				num = 1 + match.Value.Count((char c) => c == ',');
				type = type.GetElementType();
			}
			if (builtInTypesToShorthand.TryGetValue(type, out var value))
			{
				AppendOpenColor(stringBuilder, "#" + keywordBlueHex).Append(value).Append("</color>");
			}
			else
			{
				stringBuilder.Append("<color=" + GetClassColor(type) + ">").Append(type.Name).Append("</color>");
			}
			if (num > 0)
			{
				stringBuilder.Append('[').Append(new string(',', num - 1)).Append(']');
			}
			return stringBuilder.ToString();
		}

		private static void ProcessGenericArguments(Type type, StringBuilder sb)
		{
			List<Type> list = type.GetGenericArguments().ToList();
			for (int i = 0; i < sb.Length; i++)
			{
				if (!list.Any())
				{
					break;
				}
				if (sb[i] != '`')
				{
					continue;
				}
				int num = i;
				i++;
				StringBuilder stringBuilder = new StringBuilder();
				for (; char.IsDigit(sb[i]); i++)
				{
					stringBuilder.Append(sb[i]);
				}
				string text = stringBuilder.ToString();
				int num2 = int.Parse(text);
				sb.Remove(num, text.Length + 1);
				int num3 = 1;
				num++;
				while (num3 < "</color>".Length && sb[num] == "</color>"[num3])
				{
					num3++;
					num++;
				}
				sb.Insert(num, '<');
				num++;
				int length = sb.Length;
				while (num2 > 0 && list.Any())
				{
					num2--;
					Type type2 = list.First();
					list.RemoveAt(0);
					sb.Insert(num, ProcessType(type2));
					if (num2 > 0)
					{
						num += sb.Length - length;
						sb.Insert(num, ", ");
						num += 2;
						length = sb.Length;
					}
				}
				sb.Insert(num + sb.Length - length, '>');
			}
		}

		public static string RemoveHighlighting(string _string)
		{
			if (_string == null)
			{
				throw new ArgumentNullException("_string");
			}
			_string = _string.Replace("<i>", string.Empty);
			_string = _string.Replace("</i>", string.Empty);
			_string = colorTagRegex.Replace(_string, string.Empty);
			_string = _string.Replace("</color>", string.Empty);
			return _string;
		}

		[Obsolete("Use 'ParseMethod(MethodInfo)' instead (rename).")]
		public static string HighlightMethod(MethodInfo method)
		{
			return ParseMethod(method);
		}

		public static string ParseMethod(MethodInfo method)
		{
			string key = GeneralExtensions.FullDescription((MethodBase)method);
			if (highlightedMethods.ContainsKey(key))
			{
				return highlightedMethods[key];
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(Parse(method.DeclaringType, includeNamespace: false));
			stringBuilder.Append('.');
			string text = ((!method.IsStatic) ? "#ff8000" : "#b55b02");
			stringBuilder.Append("<color=" + text + ">" + method.Name + "</color>");
			if (method.IsGenericMethod)
			{
				stringBuilder.Append("<");
				Type[] genericArguments = method.GetGenericArguments();
				for (int i = 0; i < genericArguments.Length; i++)
				{
					Type type = genericArguments[i];
					if (type.IsGenericParameter)
					{
						stringBuilder.Append("<color=#92c470>" + genericArguments[i].Name + "</color>");
					}
					else
					{
						stringBuilder.Append(Parse(type, includeNamespace: false));
					}
					if (i < genericArguments.Length - 1)
					{
						stringBuilder.Append(", ");
					}
				}
				stringBuilder.Append(">");
			}
			stringBuilder.Append('(');
			ParameterInfo[] parameters = method.GetParameters();
			for (int j = 0; j < parameters.Length; j++)
			{
				ParameterInfo parameterInfo = parameters[j];
				stringBuilder.Append(Parse(parameterInfo.ParameterType, includeNamespace: false));
				if (j < parameters.Length - 1)
				{
					stringBuilder.Append(", ");
				}
			}
			stringBuilder.Append(')');
			string text2 = stringBuilder.ToString();
			highlightedMethods.Add(key, text2);
			return text2;
		}

		[Obsolete("Use 'ParseConstructor(ConstructorInfo)' instead (rename).")]
		public static string HighlightConstructor(ConstructorInfo ctor)
		{
			return ParseConstructor(ctor);
		}

		public static string ParseConstructor(ConstructorInfo ctor)
		{
			string key = GeneralExtensions.FullDescription((MethodBase)ctor);
			if (highlightedMethods.ContainsKey(key))
			{
				return highlightedMethods[key];
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(Parse(ctor.DeclaringType, includeNamespace: false));
			string value = stringBuilder.ToString();
			stringBuilder.Append('.');
			stringBuilder.Append(value);
			stringBuilder.Append('(');
			ParameterInfo[] parameters = ctor.GetParameters();
			for (int i = 0; i < parameters.Length; i++)
			{
				ParameterInfo parameterInfo = parameters[i];
				stringBuilder.Append(Parse(parameterInfo.ParameterType, includeNamespace: false));
				if (i < parameters.Length - 1)
				{
					stringBuilder.Append(", ");
				}
			}
			stringBuilder.Append(')');
			string text = stringBuilder.ToString();
			highlightedMethods.Add(key, text);
			return text;
		}

		public static string GetMemberInfoColor(MemberInfo memberInfo, out bool isStatic)
		{
			isStatic = false;
			if (memberInfo is FieldInfo fieldInfo)
			{
				if (fieldInfo.IsStatic)
				{
					isStatic = true;
					return "#8d8dc6";
				}
				return "#c266ff";
			}
			if (memberInfo is MethodInfo methodInfo)
			{
				if (methodInfo.IsStatic)
				{
					isStatic = true;
					return "#b55b02";
				}
				return "#ff8000";
			}
			if (memberInfo is PropertyInfo propertyInfo)
			{
				if (propertyInfo.GetAccessors(nonPublic: true)[0].IsStatic)
				{
					isStatic = true;
					return "#588075";
				}
				return "#55a38e";
			}
			if (memberInfo is ConstructorInfo)
			{
				isStatic = true;
				return "#2df7b2";
			}
			throw new NotImplementedException(memberInfo.GetType().Name + " is not supported");
		}
	}
	public static class ToStringUtility
	{
		internal static Dictionary<string, MethodInfo> toStringMethods = new Dictionary<string, MethodInfo>();

		private const string nullString = "<color=grey>null</color>";

		private const string nullUnknown = "<color=grey>null</color> (?)";

		private const string destroyedString = "<color=red>Destroyed</color>";

		private const string untitledString = "<i><color=grey>untitled</color></i>";

		private const string eventSystemNamespace = "UnityEngine.EventSystem";

		public static string PruneString(string s, int chars = 200, int lines = 5)
		{
			if (string.IsNullOrEmpty(s))
			{
				return s;
			}
			StringBuilder stringBuilder = new StringBuilder(Math.Max(chars, s.Length));
			int num = 0;
			for (int i = 0; i < s.Length; i++)
			{
				if (num >= lines || i >= chars)
				{
					stringBuilder.Append("...");
					break;
				}
				char c = s[i];
				if (c == '\r' || c == '\n')
				{
					num++;
				}
				stringBuilder.Append(c);
			}
			return stringBuilder.ToString();
		}

		public static string ToStringWithType(object value, Type fallbackType, bool includeNamespace = true)
		{
			if (value.IsNullOrDestroyed() && (object)fallbackType == null)
			{
				return "<color=grey>null</color> (?)";
			}
			Type type = value?.GetActualType() ?? fallbackType;
			string text = SignatureHighlighter.Parse(type, includeNamespace);
			StringBuilder stringBuilder = new StringBuilder();
			if (value.IsNullOrDestroyed())
			{
				if (value == null)
				{
					stringBuilder.Append("<color=grey>null</color>");
					AppendRichType(stringBuilder, text);
					return stringBuilder.ToString();
				}
				stringBuilder.Append("<color=red>Destroyed</color>");
				AppendRichType(stringBuilder, text);
				return stringBuilder.ToString();
			}
			Object val = (Object)((value is Object) ? value : null);
			if (val != null)
			{
				if (string.IsNullOrEmpty(val.name))
				{
					stringBuilder.Append("<i><color=grey>untitled</color></i>");
				}
				else
				{
					stringBuilder.Append('"');
					stringBuilder.Append(PruneString(val.name, 50, 1));
					stringBuilder.Append('"');
				}
				AppendRichType(stringBuilder, text);
			}
			else if (type.FullName.StartsWith("UnityEngine.EventSystem"))
			{
				stringBuilder.Append(text);
			}
			else
			{
				string text2 = ToString(value);
				if (type.IsGenericType || text2 == type.FullName || text2 == type.FullName + " " + type.FullName || text2 == "Il2Cpp" + type.FullName || type.FullName == "Il2Cpp" + text2)
				{
					stringBuilder.Append(text);
				}
				else
				{
					stringBuilder.Append(PruneString(text2));
					AppendRichType(stringBuilder, text);
				}
			}
			return stringBuilder.ToString();
		}

		private static void AppendRichType(StringBuilder sb, string richType)
		{
			sb.Append(' ');
			sb.Append('(');
			sb.Append(richType);
			sb.Append(')');
		}

		private static string ToString(object value)
		{
			if (value.IsNullOrDestroyed())
			{
				if (value == null)
				{
					return "<color=grey>null</color>";
				}
				return "<color=red>Destroyed</color>";
			}
			Type actualType = value.GetActualType();
			if (!toStringMethods.ContainsKey(actualType.AssemblyQualifiedName))
			{
				MethodInfo method = actualType.GetMethod("ToString", ArgumentUtility.EmptyTypes);
				toStringMethods.Add(actualType.AssemblyQualifiedName, method);
			}
			value = value.TryCast(actualType);
			string theString;
			try
			{
				theString = (string)toStringMethods[actualType.AssemblyQualifiedName].Invoke(value, ArgumentUtility.EmptyArgs);
			}
			catch (Exception e)
			{
				theString = e.ReflectionExToString();
			}
			return ReflectionUtility.ProcessTypeInString(actualType, theString);
		}
	}
	public static class UnityHelpers
	{
		private static PropertyInfo onEndEdit;

		public static bool OccuredEarlierThanDefault(this float time)
		{
			return Time.realtimeSinceStartup - 0.01f >= time;
		}

		public static bool OccuredEarlierThan(this float time, float secondsAgo)
		{
			return Time.realtimeSinceStartup - secondsAgo >= time;
		}

		public static bool IsNullOrDestroyed(this object obj, bool suppressWarning = true)
		{
			try
			{
				if (obj == null)
				{
					if (!suppressWarning)
					{
						Universe.LogWarning("The target instance is null!");
					}
					return true;
				}
				Object val = (Object)((obj is Object) ? obj : null);
				if (val != null && !Object.op_Implicit(val))
				{
					if (!suppressWarning)
					{
						Universe.LogWarning("The target UnityEngine.Object was destroyed!");
					}
					return true;
				}
				return false;
			}
			catch
			{
				return true;
			}
		}

		public static string GetTransformPath(this Transform transform, bool includeSelf = false)
		{
			StringBuilder stringBuilder = new StringBuilder();
			if (includeSelf)
			{
				stringBuilder.Append(((Object)transform).name);
			}
			while (Object.op_Implicit((Object)(object)transform.parent))
			{
				transform = transform.parent;
				stringBuilder.Insert(0, '/');
				stringBuilder.Insert(0, ((Object)transform).name);
			}
			return stringBuilder.ToString();
		}

		public static string ToHex(this Color color)
		{
			//IL_0001: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255);
			byte b2 = (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255);
			byte b3 = (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255);
			return $"{b:X2}{b2:X2}{b3:X2}";
		}

		public static Color ToColor(this string _string)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			_string = _string.Replace("#", "");
			if (_string.Length != 6)
			{
				return Color.magenta;
			}
			byte b = byte.Parse(_string.Substring(0, 2), NumberStyles.HexNumber);
			byte b2 = byte.Parse(_string.Substring(2, 2), NumberStyles.HexNumber);
			byte b3 = byte.Parse(_string.Substring(4, 2), NumberStyles.HexNumber);
			Color result = default(Color);
			result.r = (float)((decimal)b / 255m);
			result.g = (float)((decimal)b2 / 255m);
			result.b = (float)((decimal)b3 / 255m);
			result.a = 1f;
			return result;
		}

		public static UnityEvent<string> GetOnEndEdit(this InputField _this)
		{
			if ((object)onEndEdit == null)
			{
				onEndEdit = AccessTools.Property(typeof(InputField), "onEndEdit") ?? throw new Exception("Could not get InputField.onEndEdit property!");
			}
			return onEndEdit.GetValue(_this, null).TryCast<UnityEvent<string>>();
		}
	}
}
namespace UniverseLib.UI
{
	public class UIBase
	{
		internal static readonly int TOP_SORTORDER = 30000;

		public string ID { get; }

		public GameObject RootObject { get; }

		public RectTransform RootRect { get; }

		public Canvas Canvas { get; }

		public Action UpdateMethod { get; }

		public PanelManager Panels { get; }

		public bool Enabled
		{
			get
			{
				return Object.op_Implicit((Object)(object)RootObject) && RootObject.activeSelf;
			}
			set
			{
				UniversalUI.SetUIActive(ID, value);
			}
		}

		public UIBase(string id, Action updateMethod)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(id))
			{
				throw new ArgumentException("Cannot register a UI with a null or empty id!");
			}
			if (UniversalUI.registeredUIs.ContainsKey(id))
			{
				throw new ArgumentException("A UI with the id '" + id + "' is already registered!");
			}
			ID = id;
			UpdateMethod = updateMethod;
			RootObject = UIFactory.CreateUIObject(id + "_Root", UniversalUI.CanvasRoot);
			RootObject.SetActive(false);
			RootRect = RootObject.GetComponent<RectTransform>();
			Canvas = RootObject.AddComponent<Canvas>();
			Canvas.renderMode = (RenderMode)1;
			Canvas.referencePixelsPerUnit = 100f;
			Canvas.sortingOrder = TOP_SORTORDER;
			Canvas.overrideSorting = true;
			CanvasScaler val = RootObject.AddComponent<CanvasScaler>();
			val.referenceResolution = new Vector2(1920f, 1080f);
			val.screenMatchMode = (ScreenMatchMode)1;
			RootObject.AddComponent<GraphicRaycaster>();
			RectTransform component = RootObject.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.pivot = new Vector2(0.5f, 0.5f);
			Panels = CreatePanelManager();
			RootObject.SetActive(true);
			UniversalUI.registeredUIs.Add(id, this);
			UniversalUI.uiBases.Add(this);
		}

		protected virtual PanelManager CreatePanelManager()
		{
			return new PanelManager(this);
		}

		public void SetOnTop()
		{
			RootObject.transform.SetAsLastSibling();
			foreach (UIBase uiBasis in UniversalUI.uiBases)
			{
				int num = UniversalUI.CanvasRoot.transform.childCount - ((Transform)uiBasis.RootRect).GetSiblingIndex();
				uiBasis.Canvas.sortingOrder = TOP_SORTORDER - num;
			}
			UniversalUI.uiBases.Sort((UIBase a, UIBase b) => b.RootObject.transform.GetSiblingIndex().CompareTo(a.RootObject.transform.GetSiblingIndex()));
		}

		internal void Update()
		{
			try
			{
				Panels.Update();
				UpdateMethod?.Invoke();
			}
			catch (Exception arg)
			{
				Universe.LogWarning($"Exception invoking update method for {ID}: {arg}");
			}
		}
	}
	public static class UIFactory
	{
		internal static Vector2 largeElementSize = new Vector2(100f, 30f);

		internal static Vector2 smallElementSize = new Vector2(25f, 25f);

		internal static Color defaultTextColor = Color.white;

		public static GameObject CreateUIObject(string name, GameObject parent, Vector2 sizeDelta = default(Vector2))
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name)
			{
				layer = 5,
				hideFlags = (HideFlags)61
			};
			if (Object.op_Implicit((Object)(object)parent))
			{
				val.transform.SetParent(parent.transform, false);
			}
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = sizeDelta;
			return val;
		}

		internal static void SetDefaultTextValues(Text text)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)text).color = defaultTextColor;
			text.font = UniversalUI.DefaultFont;
			text.fontSize = 14;
		}

		internal static void SetDefaultSelectableValues(Selectable selectable)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			Navigation navigation = selectable.navigation;
			((Navigation)(ref navigation)).mode = (Mode)4;
			selectable.navigation = navigation;
			RuntimeHelper.Instance.Internal_SetColorBlock(selectable, (Color?)new Color(0.2f, 0.2f, 0.2f), (Color?)new Color(0.3f, 0.3f, 0.3f), (Color?)new Color(0.15f, 0.15f, 0.15f), (Color?)null);
		}

		public static LayoutElement SetLayoutElement(GameObject gameObject, int? minWidth = null, int? minHeight = null, int? flexibleWidth = null, int? flexibleHeight = null, int? preferredWidth = null, int? preferredHeight = null, bool? ignoreLayout = null)
		{
			LayoutElement val = gameObject.GetComponent<LayoutElement>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = gameObject.AddComponent<LayoutElement>();
			}
			if (minWidth.HasValue)
			{
				val.minWidth = minWidth.Value;
			}
			if (minHeight.HasValue)
			{
				val.minHeight = minHeight.Value;
			}
			if (flexibleWidth.HasValue)
			{
				val.flexibleWidth = flexibleWidth.Value;
			}
			if (flexibleHeight.HasValue)
			{
				val.flexibleHeight = flexibleHeight.Value;
			}
			if (preferredWidth.HasValue)
			{
				val.preferredWidth = preferredWidth.Value;
			}
			if (preferredHeight.HasValue)
			{
				val.preferredHeight = preferredHeight.Value;
			}
			if (ignoreLayout.HasValue)
			{
				val.ignoreLayout = ignoreLayout.Value;
			}
			return val;
		}

		public static T SetLayoutGroup<T>(GameObject gameObject, bool? forceWidth = null, bool? forceHeight = null, bool? childControlWidth = null, bool? childControlHeight = null, int? spacing = null, int? padTop = null, int? padBottom = null, int? padLeft = null, int? padRight = null, TextAnchor? childAlignment = null) where T : HorizontalOrVerticalLayoutGroup
		{
			T val = gameObject.GetComponent<T>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = gameObject.AddComponent<T>();
			}
			return SetLayoutGroup(val, forceWidth, forceHeight, childControlWidth, childControlHeight, spacing, padTop, padBottom, padLeft, padRight, childAlignment);
		}

		public static T SetLayoutGroup<T>(T group, bool? forceWidth = null, bool? forceHeight = null, bool? childControlWidth = null, bool? childControlHeight = null, int? spacing = null, int? padTop = null, int? padBottom = null, int? padLeft = null, int? padRight = null, TextAnchor? childAlignment = null) where T : HorizontalOrVerticalLayoutGroup
		{
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			if (forceWidth.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)group).childForceExpandWidth = forceWidth.Value;
			}
			if (forceHeight.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)group).childForceExpandHeight = forceHeight.Value;
			}
			if (childControlWidth.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)(object)group).SetChildControlWidth(childControlWidth.Value);
			}
			if (childControlHeight.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)(object)group).SetChildControlHeight(childControlHeight.Value);
			}
			if (spacing.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)group).spacing = spacing.Value;
			}
			if (padTop.HasValue)
			{
				((LayoutGroup)(object)group).padding.top = padTop.Value;
			}
			if (padBottom.HasValue)
			{
				((LayoutGroup)(object)group).padding.bottom = padBottom.Value;
			}
			if (padLeft.HasValue)
			{
				((LayoutGroup)(object)group).padding.left = padLeft.Value;
			}
			if (padRight.HasValue)
			{
				((LayoutGroup)(object)group).padding.right = padRight.Value;
			}
			if (childAlignment.HasValue)
			{
				((LayoutGroup)(object)group).childAlignment = childAlignment.Value;
			}
			return group;
		}

		public static GameObject CreatePanel(string name, GameObject parent, out GameObject contentHolder, Color? bgColor = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)1, (int?)1, (int?)1, (int?)1, (TextAnchor?)null);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.anchoredPosition = Vector2.zero;
			component.sizeDelta = Vector2.zero;
			((Graphic)val.AddComponent<Image>()).color = Color.black;
			val.AddComponent<RectMask2D>();
			contentHolder = CreateUIObject("Content", val);
			Image val2 = contentHolder.AddComponent<Image>();
			val2.type = (Type)3;
			((Graphic)val2).color = (Color)((!bgColor.HasValue) ? new Color(0.07f, 0.07f, 0.07f) : bgColor.Value);
			UIFactory.SetLayoutGroup<VerticalLayoutGroup>(contentHolder, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)3, (int?)3, (int?)3, (int?)3, (int?)3, (TextAnchor?)null);
			return val;
		}

		public static GameObject CreateVerticalGroup(GameObject parent, string name, bool forceWidth, bool forceHeight, bool childControlWidth, bool childControlHeight, int spacing = 0, Vector4 padding = default(Vector4), Color bgColor = default(Color), TextAnchor? childAlignment = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val, (bool?)forceWidth, (bool?)forceHeight, (bool?)childControlWidth, (bool?)childControlHeight, (int?)spacing, (int?)(int)padding.x, (int?)(int)padding.y, (int?)(int)padding.z, (int?)(int)padding.w, childAlignment);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = (Color)((bgColor == default(Color)) ? new Color(0.17f, 0.17f, 0.17f) : bgColor);
			return val;
		}

		public static GameObject CreateHorizontalGroup(GameObject parent, string name, bool forceExpandWidth, bool forceExpandHeight, bool childControlWidth, bool childControlHeight, int spacing = 0, Vector4 padding = default(Vector4), Color bgColor = default(Color), TextAnchor? childAlignment = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)forceExpandWidth, (bool?)forceExpandHeight, (bool?)childControlWidth, (bool?)childControlHeight, (int?)spacing, (int?)(int)padding.x, (int?)(int)padding.y, (int?)(int)padding.z, (int?)(int)padding.w, childAlignment);
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = (Color)((bgColor == default(Color)) ? new Color(0.17f, 0.17f, 0.17f) : bgColor);
			return val;
		}

		public static GameObject CreateGridGroup(GameObject parent, string name, Vector2 cellSize, Vector2 spacing, Color bgColor = default(Color))
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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)
			GameObject val = CreateUIObject(name, parent);
			GridLayoutGroup val2 = val.AddComponent<GridLayoutGroup>();
			((LayoutGroup)val2).childAlignment = (TextAnchor)0;
			val2.cellSize = cellSize;
			val2.spacing = spacing;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = (Color)((bgColor == default(Color)) ? new Color(0.17f, 0.17f, 0.17f) : bgColor);
			return val;
		}

		public static Text CreateLabel(GameObject parent, string name, string defaultText, TextAnchor alignment = 3, Color color = default(Color), bool supportRichText = true, int fontSize = 14)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			Text val2 = val.AddComponent<Text>();
			SetDefaultTextValues(val2);
			val2.text = defaultText;
			((Graphic)val2).color = ((color == default(Color)) ? defaultTextColor : color);
			val2.supportRichText = supportRichText;
			val2.alignment = alignment;
			val2.fontSize = fontSize;
			return val2;
		}

		public static ButtonRef CreateButton(GameObject parent, string name, string text, Color? normalColor = null)
		{
			//IL_0003: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			Color valueOrDefault = normalColor.GetValueOrDefault();
			if (!normalColor.HasValue)
			{
				((Color)(ref valueOrDefault))..ctor(0.25f, 0.25f, 0.25f);
				normalColor = valueOrDefault;
			}
			ButtonRef buttonRef = CreateButton(parent, name, text, default(ColorBlock));
			RuntimeHelper instance = RuntimeHelper.Instance;
			Button component = buttonRef.Component;
			Color? normal = normalColor;
			Color? val = normalColor;
			float num = 1.2f;
			Color? highlighted = (val.HasValue ? new Color?(val.GetValueOrDefault() * num) : null);
			val = normalColor;
			num = 0.7f;
			instance.Internal_SetColorBlock((Selectable)(object)component, normal, highlighted, val.HasValue ? new Color?(val.GetValueOrDefault() * num) : null);
			return buttonRef;
		}

		public static ButtonRef CreateButton(GameObject parent, string name, string text, ColorBlock colors)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent, smallElementSize);
			GameObject val2 = CreateUIObject("Text", val);
			Image val3 = val.AddComponent<Image>();
			val3.type = (Type)1;
			((Graphic)val3).color = new Color(1f, 1f, 1f, 1f);
			Button val4 = val.AddComponent<Button>();
			SetDefaultSelectableValues((Selectable)(object)val4);
			((ColorBlock)(ref colors)).colorMultiplier = 1f;
			RuntimeHelper.Instance.Internal_SetColorBlock((Selectable)(object)val4, colors);
			Text val5 = val2.AddComponent<Text>();
			val5.text = text;
			SetDefaultTextValues(val5);
			val5.alignment = (TextAnchor)4;
			RectTransform component = val2.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.sizeDelta = Vector2.zero;
			SetButtonDeselectListener(val4);
			return new ButtonRef(val4);
		}

		internal static void SetButtonDeselectListener(Button button)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			((UnityEvent)button.onClick).AddListener((UnityAction)delegate
			{
				((Selectable)button).OnDeselect((BaseEventData)null);
			});
		}

		public static GameObject CreateSlider(GameObject parent, string name, out Slider slider)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0032: 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)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent, smallElementSize);
			GameObject val2 = CreateUIObject("Background", val);
			GameObject val3 = CreateUIObject("Fill Area", val);
			GameObject val4 = CreateUIObject("Fill", val3);
			GameObject val5 = CreateUIObject("Handle Slide Area", val);
			GameObject val6 = CreateUIObject("Handle", val5);
			Image val7 = val2.AddComponent<Image>();
			val7.type = (Type)1;
			((Graphic)val7).color = new Color(0.15f, 0.15f, 0.15f, 1f);
			RectTransform component = val2.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0.25f);
			component.anchorMax = new Vector2(1f, 0.75f);
			component.sizeDelta = new Vector2(0f, 0f);
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0.25f);
			component2.anchorMax = new Vector2(1f, 0.75f);
			component2.anchoredPosition = new Vector2(-5f, 0f);
			component2.sizeDelta = new Vector2(-20f, 0f);
			Image val8 = val4.AddComponent<Image>();
			val8.type = (Type)1;
			((Graphic)val8).color = new Color(0.3f, 0.3f, 0.3f, 1f);
			val4.GetComponent<RectTransform>().sizeDelta = new Vector2(10f, 0f);
			RectTransform component3 = val5.GetComponent<RectTransform>();
			component3.sizeDelta = new Vector2(-20f, 0f);
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(1f, 1f);
			Image val9 = val6.AddComponent<Image>();
			((Graphic)val9).color = new Color(0.5f, 0.5f, 0.5f, 1f);
			val6.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f);
			slider = val.AddComponent<Slider>();
			slider.fillRect = val4.GetComponent<RectTransform>();
			slider.handleRect = val6.GetComponent<RectTransform>();
			((Selectable)slider).targetGraphic = (Graphic)(object)val9;
			slider.direction = (Direction)0;
			RuntimeHelper.Instance.Internal_SetColorBlock((Selectable)(object)slider, (Color?)new Color(0.4f, 0.4f, 0.4f), (Color?)new Color(0.55f, 0.55f, 0.55f), (Color?)new Color(0.3f, 0.3f, 0.3f), (Color?)null);
			return val;
		}

		public static GameObject CreateScrollbar(GameObject parent, string name, out Scrollbar scrollbar)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent, smallElementSize);
			GameObject val2 = CreateUIObject("Sliding Area", val);
			GameObject val3 = CreateUIObject("Handle", val2);
			Image val4 = val.AddComponent<Image>();
			val4.type = (Type)1;
			((Graphic)val4).color = new Color(0.1f, 0.1f, 0.1f);
			Image val5 = val3.AddComponent<Image>();
			val5.type = (Type)1;
			((Graphic)val5).color = new Color(0.4f, 0.4f, 0.4f);
			RectTransform component = val2.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(-20f, -20f);
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.sizeDelta = new Vector2(20f, 20f);
			scrollbar = val.AddComponent<Scrollbar>();
			scrollbar.handleRect = component2;
			((Selectable)scrollbar).targetGraphic = (Graphic)(object)val5;
			SetDefaultSelectableValues((Selectable)(object)scrollbar);
			return val;
		}

		public static GameObject CreateToggle(GameObject parent, string name, out Toggle toggle, out Text text, Color bgColor = default(Color), int checkWidth = 20, int checkHeight = 20)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent, smallElementSize);
			UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)5, (int?)0, (int?)0, (int?)0, (int?)0, (TextAnchor?)(TextAnchor)3);
			toggle = val.AddComponent<Toggle>();
			toggle.isOn = true;
			SetDefaultSelectableValues((Selectable)(object)toggle);
			Toggle t2 = toggle;
			((UnityEvent<bool>)(object)toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
			{
				((Selectable)t2).OnDeselect((BaseEventData)null);
			});
			GameObject val2 = CreateUIObject("Background", val);
			Image val3 = val2.AddComponent<Image>();
			((Graphic)val3).color = (Color)((bgColor == default(Color)) ? new Color(0.04f, 0.04f, 0.04f, 0.75f) : bgColor);
			UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val2, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)null);
			SetLayoutElement(val2, checkWidth, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0);
			GameObject val4 = CreateUIObject("Checkmark", val2);
			Image val5 = val4.AddComponent<Image>();
			((Graphic)val5).color = new Color(0.8f, 1f, 0.8f, 0.3f);
			GameObject val6 = CreateUIObject("Label", val);
			text = val6.AddComponent<Text>();
			text.text = "";
			text.alignment = (TextAnchor)3;
			SetDefaultTextValues(text);
			SetLayoutElement(val6, 0, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0);
			toggle.graphic = (Graphic)(object)val5;
			((Selectable)toggle).targetGraphic = (Graphic)(object)val3;
			return val;
		}

		public static InputFieldRef CreateInputField(GameObject parent, string name, string placeHolderText)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: 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_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateUIObject(name, parent);
			Image val2 = val.AddComponent<Image>();
			val2.type = (Type)1;
			((Graphic)val2).color = new Color(0f, 0f, 0f, 0.5f);
			InputField val3 = val.AddComponent<InputField>();
			Navigation navigation = ((Selectable)val3).navigation;
			((Navigation)(ref navigation)).mode = (Mode)0;
			((Selectable)val3).navigation = navigation;
			val3.lineType = (LineType)0;
			((Selectable)val3).interactable = true;
			((Selectable)val3).transition = (Transition)1;
			((Selectable)val3).targetGraphic = (Graphic)(object)val2;
			RuntimeHelper.Instance.Internal_SetColorBlock((Selectable)(object)val3, (Color?)new Color(1f, 1f, 1f, 1f), (Color?)new Color(0.95f, 0.95f, 0.95f, 1f), (Color?)new Color(0.78f, 0.78f, 0.78f, 1f), (Color?)null);
			GameObject val4 = CreateUIObject("TextArea", val);
			val4.AddComponent<RectMask2D>();
			RectTransform component = val4.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			GameObject val5 = CreateUIObject("Placeholder", val4);
			Text val6 = val5.AddComponent<Text>();
			SetDefaultTextValues(val6);
			val6.text = placeHolderText ?? "...";
			((Graphic)val6).color = new Color(0.5f, 0.5f, 0.5f, 1f);
			val6.horizontalOverflow = (HorizontalWrapMode)0;
			val6.alignment = (TextAnchor)3;
			val6.fontSize = 14;
			RectTransform component2 = val5.GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = Vector2.zero;
			val3.placeholder = (Graphic)(object)val6;
			GameObject val7 = CreateUIObject("Text", val4);
			Text val8 = val7.AddComponent<Text>();
			SetDefaultTextValues(val8);
			val8.text = "";
			((Graphic)val8).color = new Color(1f, 1f, 1f, 1f);
			val8.horizontalOverflow = (HorizontalWrapMode)0;
			val8.alignment = (TextAnchor)3;
			val8.fontSize = 14;
			RectTransform component3 = val7.GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = Vector2.one;
			component3.offsetMin = Vector2.zero;
			component3.offsetMax = Vector2.zero;
			val3.textComponent = val8;
			val3.characterLimit = 16000;
			return new InputFieldRef(val3);
		}

		public static GameObject CreateDropdown(GameObject parent, string name, out Dropdown dropdown, string defaultItemText, int itemFontSize, Action<int> onValueChanged, string[] defaultOptions = null)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing