Decompiled source of CommonCustomsMenuPlugin v1.0.8

CommonCustomsMenuPlugin.dll

Decompiled 17 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bounce.Singletons;
using HarmonyLib;
using ModdingTales;
using Newtonsoft.Json;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CommonCustomsMenu")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("CommonCustomsMenu")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("CommonCustomsMenu")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.8.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.commoncustomsmenu", "Common Customs Menu Plugin", "1.0.8.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CommonCustomsMenuPlugin : BaseUnityPlugin
{
	public static class _Internal
	{
		public static class CustomsMenu
		{
			public class RewriteClause
			{
				public string kind { get; set; }

				public string category { get; set; }

				public string prefix { get; set; }

				public string suffix { get; set; }
			}

			public class AssetInfo
			{
				[NonSerialized]
				public Internal _internal = new Internal();

				public string name { get; set; } = "";


				public string provider { get; set; }

				public string filename { get; set; } = "";


				public string pack { get; set; } = "";


				public string prefab { get; set; } = "";


				public string kind { get; set; } = "";


				public string category { get; set; } = "";


				public string header { get; set; } = "";


				public string groupName { get; set; } = "";


				public string description { get; set; } = "";


				public string tags { get; set; } = "";


				public string author { get; set; } = "";


				public string version { get; set; } = "";


				public string comment { get; set; } = "";


				public float size { get; set; } = 1f;


				public bool hasAnimations { get; set; } = false;


				public bool hasAudio { get; set; } = false;


				public bool hasBlendshapes { get; set; } = false;


				public string[] variants { get; set; } = null;


				public Chain[] chain { get; set; } = null;


				public string[] animationOrder { get; set; } = null;


				public Elements[] blendshapes { get; set; } = null;


				public Compensation adjust { get; set; } = new Compensation();


				public AssetInfo Clone()
				{
					return new AssetInfo
					{
						adjust = adjust,
						animationOrder = animationOrder,
						author = author,
						blendshapes = blendshapes,
						category = category,
						comment = comment,
						description = description,
						filename = filename,
						groupName = groupName,
						hasAnimations = hasAnimations,
						hasAudio = hasAudio,
						hasBlendshapes = hasBlendshapes,
						header = header,
						kind = kind,
						name = name,
						pack = pack,
						prefab = prefab,
						provider = provider,
						size = size,
						tags = tags,
						variants = variants,
						chain = chain,
						version = version,
						_internal = _internal
					};
				}
			}

			public enum AnimationStyle
			{
				None = 0,
				Single = 1,
				PingPong = 2,
				Loop = 0x80,
				ClampStart = 0x100,
				ClampNone = 0x200,
				ClampEnd = 0x400
			}

			public class Elements
			{
				[NonSerialized]
				public CreatureBoardAsset target;

				public string name { get; set; } = "No Name";


				public Element[] elements { get; set; }
			}

			public class Element
			{
				public string audio { get; set; }

				public string animation { get; set; }

				public AnimationStyle style { get; set; } = AnimationStyle.None;


				public float delay { get; set; }

				public int blendShapeIndex { get; set; }

				public float start { get; set; }

				public float end { get; set; }

				public float step { get; set; }
			}

			public class Compensation
			{
				public float tX { get; set; } = 0f;


				public float tY { get; set; } = 0f;


				public float tZ { get; set; } = 0f;


				public float rW { get; set; } = Quaternion.identity.w;


				public float rX { get; set; } = Quaternion.identity.x;


				public float rY { get; set; } = Quaternion.identity.y;


				public float rZ { get; set; } = Quaternion.identity.z;


				public float sX { get; set; } = 1f;


				public float sY { get; set; } = 1f;


				public float sZ { get; set; } = 1f;

			}

			public class Chain
			{
				public string prefab { get; set; } = "";


				public float offsetPosX { get; set; } = 0f;


				public float offsetPosY { get; set; } = 0f;


				public float offsetPosZ { get; set; } = 0f;


				public float offsetRotX { get; set; } = 0f;


				public float offsetRotY { get; set; } = 0f;


				public float offsetRotZ { get; set; } = 0f;

			}

			public class Internal
			{
				public PlayerGuid spawnPlayer { get; set; }
			}

			public static IEnumerator BuildKindsMenu(MenuCollection menus, Dictionary<string, AssetInfo> assets)
			{
				LoggingPlugin.LogDebug("Building Kind Menu (Based On Category)");
				Dictionary<string, IMenuItem> contents = new Dictionary<string, IMenuItem>();
				IEnumerable<string> uniqueKinds = from kind in assets.Values.Select((AssetInfo asset) => asset.category).Distinct()
					orderby kind
					select kind;
				if (uniqueKinds.Count() <= 0)
				{
					yield break;
				}
				string currentState = ((!_self.menus.items.ContainsKey("Kind")) ? "closed" : (_self.menus.items["Kind"].properties.ContainsKey("status") ? _self.menus.items["Kind"].properties["status"] : "closed"));
				int cY = 0;
				foreach (string kind2 in uniqueKinds)
				{
					LoggingPlugin.LogTrace("Creating Icon For " + kind2);
					IMenuItem icon = new MenuTexture("Kind." + kind2, 0, cY * 35, 32f, 32f, "Kind." + kind2 + ".png", "Kind." + kind2 + ".Selected.png", kind2, delegate(string id, string val)
					{
						_self.menus.items["Kind"].properties["selected"] = id;
						((MonoBehaviour)_self).StartCoroutine(BuildGroupsMenu(menus, assets));
					}, delegate(string id, string val, int x, int y)
					{
						val = val.Substring("Kind.".Length);
						val = val.Substring(0, val.Length - ".png".Length);
						_self.menus.properties["info"] = "   <color=#FFA400>TYPE:</color> <color=#EEEEEE>" + val + "</color> ";
					});
					if (!contents.ContainsKey(icon.id))
					{
						contents.Add(icon.id, icon);
					}
					cY++;
				}
				Menu kindMenu = new Menu("Kind", 10, 780, 55, 270, 55, 35 * contents.Count)
				{
					properties = 
					{
						["backColor"] = "000000DD",
						["status"] = currentState
					},
					children = contents
				};
				while (_self.guiSafe != "")
				{
					LoggingPlugin.LogTrace("Waiting On " + _self.guiSafe + " To Finish");
					yield return (object)new WaitForEndOfFrame();
				}
				LoggingPlugin.LogTrace("Applying Kind Menu");
				_self.guiSafe = "BuildKindMenu";
				if (menus.items.ContainsKey(kindMenu.id))
				{
					menus.items[kindMenu.id] = kindMenu;
				}
				else
				{
					menus.items.Add(kindMenu.id, kindMenu);
				}
				_self.guiSafe = "";
				LoggingPlugin.LogTrace("Triggering Kind Menu Selection");
				menus.items[kindMenu.id].children.ElementAt(0).Value.Trigger(menus.items[kindMenu.id].children.ElementAt(0).Value.id, "");
			}

			public static IEnumerator BuildGroupsMenu(MenuCollection menus, Dictionary<string, AssetInfo> assets)
			{
				if (!_self.menus.items["Kind"].properties.ContainsKey("selected"))
				{
					yield break;
				}
				string kind = _self.menus.items["Kind"].properties["selected"].Substring("Kind.".Length);
				string filter = (_self.menus.items["Filter"].properties.ContainsKey("group") ? _self.menus.items["Filter"].properties["group"] : "");
				LoggingPlugin.LogDebug("Building Group Menu For Kind '" + kind + "' And Filter '" + filter + "'");
				Dictionary<string, IMenuItem> contents = new Dictionary<string, IMenuItem>();
				var uniqueCombinations = (from asset in (from asset in assets.Values
						where asset.category == kind && asset.groupName.Contains(filter)
						select new { asset.header, asset.groupName }).Distinct()
					orderby asset.header, asset.groupName
					select asset).ToList();
				if (uniqueCombinations.Count() <= 0)
				{
					yield break;
				}
				string currentState = ((!_self.menus.items.ContainsKey("Group")) ? "closed" : (_self.menus.items["Group"].properties.ContainsKey("status") ? _self.menus.items["Group"].properties["status"] : "closed"));
				int cY = 0;
				string lastHeader = "";
				foreach (var item in uniqueCombinations)
				{
					if (item.header != lastHeader)
					{
						LoggingPlugin.LogTrace("Creating Header " + item.header);
						lastHeader = item.header;
						IMenuItem header = new MenuText("Header." + item.header, 0, cY * 35, 300f, 30f, 16f, item.header.ToUpper(), item.header, Helpers.MakeColor("E25508"), Helpers.MakeColor("E25508"), Helpers.MakeColor("222222"), Helpers.MakeColor("222222"), null);
						if (!contents.ContainsKey(header.id))
						{
							contents.Add(header.id, header);
						}
						cY++;
					}
					LoggingPlugin.LogTrace("Creating Group " + item.groupName);
					IMenuItem entry = new MenuSelectableText("Header." + item.header + ".Group." + item.groupName, 0, cY * 35, 300f, 30f, 16f, item.groupName, item.groupName, Helpers.MakeColor("A6A6A6"), Helpers.MakeColor("EEEEEE"), Helpers.MakeColor("111111"), Helpers.MakeColor("030303"), Helpers.MakeColor("3B3B3B"), Helpers.MakeColor("FF6000"), delegate(string id, string val)
					{
						_self.menus.items["Group"].properties["selected"] = id.Substring(0, id.Length - ".Text".Length);
						((MonoBehaviour)_self).StartCoroutine(BuildAssetsMenu(menus, assets));
					});
					if (!contents.ContainsKey(entry.id))
					{
						contents.Add(entry.id, entry);
					}
					cY++;
				}
				Menu groupMenu = new Menu("Group", 80, 780, 320, 270, 300, 35 * contents.Count)
				{
					properties = 
					{
						["backColor"] = "000000DD",
						["status"] = currentState
					},
					children = contents
				};
				while (_self.guiSafe != "")
				{
					LoggingPlugin.LogTrace("Waiting On " + _self.guiSafe + " To Finish");
					yield return (object)new WaitForEndOfFrame();
				}
				LoggingPlugin.LogTrace("Applying Group Menu For Kind '" + kind + "'");
				_self.guiSafe = "BuildGroupMenu";
				if (menus.items.ContainsKey(groupMenu.id))
				{
					menus.items[groupMenu.id] = groupMenu;
				}
				else
				{
					menus.items.Add(groupMenu.id, groupMenu);
				}
				_self.guiSafe = "";
				LoggingPlugin.LogTrace("Triggering Group Menu For Kind '" + kind + "' Selection");
				if (menus.items[groupMenu.id].children.Count > 0)
				{
					menus.items[groupMenu.id].children.ElementAt(1).Value.children.ElementAt(1).Value.Trigger(menus.items[groupMenu.id].children.ElementAt(1).Value.children.ElementAt(1).Value.id, "");
				}
			}

			public static IEnumerator BuildAssetsMenu(MenuCollection menus, Dictionary<string, AssetInfo> assets)
			{
				if (!_self.menus.items["Kind"].properties.ContainsKey("selected") || !_self.menus.items["Group"].properties.ContainsKey("selected"))
				{
					yield break;
				}
				string kind = _self.menus.items["Kind"].properties["selected"].Substring("Kind.".Length);
				string group = _self.menus.items["Group"].properties["selected"];
				group = group.Substring(group.IndexOf(".Group.") + ".Group.".Length);
				string header = _self.menus.items["Group"].properties["selected"];
				header = header.Substring(0, header.IndexOf(".Group.")).Substring("Header.".Length);
				string filter = (_self.menus.items["Filter"].properties.ContainsKey("asset") ? _self.menus.items["Filter"].properties["asset"] : "");
				LoggingPlugin.LogDebug("Building Assets Menu Of Kind '" + kind + "' And Group '" + group + "' And Filter '" + filter + "'");
				Dictionary<string, IMenuItem> contents = new Dictionary<string, IMenuItem>();
				List<AssetInfo> items = (from asset in assets.Values
					where asset.category == kind && asset.header == header && asset.groupName == @group && asset.name.Contains(filter)
					orderby asset.name, asset.version
					select asset).ToList();
				if (items.Count() <= 0)
				{
					yield break;
				}
				string currentState = ((!_self.menus.items.ContainsKey("Content")) ? "closed" : (_self.menus.items["Content"].properties.ContainsKey("status") ? _self.menus.items["Content"].properties["status"] : "closed"));
				int cX = 0;
				int cY = 0;
				int badgeSize = (int)(990f / (float)_self.assetBadgesPerRow.Value);
				LoggingPlugin.LogTrace("Badge Size = 100 x 11 / " + _self.assetBadgesPerRow.Value + " = " + badgeSize);
				float badgeTextSize = 4f + Math.Min(12f, 132f / (float)_self.assetBadgesPerRow.Value);
				LoggingPlugin.LogTrace("Badge Text = 6 + 10 x 11 / " + _self.assetBadgesPerRow.Value + " = " + badgeTextSize);
				foreach (AssetInfo asset2 in items)
				{
					LoggingPlugin.LogTrace("Creating Badge For " + asset2.name);
					IMenuItem badge = new MenuBadge("Kind." + kind + ".Group." + group + ".Asset." + asset2.prefab, cX * (badgeSize + 10), cY * (badgeSize + 35), badgeSize, badgeSize, badgeTextSize, "Portrait." + asset2.prefab.Replace("/", ".").Replace("\\", ".") + ".png", "Portrait." + asset2.prefab.Replace("/", ".").Replace("\\", ".") + ".png", JsonConvert.SerializeObject((object)asset2), asset2.name, Color.white, Color.white, Color.clear, Color.clear, delegate(string id, string value)
					{
						AssetInfo assetInfo = JsonConvert.DeserializeObject<AssetInfo>(value);
						try
						{
							LoggingPlugin.LogInfo("Selected Asset:\r\n" + JsonConvert.SerializeObject((object)assetInfo));
							_self.providers[assetInfo.provider].SelectionCallback(assetInfo);
						}
						catch (Exception ex)
						{
							LoggingPlugin.LogWarning("Error Sending Notification To Provider " + assetInfo.provider);
							LoggingPlugin.LogWarning("Details: " + ex.Message);
						}
					}, delegate(string id, string value, int x, int y)
					{
						if (value != "")
						{
							_self.menus.properties["info"] = "   <color=#FFA400>NAME:</color> <color=#EEEEEE>" + asset2.name + "</color><color=#FFA400>,</color> <color=#FFA400>TYPE:</color> <color=#EEEEEE>" + asset2.kind + "</color><color=#FFA400>,</color> <color=#FFA400>CLASS:</color> <color=#EEEEEE>" + asset2.header + "</color><color=#FFA400>,</color> <color=#FFA400>GROUP:</color> <color=#EEEEEE>" + asset2.groupName + "</color><color=#FFA400>,</color> <color=#FFA400>VERSION:</color> <color=#EEEEEE>" + ((asset2.version != "") ? asset2.version : "Unversioned") + "</color><color=#FFA400>,</color> <color=#FFA400>AUTHOR:</color> <color=#EEEEEE>" + ((asset2.author != "") ? asset2.author : "Uncredited") + "</color><color=#FFA400>,</color> <color=#FFA400>PACK:</color> <color=#EEEEEE>" + asset2.pack + "</color><color=#FFA400>,</color> <color=#FFA400>ITEM:</color> <color=#EEEEEE>" + Path.GetFileNameWithoutExtension(asset2.prefab) + "</color><color=#FFA400>,</color> <color=#FFA400>ANIMATED:</color> <color=#EEEEEE>" + asset2.hasAnimations + "</color><color=#FFA400>,</color> <color=#FFA400>AUDIO:</color> <color=#EEEEEE>" + asset2.hasAudio + "</color><color=#FFA400>,</color> <color=#FFA400>MORPHS:</color> <color=#EEEEEE>" + asset2.hasBlendshapes + "</color>";
						}
						else
						{
							_self.menus.properties["info"] = "";
						}
					});
					if (!contents.ContainsKey(badge.id))
					{
						contents.Add(badge.id, badge);
					}
					cX++;
					if (cX >= _self.assetBadgesPerRow.Value)
					{
						cX = 0;
						cY++;
					}
				}
				int numRows = (int)Math.Ceiling((decimal)contents.Count / (decimal)_self.assetBadgesPerRow.Value);
				Menu contentMenu = new Menu("Content", 420, 780, 1255, 270, 1250, numRows * (badgeSize + 35))
				{
					properties = 
					{
						["backColor"] = "000000DD",
						["status"] = currentState
					},
					children = contents
				};
				while (_self.guiSafe != "")
				{
					LoggingPlugin.LogTrace("Waiting On " + _self.guiSafe + " To Finish");
					yield return (object)new WaitForEndOfFrame();
				}
				LoggingPlugin.LogTrace("Applying Assets Menu Of Kind '" + kind + "' And Group '" + group + "'");
				_self.guiSafe = "BuildAssetsMenu";
				if (menus.items.ContainsKey(contentMenu.id))
				{
					menus.items[contentMenu.id] = contentMenu;
				}
				else
				{
					menus.items.Add(contentMenu.id, contentMenu);
				}
				_self.guiSafe = "";
			}

			public static IEnumerator BuildFiltersMenu(MenuCollection menus, Dictionary<string, AssetInfo> assets)
			{
				LoggingPlugin.LogDebug("Building Filters Menu");
				Dictionary<string, IMenuItem> contents = new Dictionary<string, IMenuItem>();
				IMenuItem label1 = new MenuLabel("Filter.Group.Label", 20, 20, 200f, 25f, 16f, "Group Filter", Helpers.MakeColor("FF4A00"), null, delegate(string id, string text)
				{
					_self.menus.items["Filter"].properties["group"] = text;
					((MonoBehaviour)_self).StartCoroutine(BuildGroupsMenu(menus, assets));
				});
				contents.Add(label1.id, label1);
				IMenuItem filter1 = new MenuTextInput("Filter.Group", 20, 80, 200f, 25f, 16f, "", Helpers.MakeColor("FF4A00"), Helpers.MakeColor("555555"), delegate(string id, string text)
				{
					_self.menus.items["Filter"].properties["group"] = text;
					((MonoBehaviour)_self).StartCoroutine(BuildGroupsMenu(menus, assets));
				});
				contents.Add(filter1.id, filter1);
				IMenuItem label2 = new MenuLabel("Filter.Asset.Label", 20, 140, 200f, 25f, 16f, "Asset Filter", Helpers.MakeColor("FF4A00"), null, delegate(string id, string text)
				{
					_self.menus.items["Filter"].properties["group"] = text;
					((MonoBehaviour)_self).StartCoroutine(BuildGroupsMenu(menus, assets));
				});
				contents.Add(label2.id, label2);
				IMenuItem filter2 = new MenuTextInput("Filter.Asset", 20, 200, 200f, 25f, 16f, "", Helpers.MakeColor("FF4A00"), Helpers.MakeColor("555555"), delegate(string id, string text)
				{
					_self.menus.items["Filter"].properties["asset"] = text;
					((MonoBehaviour)_self).StartCoroutine(BuildAssetsMenu(menus, assets));
				});
				contents.Add(filter2.id, filter2);
				string currentState = ((!_self.menus.items.ContainsKey("Filter")) ? "closed" : (_self.menus.items["Filter"].properties.ContainsKey("status") ? _self.menus.items["Filter"].properties["status"] : "closed"));
				Menu filterMenu = new Menu("Filter", 1675, 780, 245, 270, 235, 270)
				{
					properties = 
					{
						["backColor"] = "000000DD",
						["status"] = currentState
					},
					children = contents
				};
				while (_self.guiSafe != "")
				{
					LoggingPlugin.LogTrace("Waiting On " + _self.guiSafe + " To Finish");
					yield return (object)new WaitForEndOfFrame();
				}
				LoggingPlugin.LogTrace("Applying Filters Menu");
				_self.guiSafe = "BuildFiltersMenu";
				if (menus.items.ContainsKey(filterMenu.id))
				{
					menus.items[filterMenu.id] = filterMenu;
				}
				else
				{
					menus.items.Add(filterMenu.id, filterMenu);
				}
				_self.guiSafe = "";
			}

			public static IEnumerator BuildBadgeSizer(MenuCollection menus, Dictionary<string, AssetInfo> assets)
			{
				LoggingPlugin.LogDebug("Building Badge Sizer");
				Dictionary<string, IMenuItem> contents = new Dictionary<string, IMenuItem>();
				int initScrollPosition = (int)(((float)_self.assetBadgesPerRow.Value - 4f) * 320f / 22f);
				LoggingPlugin.LogTrace("ScrollPosition translates " + _self.assetBadgesPerRow.Value + " to " + initScrollPosition);
				IMenuItem scrollBar = new ScrollBar("BadgeSize.ScrollBar", 0, 0, 320f, 30f, 16f, 0f, 320 - initScrollPosition, 320f, Helpers.MakeColor("FF4A00"), Helpers.MakeColor("000000"), delegate(string id, string val)
				{
					_self.assetBadgesPerRow.Value = (int)((320f - float.Parse(val)) / 320f * 22f + 3f);
					((BaseUnityPlugin)_self).Config.Save();
					LoggingPlugin.LogTrace("Triggering Menu Refresh With " + _self.assetBadgesPerRow.Value + " Badges Per Row");
					((MonoBehaviour)_self).StartCoroutine(BuildAssetsMenu(menus, assets));
				});
				contents.Add(scrollBar.id, scrollBar);
				Menu badgeSizer = new Menu("BadgeSizer", 800, 750, 320, 30, 320, 30)
				{
					properties = { ["backColor"] = "000000DD" },
					children = contents
				};
				while (_self.guiSafe != "")
				{
					LoggingPlugin.LogTrace("Waiting On " + _self.guiSafe + " To Finish");
					yield return (object)new WaitForEndOfFrame();
				}
				LoggingPlugin.LogTrace("Applying Badge Sizer");
				_self.guiSafe = "BuildBadgeSizer";
				if (menus.items.ContainsKey(badgeSizer.id))
				{
					menus.items[badgeSizer.id] = badgeSizer;
				}
				else
				{
					menus.items.Add(badgeSizer.id, badgeSizer);
				}
				_self.guiSafe = "";
			}

			public static Dictionary<string, AssetInfo> RegisterAssets()
			{
				string text = Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/org.lordashes.plugins.commoncustomsmenu.assets.json";
				Dictionary<string, AssetInfo> dictionary = new Dictionary<string, AssetInfo>();
				if (File.Exists(text))
				{
					string text2 = File.ReadAllText(text, (CacheType)999);
					LoggingPlugin.LogDebug("Registered Assets Loaded");
					dictionary = JsonConvert.DeserializeObject<Dictionary<string, AssetInfo>>(text2);
				}
				else
				{
					LoggingPlugin.LogDebug("No Registered Assets File");
				}
				LoggingPlugin.LogDebug("Found " + dictionary.Keys.Count + " Registered Assets");
				foreach (KeyValuePair<string, Provider> provider in _self.providers)
				{
					try
					{
						LoggingPlugin.LogDebug("Consulting Provider " + provider.Key + " For Assets");
						((MonoBehaviour)_self).StartCoroutine(provider.Value.GetNewAssets(new ReadOnlyDictionary<string, AssetInfo>(dictionary), AssetsUpdate));
					}
					catch
					{
					}
				}
				return dictionary;
			}

			public static IEnumerator AssetsUpdate(Dictionary<string, AssetInfo> results)
			{
				while (_self.guiSafe != "")
				{
					LoggingPlugin.LogTrace("Waiting On " + _self.guiSafe + " To Finish");
					yield return (object)new WaitForEndOfFrame();
				}
				LoggingPlugin.LogDebug("Obtained Assets From Provider " + ((results.Count > 0) ? results.ElementAt(0).Value.provider : " Unknown"));
				_self.guiSafe = "AddingAssets";
				foreach (KeyValuePair<string, AssetInfo> result in results)
				{
					if (!_self.assets.ContainsKey(result.Key))
					{
						_self.assets.Add(result.Key, result.Value);
					}
				}
				_self.resposes++;
				LoggingPlugin.LogTrace("Writing Registered Assets File");
				string assetFile = Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/org.lordashes.plugins.commoncustomsmenu.assets.json";
				File.WriteAllText(assetFile, JsonConvert.SerializeObject((object)_self.assets, (Formatting)1), (CacheType)999);
				if (_self.rewriteScope != 0)
				{
					ApplyRewriter("org.lordashes.plugins.commoncustomsmenu.rewriter.json", ref _self.assets);
				}
				if ((int)LoggingPlugin.GetLogLevel() == 5)
				{
					File.WriteAllText(assetFile + ".memory", JsonConvert.SerializeObject((object)_self.assets, (Formatting)1), (CacheType)999);
				}
				_self.guiSafe = "";
				LoggingPlugin.LogTrace("Creating Filters Menu");
				((MonoBehaviour)_self).StartCoroutine(BuildFiltersMenu(_self.menus, _self.assets));
				LoggingPlugin.LogTrace("Creating Badge Sizer");
				((MonoBehaviour)_self).StartCoroutine(BuildBadgeSizer(_self.menus, _self.assets));
				LoggingPlugin.LogTrace("Creating Kinds Menu");
				((MonoBehaviour)_self).StartCoroutine(BuildKindsMenu(_self.menus, _self.assets));
				LoggingPlugin.LogTrace("Creating Groups Menu");
				((MonoBehaviour)_self).StartCoroutine(BuildGroupsMenu(_self.menus, _self.assets));
				LoggingPlugin.LogTrace("Creating Assets Menu");
				((MonoBehaviour)_self).StartCoroutine(BuildAssetsMenu(_self.menus, _self.assets));
			}

			private static void ApplyRewriter(string rewriterFile, ref Dictionary<string, AssetInfo> assets)
			{
				LoggingPlugin.LogDebug("Processing Rewrites");
				Dictionary<string, RewriteClause> dictionary = new Dictionary<string, RewriteClause>();
				try
				{
					string text = File.ReadAllText(rewriterFile, (CacheType)999);
					dictionary = JsonConvert.DeserializeObject<Dictionary<string, RewriteClause>>(text);
				}
				catch
				{
				}
				LoggingPlugin.LogTrace("Rewrites Has " + dictionary.Count + " Clauses");
				foreach (KeyValuePair<string, AssetInfo> asset in assets)
				{
					string text2 = "";
					if ((_self.rewriteScope & 1) > 0)
					{
						text2 = text2 + asset.Value.name + "|";
					}
					if ((_self.rewriteScope & 2) > 0)
					{
						text2 = text2 + asset.Value.description + "|";
					}
					if ((_self.rewriteScope & 4) > 0)
					{
						text2 = text2 + asset.Value.tags + "|";
					}
					if ((_self.rewriteScope & 8) > 0)
					{
						text2 = text2 + asset.Value.pack + "|";
					}
					if ((_self.rewriteScope & 0x10) > 0)
					{
						text2 = text2 + asset.Value.prefab + "|";
					}
					LoggingPlugin.LogTrace("Processing Item " + text2);
					text2 = text2.ToUpper();
					foreach (KeyValuePair<string, RewriteClause> item in dictionary)
					{
						LoggingPlugin.LogTrace("Processing Clause " + item.Key);
						if (text2.Contains(item.Key.ToUpper()))
						{
							LoggingPlugin.LogTrace("Clause Match");
							if (item.Value.kind != null)
							{
								asset.Value.kind = item.Value.kind;
							}
							if (item.Value.category != null)
							{
								asset.Value.category = item.Value.category;
							}
							if (item.Value.prefix != null)
							{
								asset.Value.name = item.Value.prefix + " " + asset.Value.name;
							}
							if (item.Value.suffix != null)
							{
								asset.Value.name = asset.Value.name + " " + item.Value.suffix;
							}
						}
					}
				}
			}
		}

		public interface IMenuItem
		{
			string id { get; set; }

			Rect position { get; set; }

			Dictionary<string, string> properties { get; set; }

			Dictionary<string, IMenuItem> children { get; set; }

			Action<string, string> Trigger { get; set; }

			void Draw(int canvas_x, int canvas_y, bool active = false);
		}

		public class Menu : IMenuItem
		{
			private IMenuItem _scrollbar = null;

			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>();


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger
			{
				get
				{
					return null;
				}
				set
				{
					throw new NotSupportedException();
				}
			}

			public Menu(string id, int x, int y, int width, int height, int canvas_width, int canvas_height)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0207: Unknown result type (might be due to invalid IL or missing references)
				//IL_0216: Unknown result type (might be due to invalid IL or missing references)
				Menu menu = this;
				this.id = id;
				position = new Rect((float)x, (float)y, (float)width, (float)height);
				properties["animationOffsetX"] = "0";
				properties["animationOffsetY"] = "0";
				properties["animationStep"] = "0";
				properties["status"] = "closed";
				properties["themeApplied"] = "false";
				properties["canvas_x"] = "0";
				properties["canvas_y"] = "0";
				LoggingPlugin.LogTrace(this.id + ": Viewport Height: " + height + ", Canvas Height: " + canvas_height + ", Scrollbar: " + (canvas_height > height));
				if (canvas_height > height)
				{
					string text = this.id + ".ScrollBar";
					Rect val = position;
					int x2 = (int)(((Rect)(ref val)).x + (float)width - 10f);
					val = position;
					_scrollbar = new ScrollBar(text, x2, (int)((Rect)(ref val)).y, 10f, height, 10f, 0f, canvas_height - height + 10, canvas_height - height + 10, Helpers.MakeColor("FF4A00"), Helpers.MakeColor("000000"), delegate(string _id, string _value)
					{
						int num = canvas_height - height - (int)float.Parse(_value);
						menu.properties["canvas_y"] = (-1 * num).ToString();
					});
					properties["canvas_y"] = (-1 * (canvas_height - height)).ToString();
				}
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_092a: Unknown result type (might be due to invalid IL or missing references)
				//IL_092f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0956: Unknown result type (might be due to invalid IL or missing references)
				//IL_095b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0982: Unknown result type (might be due to invalid IL or missing references)
				//IL_0987: Unknown result type (might be due to invalid IL or missing references)
				//IL_0997: Unknown result type (might be due to invalid IL or missing references)
				//IL_099c: Unknown result type (might be due to invalid IL or missing references)
				//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_09de: Unknown result type (might be due to invalid IL or missing references)
				//IL_09ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a0e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a21: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a26: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Expected O, but got Unknown
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Expected O, but got Unknown
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a62: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
				//IL_0acb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ad0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0aee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0af3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b11: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b16: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b34: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b39: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b58: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b5d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b67: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b6c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b8d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b92: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b9c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ba1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bc0: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Expected O, but got Unknown
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0162: Expected O, but got Unknown
				//IL_0169: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0418: Unknown result type (might be due to invalid IL or missing references)
				//IL_041d: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0516: Unknown result type (might be due to invalid IL or missing references)
				//IL_051b: Unknown result type (might be due to invalid IL or missing references)
				//IL_068e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0693: Unknown result type (might be due to invalid IL or missing references)
				//IL_061a: Unknown result type (might be due to invalid IL or missing references)
				//IL_061f: Unknown result type (might be due to invalid IL or missing references)
				//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0703: Unknown result type (might be due to invalid IL or missing references)
				if (properties.ContainsKey("status") && properties["status"] == "closed")
				{
					return;
				}
				Color black;
				if (properties["themeApplied"] != "true")
				{
					black = Color.black;
					ColorUtility.TryParseHtmlString(properties.ContainsKey("scrollBar") ? ("#" + properties["scrollBar"]) : "#000000FF", ref black);
					GUIStyle val = new GUIStyle(GUI.skin.verticalScrollbar);
					GUIStyle val2 = new GUIStyle(GUI.skin.horizontalScrollbar);
					val.normal.background = Helpers.MakeTexture(black);
					val2.normal.background = Helpers.MakeTexture(black);
					GUI.skin.verticalScrollbar = val;
					GUI.skin.horizontalScrollbar = val2;
					ColorUtility.TryParseHtmlString(properties.ContainsKey("scrollBarThumb") ? ("#" + properties["scrollBarThumb"]) : "#FA4400FF", ref black);
					GUIStyle val3 = new GUIStyle(GUI.skin.verticalScrollbarThumb);
					GUIStyle val4 = new GUIStyle(GUI.skin.horizontalScrollbarThumb);
					val3.normal.background = Helpers.MakeTexture(black);
					val4.normal.background = Helpers.MakeTexture(black);
					GUI.skin.verticalScrollbarThumb = val3;
					GUI.skin.horizontalScrollbarThumb = val4;
					properties["themeApplied"] = "true";
				}
				Rect val5;
				if (int.Parse(properties["animationStep"]) != 0)
				{
					LoggingPlugin.LogTrace("Status: " + (properties.ContainsKey("status") ? properties["status"] : "None") + ", AnimationStep: " + properties["animationStep"] + ", OX: " + properties["animationOffsetX"] + ", OY: " + properties["animationOffsetY"]);
					if (int.Parse(properties["animationOffsetX"]) != 0)
					{
						properties["animationOffsetX"] = (int.Parse(properties["animationOffsetX"]) + int.Parse(properties["animationStep"])).ToString();
					}
					else if (int.Parse(properties["animationOffsetY"]) != 0)
					{
						properties["animationOffsetY"] = (int.Parse(properties["animationOffsetY"]) + int.Parse(properties["animationStep"])).ToString();
					}
					if (properties.ContainsKey("status") && properties["status"] == "closing")
					{
						if (int.Parse(properties["animationOffsetX"]) < 0)
						{
							float num = int.Parse(properties["animationOffsetX"]);
							val5 = position;
							if (num <= -1f * ((Rect)(ref val5)).width)
							{
								LoggingPlugin.LogDebug("Menu " + id + " Viewport Closed (Left Side)");
								properties["animationStep"] = "0";
								Dictionary<string, string> dictionary = properties;
								val5 = position;
								dictionary["animationOffsetX"] = (-1f * ((Rect)(ref val5)).width).ToString();
								properties["animationOffsetY"] = "0";
								properties["status"] = "closed";
								_self.menus.properties.Remove("menuSpeed");
							}
						}
						else if (int.Parse(properties["animationOffsetX"]) > 0)
						{
							float num2 = int.Parse(properties["animationOffsetX"]);
							val5 = position;
							if (num2 >= ((Rect)(ref val5)).width)
							{
								LoggingPlugin.LogDebug("Menu " + id + " Viewport Closed (Right Side)");
								properties["animationStep"] = "0";
								Dictionary<string, string> dictionary2 = properties;
								val5 = position;
								dictionary2["animationOffsetX"] = ((Rect)(ref val5)).width.ToString();
								properties["animationOffsetY"] = "0";
								properties["status"] = "closed";
							}
						}
						else if (int.Parse(properties["animationOffsetY"]) < 0)
						{
							float num3 = int.Parse(properties["animationOffsetY"]);
							val5 = position;
							if (num3 <= -1f * ((Rect)(ref val5)).height)
							{
								LoggingPlugin.LogDebug("Menu " + id + " Viewport Closed (Top Side)");
								properties["animationStep"] = "0";
								properties["animationOffsetX"] = "0";
								Dictionary<string, string> dictionary3 = properties;
								val5 = position;
								dictionary3["animationOffsetY"] = (-1f * ((Rect)(ref val5)).height).ToString();
								properties["status"] = "closed";
							}
						}
						else if (int.Parse(properties["animationOffsetY"]) > 0)
						{
							float num4 = int.Parse(properties["animationOffsetY"]);
							val5 = position;
							if (num4 >= ((Rect)(ref val5)).height)
							{
								LoggingPlugin.LogDebug("Menu " + id + " Viewport Closed (Bottom Side)");
								properties["animationStep"] = "0";
								properties["animationOffsetX"] = "0";
								Dictionary<string, string> dictionary4 = properties;
								val5 = position;
								dictionary4["animationOffsetY"] = ((Rect)(ref val5)).height.ToString();
								properties["status"] = "closed";
							}
						}
					}
					else if (properties.ContainsKey("status") && properties["status"] == "opening")
					{
						if (int.Parse(properties["animationOffsetX"]) != 0)
						{
							if (Math.Abs(int.Parse(properties["animationOffsetX"])) <= Math.Abs(int.Parse(properties["animationStep"])))
							{
								LoggingPlugin.LogDebug("Menu " + id + " Viewport Opened (From Left/Right)");
								properties["animationStep"] = "0";
								properties["animationOffsetX"] = "0";
								properties["animationOffsetY"] = "0";
								properties["status"] = "opened";
							}
						}
						else if (int.Parse(properties["animationOffsetY"]) != 0 && Math.Abs(int.Parse(properties["animationOffsetY"])) <= Math.Abs(int.Parse(properties["animationStep"])))
						{
							LoggingPlugin.LogDebug("Menu " + id + " Viewport Opened (From Top/Bottom)");
							properties["animationStep"] = "0";
							properties["animationOffsetX"] = "0";
							properties["animationOffsetY"] = "0";
							properties["status"] = "opened";
						}
					}
				}
				val5 = position;
				float num5 = ((Rect)(ref val5)).x + (float)int.Parse(properties["animationOffsetX"]) - 10f;
				val5 = position;
				float num6 = ((Rect)(ref val5)).y + (float)int.Parse(properties["animationOffsetY"]) - 10f;
				val5 = position;
				float num7 = ((Rect)(ref val5)).width + 20f;
				val5 = position;
				Rect val6 = default(Rect);
				((Rect)(ref val6))..ctor(num5, num6, num7, ((Rect)(ref val5)).height + 20f);
				val5 = position;
				float num8 = ((Rect)(ref val5)).x + (float)int.Parse(properties["animationOffsetX"]);
				val5 = position;
				float num9 = ((Rect)(ref val5)).y + (float)int.Parse(properties["animationOffsetY"]);
				val5 = position;
				float width = ((Rect)(ref val5)).width;
				val5 = position;
				Rect val7 = default(Rect);
				((Rect)(ref val7))..ctor(num8, num9, width, ((Rect)(ref val5)).height);
				black = Color.clear;
				ColorUtility.TryParseHtmlString(properties.ContainsKey("backColor") ? ("#" + properties["backColor"]) : "#00000000", ref black);
				GUI.DrawTexture(val6, (Texture)(object)Helpers.MakeTexture(black));
				if (_scrollbar != null)
				{
					_scrollbar.Draw(int.Parse(properties["animationOffsetX"]), int.Parse(properties["animationOffsetY"]));
				}
				string[] obj = new string[12]
				{
					"ClipArea: ", null, null, null, null, null, null, null, null, null,
					null, null
				};
				val5 = position;
				obj[1] = ((Rect)(ref val5)).x.ToString();
				obj[2] = ",";
				val5 = position;
				obj[3] = ((Rect)(ref val5)).y.ToString();
				obj[4] = " + ";
				val5 = position;
				obj[5] = ((Rect)(ref val5)).width.ToString();
				obj[6] = ",";
				val5 = position;
				obj[7] = ((Rect)(ref val5)).height.ToString();
				obj[8] = " => ";
				val5 = position;
				float x = ((Rect)(ref val5)).x;
				val5 = position;
				obj[9] = (x + ((Rect)(ref val5)).width).ToString();
				obj[10] = ",";
				val5 = position;
				float y = ((Rect)(ref val5)).y;
				val5 = position;
				obj[11] = (y + ((Rect)(ref val5)).height).ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				GUI.BeginGroup(val7);
				foreach (IMenuItem value in children.Values)
				{
					try
					{
						bool active2 = active || (properties.ContainsKey("selected") && properties["selected"] == value.id);
						LoggingPlugin.LogTrace("Menu " + id + " Drawing " + value.id + ", Selected: " + (properties.ContainsKey("selected") ? properties["selected"] : "None") + " => Active: " + active + " + Selected: " + (properties.ContainsKey("selected") ? properties["selected"] : "None") + " = Result: " + active2);
						value.Draw(int.Parse(properties["canvas_x"]), int.Parse(properties["canvas_y"]), active2);
					}
					catch
					{
					}
				}
				GUI.EndGroup();
			}

			public void Open(bool instant = false)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				properties["animationOffsetX"] = "0";
				Dictionary<string, string> dictionary = properties;
				float num = Screen.height;
				Rect val = position;
				dictionary["animationOffsetY"] = (num - ((Rect)(ref val)).y).ToString();
				properties["animationStep"] = (instant ? "-100" : "-10");
				properties["status"] = "opening";
				LoggingPlugin.LogDebug("Opening Menu " + id + " At Speed " + properties["animationStep"]);
			}

			public void Close(bool instant = false)
			{
				properties["animationOffsetX"] = "0";
				properties["animationOffsetY"] = "5";
				properties["animationStep"] = (instant ? "100" : "10");
				properties["status"] = "closing";
				LoggingPlugin.LogDebug("Closing Menu " + id + " At Speed " + properties["animationStep"]);
			}

			public void Scroll(float percentage)
			{
				((ScrollBar)_scrollbar).Scroll(percentage);
			}
		}

		public class MenuCollection
		{
			public Dictionary<string, IMenuItem> items = new Dictionary<string, IMenuItem>();

			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>();


			public void Draw()
			{
				foreach (KeyValuePair<string, IMenuItem> item in items)
				{
					LoggingPlugin.LogTrace("Drawing Menu " + item.Value.id);
					item.Value.Draw(0, 0);
				}
			}
		}

		public class MenuBadge : IMenuItem
		{
			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger
			{
				get
				{
					return null;
				}
				set
				{
					throw new NotSupportedException();
				}
			}

			public MenuBadge(string id, int x, int y, float width, float height, float size, string textureName, string selectedTextureName, string selectionInfo, string text, Color? textColor, Color? selectedTextColor, Color? backColor, Color? selectedBackColor, Action<string, string> callback, Action<string, string, int, int> mouseOverCallback)
			{
				//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_004a: 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_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: 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_00ad: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				string text2 = this.id + ".icon";
				Rect val = position;
				int x2 = (int)((Rect)(ref val)).x;
				val = position;
				IMenuItem menuItem = new MenuTexture(text2, x2, (int)((Rect)(ref val)).y, width, height, textureName, selectedTextureName, selectionInfo, callback, mouseOverCallback);
				string text3 = this.id + ".label";
				val = position;
				int x3 = (int)((Rect)(ref val)).x;
				val = position;
				IMenuItem menuItem2 = new MenuLabel(text3, x3, (int)((Rect)(ref val)).y + (int)height, width, 23f, size, text, textColor, backColor, callback);
				children.Add(menuItem.id, menuItem);
				children.Add(menuItem2.id, menuItem2);
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//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)
				string[] obj = new string[6] { "Drawing Badge ", id, ". Position: ", null, null, null };
				Rect val = position;
				obj[3] = ((Rect)(ref val)).x.ToString();
				obj[4] = ",";
				val = position;
				obj[5] = ((Rect)(ref val)).y.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class MenuLabel : IMenuItem
		{
			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public MenuLabel(string id, int x, int y, float width, float height, float fontSize, string text, Color? textColor, Color? backColor, Action<string, string> callback)
			{
				//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_0051: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				properties["fontSize"] = ((fontSize != 0f) ? fontSize.ToString() : "<Default>");
				properties["text"] = text;
				properties["fontColor"] = (textColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(textColor.Value)) : "<Default>");
				properties["backColor"] = (backColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(backColor.Value)) : "<Default>");
				Trigger = callback;
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: 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_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: 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_021e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: 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_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				GUIStyle val = new GUIStyle(GUI.skin.label);
				Color black = default(Color);
				if (properties["fontColor"] != "<Default>")
				{
					black = Color.black;
					val.active.background = Helpers.MakeTexture(Color.clear);
					val.normal.background = Helpers.MakeTexture(Color.clear);
					ColorUtility.TryParseHtmlString(properties["fontColor"], ref black);
					val.active.textColor = black;
					val.normal.textColor = black;
					LoggingPlugin.LogTrace(id + ": Using Text Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				if (properties["backColor"] != "<Default>")
				{
					ColorUtility.TryParseHtmlString(properties["backColor"], ref black);
					val.active.background = Helpers.MakeTexture(black);
					val.normal.background = Helpers.MakeTexture(black);
					LoggingPlugin.LogTrace(id + ": Using Back Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				string[] obj = new string[10] { "Drawing Menu Entry ", id, ". Position: ", null, null, null, null, null, null, null };
				Rect val2 = position;
				obj[3] = ((Rect)(ref val2)).x.ToString();
				obj[4] = ",";
				val2 = position;
				obj[5] = ((Rect)(ref val2)).y.ToString();
				obj[6] = ", Size: ";
				val2 = position;
				obj[7] = ((Rect)(ref val2)).width.ToString();
				obj[8] = "x";
				val2 = position;
				obj[9] = ((Rect)(ref val2)).height.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				val2 = position;
				float num = ((Rect)(ref val2)).x + (float)canvas_x;
				val2 = position;
				float num2 = ((Rect)(ref val2)).y + (float)canvas_y;
				val2 = position;
				float width = ((Rect)(ref val2)).width;
				val2 = position;
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(num, num2, width, ((Rect)(ref val2)).height);
				GUI.Label(val3, properties["text"], val);
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class MenuSelectableText : IMenuItem
		{
			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public MenuSelectableText(string id, int x, int y, float width, float height, float fontSize, string text, string selectionInfo, Color? textColor, Color? selectedTextColor, Color? backColor, Color? selectedBackColor, Color? fillColor, Color? selectedFillColor, Action<string, string> callback)
			{
				//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_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: 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)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				string text2 = this.id + ".Marker";
				Rect val = position;
				int x2 = (int)((Rect)(ref val)).x;
				val = position;
				IMenuItem menuItem = new MenuRectangle(text2, x2, (int)((Rect)(ref val)).y, 10f, 30f, selectionInfo, fillColor, selectedFillColor, null);
				children.Add(menuItem.id, menuItem);
				string text3 = this.id + ".Text";
				val = position;
				int x3 = (int)((Rect)(ref val)).x + 10;
				val = position;
				IMenuItem menuItem2 = new MenuText(text3, x3, (int)((Rect)(ref val)).y, width - 10f, height, fontSize, text, selectionInfo, textColor, selectedTextColor, backColor, selectedBackColor, callback);
				children.Add(menuItem2.id, menuItem2);
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class MenuText : IMenuItem
		{
			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public MenuText(string id, int x, int y, float width, float height, float fontSize, string text, string selectionInfo, Color? textColor, Color? selectedTextColor, Color? backColor, Color? selectedBackColor, Action<string, string> callback)
			{
				//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_0051: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				properties["fontSize"] = ((fontSize != 0f) ? fontSize.ToString() : "<Default>");
				properties["text"] = text;
				properties["fontColor"] = (textColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(textColor.Value)) : "<Default>");
				properties["selectedColor"] = (selectedTextColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(selectedTextColor.Value)) : "<Default>");
				properties["backColor"] = (backColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(backColor.Value)) : "<Default>");
				properties["selectedBackColor"] = (selectedBackColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(selectedBackColor.Value)) : "<Default>");
				properties["selectionInfo"] = selectionInfo;
				Trigger = callback;
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0211: Unknown result type (might be due to invalid IL or missing references)
				//IL_0216: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_025c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: Unknown result type (might be due to invalid IL or missing references)
				//IL_026f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0274: Unknown result type (might be due to invalid IL or missing references)
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_0287: 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_0296: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				GUIStyle val = new GUIStyle(GUI.skin.button);
				if (properties["backColor"] != "<Default>" && properties["selectedBackColor"] != "<Default>")
				{
					Color black = Color.black;
					ColorUtility.TryParseHtmlString(active ? properties["selectedBackColor"] : properties["backColor"], ref black);
					val.active.background = Helpers.MakeTexture(black);
					val.normal.background = Helpers.MakeTexture(black);
					LoggingPlugin.LogTrace(id + ": Using Background Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				if (properties["fontColor"] != "<Default>" && properties["selectedColor"] != "<Default>")
				{
					Color black = Color.black;
					ColorUtility.TryParseHtmlString(active ? properties["selectedColor"] : properties["fontColor"], ref black);
					val.active.textColor = black;
					val.normal.textColor = black;
					LoggingPlugin.LogTrace(id + ": Using Text Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				val.alignment = (TextAnchor)3;
				val.fontStyle = (FontStyle)1;
				string[] obj = new string[14]
				{
					"Drawing Menu Text ", id, ". Position: ", null, null, null, null, null, null, null,
					null, null, null, null
				};
				Rect val2 = position;
				obj[3] = ((Rect)(ref val2)).x.ToString();
				obj[4] = ",";
				val2 = position;
				obj[5] = ((Rect)(ref val2)).y.ToString();
				obj[6] = " + ";
				obj[7] = canvas_x.ToString();
				obj[8] = ",";
				obj[9] = canvas_y.ToString();
				obj[10] = ", Size: ";
				val2 = position;
				obj[11] = ((Rect)(ref val2)).width.ToString();
				obj[12] = "x";
				val2 = position;
				obj[13] = ((Rect)(ref val2)).height.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				val2 = position;
				float num = ((Rect)(ref val2)).x + (float)canvas_x;
				val2 = position;
				float num2 = ((Rect)(ref val2)).y + (float)canvas_y;
				val2 = position;
				float width = ((Rect)(ref val2)).width;
				val2 = position;
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(num, num2, width, ((Rect)(ref val2)).height);
				if (GUI.Button(val3, properties["text"], val) && Trigger != null)
				{
					Trigger(id, properties["selectionInfo"]);
				}
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class MenuRectangle : IMenuItem
		{
			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public MenuRectangle(string id, int x, int y, float width, float height, string selectionInfo, Color? fillColor, Color? selectedFillColor, Action<string, string> callback)
			{
				//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_0051: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				properties["fillColor"] = (fillColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(fillColor.Value)) : "<Default>");
				properties["selectedFillColor"] = (selectedFillColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(selectedFillColor.Value)) : "<Default>");
				properties["selectionInfo"] = selectionInfo;
				Trigger = callback;
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: 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_0054: 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)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				GUIStyle val = new GUIStyle(GUI.skin.button);
				if (properties["fillColor"] != "<Default>" && properties["selectedFillColor"] != "<Default>")
				{
					Color black = Color.black;
					ColorUtility.TryParseHtmlString(active ? properties["selectedFillColor"] : properties["fillColor"], ref black);
					val.normal.background = Helpers.MakeTexture(black);
					LoggingPlugin.LogTrace(id + ": Using Fill Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				string[] obj = new string[10] { "Drawing Rectangle ", id, ". Position: ", null, null, null, null, null, null, null };
				Rect val2 = position;
				obj[3] = ((Rect)(ref val2)).x.ToString();
				obj[4] = ",";
				val2 = position;
				obj[5] = ((Rect)(ref val2)).y.ToString();
				obj[6] = ", Size: ";
				val2 = position;
				obj[7] = ((Rect)(ref val2)).width.ToString();
				obj[8] = "x";
				val2 = position;
				obj[9] = ((Rect)(ref val2)).height.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				val2 = position;
				float num = ((Rect)(ref val2)).x + (float)canvas_x;
				val2 = position;
				float num2 = ((Rect)(ref val2)).y + (float)canvas_y;
				val2 = position;
				float width = ((Rect)(ref val2)).width;
				val2 = position;
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(num, num2, width, ((Rect)(ref val2)).height);
				if (GUI.Button(val3, "", val) && Trigger != null)
				{
					Trigger(id, properties["selectionInfo"]);
				}
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class MenuTextInput : IMenuItem
		{
			private string _inputText = string.Empty;

			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public MenuTextInput(string id, int x, int y, float width, float height, float fontSize, string text, Color? textColor, Color? backColor, Action<string, string> callback)
			{
				//IL_0017: 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_005c: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				properties["fontSize"] = ((fontSize != 0f) ? fontSize.ToString() : "<Default>");
				_inputText = text;
				properties["fontColor"] = (textColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(textColor.Value)) : "<Default>");
				properties["backColor"] = (backColor.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(backColor.Value)) : "<Default>");
				Trigger = callback;
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0032: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Unknown result type (might be due to invalid IL or missing references)
				//IL_0207: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: 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_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				//IL_024a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: 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_00e7: 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)
				GUIStyle val = new GUIStyle(GUI.skin.textField);
				if (properties["backColor"] != "<Default>")
				{
					Color black = Color.black;
					ColorUtility.TryParseHtmlString(properties["backColor"], ref black);
					val.active.background = Helpers.MakeTexture(black);
					val.normal.background = Helpers.MakeTexture(black);
					LoggingPlugin.LogTrace(id + ": Using Background Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				if (properties["fontColor"] != "<Default>")
				{
					Color black = Color.black;
					ColorUtility.TryParseHtmlString(properties["fontColor"], ref black);
					val.active.textColor = black;
					val.normal.textColor = black;
					LoggingPlugin.LogTrace(id + ": Using Text Color: " + ColorUtility.ToHtmlStringRGBA(black));
				}
				val.alignment = (TextAnchor)3;
				val.fontStyle = (FontStyle)1;
				string[] obj = new string[14]
				{
					"Drawing Menu Text Input ", id, ". Position: ", null, null, null, null, null, null, null,
					null, null, null, null
				};
				Rect val2 = position;
				obj[3] = ((Rect)(ref val2)).x.ToString();
				obj[4] = ",";
				val2 = position;
				obj[5] = ((Rect)(ref val2)).y.ToString();
				obj[6] = " + ";
				obj[7] = canvas_x.ToString();
				obj[8] = ",";
				obj[9] = canvas_y.ToString();
				obj[10] = ", Size: ";
				val2 = position;
				obj[11] = ((Rect)(ref val2)).width.ToString();
				obj[12] = "x";
				val2 = position;
				obj[13] = ((Rect)(ref val2)).height.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				GUI.SetNextControlName(id);
				val2 = position;
				float num = ((Rect)(ref val2)).x + (float)canvas_x;
				val2 = position;
				float num2 = ((Rect)(ref val2)).y + (float)canvas_y;
				val2 = position;
				float width = ((Rect)(ref val2)).width;
				val2 = position;
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(num, num2, width, ((Rect)(ref val2)).height);
				string text = GUI.TextField(val3, _inputText, val);
				if (_inputText != text)
				{
					_inputText = text;
					Trigger(id, text);
				}
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class MenuTexture : IMenuItem
		{
			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public Action<string, string, int, int> MouseOver { get; set; } = null;


			private string _mouseOverName { get; set; } = "";


			public MenuTexture(string id, int x, int y, float width, float height, string textureName, string selectedTextureName, string selectionInfo, Action<string, string> callback, Action<string, string, int, int> mouseOverCallback = null)
			{
				//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_0063: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				properties["textureName"] = textureName;
				properties["selectedTextureName"] = selectedTextureName;
				properties["selectionInfo"] = selectionInfo;
				Trigger = callback;
				Trigger = callback;
				MouseOver = mouseOverCallback;
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//IL_0051: 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)
				//IL_0073: 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_0096: 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_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: 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_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_026e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0275: Unknown result type (might be due to invalid IL or missing references)
				string[] obj = new string[14]
				{
					"Drawing Texture ",
					id,
					" (",
					properties["textureName"],
					"). Active: ",
					active.ToString(),
					", Position: ",
					null,
					null,
					null,
					null,
					null,
					null,
					null
				};
				Rect val = position;
				obj[7] = ((Rect)(ref val)).x.ToString();
				obj[8] = ",";
				val = position;
				obj[9] = ((Rect)(ref val)).y.ToString();
				obj[10] = ", Size: ";
				val = position;
				obj[11] = ((Rect)(ref val)).width.ToString();
				obj[12] = "x";
				val = position;
				obj[13] = ((Rect)(ref val)).height.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				val = position;
				float num = ((Rect)(ref val)).x + (float)canvas_x;
				val = position;
				float num2 = ((Rect)(ref val)).y + (float)canvas_y;
				val = position;
				float width = ((Rect)(ref val)).width;
				val = position;
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(num, num2, width, ((Rect)(ref val)).height);
				if (GUI.Button(val2, "") && Trigger != null)
				{
					Trigger(id, properties["selectionInfo"]);
				}
				GUI.DrawTexture(val2, (Texture)(object)(active ? Helpers.GetTexture(properties["selectedTextureName"]) : Helpers.GetTexture(properties["textureName"])));
				Vector2 mousePosition = Event.current.mousePosition;
				if (((Rect)(ref val2)).Contains(mousePosition) && _mouseOverName == "")
				{
					_mouseOverName = id;
					if (MouseOver != null)
					{
						MouseOver(id, properties["textureName"], (int)mousePosition.x, (int)mousePosition.y);
					}
				}
				else if (!((Rect)(ref val2)).Contains(mousePosition) && _mouseOverName != "")
				{
					_mouseOverName = "";
					if (MouseOver != null)
					{
						MouseOver(id, "", (int)mousePosition.x, (int)mousePosition.y);
					}
				}
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}
		}

		public class ScrollBar : IMenuItem
		{
			private float _scrollPosition = 0f;

			public string id { get; set; } = "";


			public Rect position { get; set; } = Rect.zero;


			public Dictionary<string, string> properties { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);


			public Dictionary<string, IMenuItem> children { get; set; } = new Dictionary<string, IMenuItem>();


			public Action<string, string> Trigger { get; set; } = null;


			public ScrollBar(string id, int x, int y, float width, float height, float size, float min, float value, float max, Color? slider, Color? scrollBar, Action<string, string> callback)
			{
				//IL_0017: 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_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0108: Unknown result type (might be due to invalid IL or missing references)
				this.id = id;
				position = new Rect((float)x, (float)y, width, height);
				properties["size"] = size.ToString();
				properties["min"] = min.ToString();
				properties["max"] = max.ToString();
				properties["slider"] = (slider.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(slider.Value)) : "<Default>");
				properties["scrollBar"] = (scrollBar.HasValue ? ("#" + ColorUtility.ToHtmlStringRGBA(scrollBar.Value)) : "<Default>");
				Trigger = callback;
				properties["themeApplied"] = "false";
				_scrollPosition = value;
				LoggingPlugin.LogTrace("Creating ScrollBar " + this.id + " With " + min + "<" + value + "<" + max);
			}

			public void Draw(int canvas_x, int canvas_y, bool active = false)
			{
				//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_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_0208: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: 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_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_0249: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_025d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: 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_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Expected O, but got Unknown
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: 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_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: Expected O, but got Unknown
				//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
				float num = 0f;
				string[] obj = new string[10] { "Drawing ScrollBar ", id, ". Position: ", null, null, null, null, null, null, null };
				Rect val = position;
				obj[3] = ((Rect)(ref val)).x.ToString();
				obj[4] = ",";
				val = position;
				obj[5] = ((Rect)(ref val)).y.ToString();
				obj[6] = ", Size: ";
				val = position;
				obj[7] = ((Rect)(ref val)).width.ToString();
				obj[8] = "x";
				val = position;
				obj[9] = ((Rect)(ref val)).height.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				if (properties["themeApplied"] != "true")
				{
					if (properties["scrollBar"] != "<Default>")
					{
						Color black = Color.black;
						ColorUtility.TryParseHtmlString(properties["scrollBar"], ref black);
						GUIStyle val2 = new GUIStyle(GUI.skin.verticalScrollbar);
						val2.normal.background = Helpers.MakeTexture(black);
						GUI.skin.verticalScrollbar = val2;
						GUI.skin.horizontalScrollbar = val2;
					}
					if (properties["slider"] != "<Default>")
					{
						Color black2 = Color.black;
						ColorUtility.TryParseHtmlString(properties["slider"], ref black2);
						GUIStyle val3 = new GUIStyle(GUI.skin.verticalScrollbarThumb);
						val3.normal.background = Helpers.MakeTexture(black2);
						GUI.skin.verticalScrollbarThumb = val3;
						GUI.skin.horizontalScrollbarThumb = val3;
					}
					properties["themeApplied"] = "true";
				}
				val = position;
				float num2 = ((Rect)(ref val)).x + (float)canvas_x;
				val = position;
				float num3 = ((Rect)(ref val)).y + (float)canvas_y;
				val = position;
				float width = ((Rect)(ref val)).width;
				val = position;
				Rect val4 = default(Rect);
				((Rect)(ref val4))..ctor(num2, num3, width, ((Rect)(ref val)).height);
				val = position;
				float height = ((Rect)(ref val)).height;
				val = position;
				num = ((!(height >= ((Rect)(ref val)).width)) ? GUI.HorizontalScrollbar(val4, _scrollPosition, float.Parse(properties["size"], CultureInfo.InvariantCulture), float.Parse(properties["max"], CultureInfo.InvariantCulture), float.Parse(properties["min"], CultureInfo.InvariantCulture)) : GUI.VerticalScrollbar(val4, _scrollPosition, float.Parse(properties["size"], CultureInfo.InvariantCulture), float.Parse(properties["max"], CultureInfo.InvariantCulture), float.Parse(properties["min"], CultureInfo.InvariantCulture)));
				if (num != _scrollPosition)
				{
					_scrollPosition = num;
					if (Trigger != null)
					{
						Trigger(id, _scrollPosition.ToString());
					}
					LoggingPlugin.LogTrace("ScrollBar " + id + " Scrolled To " + properties["min"] + "<" + num + "<" + properties["max"]);
				}
				foreach (IMenuItem value in children.Values)
				{
					value.Draw(canvas_x, canvas_y, active);
				}
			}

			public void Scroll(float percentage)
			{
				_scrollPosition = percentage * float.Parse(properties["max"]) / 100f;
			}
		}
	}

	public static class SafeCalls
	{
		public static bool InvokeWithSuccessBool(string methodOwner, string method, object[] parameters, object instance = null)
		{
			try
			{
				Type type = Type.GetType(methodOwner);
				int num = 0;
				Exception ex = null;
				MethodInfo[] array = (from mi in type.GetRuntimeMethods()
					where mi.Name == method
					select mi).ToArray();
				MethodInfo[] array2 = array;
				foreach (MethodInfo methodInfo in array2)
				{
					try
					{
						methodInfo.Invoke(instance, parameters);
					}
					catch (Exception ex2)
					{
						num++;
						ex = ex2;
					}
				}
				if (num == array.Length)
				{
					return false;
				}
				return true;
			}
			catch (Exception ex3)
			{
				LoggingPlugin.LogWarning("Exception Calling " + methodOwner + "." + method);
				LoggingPlugin.LogWarning("Exception Details: " + ex3.Message);
				return false;
			}
		}

		public static void Invoke(string methodOwner, string method, object[] parameters, object instance = null)
		{
			try
			{
				Type type = Type.GetType(methodOwner);
				int num = 0;
				Exception ex = null;
				MethodInfo[] array = (from mi in type.GetRuntimeMethods()
					where mi.Name == method
					select mi).ToArray();
				MethodInfo[] array2 = array;
				foreach (MethodInfo methodInfo in array2)
				{
					try
					{
						methodInfo.Invoke(instance, parameters);
					}
					catch (Exception ex2)
					{
						num++;
						ex = ex2;
					}
				}
				if (num == array.Length)
				{
					throw ex;
				}
			}
			catch (Exception ex3)
			{
				LoggingPlugin.LogWarning("Exception Calling " + methodOwner + "." + method);
				LoggingPlugin.LogWarning("Exception Details: " + ex3.Message);
			}
		}

		public static T Invoke<T>(string methodOwner, string method, object[] parameters, object instance = null)
		{
			try
			{
				Type type = Type.GetType(methodOwner);
				int num = 0;
				Exception ex = null;
				MethodInfo[] array = (from mi in type.GetRuntimeMethods()
					where mi.Name == method
					select mi).ToArray();
				T val = default(T);
				MethodInfo[] array2 = array;
				foreach (MethodInfo methodInfo in array2)
				{
					try
					{
						return (T)methodInfo.Invoke(instance, parameters);
					}
					catch (Exception ex2)
					{
						num++;
						ex = ex2;
					}
				}
				if (num == array.Length)
				{
					throw ex;
				}
			}
			catch (Exception ex3)
			{
				LoggingPlugin.LogWarning("Exception Calling " + methodOwner + "." + method);
				LoggingPlugin.LogWarning("Exception Details: " + ex3.Message);
			}
			return default(T);
		}
	}

	public static class Utility
	{
		private static GameInput gameInputInstance;

		private static MethodInfo gameInputDisable;

		private static MethodInfo gameInputEnable;

		public static bool isBoardLoaded()
		{
			return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
		}

		public static float ParseFloat(string value)
		{
			return float.Parse(value, CultureInfo.InvariantCulture);
		}

		public static GameObject FindInHierarchy(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: true, ref results, ref done);
			return (results.Count > 0) ? results.ElementAt(0) : null;
		}

		public static GameObject FindInHierarchyViaPartialName(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: true, ref results, ref done, partial: true);
			return (results.Count > 0) ? results.ElementAt(0) : null;
		}

		public static GameObject[] FindAllInHierarchy(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: false, ref results, ref done);
			return results.ToArray();
		}

		public static GameObject[] FindAllInHierarchyViaPartialName(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: false, ref results, ref done, partial: true);
			return results.ToArray();
		}

		public static GameObject FindWithComponentInHierarchy(GameObject start, string seekType)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, null, seekType, single: true, ref results, ref done);
			return (results.Count > 0) ? results.ElementAt(0) : null;
		}

		public static GameObject[] FindAllWithComponentInHierarchy<T>(GameObject start, string seekType)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, null, seekType, single: false, ref results, ref done);
			return results.ToArray();
		}

		public static void Traverse(Transform root, string seekName, string seekType, bool single, ref List<GameObject> results, ref bool done, bool partial = false)
		{
			try
			{
				if ((seekName == null || seekName == ((Object)((Component)root).gameObject).name || (partial && ((Object)((Component)root).gameObject).name.Contains(seekName))) && (seekType == null || (Object)(object)((Component)root).GetComponent(seekType) != (Object)null))
				{
					LoggingPlugin.LogTrace("Matched '" + ((Object)((Component)root).gameObject).name + "'");
					results.Add(((Component)root).gameObject);
					if (single)
					{
						done = true;
						return;
					}
				}
				foreach (Transform item in ExtensionMethods.Children(root))
				{
					if (!done)
					{
						Traverse(item, seekName, seekType, single, ref results, ref done, partial);
					}
				}
			}
			catch
			{
			}
		}

		public static object LookUp(in Dictionary<string, object> dictionary, string key)
		{
			foreach (KeyValuePair<string, object> item in dictionary)
			{
				if (item.Key.ToUpper() == key.ToUpper())
				{
					return item.Value;
				}
			}
			return null;
		}

		public static void PostOnMainPage(BaseUnityPlugin plugin)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
			ModdingUtils.Initialize(plugin, new ManualLogSource("Common Customs Menu Plugin"), text, false);
		}

		public static void GameInputEnabled(bool setting)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			if (gameInputInstance == null || gameInputDisable == null || gameInputEnable == null)
			{
				try
				{
					gameInputInstance = null;
					gameInputDisable = null;
					gameInputEnable = null;
					gameInputInstance = (GameInput)(from f in typeof(ControllerManager).GetRuntimeFields()
						where f.Name == "_gameInput"
						select f).ToArray()[0].GetValue(null);
					gameInputDisable = (from m in typeof(GameInput).GetMethods()
						where m.Name == "Disable"
						select m).ElementAt(0);
					gameInputEnable = (from m in typeof(GameInput).GetMethods()
						where m.Name == "Enable"
						select m).ElementAt(0);
				}
				catch
				{
					LoggingPlugin.LogWarning("Unable To Get Game Input Reference Or Reference To One Of Its Methods");
				}
			}
			if (setting)
			{
				LoggingPlugin.LogTrace("Enabling Game Input");
				gameInputEnable.Invoke(gameInputInstance, new object[0]);
			}
			else
			{
				LoggingPlugin.LogTrace("Disabling Game Input");
				gameInputDisable.Invoke(gameInputInstance, new object[0]);
			}
		}
	}

	private class Provider
	{
		public string description { get; set; } = "";


		public Func<ReadOnlyDictionary<string, _Internal.CustomsMenu.AssetInfo>, Func<Dictionary<string, _Internal.CustomsMenu.AssetInfo>, IEnumerator>, IEnumerator> GetNewAssets { get; set; } = null;


		public Action<_Internal.CustomsMenu.AssetInfo> SelectionCallback { get; set; } = null;

	}

	public enum RewriteScope
	{
		off = 0,
		name = 1,
		description = 2,
		tags = 4,
		pack = 8,
		prefab = 0x10
	}

	public static class Helpers
	{
		private static Dictionary<string, Texture2D> textureCache = new Dictionary<string, Texture2D>(StringComparer.OrdinalIgnoreCase);

		public static Texture2D GetTexture(string textureName)
		{
			if (!textureCache.ContainsKey(textureName))
			{
				if (File.Exists(Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/" + textureName))
				{
					LoggingPlugin.LogTrace("Texture Request '" + textureName + "' From Cache");
					textureCache[textureName] = Image.LoadTexture(Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/" + textureName, (CacheType)999);
				}
				else if (File.Exists(textureName))
				{
					LoggingPlugin.LogTrace("Texture Request '" + textureName + "' From CustomData");
					textureCache[textureName] = Image.LoadTexture(textureName, (CacheType)999);
				}
				else
				{
					LoggingPlugin.LogTrace("Texture Request '" + textureName + "' From Default");
					textureCache[textureName] = Image.LoadTexture("org.lordashes.plugins.commoncustomsmenu.default.png", (CacheType)999);
				}
			}
			return textureCache[textureName];
		}

		public static Color MakeColor(string code)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			Color clear = Color.clear;
			if (code.Substring(0, 1) != "#")
			{
				code = "#" + code;
			}
			ColorUtility.TryParseHtmlString(code, ref clear);
			return clear;
		}

		public static Texture2D MakeTexture(Color color, int width = 1, int height = 1)
		{
			//IL_0001: 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_0023: Expected O, but got Unknown
			//IL_0035: 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)
			string key = ColorUtility.ToHtmlStringRGBA(color);
			if (!textureCache.ContainsKey(key))
			{
				Texture2D val = new Texture2D(width, height);
				Color[] array = (Color[])(object)new Color[width * height];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = color;
				}
				val.SetPixels(array);
				val.Apply();
				textureCache.Add(key, val);
			}
			return textureCache[key];
		}
	}

	public const string Name = "Common Customs Menu Plugin";

	public const string Guid = "org.lordashes.plugins.commoncustomsmenu";

	public const string Version = "1.0.8.0";

	public const string Author = "Lord Ashes";

	public static CommonCustomsMenuPlugin _self = null;

	public static int initialized = 0;

	private KeyboardShortcut menuToggleTrigger;

	private ConfigEntry<int> assetBadgesPerRow;

	private float pluginsRegistrationComplete = 5f;

	private Dictionary<string, _Internal.CustomsMenu.AssetInfo> assets = new Dictionary<string, _Internal.CustomsMenu.AssetInfo>();

	public string guiSafe = "";

	private Dictionary<string, Provider> providers = new Dictionary<string, Provider>();

	private int resposes = 0;

	private _Internal.MenuCollection menus = new _Internal.MenuCollection();

	private Rect infoBar = new Rect(0f, 1055f, 1920f, 25f);

	private bool animateOpening = true;

	private int rewriteScope = 31;

	private static string registrationMessageSpecs = "60,120,16,30";

	private GUIStyle invisibleButton = null;

	private void Awake()
	{
		//IL_001e: 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_003e: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Invalid comparison between Unknown and I4
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Expected O, but got Unknown
		_self = this;
		LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", (DiagnosticLevel)3, (ConfigDescription)null).Value);
		string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName;
		DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
		Debug.Log((object)(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")"));
		menuToggleTrigger = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Menu Toggle Trigger", new KeyboardShortcut((KeyCode)278, Array.Empty<KeyCode>()), (ConfigDescription)null).Value;
		assetBadgesPerRow = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Number Of Asset Badges Per Row", 11, (ConfigDescription)null);
		animateOpening = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Animate Opening", true, (ConfigDescription)null).Value;
		pluginsRegistrationComplete = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Plugin Registration Complete", 5f, (ConfigDescription)null).Value;
		rewriteScope = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Rewrite Scope Value", rewriteScope, (ConfigDescription)null).Value;
		registrationMessageSpecs = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Registration Message Specs", registrationMessageSpecs, (ConfigDescription)null).Value;
		if (!Directory.Exists(Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/"))
		{
			Directory.CreateDirectory(Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/");
		}
		if ((int)LoggingPlugin.GetLogLevel() >= 4)
		{
			((MonoBehaviour)this).StartCoroutine(WarnAboutLogLevel());
		}
		Harmony val = new Harmony("org.lordashes.plugins.commoncustomsmenu");
		val.PatchAll();
		((MonoBehavi