Decompiled source of MIMESIS Mod Menu v2.5.3

shadcnui.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using UnityEngine;
using shadcnui.GUIComponents.Controls;
using shadcnui.GUIComponents.Core;
using shadcnui.GUIComponents.Data;
using shadcnui.GUIComponents.Display;
using shadcnui.GUIComponents.Layout;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef8ee12e-d6b5-4140-a69e-badff5b5b662")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace shadcnui
{
	public static class UnityHelpers
	{
		public class GUIStyle
		{
			private GUIStyle _guiStyle;

			public float fixedWidth
			{
				get
				{
					return _guiStyle.fixedWidth;
				}
				set
				{
					_guiStyle.fixedWidth = value;
				}
			}

			public float fixedHeight
			{
				get
				{
					return _guiStyle.fixedHeight;
				}
				set
				{
					_guiStyle.fixedHeight = value;
				}
			}

			public RectOffset margin
			{
				get
				{
					return _guiStyle.margin;
				}
				set
				{
					_guiStyle.margin = value;
				}
			}

			public bool richText
			{
				get
				{
					return _guiStyle.richText;
				}
				set
				{
					_guiStyle.richText = value;
				}
			}

			public RectOffset padding
			{
				get
				{
					return _guiStyle.padding;
				}
				set
				{
					_guiStyle.padding = value;
				}
			}

			public RectOffset border
			{
				get
				{
					return _guiStyle.border;
				}
				set
				{
					_guiStyle.border = value;
				}
			}

			public RectOffset overflow
			{
				get
				{
					return _guiStyle.overflow;
				}
				set
				{
					_guiStyle.overflow = value;
				}
			}

			public TextAnchor alignment
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return _guiStyle.alignment;
				}
				set
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					_guiStyle.alignment = value;
				}
			}

			public FontStyle fontStyle
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return _guiStyle.fontStyle;
				}
				set
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					_guiStyle.fontStyle = value;
				}
			}

			public int fontSize
			{
				get
				{
					return _guiStyle.fontSize;
				}
				set
				{
					_guiStyle.fontSize = value;
				}
			}

			public Font font
			{
				get
				{
					return _guiStyle.font;
				}
				set
				{
					_guiStyle.font = value;
				}
			}

			public GUIStyleState normal
			{
				get
				{
					return _guiStyle.normal;
				}
				set
				{
					_guiStyle.normal = value;
				}
			}

			public GUIStyleState hover
			{
				get
				{
					return _guiStyle.hover;
				}
				set
				{
					_guiStyle.hover = value;
				}
			}

			public GUIStyleState active
			{
				get
				{
					return _guiStyle.active;
				}
				set
				{
					_guiStyle.active = value;
				}
			}

			public GUIStyleState focused
			{
				get
				{
					return _guiStyle.focused;
				}
				set
				{
					_guiStyle.focused = value;
				}
			}

			public GUIStyleState onNormal
			{
				get
				{
					return _guiStyle.onNormal;
				}
				set
				{
					_guiStyle.onNormal = value;
				}
			}

			public GUIStyleState onHover
			{
				get
				{
					return _guiStyle.onHover;
				}
				set
				{
					_guiStyle.onHover = value;
				}
			}

			public GUIStyleState onActive
			{
				get
				{
					return _guiStyle.onActive;
				}
				set
				{
					_guiStyle.onActive = value;
				}
			}

			public GUIStyleState onFocused
			{
				get
				{
					return _guiStyle.onFocused;
				}
				set
				{
					_guiStyle.onFocused = value;
				}
			}

			public TextClipping clipping
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return _guiStyle.clipping;
				}
				set
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					_guiStyle.clipping = value;
				}
			}

			public ImagePosition imagePosition
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return _guiStyle.imagePosition;
				}
				set
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					_guiStyle.imagePosition = value;
				}
			}

			public Vector2 contentOffset
			{
				get
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					return _guiStyle.contentOffset;
				}
				set
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					_guiStyle.contentOffset = value;
				}
			}

			public bool wordWrap
			{
				get
				{
					return _guiStyle.wordWrap;
				}
				set
				{
					_guiStyle.wordWrap = value;
				}
			}

			public bool stretchWidth
			{
				get
				{
					return _guiStyle.stretchWidth;
				}
				set
				{
					_guiStyle.stretchWidth = value;
				}
			}

			public bool stretchHeight
			{
				get
				{
					return _guiStyle.stretchHeight;
				}
				set
				{
					_guiStyle.stretchHeight = value;
				}
			}

			public string name
			{
				get
				{
					return _guiStyle.name;
				}
				set
				{
					_guiStyle.name = value;
				}
			}

			public GUIStyle(GUIStyle style)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				_guiStyle = new GUIStyle(style);
			}

			public GUIStyle()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				_guiStyle = new GUIStyle();
			}

			public static implicit operator GUIStyle(GUIStyle style)
			{
				return style._guiStyle;
			}

			public static implicit operator GUIStyle(GUIStyle style)
			{
				return new GUIStyle(style);
			}

			public GUIStyle GetInternalStyle()
			{
				return _guiStyle;
			}
		}

		public class RectOffset
		{
			private RectOffset _rectOffset;

			public int left
			{
				get
				{
					return _rectOffset.left;
				}
				set
				{
					_rectOffset.left = value;
				}
			}

			public int right
			{
				get
				{
					return _rectOffset.right;
				}
				set
				{
					_rectOffset.right = value;
				}
			}

			public int top
			{
				get
				{
					return _rectOffset.top;
				}
				set
				{
					_rectOffset.top = value;
				}
			}

			public int bottom
			{
				get
				{
					return _rectOffset.bottom;
				}
				set
				{
					_rectOffset.bottom = value;
				}
			}

			public int horizontal => _rectOffset.horizontal;

			public int vertical => _rectOffset.vertical;

			public RectOffset(int left, int right, int top, int bottom)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				_rectOffset = new RectOffset();
				_rectOffset.left = left;
				_rectOffset.right = right;
				_rectOffset.top = top;
				_rectOffset.bottom = bottom;
			}

			public RectOffset()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				_rectOffset = new RectOffset();
			}

			public static implicit operator RectOffset(RectOffset rectOffset)
			{
				return rectOffset._rectOffset;
			}

			public static implicit operator RectOffset(RectOffset rectOffset)
			{
				return new RectOffset(rectOffset.left, rectOffset.right, rectOffset.top, rectOffset.bottom);
			}

			public RectOffset GetInternalRectOffset()
			{
				return _rectOffset;
			}
		}

		public class Font
		{
			private Font _font;

			public string name => ((Object)_font).name;

			public Font(string name)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				_font = new Font(name);
			}

			public Font(Font font)
			{
				_font = font;
			}

			public static implicit operator Font(Font font)
			{
				return font._font;
			}

			public static implicit operator Font(Font font)
			{
				return new Font(font);
			}

			public Font GetInternalFont()
			{
				return _font;
			}

			public static Font CreateDynamicFontFromOSFont(string fontname, int size)
			{
				return new Font(Font.CreateDynamicFontFromOSFont(fontname, size));
			}

			public static Font CreateDynamicFontFromOSFont(string[] fontnames, int size)
			{
				return new Font(Font.CreateDynamicFontFromOSFont(fontnames, size));
			}
		}

		public class GUIContent
		{
			private GUIContent _guiContent;

			private static GUIContent _none;

			public string text
			{
				get
				{
					return _guiContent.text;
				}
				set
				{
					_guiContent.text = value;
				}
			}

			public Texture image
			{
				get
				{
					return _guiContent.image;
				}
				set
				{
					_guiContent.image = value;
				}
			}

			public string tooltip
			{
				get
				{
					return _guiContent.tooltip;
				}
				set
				{
					_guiContent.tooltip = value;
				}
			}

			public static GUIContent none
			{
				get
				{
					if (_none == null)
					{
						_none = new GUIContent("");
					}
					return _none;
				}
			}

			public GUIContent()
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				_guiContent = new GUIContent();
			}

			public GUIContent(string text)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				_guiContent = new GUIContent(text);
			}

			public GUIContent(string text, Texture image)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				_guiContent = new GUIContent(text, image);
			}

			public GUIContent(string text, Texture image, string tooltip)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				_guiContent = new GUIContent(text, image, tooltip);
			}

			public static implicit operator GUIContent(GUIContent content)
			{
				return content._guiContent;
			}

			public GUIContent GetInternalGUIContent()
			{
				return _guiContent;
			}
		}

		public static bool Button(string text, GUIStyle style, params GUILayoutOption[] options)
		{
			return GUILayout.Button(text, (GUIStyle)style, options);
		}

		public static void Label(GUIContent content, GUIStyle style)
		{
			GUILayout.Label(content, (GUIStyle)style, Array.Empty<GUILayoutOption>());
		}

		public static void Label(string text, params GUILayoutOption[] options)
		{
			GUILayout.Label(text, options);
		}

		public static void Label(string text, GUIStyle style)
		{
			GUILayout.Label(text, (GUIStyle)style, Array.Empty<GUILayoutOption>());
		}

		public static bool Button(string text, params GUILayoutOption[] options)
		{
			return GUILayout.Button(text, options);
		}

		public static bool Button(string text, GUIStyle style)
		{
			return GUILayout.Button(text, (GUIStyle)style, Array.Empty<GUILayoutOption>());
		}

		public static bool Toggle(bool value, string text, params GUILayoutOption[] options)
		{
			return GUILayout.Toggle(value, text, options);
		}

		public static bool Toggle(bool value, string text, GUIStyle style)
		{
			return GUILayout.Toggle(value, text, (GUIStyle)style, Array.Empty<GUILayoutOption>());
		}

		public static bool Toggle(bool value, string text, GUIStyle style, params GUILayoutOption[] options)
		{
			return GUILayout.Toggle(value, text, (GUIStyle)style, options);
		}

		public static bool Toggle(Rect position, bool value, string text, GUIStyle style)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return GUI.Toggle(position, value, text, (GUIStyle)style);
		}

		public static void Label(string text, GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.Label(text, (GUIStyle)style, options);
		}

		public static void Label(Rect position, string text, GUIStyle style)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(position, text, (GUIStyle)style);
		}

		public static void Label(Texture image, params GUILayoutOption[] options)
		{
			GUILayout.Label(image, options);
		}

		public static void Label(Texture image, GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.Label(image, (GUIStyle)style, options);
		}

		public static void Box(string text, GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.Box(text, (GUIStyle)style, options);
		}

		public static void Box(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.Box((GUIContent)content, (GUIStyle)style, options);
		}

		public static string TextField(string text, GUIStyle style, params GUILayoutOption[] options)
		{
			return GUILayout.TextField(text, (GUIStyle)style, options);
		}

		public static string PasswordField(string password, char maskChar, GUIStyle style, params GUILayoutOption[] options)
		{
			return GUILayout.PasswordField(password, maskChar, (GUIStyle)style, options);
		}

		public static string TextArea(string text, params GUILayoutOption[] options)
		{
			return GUILayout.TextArea(text, options);
		}

		public static string TextArea(string text, GUIStyle style, params GUILayoutOption[] options)
		{
			return GUILayout.TextArea(text, (GUIStyle)style, options);
		}

		public static string TextArea(string text, int maxLength, GUIStyle style, params GUILayoutOption[] options)
		{
			return GUILayout.TextArea(text, maxLength, (GUIStyle)style, options);
		}
	}
}
namespace shadcnui.GUIComponents.Layout
{
	public class Card : BaseComponent
	{
		public Card(GUIHelper helper)
			: base(helper)
		{
		}

		public void BeginCard(float width = -1f, float height = -1f)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			List<GUILayoutOption> list = new List<GUILayoutOption>();
			if (width > 0f)
			{
				list.Add(GUILayout.Width(width * guiHelper.uiScale));
			}
			if (height > 0f)
			{
				list.Add(GUILayout.Height(height * guiHelper.uiScale));
			}
			layoutComponents.BeginVerticalGroup(styleManager.GetCardStyle(), list.ToArray());
		}

		public void EndCard()
		{
			layoutComponents.EndVerticalGroup();
		}

		public void CardHeader(Action content)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginVerticalGroup(styleManager.GetCardHeaderStyle());
			content();
			layoutComponents.EndVerticalGroup();
		}

		public void CardTitle(string title)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			UnityHelpers.Label(title, (UnityHelpers.GUIStyle)styleManager.GetCardTitleStyle());
		}

		public void CardDescription(string description)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			UnityHelpers.Label(description, (UnityHelpers.GUIStyle)styleManager.GetCardDescriptionStyle());
		}

		public void CardContent(Action content)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginVerticalGroup(styleManager.GetCardContentStyle());
			content();
			layoutComponents.EndVerticalGroup();
		}

		public void CardFooter(Action content)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginHorizontalGroup(styleManager.GetCardFooterStyle());
			content();
			layoutComponents.EndHorizontalGroup();
		}

		public void DrawCard(string title, string description, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			BeginCard(width, height);
			if (!string.IsNullOrEmpty(title) || !string.IsNullOrEmpty(description))
			{
				CardHeader(delegate
				{
					if (!string.IsNullOrEmpty(title))
					{
						CardTitle(title);
					}
					if (!string.IsNullOrEmpty(description))
					{
						CardDescription(description);
					}
				});
			}
			if (!string.IsNullOrEmpty(content))
			{
				CardContent(delegate
				{
					StyleManager styleManager = guiHelper.GetStyleManager();
					UnityHelpers.Label(content, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
				});
			}
			if (footerContent != null)
			{
				CardFooter(footerContent);
			}
			EndCard();
		}

		public void CardImage(Texture2D image, float height = 150f)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			guiHelper.GetStyleManager();
			GUI.DrawTexture(GUILayoutUtility.GetRect(0f, height, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }), (Texture)(object)image, (ScaleMode)1);
		}

		public void DrawCardWithImage(Texture2D image, string title, string description, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			BeginCard(width, height);
			CardImage(image);
			if (!string.IsNullOrEmpty(title) || !string.IsNullOrEmpty(description))
			{
				CardHeader(delegate
				{
					if (!string.IsNullOrEmpty(title))
					{
						CardTitle(title);
					}
					if (!string.IsNullOrEmpty(description))
					{
						CardDescription(description);
					}
				});
			}
			if (!string.IsNullOrEmpty(content))
			{
				CardContent(delegate
				{
					StyleManager styleManager = guiHelper.GetStyleManager();
					UnityHelpers.Label(content, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
				});
			}
			if (footerContent != null)
			{
				CardFooter(footerContent);
			}
			EndCard();
		}

		public void CardWithAvatar(Texture2D avatar, string title, string subtitle)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginHorizontalGroup(styleManager.GetCardHeaderStyle());
			guiHelper.Avatar(avatar, "", ControlSize.Default, AvatarShape.Circle);
			layoutComponents.BeginVerticalGroup();
			CardTitle(title);
			CardDescription(subtitle);
			layoutComponents.EndVerticalGroup();
			layoutComponents.EndHorizontalGroup();
		}

		public void DrawCardWithAvatar(Texture2D avatar, string title, string subtitle, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			BeginCard(width, height);
			CardWithAvatar(avatar, title, subtitle);
			if (!string.IsNullOrEmpty(content))
			{
				CardContent(delegate
				{
					StyleManager styleManager = guiHelper.GetStyleManager();
					UnityHelpers.Label(content, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
				});
			}
			if (footerContent != null)
			{
				CardFooter(footerContent);
			}
			EndCard();
		}

		public void CardHeader(string title, string description, Action Actions)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginHorizontalGroup(styleManager.GetCardHeaderStyle());
			layoutComponents.BeginVerticalGroup();
			CardTitle(title);
			CardDescription(description);
			layoutComponents.EndVerticalGroup();
			GUILayout.FlexibleSpace();
			Actions();
			layoutComponents.EndHorizontalGroup();
		}

		public void DrawCardWithHeader(string title, string description, Action header, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			BeginCard(width, height);
			CardHeader(title, description, header);
			if (!string.IsNullOrEmpty(content))
			{
				CardContent(delegate
				{
					StyleManager styleManager = guiHelper.GetStyleManager();
					UnityHelpers.Label(content, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
				});
			}
			if (footerContent != null)
			{
				CardFooter(footerContent);
			}
			EndCard();
		}

		public void DrawSimpleCard(string content, float width = -1f, float height = -1f)
		{
			BeginCard(width, height);
			CardContent(delegate
			{
				StyleManager styleManager = guiHelper.GetStyleManager();
				UnityHelpers.Label(content, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
			});
			EndCard();
		}
	}
	public class Layout
	{
		private GUIHelper guiHelper;

		public Layout(GUIHelper helper)
		{
			guiHelper = helper;
		}

		public Vector2 DrawScrollView(Vector2 scrollPosition, Action drawContent, params GUILayoutOption[] options)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, options);
			drawContent?.Invoke();
			GUILayout.EndScrollView();
			return scrollPosition;
		}

		public void BeginHorizontalGroup()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		}

		public void BeginHorizontalGroup(params GUILayoutOption[] options)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		}

		public void BeginHorizontalGroup(GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.BeginHorizontal(style, options);
		}

		public void EndHorizontalGroup()
		{
			GUILayout.EndHorizontal();
		}

		public void BeginVerticalGroup()
		{
			GUILayout.BeginVertical(GUIStyle.none, Array.Empty<GUILayoutOption>());
		}

		public void BeginVerticalGroup(params GUILayoutOption[] options)
		{
			GUILayout.BeginVertical(GUIStyle.none, options);
		}

		public void BeginVerticalGroup(GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.BeginVertical(style, options);
		}

		public void EndVerticalGroup()
		{
			GUILayout.EndVertical();
		}

		public void AddSpace(float pixels)
		{
			GUILayout.Space(pixels * guiHelper.uiScale);
		}
	}
	public class MenuBar : BaseComponent
	{
		public class MenuItem
		{
			public string Text;

			public Action OnClick;

			public bool Disabled;

			public List<MenuItem> SubItems;

			public string Shortcut;

			public bool IsSeparator;

			public bool IsHeader;

			public MenuItem()
			{
			}

			public MenuItem(string text, Action onClick = null, bool disabled = false, List<MenuItem> subItems = null, string shortcut = "")
			{
				Text = text;
				OnClick = onClick;
				Disabled = disabled;
				SubItems = subItems ?? new List<MenuItem>();
				Shortcut = shortcut;
				IsSeparator = false;
				IsHeader = false;
			}

			public static MenuItem Separator()
			{
				return new MenuItem
				{
					IsSeparator = true
				};
			}

			public static MenuItem Header(string text)
			{
				return new MenuItem
				{
					Text = text,
					IsHeader = true
				};
			}
		}

		public class MenuBarConfig
		{
			public List<MenuItem> Items { get; set; }

			public GUILayoutOption[] Options { get; set; }

			public MenuBarConfig(List<MenuItem> items)
			{
				Items = items;
				Options = Array.Empty<GUILayoutOption>();
			}
		}

		private struct MenuData
		{
			public List<MenuItem> Items;

			public int ParentIndex;

			public MenuData(List<MenuItem> items, int parentIndex)
			{
				Items = items;
				ParentIndex = parentIndex;
			}
		}

		private int _activeMenuIndex = -1;

		private bool _isDropdownOpen;

		private readonly Stack<MenuData> _menuStack = new Stack<MenuData>();

		private Rect _menuBarRect;

		public bool IsDropdownOpen => _isDropdownOpen;

		public MenuBar(GUIHelper helper)
			: base(helper)
		{
		}

		public void Draw(MenuBarConfig config)
		{
			Draw(config.Items, config.Options);
		}

		public void Draw(List<MenuItem> items, params GUILayoutOption[] options)
		{
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			if (items == null || items.Count == 0)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginHorizontalGroup(styleManager.GetMenuBarStyle(), options);
			for (int i = 0; i < items.Count; i++)
			{
				MenuItem menuItem = items[i];
				if (menuItem.IsSeparator || menuItem.IsHeader)
				{
					continue;
				}
				GUIStyle buttonStyle = styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default);
				bool enabled = GUI.enabled;
				if (menuItem.Disabled)
				{
					GUI.enabled = false;
				}
				bool num = UnityHelpers.Button(menuItem.Text, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				GUI.enabled = enabled;
				if (num)
				{
					if (menuItem.SubItems.Count > 0)
					{
						_activeMenuIndex = i;
						_menuStack.Clear();
						_menuStack.Push(new MenuData(menuItem.SubItems, i));
						_isDropdownOpen = true;
					}
					else
					{
						menuItem.OnClick?.Invoke();
						CloseDropdown();
					}
				}
			}
			layoutComponents.EndHorizontalGroup();
			_menuBarRect = GUILayoutUtility.GetLastRect();
			if (_isDropdownOpen && _menuStack.Count > 0)
			{
				DrawDropdownMenu();
			}
			HandleClickOutside();
		}

		private void DrawDropdownMenu()
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			MenuData menuData = _menuStack.Peek();
			layoutComponents.BeginVerticalGroup(styleManager.GetMenuDropdownStyle(), GUILayout.Width(220f * guiHelper.uiScale));
			if (_menuStack.Count > 1)
			{
				if (UnityHelpers.Button("<- Back", styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default)))
				{
					_menuStack.Pop();
					if (_menuStack.Count == 1)
					{
						_activeMenuIndex = _menuStack.Peek().ParentIndex;
					}
					layoutComponents.EndVerticalGroup();
					return;
				}
				UnityHelpers.Box("", GUI.skin.horizontalSlider);
			}
			foreach (MenuItem item in menuData.Items)
			{
				DrawMenuItem(item);
			}
			layoutComponents.EndVerticalGroup();
		}

		private void DrawMenuItem(MenuItem item)
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (item.IsHeader)
			{
				UnityHelpers.Label(item.Text, (UnityHelpers.GUIStyle)styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default));
				return;
			}
			if (item.IsSeparator)
			{
				UnityHelpers.Box("", GUI.skin.horizontalSlider);
				return;
			}
			bool enabled = GUI.enabled;
			if (item.Disabled)
			{
				GUI.enabled = false;
			}
			if (item.SubItems.Count > 0)
			{
				if (GUILayout.Button(item.Text, styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					_menuStack.Push(new MenuData(item.SubItems, _activeMenuIndex));
				}
			}
			else
			{
				GUIStyle buttonStyle = styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default);
				GUIStyle menuBarItemStyle = styleManager.GetMenuBarItemStyle();
				Rect rect = GUILayoutUtility.GetRect(GUIContent.none, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				if (GUI.Button(rect, "", buttonStyle))
				{
					item.OnClick?.Invoke();
					CloseDropdown();
				}
				GUI.Label(rect, item.Text, menuBarItemStyle);
				if (!string.IsNullOrEmpty(item.Shortcut))
				{
					GUIStyle menuBarItemStyle2 = styleManager.GetMenuBarItemStyle(ControlVariant.Default, ControlSize.Default, isShortcut: true);
					GUI.Label(rect, item.Shortcut, menuBarItemStyle2);
				}
			}
			GUI.enabled = enabled;
		}

		private void HandleClickOutside()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Event.current.type == 0 && _isDropdownOpen)
			{
				Vector2 mousePosition = Event.current.mousePosition;
				if (!((Rect)(ref _menuBarRect)).Contains(mousePosition))
				{
					CloseDropdown();
					Event.current.Use();
				}
			}
		}

		public void CloseDropdown()
		{
			_activeMenuIndex = -1;
			_isDropdownOpen = false;
			_menuStack.Clear();
		}
	}
	public class Separator : BaseComponent
	{
		public Separator(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawSeparator(SeparatorOrientation orientation = SeparatorOrientation.Horizontal, bool decorative = true, params GUILayoutOption[] options)
		{
			GUIStyle separatorStyle = guiHelper.GetStyleManager().GetSeparatorStyle(orientation);
			List<GUILayoutOption> list = new List<GUILayoutOption>();
			if (orientation == SeparatorOrientation.Horizontal)
			{
				list.Add(GUILayout.Height((float)Mathf.RoundToInt(1f * guiHelper.uiScale)));
				list.Add(GUILayout.ExpandWidth(true));
			}
			else
			{
				list.Add(GUILayout.Width((float)Mathf.RoundToInt(1f * guiHelper.uiScale)));
				list.Add(GUILayout.ExpandHeight(true));
			}
			if (options != null && options.Length != 0)
			{
				list.AddRange(options);
			}
			UnityHelpers.Box(UnityHelpers.GUIContent.none, separatorStyle, list.ToArray());
		}

		public void HorizontalSeparator(params GUILayoutOption[] options)
		{
			DrawSeparator(SeparatorOrientation.Horizontal, decorative: true, options);
		}

		public void VerticalSeparator(params GUILayoutOption[] options)
		{
			DrawSeparator(SeparatorOrientation.Vertical, decorative: true, options);
		}

		public void DrawSeparator(Rect rect, SeparatorOrientation orientation = SeparatorOrientation.Horizontal)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle separatorStyle = guiHelper.GetStyleManager().GetSeparatorStyle(orientation);
			GUI.Box(new Rect(((Rect)(ref rect)).x * guiHelper.uiScale, ((Rect)(ref rect)).y * guiHelper.uiScale, ((Rect)(ref rect)).width * guiHelper.uiScale, ((Rect)(ref rect)).height * guiHelper.uiScale), (GUIContent)UnityHelpers.GUIContent.none, separatorStyle);
		}

		public void SeparatorWithSpacing(SeparatorOrientation orientation = SeparatorOrientation.Horizontal, float spacingBefore = 8f, float spacingAfter = 8f, params GUILayoutOption[] options)
		{
			if (spacingBefore > 0f)
			{
				GUILayout.Space(spacingBefore * guiHelper.uiScale);
			}
			DrawSeparator(orientation, decorative: true, options);
			if (spacingAfter > 0f)
			{
				GUILayout.Space(spacingAfter * guiHelper.uiScale);
			}
		}

		public void LabeledSeparator(string text, params GUILayoutOption[] options)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			DrawSeparator(SeparatorOrientation.Horizontal, true, GUILayout.ExpandWidth(true));
			if (!string.IsNullOrEmpty(text))
			{
				GUILayout.Space(8f * guiHelper.uiScale);
				UnityHelpers.Label(text, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Muted));
				GUILayout.Space(8f * guiHelper.uiScale);
			}
			DrawSeparator(SeparatorOrientation.Horizontal, true, GUILayout.ExpandWidth(true));
			GUILayout.EndHorizontal();
		}
	}
	public class Table : BaseComponent
	{
		public Table(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawTable(string[] headers, string[,] data, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			if (headers == null || data == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(headers, data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(variant, size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(variant, size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(variant, size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, options);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < headers.Length; i++)
			{
				UnityHelpers.Label(headers[i], (UnityHelpers.GUIStyle)tableHeaderStyle);
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup();
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(data[j, k] ?? "", (UnityHelpers.GUIStyle)tableCellStyle);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		public void DrawTable(Rect rect, string[] headers, string[,] data, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default)
		{
			//IL_0083: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			if (headers != null && data != null)
			{
				StyleManager styleManager = guiHelper.GetStyleManager();
				if (styleManager == null)
				{
					GUI.Box(rect, "Table", GUI.skin.box);
					return;
				}
				GUIStyle tableStyle = styleManager.GetTableStyle(variant, size);
				Rect val = new Rect(((Rect)(ref rect)).x * guiHelper.uiScale, ((Rect)(ref rect)).y * guiHelper.uiScale, ((Rect)(ref rect)).width * guiHelper.uiScale, ((Rect)(ref rect)).height * guiHelper.uiScale);
				GUI.Box(val, "", tableStyle);
				GUILayout.BeginArea(val);
				DrawTable(headers, data, variant, size);
				GUILayout.EndArea();
			}
		}

		public void SortableTable(string[] headers, string[,] data, ref int[] sortColumns, ref bool[] sortAscending, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, Action<int, bool> onSort = null, params GUILayoutOption[] options)
		{
			if (headers == null || data == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(headers, data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(variant, size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(variant, size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(variant, size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, options);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < headers.Length; i++)
			{
				int arg = i;
				string text = headers[i];
				if (sortColumns != null && sortAscending != null && i < sortColumns.Length && sortColumns[i] == i)
				{
					text += (sortAscending[i] ? " ↑" : " ↓");
				}
				if (UnityHelpers.Button(text, tableHeaderStyle, options) && onSort != null)
				{
					bool arg2 = true;
					if (sortColumns != null && sortAscending != null && i < sortColumns.Length && sortColumns[i] == i)
					{
						arg2 = !sortAscending[i];
					}
					onSort(arg, arg2);
				}
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup();
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(data[j, k] ?? "", (UnityHelpers.GUIStyle)tableCellStyle);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		public void SelectableTable(string[] headers, string[,] data, ref bool[] selectedRows, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, Action<int, bool> onSelectionChange = null, params GUILayoutOption[] options)
		{
			if (headers == null || data == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(headers, data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(variant, size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(variant, size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(variant, size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, options);
			layoutComponents.BeginHorizontalGroup();
			UnityHelpers.Label("", GUILayout.Width(20f * guiHelper.uiScale));
			for (int i = 0; i < headers.Length; i++)
			{
				UnityHelpers.Label(headers[i], (UnityHelpers.GUIStyle)tableHeaderStyle);
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			if (selectedRows == null || selectedRows.Length != length)
			{
				selectedRows = new bool[length];
			}
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup();
				bool flag = UnityHelpers.Toggle(selectedRows[j], "", GUILayout.Width(20f * guiHelper.uiScale));
				if (flag != selectedRows[j])
				{
					selectedRows[j] = flag;
					onSelectionChange?.Invoke(j, flag);
				}
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(data[j, k] ?? "", (UnityHelpers.GUIStyle)tableCellStyle);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		public void CustomTable(string[] headers, object[,] data, Action<object, int, int> cellRenderer, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			if (headers == null || data == null || cellRenderer == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(headers, data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(variant, size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(variant, size);
			layoutComponents.BeginVerticalGroup(tableStyle, options);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < headers.Length; i++)
			{
				UnityHelpers.Label(headers[i], (UnityHelpers.GUIStyle)tableHeaderStyle);
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup();
				for (int k = 0; k < length2; k++)
				{
					object arg = data[j, k];
					cellRenderer(arg, j, k);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		public void PaginatedTable(string[] headers, string[,] data, ref int currentPage, int pageSize, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, Action<int> onPageChange = null, params GUILayoutOption[] options)
		{
			if (headers == null || data == null)
			{
				return;
			}
			int length = data.GetLength(0);
			int num = Mathf.CeilToInt((float)length / (float)pageSize);
			if (currentPage < 0)
			{
				currentPage = 0;
			}
			if (currentPage >= num)
			{
				currentPage = num - 1;
			}
			int num2 = currentPage * pageSize;
			int num3 = Mathf.Min(num2 + pageSize, length) - num2;
			string[,] array = new string[num3, data.GetLength(1)];
			for (int i = 0; i < num3; i++)
			{
				for (int j = 0; j < data.GetLength(1); j++)
				{
					array[i, j] = data[num2 + i, j];
				}
			}
			DrawTable(headers, array, variant, size, options);
			layoutComponents.AddSpace(8f);
			layoutComponents.BeginHorizontalGroup();
			if (UnityHelpers.Button("← Previous", GUILayout.Width(80f * guiHelper.uiScale)) && currentPage > 0)
			{
				currentPage--;
				onPageChange?.Invoke(currentPage);
			}
			GUILayout.FlexibleSpace();
			string text = $"Page {currentPage + 1} of {num}";
			GUIStyle val = guiHelper.GetStyleManager()?.GetLabelStyle(ControlVariant.Muted) ?? GUI.skin.label;
			UnityHelpers.Label(text, (UnityHelpers.GUIStyle)val);
			GUILayout.FlexibleSpace();
			if (UnityHelpers.Button("Next →", GUILayout.Width(80f * guiHelper.uiScale)) && currentPage < num - 1)
			{
				currentPage++;
				onPageChange?.Invoke(currentPage);
			}
			layoutComponents.EndHorizontalGroup();
		}

		public void SearchableTable(string[] headers, string[,] data, ref string searchQuery, ref string[,] filteredData, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, Action<string> onSearch = null, params GUILayoutOption[] options)
		{
			if (headers != null && data != null)
			{
				layoutComponents.BeginHorizontalGroup();
				StyleManager obj = guiHelper.GetStyleManager();
				GUIStyle val = obj?.GetLabelStyle(ControlVariant.Default) ?? GUI.skin.label;
				GUIStyle val2 = obj?.GetInputStyle(ControlVariant.Default) ?? GUI.skin.textField;
				UnityHelpers.Label("Search:", val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f * guiHelper.uiScale) });
				string text = GUILayout.TextField(searchQuery ?? "", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f * guiHelper.uiScale) });
				if (text != searchQuery)
				{
					searchQuery = text;
					onSearch?.Invoke(searchQuery);
					filteredData = FilterTableData(data, searchQuery);
				}
				layoutComponents.EndHorizontalGroup();
				layoutComponents.AddSpace(8f);
				string[,] data2 = filteredData ?? data;
				DrawTable(headers, data2, variant, size, options);
			}
		}

		public void ResizableTable(string[] headers, string[,] data, ref float[] columnWidths, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			if (headers == null || data == null)
			{
				return;
			}
			if (columnWidths == null || columnWidths.Length != headers.Length)
			{
				columnWidths = new float[headers.Length];
				for (int i = 0; i < columnWidths.Length; i++)
				{
					columnWidths[i] = 100f;
				}
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(headers, data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(variant, size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(variant, size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(variant, size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, options);
			layoutComponents.BeginHorizontalGroup();
			for (int j = 0; j < headers.Length; j++)
			{
				float num = columnWidths[j] * guiHelper.uiScale;
				UnityHelpers.Label(headers[j], tableHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) });
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int k = 0; k < length; k++)
			{
				layoutComponents.BeginHorizontalGroup();
				for (int l = 0; l < length2; l++)
				{
					string text = data[k, l] ?? "";
					float num2 = columnWidths[l] * guiHelper.uiScale;
					UnityHelpers.Label(text, tableCellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num2) });
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		private void DrawSimpleTable(string[] headers, string[,] data)
		{
			layoutComponents.BeginVerticalGroup(GUI.skin.box);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < headers.Length; i++)
			{
				UnityHelpers.Label(headers[i], (UnityHelpers.GUIStyle)GUI.skin.label);
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup();
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(data[j, k] ?? "", (UnityHelpers.GUIStyle)GUI.skin.label);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		private void DrawSimpleTable(string[] headers, object[,] data)
		{
			layoutComponents.BeginVerticalGroup(GUI.skin.box);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < headers.Length; i++)
			{
				UnityHelpers.Label(headers[i], (UnityHelpers.GUIStyle)GUI.skin.label);
			}
			layoutComponents.EndHorizontalGroup();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup();
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(data[j, k]?.ToString() ?? "", (UnityHelpers.GUIStyle)GUI.skin.label);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		private string[,] FilterTableData(string[,] data, string searchQuery)
		{
			if (string.IsNullOrEmpty(searchQuery))
			{
				return data;
			}
			List<int> list = new List<int>();
			int length = data.GetLength(0);
			int length2 = data.GetLength(1);
			for (int i = 0; i < length; i++)
			{
				for (int j = 0; j < length2; j++)
				{
					if ((data[i, j] ?? "").ToLower().Contains(searchQuery.ToLower()))
					{
						list.Add(i);
						break;
					}
				}
			}
			string[,] array = new string[list.Count, length2];
			for (int k = 0; k < list.Count; k++)
			{
				int num = list[k];
				for (int l = 0; l < length2; l++)
				{
					array[k, l] = data[num, l];
				}
			}
			return array;
		}
	}
	public class Tabs : BaseComponent
	{
		public enum TabSide
		{
			Left,
			Right
		}

		public enum TabPosition
		{
			Top,
			Bottom,
			Left,
			Right
		}

		public class TabsConfig
		{
			public string[] TabNames { get; set; }

			public int SelectedIndex { get; set; }

			public Action<int> OnTabChange { get; set; }

			public Action Content { get; set; }

			public int MaxLines { get; set; }

			public TabPosition Position { get; set; }

			public TabSide Side { get; set; }

			public float TabWidth { get; set; }

			public GUILayoutOption[] Options { get; set; }

			public TabsConfig(string[] tabNames, int selectedIndex)
			{
				TabNames = tabNames;
				SelectedIndex = selectedIndex;
				OnTabChange = null;
				Content = null;
				MaxLines = 1;
				Position = TabPosition.Top;
				Side = TabSide.Left;
				TabWidth = 120f;
				Options = Array.Empty<GUILayoutOption>();
			}
		}

		public struct TabConfig
		{
			public string Name;

			public Action Content;

			public bool Disabled;

			public TabConfig(string name, Action content, bool disabled = false)
			{
				Name = name;
				Content = content;
				Disabled = disabled;
			}
		}

		public Tabs(GUIHelper helper)
			: base(helper)
		{
		}

		public int Draw(TabsConfig config)
		{
			return DrawTabsInternal(config);
		}

		public int Draw(string[] tabNames, int selectedIndex, Action content, Action<int> onTabChange = null, int maxLines = 1, TabPosition position = TabPosition.Top, TabSide side = TabSide.Left, float tabWidth = 120f, params GUILayoutOption[] options)
		{
			TabsConfig config = new TabsConfig(tabNames, selectedIndex)
			{
				OnTabChange = onTabChange,
				Content = content,
				MaxLines = maxLines,
				Position = position,
				Side = side,
				TabWidth = tabWidth,
				Options = options
			};
			return DrawTabsInternal(config);
		}

		private int DrawTabsInternal(TabsConfig config)
		{
			if (config.TabNames == null || config.TabNames.Length == 0)
			{
				config.Content?.Invoke();
				return config.SelectedIndex;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			int selectedIndex = Mathf.Clamp(config.SelectedIndex, 0, config.TabNames.Length - 1);
			int newSelectedIndex = selectedIndex;
			Action action = delegate
			{
				int num2 = (int)Mathf.Ceil((float)config.TabNames.Length / (float)config.MaxLines);
				for (int k = 0; k < config.MaxLines; k++)
				{
					bool flag4 = false;
					try
					{
						layoutComponents.BeginHorizontalGroup(styleManager.GetTabsListStyle());
						flag4 = true;
						for (int l = k * num2; l < (k + 1) * num2 && l < config.TabNames.Length; l++)
						{
							bool active2 = l == selectedIndex;
							GUIStyle tabsTriggerStyle2 = styleManager.GetTabsTriggerStyle(active2);
							GUILayoutOption[] options2;
							if (config.Options == null || config.Options.Length == 0)
							{
								options2 = (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)Mathf.RoundToInt(36f * guiHelper.uiScale)) };
							}
							else
							{
								List<GUILayoutOption> list2 = new List<GUILayoutOption>(config.Options.Length + 1);
								list2.Add(GUILayout.Height((float)Mathf.RoundToInt(36f * guiHelper.uiScale)));
								list2.AddRange(config.Options);
								options2 = list2.ToArray();
							}
							if (UnityHelpers.Button(config.TabNames[l] ?? $"Tab {l + 1}", tabsTriggerStyle2, options2) && l != selectedIndex)
							{
								newSelectedIndex = l;
								config.OnTabChange?.Invoke(l);
							}
							if (l < (k + 1) * num2 - 1 && l < config.TabNames.Length - 1)
							{
								layoutComponents.AddSpace(2f);
							}
						}
					}
					catch (Exception)
					{
					}
					finally
					{
						if (flag4)
						{
							try
							{
								layoutComponents.EndHorizontalGroup();
							}
							catch
							{
							}
						}
					}
				}
			};
			Action action2 = delegate
			{
				int num = (int)Mathf.Ceil((float)config.TabNames.Length / (float)config.MaxLines);
				for (int i = 0; i < config.MaxLines; i++)
				{
					bool flag3 = false;
					try
					{
						layoutComponents.BeginVerticalGroup(GUILayout.Width(config.TabWidth * guiHelper.uiScale));
						flag3 = true;
						for (int j = i * num; j < (i + 1) * num && j < config.TabNames.Length; j++)
						{
							bool active = j == selectedIndex;
							GUIStyle tabsTriggerStyle = styleManager.GetTabsTriggerStyle(active);
							GUILayoutOption[] options;
							if (config.Options == null || config.Options.Length == 0)
							{
								options = (GUILayoutOption[])(object)new GUILayoutOption[4]
								{
									GUILayout.Width(config.TabWidth * guiHelper.uiScale),
									GUILayout.Height((float)Mathf.RoundToInt(36f * guiHelper.uiScale)),
									GUILayout.ExpandWidth(false),
									GUILayout.ExpandHeight(false)
								};
							}
							else
							{
								List<GUILayoutOption> list = new List<GUILayoutOption>(config.Options.Length + 4);
								list.Add(GUILayout.Width(config.TabWidth * guiHelper.uiScale));
								list.Add(GUILayout.Height((float)Mathf.RoundToInt(36f * guiHelper.uiScale)));
								list.Add(GUILayout.ExpandWidth(false));
								list.Add(GUILayout.ExpandHeight(false));
								list.AddRange(config.Options);
								options = list.ToArray();
							}
							if (UnityHelpers.Button(config.TabNames[j] ?? $"Tab {j + 1}", tabsTriggerStyle, options) && j != selectedIndex)
							{
								newSelectedIndex = j;
								config.OnTabChange?.Invoke(j);
							}
							if (j < (i + 1) * num - 1 && j < config.TabNames.Length - 1)
							{
								layoutComponents.AddSpace(2f);
							}
						}
					}
					catch (Exception)
					{
					}
					finally
					{
						if (flag3)
						{
							try
							{
								layoutComponents.EndVerticalGroup();
							}
							catch
							{
							}
						}
					}
				}
			};
			if (config.Position == TabPosition.Top)
			{
				action();
				config.Content?.Invoke();
			}
			else if (config.Position == TabPosition.Bottom)
			{
				config.Content?.Invoke();
				action();
			}
			else if (config.Position == TabPosition.Left)
			{
				bool flag = false;
				try
				{
					layoutComponents.BeginHorizontalGroup();
					flag = true;
					action2();
					config.Content?.Invoke();
				}
				catch (Exception)
				{
				}
				finally
				{
					if (flag)
					{
						try
						{
							layoutComponents.EndHorizontalGroup();
						}
						catch
						{
						}
					}
				}
			}
			else if (config.Position == TabPosition.Right)
			{
				bool flag2 = false;
				try
				{
					layoutComponents.BeginHorizontalGroup();
					flag2 = true;
					config.Content?.Invoke();
					action2();
				}
				catch (Exception)
				{
				}
				finally
				{
					if (flag2)
					{
						try
						{
							layoutComponents.EndHorizontalGroup();
						}
						catch
						{
						}
					}
				}
			}
			return newSelectedIndex;
		}

		public void BeginTabContent(params GUILayoutOption[] options)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginVerticalGroup(styleManager.GetTabsContentStyle(), options);
		}

		public void EndTabContent()
		{
			layoutComponents.EndVerticalGroup();
		}

		public int TabsWithContent(TabConfig[] tabConfigs, int selectedIndex, Action<int> onTabChange = null)
		{
			if (tabConfigs == null || tabConfigs.Length == 0)
			{
				return selectedIndex;
			}
			string[] array = new string[tabConfigs.Length];
			for (int i = 0; i < tabConfigs.Length; i++)
			{
				array[i] = tabConfigs[i].Name;
			}
			int num = Draw(array, selectedIndex, null, onTabChange, 1, TabPosition.Top, TabSide.Left, 120f);
			if (num >= 0 && num < tabConfigs.Length)
			{
				BeginTabContent(GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
				tabConfigs[num].Content?.Invoke();
				EndTabContent();
			}
			return num;
		}
	}
}
namespace shadcnui.GUIComponents.Display
{
	public class Avatar : BaseComponent
	{
		public struct AvatarData
		{
			public Texture2D Image;

			public string FallbackText;

			public bool IsOnline;

			public string Name;

			public AvatarData(Texture2D image, string fallbackText, bool isOnline = false, string name = "")
			{
				Image = image;
				FallbackText = fallbackText;
				IsOnline = isOnline;
				Name = name;
			}
		}

		public Avatar(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawAvatar(Texture2D image, string fallbackText, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, params GUILayoutOption[] options)
		{
			StyleManager obj = guiHelper.GetStyleManager();
			GUIStyle avatarStyle = obj.GetAvatarStyle(size, shape);
			GUIStyle avatarStyle2 = obj.GetAvatarStyle(size, shape);
			GUILayoutOption[] options2 = new List<GUILayoutOption>(options).ToArray();
			if ((Object)(object)image != (Object)null)
			{
				UnityHelpers.Label((Texture)(object)image, avatarStyle, options2);
			}
			else
			{
				UnityHelpers.Label(fallbackText ?? "A", avatarStyle2, options2);
			}
		}

		public void DrawAvatar(Rect rect, Texture2D image, string fallbackText, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			StyleManager styleManager = guiHelper.GetStyleManager();
			GUIStyle avatarStyle = styleManager.GetAvatarStyle(size, shape);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref rect)).x * guiHelper.uiScale, ((Rect)(ref rect)).y * guiHelper.uiScale, ((Rect)(ref rect)).width * guiHelper.uiScale, ((Rect)(ref rect)).height * guiHelper.uiScale);
			if ((Object)(object)image != (Object)null)
			{
				GUI.Label(val, (Texture)(object)image, avatarStyle);
				return;
			}
			GUIStyle avatarStyle2 = styleManager.GetAvatarStyle(size, shape);
			GUI.Label(val, new GUIContent(fallbackText ?? "A"), avatarStyle2);
		}

		public void AvatarWithStatus(Texture2D image, string fallbackText, bool isOnline, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, params GUILayoutOption[] options)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginVerticalGroup();
			DrawAvatar(image, fallbackText, size, shape, options);
			Rect lastRect = GUILayoutUtility.GetLastRect();
			if (isOnline && styleManager != null)
			{
				float num = styleManager.GetStatusIndicatorSize(size) * guiHelper.uiScale;
				float num2 = ((Rect)(ref lastRect)).x + ((Rect)(ref lastRect)).width - num * 0.9f;
				float num3 = ((Rect)(ref lastRect)).y + ((Rect)(ref lastRect)).height - num * 0.9f;
				Rect rect = default(Rect);
				((Rect)(ref rect))..ctor(num2, num3, num, num);
				DrawStatusDot(rect, isOnline: true);
			}
			layoutComponents.EndVerticalGroup();
		}

		private void DrawStatusIndicator(bool isOnline, ControlSize size)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager != null)
			{
				Color color = (isOnline ? Color.green : Color.gray);
				float statusIndicatorSize = styleManager.GetStatusIndicatorSize(size);
				GUIStyle val = new UnityHelpers.GUIStyle(GUI.skin.box);
				val.normal.background = styleManager.CreateSolidTexture(color);
				val.fixedWidth = statusIndicatorSize * guiHelper.uiScale;
				val.fixedHeight = statusIndicatorSize * guiHelper.uiScale;
				val.border = new UnityHelpers.RectOffset(0, 0, 0, 0);
				val.padding = new UnityHelpers.RectOffset(0, 0, 0, 0);
				val.margin = new UnityHelpers.RectOffset(0, 0, 0, 0);
				UnityHelpers.Label(GUIContent.none, val);
			}
		}

		private void DrawStatusDot(Rect rect, bool isOnline)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager != null)
			{
				Color color = (isOnline ? Color.green : Color.gray);
				GUIStyle val = new UnityHelpers.GUIStyle(GUI.skin.box);
				val.normal.background = styleManager.CreateSolidTexture(color);
				GUI.Box(rect, GUIContent.none, val);
			}
		}

		public void AvatarWithName(Texture2D image, string fallbackText, string name, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, bool showNameBelow = false, params GUILayoutOption[] options)
		{
			if (showNameBelow)
			{
				layoutComponents.BeginVerticalGroup();
				DrawAvatar(image, fallbackText, size, shape, options);
				if (!string.IsNullOrEmpty(name))
				{
					layoutComponents.AddSpace(4f);
					GUIStyle val = guiHelper.GetStyleManager()?.GetLabelStyle(ControlVariant.Default) ?? GUI.skin.label;
					UnityHelpers.Label(name, (UnityHelpers.GUIStyle)val);
				}
				layoutComponents.EndVerticalGroup();
				return;
			}
			layoutComponents.BeginHorizontalGroup();
			DrawAvatar(image, fallbackText, size, shape, options);
			if (!string.IsNullOrEmpty(name))
			{
				layoutComponents.AddSpace(8f);
				GUIStyle val2 = guiHelper.GetStyleManager()?.GetLabelStyle(ControlVariant.Default) ?? GUI.skin.label;
				val2.alignment = (TextAnchor)3;
				UnityHelpers.Label(name, (UnityHelpers.GUIStyle)val2);
			}
			layoutComponents.EndHorizontalGroup();
		}

		public void AvatarWithBorder(Texture2D image, string fallbackText, Color borderColor, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, params GUILayoutOption[] options)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			GUIStyle val = new UnityHelpers.GUIStyle(GUI.skin.box);
			val.normal.background = styleManager.CreateSolidTexture(borderColor);
			val.alignment = (TextAnchor)4;
			val.padding = new UnityHelpers.RectOffset(2, 2, 2, 2);
			layoutComponents.BeginVerticalGroup(val, options);
			DrawAvatar(image, fallbackText, size, shape, options);
			layoutComponents.EndVerticalGroup();
		}
	}
	public class Badge : BaseComponent
	{
		public Badge(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			GUIStyle badgeStyle = guiHelper.GetStyleManager().GetBadgeStyle(variant, size);
			UnityHelpers.Label(text ?? "Badge", badgeStyle, options);
		}

		public void DrawBadge(Rect rect, string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle badgeStyle = guiHelper.GetStyleManager().GetBadgeStyle(variant, size);
			UnityHelpers.Label(new Rect(((Rect)(ref rect)).x * guiHelper.uiScale, ((Rect)(ref rect)).y * guiHelper.uiScale, ((Rect)(ref rect)).width * guiHelper.uiScale, ((Rect)(ref rect)).height * guiHelper.uiScale), text ?? "Badge", badgeStyle);
		}

		public void BadgeWithIcon(string text, Texture2D icon, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			layoutComponents.BeginHorizontalGroup();
			if ((Object)(object)icon != (Object)null)
			{
				UnityHelpers.Label((Texture)(object)icon, GUILayout.Width(16f * guiHelper.uiScale), GUILayout.Height(16f * guiHelper.uiScale));
				layoutComponents.AddSpace(4f);
			}
			DrawBadge(text, variant, size, options);
			layoutComponents.EndHorizontalGroup();
		}

		public void CountBadge(int count, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, int maxCount = 99, params GUILayoutOption[] options)
		{
			string text = ((count > maxCount) ? $"{maxCount}+" : count.ToString());
			DrawBadge(text, variant, size, options);
		}

		public void StatusBadge(string text, bool isActive, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			layoutComponents.BeginHorizontalGroup();
			Color color = (isActive ? Color.green : Color.gray);
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager != null)
			{
				UnityHelpers.GUIStyle gUIStyle = new UnityHelpers.GUIStyle(GUI.skin.box);
				gUIStyle.normal.background = styleManager.CreateSolidTexture(color);
				gUIStyle.fixedWidth = 8f * guiHelper.uiScale;
				gUIStyle.fixedHeight = 8f * guiHelper.uiScale;
				gUIStyle.border = new UnityHelpers.RectOffset(0, 0, 0, 0);
				gUIStyle.padding = new UnityHelpers.RectOffset(0, 0, 0, 0);
				gUIStyle.margin = new UnityHelpers.RectOffset(0, 0, 0, 0);
				GUIStyle val = gUIStyle;
				UnityHelpers.Label("", (UnityHelpers.GUIStyle)val);
				layoutComponents.AddSpace(4f);
			}
			DrawBadge(text, variant, size, options);
			layoutComponents.EndHorizontalGroup();
		}

		public void ProgressBadge(string text, float progress, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			layoutComponents.BeginVerticalGroup();
			DrawBadge(text, variant, size, options);
			layoutComponents.AddSpace(2f);
			Rect rect = GUILayoutUtility.GetRect(60f * guiHelper.uiScale, 4f * guiHelper.uiScale);
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager != null)
			{
				GUIStyle val = new UnityHelpers.GUIStyle(GUI.skin.box);
				val.normal.background = styleManager.CreateSolidTexture(Color.gray);
				GUI.Box(rect, "", val);
				Rect val2 = new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width * Mathf.Clamp01(progress), ((Rect)(ref rect)).height);
				GUIStyle val3 = new UnityHelpers.GUIStyle(GUI.skin.box);
				val3.normal.background = styleManager.CreateSolidTexture(Color.green);
				GUI.Box(val2, "", val3);
			}
			layoutComponents.EndVerticalGroup();
		}

		public void AnimatedBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			//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)
			//IL_002f: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			float num = (Mathf.Sin(Time.time * 2f) + 1f) * 0.5f * 0.3f + 0.7f;
			Color color = GUI.color;
			GUI.color = new Color(color.r, color.g, color.b, num);
			DrawBadge(text, variant, size, options);
			GUI.color = color;
		}

		public void RoundedBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, float cornerRadius = 12f, params GUILayoutOption[] options)
		{
			GUIStyle badgeStyle = guiHelper.GetStyleManager().GetBadgeStyle(variant, size);
			GUIStyle val = new UnityHelpers.GUIStyle(badgeStyle);
			int num = Mathf.RoundToInt(cornerRadius * guiHelper.uiScale);
			val.border = new UnityHelpers.RectOffset(num, num, num, num);
			val.padding = new UnityHelpers.RectOffset(badgeStyle.padding.left + 4, badgeStyle.padding.right + 4, badgeStyle.padding.top + 2, badgeStyle.padding.bottom + 2);
			UnityHelpers.Label(text ?? "Badge", val, options);
		}

		public void PillBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			RoundedBadge(text, variant, size, 999f, options);
		}
	}
	public enum ChartType
	{
		Line,
		Bar,
		Area,
		Pie,
		Scatter
	}
	[Serializable]
	public class ChartDataPoint
	{
		public string Name { get; set; }

		public float Value { get; set; }

		public Color Color { get; set; }

		public Dictionary<string, object> Payload { get; set; }

		public ChartDataPoint(string name, float value, Color color = default(Color))
		{
			//IL_0015: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Name = name;
			Value = value;
			Color = ((color == default(Color)) ? Color.blue : color);
			Payload = new Dictionary<string, object>();
		}
	}
	[Serializable]
	public class ChartSeries
	{
		public string Key { get; set; }

		public string Label { get; set; }

		public Color Color { get; set; }

		public List<ChartDataPoint> Data { get; set; }

		public bool Visible { get; set; }

		public ChartSeries(string key, string label, Color color = default(Color))
		{
			//IL_0015: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Key = key;
			Label = label;
			Color = ((color == default(Color)) ? Color.blue : color);
			Data = new List<ChartDataPoint>();
			Visible = true;
		}
	}
	[Serializable]
	public class ChartConfig
	{
		public List<ChartSeries> Series { get; set; }

		public ChartType ChartType { get; set; }

		public Vector2 Size { get; set; }

		public GUILayoutOption[] Options { get; set; }

		public ChartConfig(List<ChartSeries> series, ChartType chartType)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Series = series;
			ChartType = chartType;
			Size = new Vector2(400f, 300f);
			Options = Array.Empty<GUILayoutOption>();
		}
	}
	public class Chart : BaseComponent
	{
		private Rect _chartRect;

		public Chart(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawChart(ChartConfig config)
		{
			//IL_0022: 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)
			StyleManager styleManager = guiHelper.GetStyleManager();
			List<GUILayoutOption> list = new List<GUILayoutOption>(config.Options);
			if (list.Count == 0)
			{
				list.Add(GUILayout.Width(config.Size.x));
				list.Add(GUILayout.Height(config.Size.y));
			}
			layoutComponents.BeginVerticalGroup(styleManager.GetChartStyle(ControlVariant.Default, ControlSize.Default), list.ToArray());
			DrawChartContent(config);
			layoutComponents.EndVerticalGroup();
		}

		private void DrawChartContent(ChartConfig config)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0043: 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)
			Rect rect = GUILayoutUtility.GetRect(config.Size.x, config.Size.y, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			if ((int)Event.current.type == 7)
			{
				_chartRect = rect;
				switch (config.ChartType)
				{
				case ChartType.Line:
					DrawLineChart(config.Series);
					break;
				case ChartType.Bar:
					DrawBarChart(config.Series);
					break;
				case ChartType.Area:
					DrawAreaChart(config.Series);
					break;
				case ChartType.Pie:
					DrawPieChart(config.Series);
					break;
				case ChartType.Scatter:
					DrawScatterChart(config.Series);
					break;
				}
			}
		}

		private void DrawLineChart(List<ChartSeries> series)
		{
			if (series.Count == 0)
			{
				return;
			}
			DrawGrid();
			DrawAxes(series);
			foreach (ChartSeries item in series.Where((ChartSeries s) => s.Visible))
			{
				DrawLineSeries(item, series);
			}
		}

		private void DrawBarChart(List<ChartSeries> series)
		{
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			if (series.Count == 0)
			{
				return;
			}
			DrawGrid();
			DrawAxes(series);
			float num = ((Rect)(ref _chartRect)).width - 60f;
			float num2 = ((Rect)(ref _chartRect)).height - 40f;
			float maxValue = GetMaxValue(series);
			int num3 = series.FirstOrDefault()?.Data.Count ?? 0;
			if (num3 == 0)
			{
				return;
			}
			float num4 = num / (float)num3;
			float num5 = num4 * 0.8f / (float)series.Count;
			float num6 = num4 * 0.1f;
			Rect rect = default(Rect);
			for (int i = 0; i < num3; i++)
			{
				float num7 = ((Rect)(ref _chartRect)).x + 40f + (float)i * num4 + num6;
				for (int j = 0; j < series.Count; j++)
				{
					ChartSeries chartSeries = series[j];
					if (chartSeries.Visible && i < chartSeries.Data.Count)
					{
						float num8 = chartSeries.Data[i].Value / maxValue * num2;
						float num9 = num7 + (float)j * num5;
						float num10 = ((Rect)(ref _chartRect)).y + num2 - num8;
						((Rect)(ref rect))..ctor(num9, num10, num5 - 2f, num8);
						DrawRoundedRect(rect, chartSeries.Color, 4f);
					}
				}
			}
		}

		private void DrawAreaChart(List<ChartSeries> series)
		{
			if (series.Count == 0)
			{
				return;
			}
			DrawGrid();
			DrawAxes(series);
			foreach (ChartSeries item in series.Where((ChartSeries s) => s.Visible))
			{
				DrawAreaSeries(item, series);
			}
		}

		private void DrawPieChart(List<ChartSeries> series)
		{
			//IL_0120: 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)
			if (series.Count == 0)
			{
				return;
			}
			Vector2 center = default(Vector2);
			((Vector2)(ref center))..ctor(((Rect)(ref _chartRect)).x + ((Rect)(ref _chartRect)).width / 2f, ((Rect)(ref _chartRect)).y + ((Rect)(ref _chartRect)).height / 2f);
			float radius = Mathf.Min(((Rect)(ref _chartRect)).width, ((Rect)(ref _chartRect)).height) / 2f * 0.8f;
			float num = series.SelectMany((ChartSeries s) => s.Data).Sum((ChartDataPoint d) => d.Value);
			float num2 = 0f;
			foreach (ChartSeries item in series.Where((ChartSeries s) => s.Visible))
			{
				foreach (ChartDataPoint datum in item.Data)
				{
					float num3 = datum.Value / num * 360f;
					DrawPieSlice(center, radius, num2, num3, datum.Color);
					num2 += num3;
				}
			}
		}

		private void DrawScatterChart(List<ChartSeries> series)
		{
			if (series.Count == 0)
			{
				return;
			}
			DrawGrid();
			DrawAxes(series);
			foreach (ChartSeries item in series.Where((ChartSeries s) => s.Visible))
			{
				DrawScatterSeries(item, series);
			}
		}

		private void DrawGrid()
		{
			//IL_004c: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			Theme theme = guiHelper.GetStyleManager().GetTheme();
			for (int i = 1; i < 5; i++)
			{
				float num = ((Rect)(ref _chartRect)).y + ((Rect)(ref _chartRect)).height / 5f * (float)i;
				DrawLine(new Vector2(((Rect)(ref _chartRect)).x + 40f, num), new Vector2(((Rect)(ref _chartRect)).x + ((Rect)(ref _chartRect)).width - 20f, num), new Color(theme.Border.r, theme.Border.g, theme.Border.b, 0.3f));
			}
		}

		private void DrawAxes(List<ChartSeries> series)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00a7: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Theme theme = guiHelper.GetStyleManager().GetTheme();
				StyleManager styleManager = guiHelper.GetStyleManager();
				DrawLine(new Vector2(((Rect)(ref _chartRect)).x + 40f, ((Rect)(ref _chartRect)).y + ((Rect)(ref _chartRect)).height - 20f), new Vector2(((Rect)(ref _chartRect)).x + ((Rect)(ref _chartRect)).width - 20f, ((Rect)(ref _chartRect)).y + ((Rect)(ref _chartRect)).height - 20f), new Color(theme.Muted.r, theme.Muted.g, theme.Muted.b, 0.5f));
				if (series.Count <= 0 || series[0].Data.Count <= 0 || !(((Rect)(ref _chartRect)).width > 60f))
				{
					return;
				}
				float num = (((Rect)(ref _chartRect)).width - 60f) / (float)series[0].Data.Count;
				if (!(num > 0f))
				{
					return;
				}
				Rect val = default(Rect);
				for (int i = 0; i < series[0].Data.Count; i++)
				{
					float num2 = ((Rect)(ref _chartRect)).x + 40f + (float)i * num + num / 2f;
					string text = ((series[0].Data[i].Name.Length > 3) ? series[0].Data[i].Name.Substring(0, 3) : series[0].Data[i].Name);
					((Rect)(ref val))..ctor(num2 - 15f, ((Rect)(ref _chartRect)).y + ((Rect)(ref _chartRect)).height - 15f, 30f, 20f);
					if (((Rect)(ref val)).width > 0f && ((Rect)(ref val)).height > 0f)
					{
						Color color = GUI.color;
						GUI.color = theme.Muted;
						GUI.Label(val, text, styleManager.GetChartAxisStyle());
						GUI.color = color;
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("DrawAxes error: " + ex.Message));
			}
		}

		private void DrawLineSeries(ChartSeries seriesData, List<ChartSeries> series)
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			if (seriesData.Data.Count >= 2)
			{
				Vector2[] array = (Vector2[])(object)new Vector2[seriesData.Data.Count];
				float maxValue = GetMaxValue(series);
				float num = ((Rect)(ref _chartRect)).width - 60f;
				float num2 = ((Rect)(ref _chartRect)).height - 40f;
				for (int i = 0; i < seriesData.Data.Count; i++)
				{
					float num3 = ((Rect)(ref _chartRect)).x + 40f + (float)i / (float)(seriesData.Data.Count - 1) * num;
					float num4 = ((Rect)(ref _chartRect)).y + num2 - seriesData.Data[i].Value / maxValue * num2;
					array[i] = new Vector2(num3, num4);
				}
				for (int j = 0; j < array.Length - 1; j++)
				{
					DrawThickLine(array[j], array[j + 1], seriesData.Color, 2f);
				}
				Vector2[] array2 = array;
				foreach (Vector2 center in array2)
				{
					DrawCircle(center, 4f, seriesData.Color);
					DrawCircle(center, 2f, Color.white);
				}
			}
		}

		private void DrawAreaSeries(ChartSeries seriesData, List<ChartSeries> series)
		{
			//IL_006e: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			if (seriesData.Data.Count >= 2)
			{
				Vector2[] array = (Vector2[])(object)new Vector2[seriesData.Data.Count + 2];
				float maxValue = GetMaxValue(series);
				float num = ((Rect)(ref _chartRect)).width - 60f;
				float num2 = ((Rect)(ref _chartRect)).height - 40f;
				array[0] = new Vector2(((Rect)(ref _chartRect)).x + 40f, ((Rect)(ref _chartRect)).y + num2);
				for (int i = 0; i < seriesData.Data.Count; i++)
				{
					float num3 = ((Rect)(ref _chartRect)).x + 40f + (float)i / (float)(seriesData.Data.Count - 1) * num;
					float num4 = ((Rect)(ref _chartRect)).y + num2 - seriesData.Data[i].Value / maxValue * num2;
					array[i + 1] = new Vector2(num3, num4);
				}
				array[^1] = new Vector2(((Rect)(ref _chartRect)).x + num + 40f, ((Rect)(ref _chartRect)).y + num2);
				Color color = default(Color);
				((Color)(ref color))..ctor(seriesData.Color.r, seriesData.Color.g, seriesData.Color.b, 0.3f);
				for (int j = 0; j < array.Length - 1; j++)
				{
					DrawLine(array[j], array[j + 1], color);
				}
				for (int k = 1; k < array.Length - 2; k++)
				{
					DrawLine(array[k], array[k + 1], seriesData.Color);
				}
			}
		}

		private void DrawScatterSeries(ChartSeries seriesData, List<ChartSeries> series)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			float maxValue = GetMaxValue(series);
			float num = ((Rect)(ref _chartRect)).width - 60f;
			float num2 = ((Rect)(ref _chartRect)).height - 40f;
			for (int i = 0; i < seriesData.Data.Count; i++)
			{
				float num3 = ((Rect)(ref _chartRect)).x + 40f + (float)i / (float)(seriesData.Data.Count - 1) * num;
				float num4 = ((Rect)(ref _chartRect)).y + num2 - seriesData.Data[i].Value / maxValue * num2;
				DrawCircle(new Vector2(num3, num4), 4f, seriesData.Color);
			}
		}

		private void DrawPieSlice(Vector2 center, float radius, float startAngle, float sliceAngle, Color color)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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)
			int num = Mathf.Max(3, Mathf.RoundToInt(sliceAngle / 10f));
			float num2 = sliceAngle / (float)num;
			Vector2 val = center + new Vector2(Mathf.Cos(startAngle * (float)Math.PI / 180f) * radius, Mathf.Sin(startAngle * (float)Math.PI / 180f) * radius);
			for (int i = 1; i <= num; i++)
			{
				float num3 = startAngle + num2 * (float)i;
				Vector2 val2 = center + new Vector2(Mathf.Cos(num3 * (float)Math.PI / 180f) * radius, Mathf.Sin(num3 * (float)Math.PI / 180f) * radius);
				DrawLine(center, val, color);
				DrawLine(val, val2, color);
				val = val2;
			}
			DrawLine(center, val, color);
		}

		private float GetMaxValue(IEnumerable<ChartSeries> series)
		{
			float num = (from d in series.Where((ChartSeries s) => s?.Data != null).SelectMany((ChartSeries s) => s.Data)
				select d.Value).DefaultIfEmpty(0f).Max();
			if (!(num <= 0f))
			{
				return num;
			}
			return 1f;
		}

		private void DrawLine(Vector2 start, Vector2 end, Color color, float width = 1f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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)
			if ((int)Event.current.type == 7)
			{
				Color color2 = GUI.color;
				GUI.color = color;
				Vector2 val = end - start;
				float num = Mathf.Atan2(val.y, val.x) * 57.29578f;
				float magnitude = ((Vector2)(ref val)).magnitude;
				Matrix4x4 matrix = GUI.matrix;
				GUIUtility.RotateAroundPivot(num, start);
				GUI.DrawTexture(new Rect(start.x, start.y - width * 0.5f, magnitude, width), (Texture)(object)Texture2D.whiteTexture);
				GUI.matrix = matrix;
				GUI.color = color2;
			}
		}

		private void DrawCircle(Vector2 center, float radius, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(new Rect(center.x - radius, center.y - radius, radius * 2f, radius * 2f), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color2;
		}

		private void DrawThickLine(Vector2 start, Vector2 end, Color color, float thickness)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			DrawLine(start, end, color, thickness);
		}

		private void DrawRoundedRect(Rect rect, Color color, float cornerRadius)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color2;
		}
	}
	public class Dialog : BaseComponent
	{
		private bool _isOpen;

		private string _dialogId;

		public bool IsOpen => _isOpen;

		public Dialog(GUIHelper helper)
			: base(helper)
		{
		}

		public void Open(string dialogId)
		{
			_dialogId = dialogId;
			_isOpen = true;
		}

		public void Close()
		{
			_isOpen = false;
			_dialogId = null;
		}

		public void DrawDialog(string dialogId, Action content, float width = 400f, float height = 300f)
		{
			if (_isOpen && !(_dialogId != dialogId))
			{
				StyleManager styleManager = guiHelper.GetStyleManager();
				DrawOverlay();
				layoutComponents.BeginVerticalGroup(styleManager.GetDialogContentStyle(), GUILayout.Width(width), GUILayout.Height(height));
				layoutComponents.BeginHorizontalGroup();
				GUILayout.FlexibleSpace();
				if (UnityHelpers.Button("×", styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default), (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(24f),
					GUILayout.Height(24f)
				}))
				{
					Close();
				}
				layoutComponents.EndHorizontalGroup();
				content?.Invoke();
				GUILayout.EndVertical();
			}
		}

		public void DrawDialog(string dialogId, string title, string description, Action content, Action footer = null, float width = 400f, float height = 300f)
		{
			if (_isOpen && !(_dialogId != dialogId))
			{
				StyleManager styleManager = guiHelper.GetStyleManager();
				DrawOverlay();
				layoutComponents.BeginVerticalGroup(styleManager.GetDialogContentStyle(), GUILayout.Width(width), GUILayout.Height(height));
				layoutComponents.BeginHorizontalGroup();
				layoutComponents.BeginVerticalGroup();
				if (!string.IsNullOrEmpty(title))
				{
					UnityHelpers.Label(title, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default, ControlSize.Large));
				}
				if (!string.IsNullOrEmpty(description))
				{
					UnityHelpers.Label(description, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Muted));
				}
				layoutComponents.EndVerticalGroup();
				GUILayout.FlexibleSpace();
				if (UnityHelpers.Button("×", styleManager.GetButtonStyle(ControlVariant.Ghost, ControlSize.Default), (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(24f),
					GUILayout.Height(24f)
				}))
				{
					Close();
				}
				layoutComponents.EndHorizontalGroup();
				GUILayout.Space(16f);
				content?.Invoke();
				if (footer != null)
				{
					GUILayout.Space(16f);
					layoutComponents.BeginHorizontalGroup();
					GUILayout.FlexibleSpace();
					footer?.Invoke();
					layoutComponents.EndHorizontalGroup();
				}
				GUILayout.EndVertical();
			}
		}

		public bool DrawDialogTrigger(string label, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default)
		{
			return guiHelper.Button(label, variant, size, null, false, 1f);
		}

		public void DrawDialogHeader(string title, string description = null)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			layoutComponents.BeginVerticalGroup();
			if (!string.IsNullOrEmpty(title))
			{
				UnityHelpers.Label(title, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default, ControlSize.Large));
			}
			if (!string.IsNullOrEmpty(description))
			{
				UnityHelpers.Label(description, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Muted));
			}
			layoutComponents.EndVerticalGroup();
		}

		public void DrawDialogContent(Action content)
		{
			layoutComponents.BeginVerticalGroup();
			content?.Invoke();
			layoutComponents.EndVerticalGroup();
		}

		public void DrawDialogFooter(Action footer)
		{
			layoutComponents.BeginHorizontalGroup();
			GUILayout.FlexibleSpace();
			footer?.Invoke();
			layoutComponents.EndHorizontalGroup();
		}

		private void DrawOverlay()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Color color = GUI.color;
			GUI.color = ThemeManager.Instance.CurrentTheme.Overlay;
			GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
		}
	}
	public class Label : BaseComponent
	{
		public Label(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawLabel(string text, ControlVariant variant = ControlVariant.Default, bool disabled = false, params GUILayoutOption[] options)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			GUIStyle labelStyle = guiHelper.GetStyleManager().GetLabelStyle(variant);
			GUIStyle val = new UnityHelpers.GUIStyle(labelStyle);
			val.fontSize = Mathf.RoundToInt((float)labelStyle.fontSize * guiHelper.uiScale);
			if (disabled)
			{
				Color textColor = default(Color);
				((Color)(ref textColor))..ctor(labelStyle.normal.textColor.r, labelStyle.normal.textColor.g, labelStyle.normal.textColor.b, 0.7f);
				val.normal.textColor = textColor;
			}
			GUILayoutOption[] autoScaledOptions = GetAutoScaledOptions(options);
			UnityHelpers.Label(text ?? "", val, autoScaledOptions);
		}

		public void DrawLabel(Rect rect, string text, ControlVariant variant = ControlVariant.Default, bool disabled = false)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle labelStyle = guiHelper.GetStyleManager().GetLabelStyle(variant);
			Rect val = new Rect(((Rect)(ref rect)).x * guiHelper.uiScale, ((Rect)(ref rect)).y * guiHelper.uiScale, ((Rect)(ref rect)).width * guiHelper.uiScale, ((Rect)(ref rect)).height * guiHelper.uiScale);
			GUIStyle val2 = new UnityHelpers.GUIStyle(labelStyle);
			val2.fontSize = Mathf.RoundToInt((float)labelStyle.fontSize * guiHelper.uiScale);
			if (disabled)
			{
				Color textColor = default(Color);
				((Color)(ref textColor))..ctor(labelStyle.normal.textColor.r, labelStyle.normal.textColor.g, labelStyle.normal.textColor.b, 0.7f);
				val2.normal.textColor = textColor;
			}
			GUI.Label(val, text ?? "", val2);
		}

		public void SecondaryLabel(string text, params GUILayoutOption[] options)
		{
			DrawLabel(text, ControlVariant.Secondary, disabled: false, options);
		}

		public void MutedLabel(string text, params GUILayoutOption[] options)
		{
			DrawLabel(text, ControlVariant.Muted, disabled: false, options);
		}

		public void DestructiveLabel(string text, params GUILayoutOption[] options)
		{
			DrawLabel(text, ControlVariant.Destructive, disabled: false, options);
		}

		private GUILayoutOption[] GetAutoScaledOptions(GUILayoutOption[] userOptions)
		{
			if (userOptions == null || userOptions.Length == 0)
			{
				return (GUILayoutOption[])(object)new GUILayoutOption[0];
			}
			return userOptions;
		}
	}
	public class Popover : BaseComponent
	{
		private bool isOpen;

		public bool IsOpen => isOpen;

		public Popover(GUIHelper helper)
			: base(helper)
		{
		}

		public void Open()
		{
			isOpen = true;
		}

		public void Close()
		{
			isOpen = false;
		}

		public void DrawPopover(Action content)
		{
			if (isOpen)
			{
				layoutComponents.BeginVerticalGroup(guiHelper.GetStyleManager().GetPopoverContentStyle(), GUILayout.MaxWidth(300f), GUILayout.MaxHeight(200f));
				content?.Invoke();
				GUILayout.EndVertical();
			}
		}
	}
	public class Progress : BaseComponent
	{
		public Progress(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawProgress(float value, float width = -1f, float height = -1f, params GUILayoutOption[] options)
		{
			//IL_00b2: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			value = Mathf.Clamp01(value);
			float num = ((height > 0f) ? (height * guiHelper.uiScale) : (8f * guiHelper.uiScale));
			float num2 = ((width > 0f) ? (width * guiHelper.uiScale) : (-1f));
			List<GUILayoutOption> list = new List<GUILayoutOption>();
			list.Add(GUILayout.Height(num));
			if (num2 > 0f)
			{
				list.Add(GUILayout.Width(num2));
			}
			else
			{
				list.Add(GUILayout.ExpandWidth(true));
			}
			if (options != null && options.Length != 0)
			{
				list.AddRange(options);
			}
			Rect rect = GUILayoutUtility.GetRect(GUIContent.none, styleManager.GetProgressBarStyle(), list.ToArray());
			GUI.Box(rect, GUIContent.none, styleManager.GetProgressBarStyle());
			if (value > 0f)
			{
				GUI.Box(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width * value, ((Rect)(ref rect)).height), GUIContent.none, styleManager.GetProgressBarStyle(ControlVariant.Secondary));
			}
		}

		public void DrawProgress(Rect rect, float value)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			value = Mathf.Clamp01(value);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref rect)).x * guiHelper.uiScale, ((Rect)(ref rect)).y * guiHelper.uiScale, ((Rect)(ref rect)).width * guiHelper.uiScale, ((Rect)(ref rect)).height * guiHelper.uiScale);
			GUI.Box(val, GUIContent.none, styleManager.GetProgressBarStyle());
			if (value > 0f)
			{
				GUI.Box(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width * value, ((Rect)(ref val)).height), GUIContent.none, styleManager.GetProgressBarStyle(ControlVariant.Secondary));
			}
		}

		public void LabeledProgress(string label, float value, float width = -1f, float height = -1f, bool showPercentage = true, params GUILayoutOption[] options)
		{
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (!string.IsNullOrEmpty(label))
			{
				layoutComponents.BeginHorizontalGroup();
				UnityHelpers.Label(label, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
				if (showPercentage)
				{
					GUILayout.FlexibleSpace();
					UnityHelpers.Label((value * 100f).ToString("F0") + "%", (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Muted));
				}
				layoutComponents.EndHorizontalGroup();
				layoutComponents.AddSpace(4f);
			}
			DrawProgress(value, width, height, options);
		}

		public void CircularProgress(float value, float size = 32f, params GUILayoutOption[] options)
		{
			//IL_0052: 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_0064: 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)
			value = Mathf.Clamp01(value);
			float num = size * guiHelper.uiScale;
			List<GUILayoutOption> list = new List<GUILayoutOption>();
			list.Add(GUILayout.Width(num));
			list.Add(GUILayout.Height(num));
			if (options != null && options.Length != 0)
			{
				list.AddRange(options);
			}
			Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, list.ToArray());
			StyleManager styleManager = guiHelper.GetStyleManager();
			GUI.Box(rect, GUIContent.none, styleManager.GetProgressBarStyle());
			if (!(value > 0f))
			{
				return;
			}
			int num2 = Mathf.RoundToInt(value * 8f);
			Rect val = default(Rect);
			for (int i = 0; i < num2; i++)
			{
				_ = (float)i / 8f;
				((Rect)(ref val))..ctor(((Rect)(ref rect)).x + ((Rect)(ref rect)).width * 0.1f, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height * 0.1f, ((Rect)(ref rect)).width * 0.8f, ((Rect)(ref rect)).height * 0.8f);
				if (i < num2)
				{
					GUI.Box(val, GUIContent.none, styleManager.GetProgressBarStyle(ControlVariant.Secon

MimesisModMenu.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using Bifrost.Cooked;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using Mimesis_Mod_Menu.Core;
using Mimesis_Mod_Menu.Core.Config;
using Mimesis_Mod_Menu.Core.Features;
using Mimic;
using Mimic.Actors;
using MimicAPI.GameAPI;
using ReluProtocol;
using ReluProtocol.Enum;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using shadcnui.GUIComponents.Core;
using shadcnui.GUIComponents.Layout;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Loader), "ModMenu", "2.5.3", "notfishvr", null)]
[assembly: MelonGame("ReLUGames", "MIMESIS")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MimesisModMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e9440966918909385f3387fdfbfea974d6d8373a")]
[assembly: AssemblyProduct("MimesisModMenu")]
[assembly: AssemblyTitle("MimesisModMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Mimesis_Mod_Menu.Core
{
	public class Loader : MelonMod
	{
		private GameObject gui;

		public override void OnInitializeMelon()
		{
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)gui == (Object)null)
			{
				gui = new GameObject("MainGUI");
				gui.AddComponent<MainGUI>();
				Object.DontDestroyOnLoad((Object)(object)gui);
			}
		}
	}
	public class MainGUI : MonoBehaviour
	{
		public class FeatureState
		{
			public bool GodMode;

			public bool InfiniteStamina;

			public bool NoFallDamage;

			public bool SpeedBoost;

			public float SpeedMultiplier = 2f;

			public bool ESP;

			public float ESPDistance = 150f;

			public bool ESPShowLoot;

			public bool ESPShowPlayers;

			public bool ESPShowMonsters;

			public bool ESPShowInteractors;

			public bool ESPShowNPCs;

			public bool ESPShowFieldSkills;

			public bool ESPShowProjectiles;

			public bool ESPShowAuraSkills;

			public bool AutoLoot;

			public float AutoLootDistance = 50f;

			public bool Fullbright;

			public bool InfiniteDurability;

			public bool InfinitePrice;

			public bool InfiniteGauge;

			public bool ForceBuy;

			public bool ForceRepair;

			public bool InfiniteCurrency;
		}

		private GUIHelper guiHelper;

		private ConfigManager configManager;

		private Rect windowRect = new Rect(20f, 20f, 1000f, 800f);

		private Vector2 scrollPosition;

		private int currentDemoTab;

		private TabConfig[] demoTabs;

		private PickupManager pickupManager;

		private MovementManager movementManager;

		private AutoLootManager autoLootManager;

		private FullbrightManager fullbrightManager;

		private ItemSpawnerManager itemSpawnerManager;

		private ProtoActor selectedPlayer;

		private ProtoActor[] cachedPlayers;

		private float lastPlayerCacheTime;

		private string editingHotkey = "";

		private bool isListeningForHotkey;

		private KeyCode pendingKey;

		private bool pendingShift;

		private bool pendingCtrl;

		private bool pendingAlt;

		private string itemSpawnIDInput = "1001";

		private string itemSpawnQuantityInput = "1";

		private bool showDemoWindow = true;

		private float lastMenuToggleTime;

		private const float PLAYER_CACHE_INTERVAL = 5f;

		private const float HOTKEY_COOLDOWN = 0.5f;

		private FeatureState state = new FeatureState();

		private void Start()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//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_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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				guiHelper = new GUIHelper();
				configManager = new ConfigManager();
				demoTabs = (TabConfig[])(object)new TabConfig[6]
				{
					new TabConfig("Player", (Action)DrawPlayerTab, false),
					new TabConfig("Combat", (Action)DrawCombatTab, false),
					new TabConfig("Loot", (Action)DrawLootTab, false),
					new TabConfig("Visual", (Action)DrawVisualTab, false),
					new TabConfig("Entities", (Action)DrawEntitiesTab, false),
					new TabConfig("Settings", (Action)DrawSettingsTab, false)
				};
				autoLootManager = new AutoLootManager();
				fullbrightManager = new FullbrightManager();
				pickupManager = new PickupManager();
				movementManager = new MovementManager();
				itemSpawnerManager = new ItemSpawnerManager();
				ESPManager.Initialize();
				Patches.ApplyPatches(configManager);
				HotkeyConfig hotkey = configManager.GetHotkey("ToggleMenu");
				if ((int)hotkey.Key == 0)
				{
					configManager.SetHotkey("ToggleMenu", new HotkeyConfig((KeyCode)277));
					MelonLogger.Msg("Set ToggleMenu hotkey to Insert");
				}
				if (!configManager.GetValue("Enabled", defaultValue: true, "Enable or disable the mod menu"))
				{
					showDemoWindow = false;
				}
				MelonLogger.Msg("Mimesis Mod Menu initialized successfully");
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Start error: " + ex.Message);
			}
		}

		private void Update()
		{
			try
			{
				if (configManager == null)
				{
					autoLootManager?.Update();
					fullbrightManager?.Update();
					pickupManager?.Update();
					movementManager?.Update();
					itemSpawnerManager?.Update();
					return;
				}
				if (!configManager.GetValue("Enabled", defaultValue: true))
				{
					autoLootManager?.Update();
					fullbrightManager?.Update();
					pickupManager?.Update();
					movementManager?.Update();
					itemSpawnerManager?.Update();
					return;
				}
				if (isListeningForHotkey)
				{
					DetectHotkeyInput();
					return;
				}
				if (configManager.GetHotkey("ToggleMenu").IsPressed() && Time.time - lastMenuToggleTime > 0.5f)
				{
					showDemoWindow = !showDemoWindow;
					lastMenuToggleTime = Time.time;
				}
				if (configManager.GetHotkey("ToggleGodMode").IsPressed())
				{
					ToggleBool("godMode", delegate(bool x)
					{
						state.GodMode = x;
					}, () => state.GodMode);
				}
				if (configManager.GetHotkey("ToggleInfiniteStamina").IsPressed())
				{
					ToggleBool("infiniteStamina", delegate(bool x)
					{
						state.InfiniteStamina = x;
					}, () => state.InfiniteStamina);
				}
				if (configManager.GetHotkey("ToggleNoFallDamage").IsPressed())
				{
					ToggleBool("noFallDamage", delegate(bool x)
					{
						state.NoFallDamage = x;
					}, () => state.NoFallDamage);
				}
				if (configManager.GetHotkey("ToggleSpeedBoost").IsPressed())
				{
					ToggleBool("speedBoost", delegate(bool x)
					{
						state.SpeedBoost = x;
					}, () => state.SpeedBoost);
				}
				if (configManager.GetHotkey("ToggleESP").IsPressed())
				{
					ToggleBool("espEnabled", delegate(bool x)
					{
						state.ESP = x;
					}, () => state.ESP);
				}
				if (configManager.GetHotkey("ToggleAutoLoot").IsPressed())
				{
					state.AutoLoot = !state.AutoLoot;
					autoLootManager?.SetEnabled(state.AutoLoot);
				}
				if (configManager.GetHotkey("ToggleFullbright").IsPressed())
				{
					state.Fullbright = !state.Fullbright;
					fullbrightManager?.SetEnabled(state.Fullbright);
				}
				autoLootManager?.Update();
				fullbrightManager?.Update();
				pickupManager?.Update();
				movementManager?.Update();
				itemSpawnerManager?.Update();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Update error: " + ex.Message);
			}
		}

		private void ToggleBool(string key, Action<bool> setter, Func<bool> getter)
		{
			bool obj = !getter();
			setter(obj);
		}

		private void DetectHotkeyInput()
		{
			//IL_0061: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Invalid comparison between Unknown and I4
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Keyboard current = Keyboard.current;
				if (current != null)
				{
					KeyControl escapeKey = current.escapeKey;
					if (((escapeKey != null) ? new bool?(((ButtonControl)escapeKey).wasPressedThisFrame) : null).GetValueOrDefault())
					{
						isListeningForHotkey = false;
						return;
					}
				}
				KeyCode[] array = (KeyCode[])Enum.GetValues(typeof(KeyCode));
				KeyCode[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					KeyCode val = array2[i];
					if ((int)val == 0 || (int)val == 27)
					{
						continue;
					}
					try
					{
						KeyControl val2 = current.FindKeyOnCurrentKeyboardLayout(((object)(KeyCode)(ref val)).ToString());
						if (val2 != null && ((ButtonControl)val2).wasPressedThisFrame)
						{
							pendingKey = val;
							pendingShift = ((ButtonControl)current.leftShiftKey).isPressed || ((ButtonControl)current.rightShiftKey).isPressed;
							pendingCtrl = ((ButtonControl)current.leftCtrlKey).isPressed || ((ButtonControl)current.rightCtrlKey).isPressed;
							pendingAlt = ((ButtonControl)current.leftAltKey).isPressed || ((ButtonControl)current.rightAltKey).isPressed;
							isListeningForHotkey = false;
							break;
						}
					}
					catch
					{
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("DetectHotkeyInput error: " + ex.Message);
				isListeningForHotkey = false;
			}
		}

		private void OnGUI()
		{
			//IL_0026: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ConfigManager obj = configManager;
				if (obj == null || obj.GetValue("Enabled", defaultValue: true))
				{
					GUI.color = Color.white;
					if (GUI.Button(new Rect(10f, 10f, 150f, 30f), showDemoWindow ? "Hide Menu" : "Show Menu"))
					{
						showDemoWindow = !showDemoWindow;
					}
					if (showDemoWindow)
					{
						windowRect = GUI.Window(101, windowRect, new WindowFunction(DrawDemoWindow), "Mimesis Mod Menu");
					}
					ESPManager.UpdateESP();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("OnGUI error: " + ex.Message);
			}
		}

		private void OnDestroy()
		{
			try
			{
				fullbrightManager?.Cleanup();
				ESPManager.Cleanup();
				pickupManager?.Stop();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("OnDestroy error: " + ex.Message);
			}
		}

		public FeatureState GetFeatureState()
		{
			return state;
		}

		private void DrawDemoWindow(int windowID)
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.UpdateAnimations(showDemoWindow);
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null && obj2.BeginAnimatedGUI())
				{
					GUIHelper obj3 = guiHelper;
					currentDemoTab = ((obj3 != null) ? obj3.VerticalTabs(demoTabs?.Select((TabConfig t) => t.Name).ToArray() ?? new string[0], currentDemoTab, (Action)DrawCurrentTabContent, 140f, 1, (TabSide)0, Array.Empty<GUILayoutOption>()) : 0);
					GUIHelper obj4 = guiHelper;
					if (obj4 != null)
					{
						obj4.EndAnimatedGUI();
					}
					GUI.DragWindow();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawDemoWindow error: " + ex.Message);
			}
		}

		private void DrawCurrentTabContent()
		{
			//IL_0014: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GUIHelper obj = guiHelper;
				scrollPosition = ((obj != null) ? obj.DrawScrollView(scrollPosition, (Action)delegate
				{
					GUIHelper obj2 = guiHelper;
					if (obj2 != null)
					{
						obj2.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
					}
					demoTabs?[currentDemoTab].Content?.Invoke();
					GUIHelper obj3 = guiHelper;
					if (obj3 != null)
					{
						obj3.EndVerticalGroup();
					}
				}, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(700f) }) : scrollPosition);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawCurrentTabContent error: " + ex.Message);
			}
		}

		private void DrawPlayerTab()
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.BeginCard(-1f, -1f);
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.CardTitle("Defense");
				}
				GUIHelper obj4 = guiHelper;
				if (obj4 != null)
				{
					obj4.CardContent((Action)delegate
					{
						DrawToggleButton("God Mode", delegate(bool x)
						{
							state.GodMode = x;
						}, () => state.GodMode);
						GUIHelper obj17 = guiHelper;
						if (obj17 != null)
						{
							obj17.AddSpace(8f);
						}
						DrawToggleButton("No Fall Damage", delegate(bool x)
						{
							state.NoFallDamage = x;
						}, () => state.NoFallDamage);
						GUIHelper obj18 = guiHelper;
						if (obj18 != null)
						{
							obj18.AddSpace(8f);
						}
						DrawToggleButton("Infinite Stamina", delegate(bool x)
						{
							state.InfiniteStamina = x;
						}, () => state.InfiniteStamina);
					});
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.EndCard();
				}
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.AddSpace(12f);
				}
				GUIHelper obj7 = guiHelper;
				if (obj7 != null)
				{
					obj7.BeginCard(-1f, -1f);
				}
				GUIHelper obj8 = guiHelper;
				if (obj8 != null)
				{
					obj8.CardTitle("Movement");
				}
				GUIHelper obj9 = guiHelper;
				if (obj9 != null)
				{
					obj9.CardContent((Action)delegate
					{
						DrawToggleButton("Speed Boost", delegate(bool x)
						{
							state.SpeedBoost = x;
						}, () => state.SpeedBoost);
						if (state.SpeedBoost)
						{
							GUIHelper obj12 = guiHelper;
							if (obj12 != null)
							{
								obj12.AddSpace(8f);
							}
							DrawFloatSlider("Multiplier", delegate(float x)
							{
								state.SpeedMultiplier = x;
							}, () => state.SpeedMultiplier, 1f, 5f, "x");
							GUIHelper obj13 = guiHelper;
							if (obj13 != null)
							{
								obj13.MutedLabel($"Current: {state.SpeedMultiplier:F2}x", Array.Empty<GUILayoutOption>());
							}
						}
						GUIHelper obj14 = guiHelper;
						if (obj14 != null)
						{
							obj14.AddSpace(10f);
						}
						DrawTeleportButton("Forward 50u", 50f);
						GUIHelper obj15 = guiHelper;
						if (obj15 != null)
						{
							obj15.AddSpace(6f);
						}
						DrawTeleportButton("Forward 100u", 100f);
						GUIHelper obj16 = guiHelper;
						if (obj16 != null)
						{
							obj16.AddSpace(6f);
						}
						DrawTeleportButton("Forward 200u", 200f);
					});
				}
				GUIHelper obj10 = guiHelper;
				if (obj10 != null)
				{
					obj10.EndCard();
				}
				GUIHelper obj11 = guiHelper;
				if (obj11 != null)
				{
					obj11.EndVerticalGroup();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawPlayerTab error: " + ex.Message);
			}
		}

		private void DrawCombatTab()
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.BeginCard(-1f, -1f);
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.CardTitle("Bulk Actions");
				}
				GUIHelper obj4 = guiHelper;
				if (obj4 != null)
				{
					obj4.CardContent((Action)delegate
					{
						GUIHelper obj7 = guiHelper;
						if (obj7 != null && obj7.Button("Kill All Players", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							KillAllActors((ActorType)1);
						}
						GUIHelper obj8 = guiHelper;
						if (obj8 != null)
						{
							obj8.AddSpace(10f);
						}
						GUIHelper obj9 = guiHelper;
						if (obj9 != null && obj9.Button("Kill All Monsters", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							KillAllActors((ActorType)2);
						}
					});
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.EndCard();
				}
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.EndVerticalGroup();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawCombatTab error: " + ex.Message);
			}
		}

		private void DrawLootTab()
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.BeginCard(-1f, -1f);
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.CardTitle("Item Collection");
				}
				GUIHelper obj4 = guiHelper;
				if (obj4 != null)
				{
					obj4.CardContent((Action)delegate
					{
						//IL_002a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0039: Unknown result type (might be due to invalid IL or missing references)
						bool flag = pickupManager?.isActive ?? false;
						string text = (flag ? "Stop Picking Up" : "Pickup All Items");
						ControlVariant val = (ControlVariant)(flag ? 2 : 0);
						GUIHelper obj32 = guiHelper;
						if (obj32 != null && obj32.Button(text, val, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							if (flag)
							{
								pickupManager?.Stop();
							}
							else
							{
								pickupManager?.StartPickupAll();
							}
						}
						GUIHelper obj33 = guiHelper;
						if (obj33 != null)
						{
							obj33.MutedLabel(flag ? "Actively picking up items..." : "Click to start pickup", Array.Empty<GUILayoutOption>());
						}
					});
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.EndCard();
				}
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.AddSpace(12f);
				}
				GUIHelper obj7 = guiHelper;
				if (obj7 != null)
				{
					obj7.BeginCard(-1f, -1f);
				}
				GUIHelper obj8 = guiHelper;
				if (obj8 != null)
				{
					obj8.CardTitle("Auto Loot");
				}
				GUIHelper obj9 = guiHelper;
				if (obj9 != null)
				{
					obj9.CardContent((Action)delegate
					{
						DrawToggleButton("Auto Loot Enabled", delegate(bool x)
						{
							state.AutoLoot = x;
						}, () => state.AutoLoot);
						if (state.AutoLoot)
						{
							GUIHelper obj30 = guiHelper;
							if (obj30 != null)
							{
								obj30.AddSpace(8f);
							}
							DrawFloatSlider("Detection Range", delegate(float x)
							{
								state.AutoLootDistance = x;
							}, () => state.AutoLootDistance, 10f, 200f, "m");
							autoLootManager?.SetDistance(state.AutoLootDistance);
							GUIHelper obj31 = guiHelper;
							if (obj31 != null)
							{
								obj31.MutedLabel($"Current: {state.AutoLootDistance:F1}m", Array.Empty<GUILayoutOption>());
							}
						}
					});
				}
				GUIHelper obj10 = guiHelper;
				if (obj10 != null)
				{
					obj10.EndCard();
				}
				GUIHelper obj11 = guiHelper;
				if (obj11 != null)
				{
					obj11.AddSpace(12f);
				}
				GUIHelper obj12 = guiHelper;
				if (obj12 != null)
				{
					obj12.BeginCard(-1f, -1f);
				}
				GUIHelper obj13 = guiHelper;
				if (obj13 != null)
				{
					obj13.CardTitle("Equipment");
				}
				GUIHelper obj14 = guiHelper;
				if (obj14 != null)
				{
					obj14.CardContent((Action)delegate
					{
						DrawToggleButton("Infinite Durability", delegate(bool x)
						{
							state.InfiniteDurability = x;
						}, () => state.InfiniteDurability);
						GUIHelper obj29 = guiHelper;
						if (obj29 != null)
						{
							obj29.AddSpace(8f);
						}
						DrawToggleButton("Infinite Gauge", delegate(bool x)
						{
							state.InfiniteGauge = x;
						}, () => state.InfiniteGauge);
					});
				}
				GUIHelper obj15 = guiHelper;
				if (obj15 != null)
				{
					obj15.EndCard();
				}
				GUIHelper obj16 = guiHelper;
				if (obj16 != null)
				{
					obj16.AddSpace(12f);
				}
				GUIHelper obj17 = guiHelper;
				if (obj17 != null)
				{
					obj17.BeginCard(-1f, -1f);
				}
				GUIHelper obj18 = guiHelper;
				if (obj18 != null)
				{
					obj18.CardTitle("Commerce");
				}
				GUIHelper obj19 = guiHelper;
				if (obj19 != null)
				{
					obj19.CardContent((Action)delegate
					{
						DrawToggleButton("Infinite Currency", delegate(bool x)
						{
							state.InfiniteCurrency = x;
						}, () => state.InfiniteCurrency);
						GUIHelper obj28 = guiHelper;
						if (obj28 != null)
						{
							obj28.AddSpace(8f);
						}
						DrawToggleButton("Infinite Price", delegate(bool x)
						{
							state.InfinitePrice = x;
						}, () => state.InfinitePrice);
					});
				}
				GUIHelper obj20 = guiHelper;
				if (obj20 != null)
				{
					obj20.EndCard();
				}
				GUIHelper obj21 = guiHelper;
				if (obj21 != null)
				{
					obj21.AddSpace(12f);
				}
				GUIHelper obj22 = guiHelper;
				if (obj22 != null)
				{
					obj22.BeginCard(-1f, -1f);
				}
				GUIHelper obj23 = guiHelper;
				if (obj23 != null)
				{
					obj23.CardTitle("Shop Actions");
				}
				GUIHelper obj24 = guiHelper;
				if (obj24 != null)
				{
					obj24.CardContent((Action)delegate
					{
						DrawToggleButton("Force Buy", delegate(bool x)
						{
							state.ForceBuy = x;
						}, () => state.ForceBuy);
						GUIHelper obj27 = guiHelper;
						if (obj27 != null)
						{
							obj27.AddSpace(8f);
						}
						DrawToggleButton("Force Repair", delegate(bool x)
						{
							state.ForceRepair = x;
						}, () => state.ForceRepair);
					});
				}
				GUIHelper obj25 = guiHelper;
				if (obj25 != null)
				{
					obj25.EndCard();
				}
				GUIHelper obj26 = guiHelper;
				if (obj26 != null)
				{
					obj26.EndVerticalGroup();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawLootTab error: " + ex.Message);
			}
		}

		private void DrawVisualTab()
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.BeginCard(-1f, -1f);
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.CardTitle("ESP Settings");
				}
				GUIHelper obj4 = guiHelper;
				if (obj4 != null)
				{
					obj4.CardContent((Action)delegate
					{
						DrawToggleButton("Enable ESP", delegate(bool x)
						{
							state.ESP = x;
						}, () => state.ESP);
						if (state.ESP)
						{
							GUIHelper obj25 = guiHelper;
							if (obj25 != null)
							{
								obj25.AddSpace(10f);
							}
							DrawFloatSlider("Distance", delegate(float x)
							{
								state.ESPDistance = x;
							}, () => state.ESPDistance, 50f, 500f, "m");
						}
					});
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.EndCard();
				}
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.AddSpace(12f);
				}
				GUIHelper obj7 = guiHelper;
				if (obj7 != null)
				{
					obj7.BeginCard(-1f, -1f);
				}
				GUIHelper obj8 = guiHelper;
				if (obj8 != null)
				{
					obj8.CardTitle("ESP Visibility");
				}
				GUIHelper obj9 = guiHelper;
				if (obj9 != null)
				{
					obj9.CardContent((Action)delegate
					{
						GUIHelper obj17 = guiHelper;
						if (obj17 != null)
						{
							obj17.BeginHorizontalGroup();
						}
						GUIHelper obj18 = guiHelper;
						if (obj18 != null)
						{
							obj18.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
						}
						DrawToggleButton("Players", delegate(bool x)
						{
							state.ESPShowPlayers = x;
						}, () => state.ESPShowPlayers);
						DrawToggleButton("Monsters", delegate(bool x)
						{
							state.ESPShowMonsters = x;
						}, () => state.ESPShowMonsters);
						DrawToggleButton("Loot", delegate(bool x)
						{
							state.ESPShowLoot = x;
						}, () => state.ESPShowLoot);
						GUIHelper obj19 = guiHelper;
						if (obj19 != null)
						{
							obj19.EndVerticalGroup();
						}
						GUIHelper obj20 = guiHelper;
						if (obj20 != null)
						{
							obj20.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
						}
						DrawToggleButton("Interactors", delegate(bool x)
						{
							state.ESPShowInteractors = x;
						}, () => state.ESPShowInteractors);
						DrawToggleButton("NPCs", delegate(bool x)
						{
							state.ESPShowNPCs = x;
						}, () => state.ESPShowNPCs);
						DrawToggleButton("Field Skills", delegate(bool x)
						{
							state.ESPShowFieldSkills = x;
						}, () => state.ESPShowFieldSkills);
						GUIHelper obj21 = guiHelper;
						if (obj21 != null)
						{
							obj21.EndVerticalGroup();
						}
						GUIHelper obj22 = guiHelper;
						if (obj22 != null)
						{
							obj22.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
						}
						DrawToggleButton("Projectiles", delegate(bool x)
						{
							state.ESPShowProjectiles = x;
						}, () => state.ESPShowProjectiles);
						DrawToggleButton("Aura Skills", delegate(bool x)
						{
							state.ESPShowAuraSkills = x;
						}, () => state.ESPShowAuraSkills);
						GUIHelper obj23 = guiHelper;
						if (obj23 != null)
						{
							obj23.EndVerticalGroup();
						}
						GUIHelper obj24 = guiHelper;
						if (obj24 != null)
						{
							obj24.EndHorizontalGroup();
						}
					});
				}
				GUIHelper obj10 = guiHelper;
				if (obj10 != null)
				{
					obj10.EndCard();
				}
				GUIHelper obj11 = guiHelper;
				if (obj11 != null)
				{
					obj11.AddSpace(12f);
				}
				GUIHelper obj12 = guiHelper;
				if (obj12 != null)
				{
					obj12.BeginCard(-1f, -1f);
				}
				GUIHelper obj13 = guiHelper;
				if (obj13 != null)
				{
					obj13.CardTitle("Lighting");
				}
				GUIHelper obj14 = guiHelper;
				if (obj14 != null)
				{
					obj14.CardContent((Action)delegate
					{
						DrawToggleButton("Fullbright", delegate(bool x)
						{
							state.Fullbright = x;
							fullbrightManager?.SetEnabled(state.Fullbright);
						}, () => state.Fullbright);
					});
				}
				GUIHelper obj15 = guiHelper;
				if (obj15 != null)
				{
					obj15.EndCard();
				}
				GUIHelper obj16 = guiHelper;
				if (obj16 != null)
				{
					obj16.EndVerticalGroup();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawVisualTab error: " + ex.Message);
			}
		}

		private void DrawEntitiesTab()
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				UpdatePlayerCache();
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.BeginHorizontalGroup();
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
				}
				GUIHelper obj4 = guiHelper;
				if (obj4 != null)
				{
					obj4.BeginCard(280f, 600f);
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.CardTitle("Entity List");
				}
				ProtoActor[] array = cachedPlayers;
				int num = ((array != null) ? array.Length : 0);
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.CardDescription($"Total: {num}");
				}
				GUIHelper obj7 = guiHelper;
				if (obj7 != null)
				{
					obj7.CardContent((Action)delegate
					{
						ProtoActor[] array2 = cachedPlayers ?? Array.Empty<ProtoActor>();
						if (array2.Length == 0)
						{
							GUIHelper obj15 = guiHelper;
							if (obj15 != null)
							{
								obj15.MutedLabel("No entities found", Array.Empty<GUILayoutOption>());
							}
						}
						else
						{
							int num2 = Mathf.Min(array2.Length, 15);
							for (int i = 0; i < num2; i++)
							{
								DrawActorListItem(array2[i]);
							}
							if (array2.Length > num2)
							{
								GUIHelper obj16 = guiHelper;
								if (obj16 != null)
								{
									obj16.MutedLabel($"...and {array2.Length - num2} more", Array.Empty<GUILayoutOption>());
								}
							}
						}
					});
				}
				GUIHelper obj8 = guiHelper;
				if (obj8 != null)
				{
					obj8.EndCard();
				}
				GUIHelper obj9 = guiHelper;
				if (obj9 != null)
				{
					obj9.EndVerticalGroup();
				}
				GUIHelper obj10 = guiHelper;
				if (obj10 != null)
				{
					obj10.AddSpace(12f);
				}
				GUIHelper obj11 = guiHelper;
				if (obj11 != null)
				{
					obj11.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				DrawEntityActionsPanel();
				GUIHelper obj12 = guiHelper;
				if (obj12 != null)
				{
					obj12.EndVerticalGroup();
				}
				GUIHelper obj13 = guiHelper;
				if (obj13 != null)
				{
					obj13.EndHorizontalGroup();
				}
				GUIHelper obj14 = guiHelper;
				if (obj14 != null)
				{
					obj14.EndVerticalGroup();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawEntitiesTab error: " + ex.Message);
			}
		}

		private void DrawEntityActionsPanel()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Invalid comparison between Unknown and I4
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginCard(-1f, 600f);
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.CardTitle("Entity Actions");
				}
				if ((Object)(object)selectedPlayer != (Object)null)
				{
					string text = (((int)selectedPlayer.ActorType == 1) ? "Player" : "Monster");
					GUIHelper obj3 = guiHelper;
					if (obj3 != null)
					{
						obj3.CardDescription("Target: " + selectedPlayer.nickName + " (" + text + ")");
					}
				}
				else
				{
					GUIHelper obj4 = guiHelper;
					if (obj4 != null)
					{
						obj4.CardDescription("Select an entity to perform actions");
					}
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.CardContent((Action)delegate
					{
						//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
						//IL_01b7: Invalid comparison between Unknown and I4
						//IL_0207: Unknown result type (might be due to invalid IL or missing references)
						//IL_020d: Invalid comparison between Unknown and I4
						if ((Object)(object)selectedPlayer == (Object)null)
						{
							GUIHelper obj7 = guiHelper;
							if (obj7 != null)
							{
								obj7.MutedLabel("No entity selected", Array.Empty<GUILayoutOption>());
							}
						}
						else
						{
							DrawActorInfo(selectedPlayer, localPlayer);
							GUIHelper obj8 = guiHelper;
							if (obj8 != null)
							{
								obj8.AddSpace(14f);
							}
							GUIHelper obj9 = guiHelper;
							if (obj9 != null)
							{
								obj9.LabeledSeparator("Actions", Array.Empty<GUILayoutOption>());
							}
							GUIHelper obj10 = guiHelper;
							if (obj10 != null)
							{
								obj10.AddSpace(8f);
							}
							if ((Object)(object)localPlayer != (Object)null)
							{
								GUIHelper obj11 = guiHelper;
								if (obj11 != null && obj11.Button("Teleport To Target", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
								{
									movementManager?.TeleportToPlayer(selectedPlayer);
								}
								if (selectedPlayer.ActorID != localPlayer.ActorID)
								{
									GUIHelper obj12 = guiHelper;
									if (obj12 != null)
									{
										obj12.AddSpace(8f);
									}
									GUIHelper obj13 = guiHelper;
									if (obj13 != null && obj13.Button("Teleport Target To Me", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
									{
										movementManager?.TeleportPlayerToSelf(selectedPlayer);
									}
									GUIHelper obj14 = guiHelper;
									if (obj14 != null)
									{
										obj14.AddSpace(8f);
									}
									if ((int)selectedPlayer.ActorType == 1)
									{
										GUIHelper obj15 = guiHelper;
										if (obj15 != null && obj15.Button("Kill Player", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
										{
											KillActor(selectedPlayer);
										}
									}
									else if ((int)selectedPlayer.ActorType == 2)
									{
										GUIHelper obj16 = guiHelper;
										if (obj16 != null && obj16.Button("Kill Monster", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
										{
											KillActor(selectedPlayer);
										}
									}
								}
							}
						}
					});
				}
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.EndCard();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawEntityActionsPanel error: " + ex.Message);
			}
		}

		private void DrawSettingsTab()
		{
			try
			{
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.BeginCard(-1f, -1f);
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.CardTitle("Hotkey Configuration");
				}
				GUIHelper obj4 = guiHelper;
				if (obj4 != null)
				{
					obj4.CardDescription("Click any hotkey to edit");
				}
				GUIHelper obj5 = guiHelper;
				if (obj5 != null)
				{
					obj5.CardContent((Action)delegate
					{
						//IL_0188: Unknown result type (might be due to invalid IL or missing references)
						//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
						//IL_01de: Unknown result type (might be due to invalid IL or missing references)
						//IL_0144: Unknown result type (might be due to invalid IL or missing references)
						Dictionary<string, HotkeyConfig> source = configManager?.GetAllHotkeys() ?? new Dictionary<string, HotkeyConfig>();
						foreach (KeyValuePair<string, HotkeyConfig> item in source.OrderBy((KeyValuePair<string, HotkeyConfig> x) => x.Key))
						{
							string text = Regex.Replace(item.Key, "([a-z])([A-Z])", "$1 $2");
							GUIHelper obj16 = guiHelper;
							if (obj16 != null)
							{
								obj16.BeginHorizontalGroup();
							}
							GUIHelper obj17 = guiHelper;
							if (obj17 != null)
							{
								obj17.Label(text + ":", (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
							}
							if (isListeningForHotkey && editingHotkey == item.Key)
							{
								GUIHelper obj18 = guiHelper;
								if (obj18 != null)
								{
									obj18.DestructiveLabel("Press any key (ESC to cancel)", Array.Empty<GUILayoutOption>());
								}
							}
							else
							{
								HotkeyConfig hotkeyConfig = configManager?.GetHotkey(item.Key);
								GUIHelper obj19 = guiHelper;
								if (obj19 != null && obj19.Button(hotkeyConfig?.ToString() ?? "None", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
								{
									editingHotkey = item.Key;
									isListeningForHotkey = true;
									pendingKey = (KeyCode)0;
								}
							}
							GUIHelper obj20 = guiHelper;
							if (obj20 != null)
							{
								obj20.EndHorizontalGroup();
							}
							GUIHelper obj21 = guiHelper;
							if (obj21 != null)
							{
								obj21.AddSpace(4f);
							}
						}
						if ((int)pendingKey != 0 && !isListeningForHotkey && !string.IsNullOrEmpty(editingHotkey))
						{
							HotkeyConfig hotkey = new HotkeyConfig(pendingKey, pendingShift, pendingCtrl, pendingAlt);
							configManager?.SetHotkey(editingHotkey, hotkey);
							pendingKey = (KeyCode)0;
							editingHotkey = "";
						}
					});
				}
				GUIHelper obj6 = guiHelper;
				if (obj6 != null)
				{
					obj6.EndCard();
				}
				GUIHelper obj7 = guiHelper;
				if (obj7 != null)
				{
					obj7.AddSpace(12f);
				}
				GUIHelper obj8 = guiHelper;
				if (obj8 != null)
				{
					obj8.BeginCard(-1f, -1f);
				}
				GUIHelper obj9 = guiHelper;
				if (obj9 != null)
				{
					obj9.CardTitle("Configuration");
				}
				GUIHelper obj10 = guiHelper;
				if (obj10 != null)
				{
					obj10.CardContent((Action)delegate
					{
						GUIHelper obj13 = guiHelper;
						if (obj13 != null && obj13.Button("Save Configuration", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							MelonLogger.Msg("Configuration saved");
						}
						GUIHelper obj14 = guiHelper;
						if (obj14 != null)
						{
							obj14.AddSpace(6f);
						}
						GUIHelper obj15 = guiHelper;
						if (obj15 != null && obj15.Button("Reload Configuration", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							configManager?.LoadAllConfigs();
							MelonLogger.Msg("Configuration reloaded");
						}
					});
				}
				GUIHelper obj11 = guiHelper;
				if (obj11 != null)
				{
					obj11.EndCard();
				}
				GUIHelper obj12 = guiHelper;
				if (obj12 != null)
				{
					obj12.EndVerticalGroup();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawSettingsTab error: " + ex.Message);
			}
		}

		private void DrawToggleButton(string label, Action<bool> setter, Func<bool> getter)
		{
			Action<bool> setter2 = setter;
			bool flag = getter();
			GUIHelper obj = guiHelper;
			if (obj != null)
			{
				obj.Toggle(label, flag, (ControlVariant)0, (ControlSize)0, (Action<bool>)delegate(bool newValue)
				{
					setter2(newValue);
				}, false, Array.Empty<GUILayoutOption>());
			}
			else
				_ = 0;
		}

		private void DrawFloatSlider(string label, Action<float> setter, Func<float> getter, float min, float max, string suffix)
		{
			float num = getter();
			GUIHelper obj = guiHelper;
			if (obj != null)
			{
				obj.BeginHorizontalGroup();
			}
			GUIHelper obj2 = guiHelper;
			if (obj2 != null)
			{
				obj2.Label($"{label}: {num:F1}{suffix}", (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
			}
			float num2 = GUILayout.HorizontalSlider(num, min, max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUIHelper obj3 = guiHelper;
			if (obj3 != null)
			{
				obj3.EndHorizontalGroup();
			}
			if (num2 != num)
			{
				setter(num2);
			}
		}

		private void DrawTeleportButton(string label, float distance)
		{
			GUIHelper obj = guiHelper;
			if (obj != null && obj.Button(label, (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
			{
				movementManager?.TeleportForward(distance);
			}
		}

		private void UpdatePlayerCache()
		{
			try
			{
				if (!(Time.time - lastPlayerCacheTime < 5f))
				{
					ProtoActor[] allPlayers = PlayerAPI.GetAllPlayers();
					cachedPlayers = (from p in allPlayers
						where (Object)(object)p != (Object)null && !string.IsNullOrEmpty(p.nickName) && !p.dead
						orderby p.ActorType, p.nickName
						select p).ToArray();
					lastPlayerCacheTime = Time.time;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("UpdatePlayerCache error: " + ex.Message);
			}
		}

		private void DrawActorListItem(ProtoActor actor)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string text = actor.nickName;
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				string text2 = (((int)actor.ActorType == 1) ? "[P]" : "[M]");
				if ((Object)(object)localPlayer != (Object)null && actor.ActorID == localPlayer.ActorID)
				{
					text += " [YOU]";
				}
				text = text2 + " " + text;
				ControlVariant val = (ControlVariant)(((Object)(object)selectedPlayer != (Object)null && selectedPlayer.ActorID == actor.ActorID) ? 1 : 4);
				GUIHelper obj = guiHelper;
				if (obj != null && obj.Button(text, val, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					selectedPlayer = actor;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawActorListItem error: " + ex.Message);
			}
		}

		private void DrawActorInfo(ProtoActor selectedTarget, ProtoActor localPlayer)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)selectedTarget == (Object)null)
				{
					return;
				}
				GUIHelper obj = guiHelper;
				if (obj != null)
				{
					obj.Label("Name: " + selectedTarget.nickName, (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
				}
				GUIHelper obj2 = guiHelper;
				if (obj2 != null)
				{
					obj2.Label("Type: " + (((int)selectedTarget.ActorType == 1) ? "Player" : "Monster"), (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
				}
				GUIHelper obj3 = guiHelper;
				if (obj3 != null)
				{
					obj3.Label($"Actor ID: {selectedTarget.ActorID}", (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
				}
				if ((Object)(object)localPlayer != (Object)null && selectedTarget.ActorID != localPlayer.ActorID)
				{
					float num = Vector3.Distance(((Component)selectedTarget).transform.position, ((Component)localPlayer).transform.position);
					GUIHelper obj4 = guiHelper;
					if (obj4 != null)
					{
						obj4.Label($"Distance: {num:F1}m", (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DrawActorInfo error: " + ex.Message);
			}
		}

		private void KillActor(ProtoActor target)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Object)(object)target == (Object)null))
				{
					ActorDeathInfo val = new ActorDeathInfo
					{
						DeadActorID = target.ActorID,
						ReasonOfDeath = (ReasonOfDeath)0,
						AttackerActorID = 0,
						LinkedMasterID = 0
					};
					target.OnActorDeath(ref val);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("KillActor error: " + ex.Message);
			}
		}

		private void KillAllActors(ActorType type)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ProtoActor[] allPlayers = PlayerAPI.GetAllPlayers();
				ProtoActor[] array = allPlayers;
				foreach (ProtoActor val in array)
				{
					if ((Object)(object)val != (Object)null && val.ActorType == type && !val.dead)
					{
						KillActor(val);
					}
				}
				string text = (((int)type == 1) ? "players" : "monsters");
				MelonLogger.Msg("Killed all " + text);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("KillAllActors error: " + ex.Message);
			}
		}
	}
	public static class Patches
	{
		private static MainGUI.FeatureState featureState;

		private static string itemLogPath = "";

		private static HashSet<int> loggedItems = new HashSet<int>();

		private static readonly BindingFlags AllFieldFlags = BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly string[] NumericFieldPatterns = new string[4] { "<{0}>k__BackingField", "{0}", "_{0}", "m_{0}" };

		public static MainGUI.FeatureState GetFeatureState()
		{
			if (featureState == null)
			{
				MainGUI mainGUI = Object.FindObjectOfType<MainGUI>();
				if ((Object)(object)mainGUI != (Object)null)
				{
					featureState = mainGUI.GetFeatureState();
				}
			}
			return featureState;
		}

		public static void ApplyPatches(ConfigManager config)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			try
			{
				itemLogPath = Path.Combine(Directory.GetCurrentDirectory(), "ItemMasterIDLog.txt");
				if (!File.Exists(itemLogPath))
				{
					File.WriteAllText(itemLogPath, "ItemID,ItemName\n");
				}
				MainGUI mainGUI = Object.FindObjectOfType<MainGUI>();
				if ((Object)(object)mainGUI != (Object)null)
				{
					featureState = mainGUI.GetFeatureState();
				}
				Harmony val = new Harmony("com.Mimesis.modmenu");
				val.PatchAll(typeof(Patches).Assembly);
				MelonLogger.Msg("Harmony patches applied successfully");
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error applying patches: " + ex.Message);
			}
		}

		public static void LogItemMasterID(int itemMasterID, ItemMasterInfo masterInfo)
		{
			try
			{
				if (!loggedItems.Contains(itemMasterID) && masterInfo != null)
				{
					loggedItems.Add(itemMasterID);
					string name = masterInfo.Name;
					string text = $"{itemMasterID},{name}";
					File.AppendAllText(itemLogPath, text + Environment.NewLine);
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error logging item: " + ex.Message);
			}
		}

		public static void SetIntField(object instance, string fieldName, int value)
		{
			try
			{
				if (instance == null || string.IsNullOrEmpty(fieldName))
				{
					return;
				}
				Type type = instance.GetType();
				string[] numericFieldPatterns = NumericFieldPatterns;
				foreach (string format in numericFieldPatterns)
				{
					string name = string.Format(format, fieldName);
					FieldInfo field = type.GetField(name, AllFieldFlags);
					if (field != null && IsNumericType(field.FieldType))
					{
						try
						{
							field.SetValue(instance, Convert.ChangeType(value, field.FieldType));
							break;
						}
						catch (Exception ex)
						{
							MelonLogger.Warning("Failed to set field " + fieldName + ": " + ex.Message);
						}
					}
				}
			}
			catch (Exception ex2)
			{
				MelonLogger.Error("Error in SetIntField: " + ex2.Message);
			}
		}

		private static bool IsNumericType(Type type)
		{
			try
			{
				return type == typeof(int) || type == typeof(long) || type == typeof(short) || type == typeof(byte);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error in IsNumericType: " + ex.Message);
				return false;
			}
		}
	}
	public static class ItemSpawnerPatches
	{
		public static int pendingItemMasterID;

		public static int pendingItemQuantity;

		public static void SetItemToSpawn(int itemMasterID, int quantity)
		{
			pendingItemMasterID = itemMasterID;
			pendingItemQuantity = quantity;
		}
	}
	[HarmonyPatch]
	internal static class InventoryControllerHandleChangeActiveInvenSlotPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(InventoryController), "HandleChangeActiveInvenSlot", new Type[3]
			{
				typeof(int),
				typeof(bool),
				typeof(int)
			}, (Type[])null);
		}

		private static void Prefix(InventoryController __instance, int slotIndex)
		{
			try
			{
				if (ItemSpawnerPatches.pendingItemMasterID == 0)
				{
					return;
				}
				int pendingItemMasterID = ItemSpawnerPatches.pendingItemMasterID;
				int pendingItemQuantity = ItemSpawnerPatches.pendingItemQuantity;
				ItemMasterInfo itemMasterInfo = Inventory.GetItemMasterInfo(pendingItemMasterID);
				if (itemMasterInfo == null)
				{
					ItemSpawnerPatches.pendingItemMasterID = 0;
					return;
				}
				object fieldValue = ReflectionHelper.GetFieldValue((object)__instance, "_self");
				VCreature val = (VCreature)((fieldValue is VCreature) ? fieldValue : null);
				if (val != null && ((VActor)val).VRoom != null)
				{
					ItemElement newItemElement = ((VActor)val).VRoom.GetNewItemElement(pendingItemMasterID, false, pendingItemQuantity, 0, 0, 0);
					if (newItemElement == null)
					{
						ItemSpawnerPatches.pendingItemMasterID = 0;
						return;
					}
					__instance.AddInvenItem(slotIndex, newItemElement, false);
					ItemSpawnerPatches.pendingItemMasterID = 0;
					ItemSpawnerPatches.pendingItemQuantity = 0;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("InventoryControllerHandleChangeActiveInvenSlotPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal static class ItemInfoConstructorPatch
	{
		private static void Postfix(ItemInfo __instance)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null)
				{
					if (featureState.InfiniteDurability)
					{
						Patches.SetIntField(__instance, "durability", int.MaxValue);
					}
					if (featureState.InfinitePrice)
					{
						Patches.SetIntField(__instance, "price", int.MaxValue);
					}
					if (featureState.InfiniteGauge)
					{
						Patches.SetIntField(__instance, "remainGauge", int.MaxValue);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("ItemInfoConstructorPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(InventoryItem), "UpdateInfo")]
	internal static class InventoryItemUpdateInfoPatch
	{
		private static void Postfix(InventoryItem __instance)
		{
			try
			{
				if (__instance.ItemMasterID > 0)
				{
					ItemMasterInfo itemMasterInfo = Inventory.GetItemMasterInfo(__instance.ItemMasterID);
					if (itemMasterInfo != null)
					{
						Patches.LogItemMasterID(__instance.ItemMasterID, itemMasterInfo);
					}
				}
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null)
				{
					if (featureState.InfiniteDurability)
					{
						Patches.SetIntField(__instance, "Durability", int.MaxValue);
					}
					if (featureState.InfinitePrice)
					{
						Patches.SetIntField(__instance, "Price", int.MaxValue);
					}
					if (featureState.InfiniteGauge)
					{
						Patches.SetIntField(__instance, "RemainGauge", int.MaxValue);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("InventoryItemUpdateInfoPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch]
	internal static class EquipmentItemElementConstructorPatch
	{
		private static MethodBase TargetMethod()
		{
			try
			{
				return AccessTools.Constructor(typeof(EquipmentItemElement), new Type[7]
				{
					typeof(int),
					typeof(long),
					typeof(bool),
					typeof(int),
					typeof(int),
					typeof(int),
					typeof(InventoryController)
				}, false);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("EquipmentItemElementConstructorPatch TargetMethod error: " + ex.Message);
				return null;
			}
		}

		private static void Postfix(EquipmentItemElement __instance)
		{
			try
			{
				if (((ItemElement)__instance).ItemMasterID > 0)
				{
					ItemMasterInfo itemMasterInfo = Inventory.GetItemMasterInfo(((ItemElement)__instance).ItemMasterID);
					if (itemMasterInfo != null)
					{
						Patches.LogItemMasterID(((ItemElement)__instance).ItemMasterID, itemMasterInfo);
					}
				}
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null)
				{
					if (featureState.InfiniteDurability)
					{
						__instance.SetDurability(int.MaxValue);
					}
					if (featureState.InfiniteGauge)
					{
						__instance.SetAmount(int.MaxValue);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("EquipmentItemElementConstructorPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(StatManager), "OnDamaged")]
	internal static class StatManagerOnDamagedPatch
	{
		private static bool Prefix(object __instance, object args)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState == null || !featureState.GodMode)
				{
					return true;
				}
				object fieldValue = ReflectionHelper.GetFieldValue(args, "Victim");
				VPlayer val = (VPlayer)((fieldValue is VPlayer) ? fieldValue : null);
				if (val != null)
				{
					ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
					if ((Object)(object)localPlayer != (Object)null && localPlayer.ActorID == ((VActor)val).ObjectID)
					{
						return false;
					}
				}
				return true;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("StatManagerOnDamagedPatch error: " + ex.Message);
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(StatManager), "ConsumeStamina")]
	internal static class StatManagerConsumeStaminaPatch
	{
		private static bool Prefix()
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				return featureState == null || !featureState.InfiniteStamina;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("StatManagerConsumeStaminaPatch error: " + ex.Message);
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(MovementController), "CheckFallDamage")]
	internal static class MovementControllerCheckFallDamagePatch
	{
		private static bool Prefix(ref float __result)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState == null || !featureState.NoFallDamage)
				{
					return true;
				}
				__result = 0f;
				return false;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("MovementControllerCheckFallDamagePatch error: " + ex.Message);
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(ProtoActor), "CaculateSpeed")]
	internal static class ProtoActorCaculateSpeedPatch
	{
		private static void Postfix(ref float __result)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null && featureState.SpeedBoost)
				{
					__result *= featureState.SpeedMultiplier;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("ProtoActorCaculateSpeedPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(VPlayer), "HandleBuyItem")]
	internal static class VPlayerHandleBuyItemPatch
	{
		private static bool Prefix(VPlayer __instance, int itemMasterID, int hashCode, int machineIndex, ref MsgErrorCode __result)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState == null || !featureState.ForceBuy)
				{
					return true;
				}
				IVroom vRoom = ((VActor)__instance).VRoom;
				MaintenanceRoom val = (MaintenanceRoom)(object)((vRoom is MaintenanceRoom) ? vRoom : null);
				if (val == null)
				{
					__result = (MsgErrorCode)15;
					return false;
				}
				ItemElement newItemElement = ((IVroom)val).GetNewItemElement(itemMasterID, false, 1, 0, 0, 0);
				if (newItemElement == null)
				{
					__result = (MsgErrorCode)20000013;
					return false;
				}
				int num = default(int);
				((VActor)__instance).InventoryControlUnit.HandleAddItem(newItemElement, ref num, true, true);
				((VActor)__instance).SendToMe((IMsg)new BuyItemRes(hashCode)
				{
					remainCurrency = ((IVroom)val).Currency
				});
				((VActor)__instance).SendInSight((IMsg)new BuyItemSig
				{
					itemMasterID = itemMasterID,
					machineIndex = machineIndex
				}, false);
				__result = (MsgErrorCode)0;
				return false;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Force buy patch error: " + ex.Message);
				__result = (MsgErrorCode)1;
				return false;
			}
		}
	}
	[HarmonyPatch(typeof(VPlayer), "HandleRepairTrain")]
	internal static class VPlayerHandleRepairTrainPatch
	{
		private static bool Prefix(VPlayer __instance, int hashCode, ref MsgErrorCode __result)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState == null || !featureState.ForceRepair)
				{
					return true;
				}
				IVroom vRoom = ((VActor)__instance).VRoom;
				MaintenanceRoom val = (MaintenanceRoom)(object)((vRoom is MaintenanceRoom) ? vRoom : null);
				if (val == null)
				{
					__result = (MsgErrorCode)15;
					return false;
				}
				((VActor)__instance).SendToMe((IMsg)new RepairTramRes(hashCode)
				{
					errorCode = (MsgErrorCode)0
				});
				((VActor)__instance).SendToChannel((IMsg)new StartRepairTramSig
				{
					remainCurrency = ((IVroom)val).Currency
				});
				__result = (MsgErrorCode)0;
				return false;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Force repair patch error: " + ex.Message);
				__result = (MsgErrorCode)1;
				return false;
			}
		}
	}
	[HarmonyPatch]
	internal static class MaintenanceRoomBuyItemCurrencyPatch
	{
		private static MethodBase TargetMethod()
		{
			try
			{
				return AccessTools.Method(typeof(MaintenanceRoom), "BuyItem", new Type[2]
				{
					typeof(int),
					typeof(VCreature)
				}, (Type[])null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("MaintenanceRoomBuyItemCurrencyPatch TargetMethod error: " + ex.Message);
				return null;
			}
		}

		private static void Postfix(MaintenanceRoom __instance, int itemMasterID, VCreature creature, ref MsgErrorCode __result)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null && featureState.InfiniteCurrency && (int)__result == 0)
				{
					ReflectionHelper.InvokeMethod((object)__instance, "AddCurrency", new object[1] { int.MaxValue });
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("MaintenanceRoomBuyItemCurrencyPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch]
	internal static class GameMainBaseUpdateCurrencyPatch
	{
		private static MethodBase TargetMethod()
		{
			try
			{
				return AccessTools.Method(typeof(GameMainBase), "UpdateCurrency", new Type[1] { typeof(int) }, (Type[])null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("GameMainBaseUpdateCurrencyPatch TargetMethod error: " + ex.Message);
				return null;
			}
		}

		private static void Prefix(GameMainBase __instance, ref int currentCurrency)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null && featureState.InfiniteCurrency)
				{
					currentCurrency = int.MaxValue;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("GameMainBaseUpdateCurrencyPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch]
	internal static class GameMainBaseOnCurrencyChangedPatch
	{
		private static MethodBase TargetMethod()
		{
			try
			{
				return AccessTools.Method(typeof(GameMainBase), "OnCurrencyChanged", new Type[2]
				{
					typeof(int),
					typeof(int)
				}, (Type[])null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("GameMainBaseOnCurrencyChangedPatch TargetMethod error: " + ex.Message);
				return null;
			}
		}

		private static void Prefix(GameMainBase __instance, ref int prev, ref int curr)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null && featureState.InfiniteCurrency)
				{
					curr = int.MaxValue;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("GameMainBaseOnCurrencyChangedPatch error: " + ex.Message);
			}
		}
	}
	[HarmonyPatch]
	internal static class MaintenanceSceneOnCurrencyChangedPatch
	{
		private static MethodBase TargetMethod()
		{
			try
			{
				return AccessTools.Method(typeof(MaintenanceScene), "OnCurrencyChanged", new Type[2]
				{
					typeof(int),
					typeof(int)
				}, (Type[])null);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("MaintenanceSceneOnCurrencyChangedPatch TargetMethod error: " + ex.Message);
				return null;
			}
		}

		private static void Prefix(MaintenanceScene __instance, ref int prev, ref int curr)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null && featureState.InfiniteCurrency)
				{
					curr = int.MaxValue;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("MaintenanceSceneOnCurrencyChangedPatch error: " + ex.Message);
			}
		}
	}
}
namespace Mimesis_Mod_Menu.Core.Features
{
	public class AutoLootManager : FeatureManager
	{
		private float distance = 50f;

		private const float MIN_DISTANCE = 10f;

		private const float MAX_DISTANCE = 200f;

		public float GetDistance()
		{
			return distance;
		}

		public void SetDistance(float value)
		{
			distance = Mathf.Clamp(value, 10f, 200f);
		}

		public override void Update()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (!IsEnabled)
			{
				return;
			}
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if ((Object)(object)localPlayer == (Object)null)
				{
					return;
				}
				LootingLevelObject[] allLoot = LootAPI.GetAllLoot();
				Vector3 position = ((Component)localPlayer).transform.position;
				LootingLevelObject[] array = allLoot;
				foreach (LootingLevelObject val in array)
				{
					if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && Vector3.Distance(position, ((Component)val).transform.position) <= distance)
					{
						localPlayer.GrapLootingObject(val.ActorID);
					}
				}
			}
			catch (Exception ex)
			{
				LogError("Update", ex);
			}
		}
	}
	public static class ESPManager
	{
		private static Texture2D cachedLineTexture;

		private static Camera mainCamera;

		private static List<LootingLevelObject> cachedLootObjects = new List<LootingLevelObject>();

		private static List<ProtoActor> cachedActors = new List<ProtoActor>();

		private static float lastUpdateTime = 0f;

		private const float CACHE_UPDATE_INTERVAL = 0.5f;

		private const float ESP_TEXT_SIZE = 11f;

		private static bool isInitialized = false;

		private static MainGUI mainGUI;

		private static MainGUI.FeatureState espState;

		private static readonly Dictionary<ActorType, string> ActorTypeLabels = new Dictionary<ActorType, string>
		{
			{
				(ActorType)1,
				"[PLAYER]"
			},
			{
				(ActorType)2,
				"[MONSTER]"
			},
			{
				(ActorType)3,
				"[INTERACTOR]"
			},
			{
				(ActorType)4,
				"[NPC]"
			},
			{
				(ActorType)5,
				"[LOOT]"
			},
			{
				(ActorType)6,
				"[FIELD SKILL]"
			},
			{
				(ActorType)7,
				"[PROJECTILE]"
			},
			{
				(ActorType)8,
				"[AURA SKILL]"
			}
		};

		private static readonly Dictionary<ActorType, Color> ActorTypeColors = new Dictionary<ActorType, Color>
		{
			{
				(ActorType)1,
				Color.yellow
			},
			{
				(ActorType)2,
				Color.red
			},
			{
				(ActorType)3,
				Color.cyan
			},
			{
				(ActorType)4,
				Color.green
			},
			{
				(ActorType)5,
				Color.yellow
			},
			{
				(ActorType)6,
				new Color(1f, 0.5f, 0f)
			},
			{
				(ActorType)7,
				Color.magenta
			},
			{
				(ActorType)8,
				new Color(0.5f, 0f, 1f)
			}
		};

		public static void Initialize()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			try
			{
				if (!isInitialized)
				{
					cachedLineTexture = new Texture2D(1, 1);
					if ((Object)(object)cachedLineTexture != (Object)null)
					{
						((Texture)cachedLineTexture).filterMode = (FilterMode)0;
					}
					mainGUI = Object.FindObjectOfType<MainGUI>();
					if ((Object)(object)mainGUI != (Object)null)
					{
						espState = mainGUI.GetFeatureState();
					}
					isInitialized = true;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.Initialize error: " + ex.Message);
			}
		}

		public static void UpdateESP()
		{
			try
			{
				if (espState == null || !espState.ESP || !isInitialized)
				{
					return;
				}
				mainCamera = Camera.main;
				if (!((Object)(object)mainCamera == (Object)null))
				{
					float realtimeSinceStartup = Time.realtimeSinceStartup;
					if (realtimeSinceStartup - lastUpdateTime >= 0.5f)
					{
						UpdateActorCache();
						UpdateLootCache();
						lastUpdateTime = realtimeSinceStartup;
					}
					DrawActorESP();
					DrawLootESP();
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.UpdateESP error: " + ex.Message);
			}
		}

		private static bool IsESPEnabled()
		{
			if (espState == null)
			{
				return false;
			}
			return espState.ESP;
		}

		private static float GetESPDistance()
		{
			if (espState == null)
			{
				return 150f;
			}
			return espState.ESPDistance;
		}

		private static bool IsLootVisible()
		{
			if (espState == null)
			{
				return false;
			}
			return espState.ESPShowLoot;
		}

		private static bool ShouldShowActorType(ActorType type)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected I4, but got Unknown
			if (espState == null)
			{
				return false;
			}
			return (type - 1) switch
			{
				0 => espState.ESPShowPlayers, 
				1 => espState.ESPShowMonsters, 
				2 => espState.ESPShowInteractors, 
				3 => espState.ESPShowNPCs, 
				5 => espState.ESPShowFieldSkills, 
				6 => espState.ESPShowProjectiles, 
				7 => espState.ESPShowAuraSkills, 
				_ => false, 
			};
		}

		private static void UpdateActorCache()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Invalid comparison between Unknown and I4
			//IL_006b: 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)
			try
			{
				cachedActors.Clear();
				ProtoActor[] otherPlayers = PlayerAPI.GetOtherPlayers();
				if (otherPlayers == null || otherPlayers.Length == 0)
				{
					return;
				}
				Vector3 position = ((Component)mainCamera).transform.position;
				float eSPDistance = GetESPDistance();
				ProtoActor[] array = otherPlayers;
				foreach (ProtoActor val in array)
				{
					if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && (int)val.ActorType != 0 && (int)val.ActorType != 9)
					{
						float num = Vector3.Distance(position, ((Component)val).transform.position);
						if (num <= eSPDistance)
						{
							cachedActors.Add(val);
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.UpdateActorCache error: " + ex.Message);
			}
		}

		private static void UpdateLootCache()
		{
			//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_0063: 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)
			try
			{
				cachedLootObjects.Clear();
				if (!IsLootVisible())
				{
					return;
				}
				LootingLevelObject[] array = Object.FindObjectsOfType<LootingLevelObject>();
				if (array == null || array.Length == 0)
				{
					return;
				}
				Vector3 position = ((Component)mainCamera).transform.position;
				float eSPDistance = GetESPDistance();
				LootingLevelObject[] array2 = array;
				foreach (LootingLevelObject val in array2)
				{
					if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy)
					{
						float num = Vector3.Distance(position, ((Component)val).transform.position);
						if (num <= eSPDistance)
						{
							cachedLootObjects.Add(val);
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.UpdateLootCache error: " + ex.Message);
			}
		}

		private static void DrawActorESP()
		{
			//IL_0035: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				foreach (ProtoActor cachedActor in cachedActors)
				{
					if (!((Object)(object)cachedActor == (Object)null) && ((Component)cachedActor).gameObject.activeInHierarchy && ShouldShowActorType(cachedActor.ActorType))
					{
						Vector3 val = mainCamera.WorldToScreenPoint(((Component)cachedActor).transform.position);
						if (!(val.z <= 0f))
						{
							val.y = (float)Screen.height - val.y;
							float num = Vector3.Distance(((Component)mainCamera).transform.position, ((Component)cachedActor).transform.position);
							string arg = (ActorTypeLabels.ContainsKey(cachedActor.ActorType) ? ActorTypeLabels[cachedActor.ActorType] : "[UNKNOWN]");
							Color textColor = (ActorTypeColors.ContainsKey(cachedActor.ActorType) ? ActorTypeColors[cachedActor.ActorType] : Color.white);
							string text = $"{arg}\n{cachedActor.nickName}\n[{num:F0}m]";
							DrawESPText(val, text, textColor);
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.DrawActorESP error: " + ex.Message);
			}
		}

		private static void DrawLootESP()
		{
			//IL_003f: 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)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				foreach (LootingLevelObject cachedLootObject in cachedLootObjects)
				{
					if (!((Object)(object)cachedLootObject == (Object)null) && ((Component)cachedLootObject).gameObject.activeInHierarchy)
					{
						Vector3 val = mainCamera.WorldToScreenPoint(((Component)cachedLootObject).transform.position);
						if (!(val.z <= 0f))
						{
							val.y = (float)Screen.height - val.y;
							float num = Vector3.Distance(((Component)mainCamera).transform.position, ((Component)cachedLootObject).transform.position);
							string arg = CleanObjectName(((Object)((Component)cachedLootObject).gameObject).name);
							string text = $"{arg}\n[{num:F0}m]";
							DrawESPText(val, text, Color.white);
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.DrawLootESP error: " + ex.Message);
			}
		}

		private static void DrawESPText(Vector3 screenPos, string text, Color textColor)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					wordWrap = false
				};
				val.normal.textColor = textColor;
				GUIStyle val2 = val;
				Vector2 val3 = val2.CalcSize(new GUIContent(text));
				Rect val4 = default(Rect);
				((Rect)(ref val4))..ctor(screenPos.x - val3.x / 2f - 5f, screenPos.y - val3.y / 2f - 3f, val3.x + 10f, val3.y + 6f);
				GUI.Label(val4, text, val2);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.DrawESPText error: " + ex.Message);
			}
		}

		private static string CleanObjectName(string name)
		{
			try
			{
				if (string.IsNullOrEmpty(name))
				{
					return "Item";
				}
				name = Regex.Replace(name, "\\(Clone\\)", "");
				name = Regex.Replace(name, "[Pp]refab", "");
				name = name.Replace("_", " ").Trim();
				return string.IsNullOrEmpty(name) ? "Item" : name;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.CleanObjectName error: " + ex.Message);
				return "Item";
			}
		}

		public static void Cleanup()
		{
			try
			{
				cachedLootObjects.Clear();
				cachedActors.Clear();
				if ((Object)(object)cachedLineTexture != (Object)null)
				{
					Object.Destroy((Object)(object)cachedLineTexture);
					cachedLineTexture = null;
				}
				mainGUI = null;
				isInitialized = false;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ESPManager.Cleanup error: " + ex.Message);
			}
		}
	}
	public abstract class FeatureManager
	{
		public virtual bool IsEnabled { get; protected set; }

		public virtual void SetEnabled(bool value)
		{
			IsEnabled = value;
		}

		public virtual void Update()
		{
		}

		public virtual void Cleanup()
		{
		}

		protected void LogError(string methodName, Exception ex)
		{
			MelonLogger.Error(GetType().Name + "." + methodName + " error: " + ex.Message);
		}

		protected void LogMessage(string message)
		{
			MelonLogger.Msg("[" + GetType().Name + "] " + message);
		}
	}
	public class FullbrightManager : FeatureManager
	{
		private bool isApplied;

		private float originalAmbientIntensity = -1f;

		private Color originalAmbientColor = Color.white;

		private List<Light> modifiedLights = new List<Light>();

		private const float FULLBRIGHT_INTENSITY = 1.5f;

		public override void Update()
		{
			if (IsEnabled)
			{
				if (!isApplied)
				{
					Apply();
				}
				MaintainBrightness();
			}
			else if (isApplied)
			{
				Restore();
			}
		}

		private void Apply()
		{
			try
			{
				StoreOriginalSettings();
				ApplyBrightness();
				isApplied = true;
				LogMessage("Enabled");
			}
			catch (Exception ex)
			{
				LogError("Apply", ex);
			}
		}

		private void StoreOriginalSettings()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (originalAmbientIntensity < 0f)
			{
				originalAmbientColor = RenderSettings.ambientLight;
				originalAmbientIntensity = RenderSettings.ambientIntensity;
			}
		}

		private void ApplyBrightness()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			RenderSettings.ambientLight = Color.white;
			RenderSettings.ambientIntensity = 1.5f;
			modifiedLights.Clear();
			Light[] array = Object.FindObjectsByType<Light>((FindObjectsSortMode)0);
			foreach (Light val in array)
			{
				if ((Object)(object)val != (Object)null && ((Behaviour)val).enabled)
				{
					val.intensity *= 1.5f;
					modifiedLights.Add(val);
				}
			}
		}

		private void MaintainBrightness()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (RenderSettings.ambientIntensity < 1.4f)
				{
					RenderSettings.ambientIntensity = 1.5f;
				}
				RenderSettings.ambientLight = Color.white;
			}
			catch
			{
			}
		}

		private void Restore()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (originalAmbientIntensity >= 0f)
				{
					RenderSettings.ambientLight = originalAmbientColor;
					RenderSettings.ambientIntensity = originalAmbientIntensity;
				}
				foreach (Light modifiedLight in modifiedLights)
				{
					if ((Object)(object)modifiedLight != (Object)null)
					{
						modifiedLight.intensity /= 1.5f;
					}
				}
				modifiedLights.Clear();
				isApplied = false;
				LogMessage("Disabled");
			}
			catch (Exception ex)
			{
				LogError("Restore", ex);
			}
		}

		public override void Cleanup()
		{
			IsEnabled = false;
			Restore();
		}
	}
	public class ItemSpawnerManager : FeatureManager
	{
		private Dictionary<int, int> pendingItemsToSpawn = new Dictionary<int, int>();

		public void AddItemToSpawn(int itemMasterID, int quantity = 1)
		{
			try
			{
				if (pendingItemsToSpawn.ContainsKey(itemMasterID))
				{
					pendingItemsToSpawn[itemMasterID] += quantity;
				}
				else
				{
					pendingItemsToSpawn[itemMasterID] = quantity;
				}
				LogMessage($"Queued item {itemMasterID} x{quantity}");
			}
			catch (Exception ex)
			{
				LogError("AddItemToSpawn", ex);
			}
		}

		public Dictionary<int, int> GetPendingItems()
		{
			return new Dictionary<int, int>(pendingItemsToSpawn);
		}

		public void ClearPendingItems()
		{
			pendingItemsToSpawn.Clear();
		}

		public override void Update()
		{
			if (pendingItemsToSpawn.Count == 0)
			{
				return;
			}
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if ((Object)(object)localPlayer == (Object)null)
				{
					return;
				}
				List<KeyValuePair<int, int>> list = pendingItemsToSpawn.ToList();
				foreach (KeyValuePair<int, int> item in list)
				{
					int key = item.Key;
					int value = item.Value;
					ItemSpawnerPatches.SetItemToSpawn(key, value);
					pendingItemsToSpawn.Remove(key);
				}
			}
			catch (Exception ex)
			{
				LogError("Update", ex);
			}
		}
	}
	public class MovementManager : FeatureManager
	{
		private const float TELEPORT_OFFSET = 1.5f;

		public override void Update()
		{
		}

		public void TeleportForward(float distance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if (!((Object)(object)localPlayer == (Object)null))
				{
					Vector3 val = ((Component)localPlayer).transform.position + ((Component)localPlayer).transform.forward * distance;
					localPlayer.Teleport(val, ((Component)localPlayer).transform.eulerAngles, false);
					LogMessage($"Teleported forward {distance}u");
				}
			}
			catch (Exception ex)
			{
				LogError("TeleportForward", ex);
			}
		}

		public void TeleportToPlayer(ProtoActor targetPlayer)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Object)(object)targetPlayer == (Object)null))
				{
					ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
					if (!((Object)(object)localPlayer == (Object)null))
					{
						Vector3 val = ((Component)targetPlayer).transform.position + Vector3.back * 1.5f;
						localPlayer.Teleport(val, ((Component)targetPlayer).transform.eulerAngles, false);
						LogMessage("Teleported to " + targetPlayer.nickName);
					}
				}
			}
			catch (Exception ex)
			{
				LogError("TeleportToPlayer", ex);
			}
		}

		public void TeleportPlayerToSelf(ProtoActor targetPlayer)
		{
			//IL_0030: 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_003f: 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)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Object)(object)targetPlayer == (Object)null))
				{
					ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
					if (!((Object)(object)localPlayer == (Object)null) && targetPlayer.ActorID != localPlayer.ActorID)
					{
						Vector3 val = ((Component)localPlayer).transform.position + Vector3.back * 1.5f;
						targetPlayer.Teleport(val, ((Component)localPlayer).transform.eulerAngles, false);
						LogMessage("Teleported " + targetPlayer.nickName + " to you");
					}
				}
			}
			catch (Exception ex)
			{
				LogError("TeleportPlayerToSelf", ex);
			}
		}
	}
	public class PickupManager : FeatureManager
	{
		private Queue<LootingLevelObject> pickupQueue = new Queue<LootingLevelObject>();

		private float pickupCooldown;

		private const float PICKUP_COOLDOWN = 0.05f;

		public bool isActive => IsEnabled;

		public override void Update()
		{
			if (IsEnabled && pickupQueue.Count != 0)
			{
				pickupCooldown -= Time.deltaTime;
				if (pickupCooldown <= 0f)
				{
					ProcessNextPickup();
				}
			}
		}

		public void StartPickupAll()
		{
			try
			{
				pickupQueue.Clear();
				LootingLevelObject[] allLoot = LootAPI.GetAllLoot();
				if (allLoot.Length == 0)
				{
					LogMessage("No items to pick up");
					return;
				}
				LootingLevelObject[] array = allLoot;
				foreach (LootingLevelObject item in array)
				{
					pickupQueue.Enqueue(item);
				}
				IsEnabled = true;
				pickupCooldown = 0.05f;
				LogMessage($"Starting pickup of {pickupQueue.Count} items");
			}
			catch (Exception ex)
			{
				LogError("StartPickupAll", ex);
			}
		}

		public void Stop()
		{
			IsEnabled = false;
			pickupQueue.Clear();
			LogMessage("Pickup stopped");
		}

		private void ProcessNextPickup()
		{
			if (pickupQueue.Count == 0)
			{
				IsEnabled = false;
				LogMessage("Pickup complete");
				return;
			}
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if ((Object)(object)localPlayer == (Object)null)
				{
					Stop();
					return;
				}
				LootingLevelObject val = pickupQueue.Dequeue();
				if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
				{
					localPlayer.GrapLootingObject(val.ActorID);
				}
				pickupCooldown = 0.05f;
			}
			catch (Exception ex)
			{
				LogError("ProcessNextPickup", ex);
				pickupCooldown = 0.05f;
			}
		}
	}
}
namespace Mimesis_Mod_Menu.Core.Config
{
	public class ConfigManager
	{
		private const string MAIN_CATEGORY = "Mimesis Mod Menu";

		private const string HOTKEYS_CATEGORY = "Mimesis Mod Menu Hotkeys";

		private MelonPreferences_Category mainCategory;

		private MelonPreferences_Category hotkeysCategory;

		private Dictionary<string, MelonPreferences_Entry<string>> stringEntries = new Dictionary<string, MelonPreferences_Entry<string>>();

		private Dictionary<string, MelonPreferences_Entry<bool>> boolEntries = new Dictionary<string, MelonPreferences_Entry<bool>>();

		private Dictionary<string, MelonPreferences_Entry<float>> floatEntries = new Dictionary<string, MelonPreferences_Entry<float>>();

		private Dictionary<string, MelonPreferences_Entry<string>> hotkeyEntries = new Dictionary<string, MelonPreferences_Entry<string>>();

		public ConfigManager()
		{
			mainCategory = MelonPreferences.CreateCategory("Mimesis Mod Menu", "Mimesis Mod Menu Configuration");
			hotkeysCategory = MelonPreferences.CreateCategory("Mimesis Mod Menu Hotkeys", "Mimesis Mod Menu Hotkey Configuration");
		}

		public void LoadAllConfigs()
		{
		}

		public T GetValue<T>(string key, T defaultValue, string description = "")
		{
			try
			{
				if (typeof(T) == typeof(string))
				{
					if (!stringEntries.TryGetValue(key, out MelonPreferences_Entry<string> value))
					{
						value = mainCategory.CreateEntry<string>(key, (string)(object)defaultValue, key, description, false, false, (ValueValidator)null, (string)null);
						stringEntries[key] = value;
					}
					return (T)(object)value.Value;
				}
				if (typeof(T) == typeof(bool))
				{
					if (!boolEntries.TryGetValue(key, out MelonPreferences_Entry<bool> value2))
					{
						value2 = mainCategory.CreateEntry<bool>(key, (bool)(object)defaultValue, key, description, false, false, (ValueValidator)null, (string)null);
						boolEntries[key] = value2;
					}
					return (T)(object)value2.Value;
				}
				if (typeof(T) == typeof(float))
				{
					if (!floatEntries.TryGetValue(key, out MelonPreferences_Entry<float> value3))
					{
						value3 = mainCategory.CreateEntry<float>(key, (float)(object)defaultValue, key, description, false, false, (ValueValidator)null, (string)null);
						floatEntries[key] = value3;
					}
					return (T)(object)value3.Value;
				}
				MelonLogger.Warning("Unsupported type " + typeof(T).Name + " for key " + key);
				return defaultValue;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error getting " + typeof(T).Name + " " + key + ": " + ex.Message);
				return defaultValue;
			}
		}

		public void SetValue<T>(string key, T value, string description = "")
		{
			try
			{
				if (typeof(T) == typeof(string))
				{
					if (!stringEntries.TryGetValue(key, out MelonPreferences_Entry<string> value2))
					{
						value2 = mainCategory.CreateEntry<string>(key, (string)(object)value, key, description, false, false, (ValueValidator)null, (string)null);
						stringEntries[key] = value2;
					}
					else
					{
						value2.Value = (string)(object)value;
					}
				}
				else if (typeof(T) == typeof(bool))
				{
					if (!boolEntries.TryGetValue(key, out MelonPreferences_Entry<bool> value3))
					{
						value3 = mainCategory.CreateEntry<bool>(key, (bool)(object)value, key, description, false, false, (ValueValidator)null, (string)null);
						boolEntries[key] = value3;
					}
					else
					{
						value3.Value = (bool)(object)value;
					}
				}
				else
				{
					if (!(typeof(T) == typeof(float)))
					{
						MelonLogger.Warning("Unsupported type " + typeof(T).Name + " for key " + key);
						return;
					}
					if (!floatEntries.TryGetValue(key, out MelonPreferences_Entry<float> value4))
					{
						value4 = mainCategory.CreateEntry<float>(key, (float)(object)value, key, description, false, false, (ValueValidator)null, (string)null);
						floatEntries[key] = value4;
					}
					else
					{
						value4.Value = (float)(object)value;
					}
				}
				MelonPreferences.Save();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error setting " + typeof(T).Name + " " + key + ": " + ex.Message);
			}
		}

		public HotkeyConfig GetHotkey(string feature)
		{
			try
			{
				if (!hotkeyEntries.TryGetValue(feature, out MelonPreferences_Entry<string> value))
				{
					value = hotkeysCategory.CreateEntry<string>(feature, "None", feature, "", false, false, (ValueValidator)null, (string)null);
					hotkeyEntries[feature] = value;
				}
				if (value != null)
				{
					return HotkeyConfig.Parse(value.Value);
				}
				return new HotkeyConfig((KeyCode)0);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error getting hotkey " + feature + ": " + ex.Message);
				return new HotkeyConfig((KeyCode)0);
			}
		}

		public void SetHotkey(string feature, HotkeyConfig hotkey)
		{
			try
			{
				if (!hotkeyEntries.TryGetValue(feature, out MelonPreferences_Entry<string> value))
				{
					value = hotkeysCategory.CreateEntry<string>(feature, hotkey.ToString(), feature, "", false, false, (ValueValidator)null, (string)null);
					hotkeyEntries[feature] = value;
				}
				else
				{
					value.Value = hotkey.ToString();
				}
				MelonPreferences.Save();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Error setting hotkey " + feature + ": " + ex.Message);
			}
		}

		public bool IsHotkeyPressed(string feature)
		{
			return GetHotkey(feature).IsPressed();
		}

		public Dictionary<string, HotkeyConfig> GetAllHotkeys()
		{
			Dictionary<string, HotkeyConfig> dictionary = new Dictionary<string, HotkeyConfig>();
			try
			{
				foreach (MelonPreferences_Entry entry in hotkeysCategory.Entries)
				{
					if (entry is MelonPreferences_Entry<string> val)
					{
						dictionary[entry.Identifier] = HotkeyConfig.Parse(val.Value);
						hotkeyEntries[entry.Identifier] = val;
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Error getting all hotkeys: " + ex.Message);
			}
			return dictionary;
		}
	}
	public class HotkeyConfig
	{
		public KeyCode Key { get; set; }

		public bool Shift { get; set; }

		public bool Ctrl { get; set; }

		public bool Alt { get; set; }

		public HotkeyConfig(KeyCode key = 0, bool shift = false, bool ctrl = false, bool alt = false)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Key = key;
			Shift = shift;
			Ctrl = ctrl;
			Alt = alt;
		}

		public bool IsPressed()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((int)Key == 0)
				{
					return false;
				}
				Keyboard current = Keyboard.current;
				if (current == null)
				{
					return false;
				}
				KeyCode key = Key;
				KeyControl val = current.FindKeyOnCurrentKeyboardLayout(((object)(KeyCode)(ref key)).ToString());
				if (val == null || !((ButtonControl)val).wasPressedThisFrame)
				{
					return false;
				}
				return CheckModifiers(current);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("IsPressed error: " + ex.Message);
				return false;
			}
		}

		private bool CheckModifiers(Keyboard keyboard)
		{
			bool flag = ((ButtonControl)keyboard.leftShiftKey).isPressed || ((ButtonControl)keyboard.rightShiftKey).isPressed;
			bool flag2 = ((ButtonControl)keyboard.leftCtrlKey).isPressed || ((ButtonControl)keyboard.rightCtrlKey).isPressed;
			bool flag3 = ((ButtonControl)keyboard.leftAltKey).isPressed || ((ButtonControl)keyboard.rightAltKey).isPressed;
			if (Shift == flag && Ctrl == flag2)
			{
				return Alt == flag3;
			}
			return false;
		}

		public override string ToString()
		{
			//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)
			try
			{
				KeyCode key = Key;
				string text = ((object)(KeyCode)(ref key)).ToString();
				if (Ctrl)
				{
					text = "Ctrl+" + text;
				}
				if (Shift)
				{
					text = "Shift+" + text;
				}
				if (Alt)
				{
					text = "Alt+" + text;
				}
				return text;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("ToString error: " + ex.Message);
				return "None";
			}
		}

		public static HotkeyConfig Parse(string input)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (string.IsNullOrEmpty(input) || input.Equals("None", StringComparison.OrdinalIgnoreCase))
				{
					return new HotkeyConfig((KeyCode)0);
				}
				bool ctrl = input.Contains("Ctrl+");
				bool shift = input.Contains("Shift+");
				bool alt = input.Contains("Alt+");
				string value = input.Replace("Ctrl+", "").Replace("Shift+", "").Replace("Alt+", "")
					.Trim();
				if (Enum.TryParse<KeyCode>(value, ignoreCase: true, out KeyCode result))
				{
					return new HotkeyConfig(result, shift, ctrl, alt);
				}
				MelonLogger.Warning("Failed to parse hotkey: " + input);
				return new HotkeyConfig((KeyCode)0);
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("Parse error: " + ex.Message);
				return new HotkeyConfig((KeyCode)0);
			}
		}
	}
}