Decompiled source of MIMESIS Mod Menu v2.7.0

shadcnui.dll

Decompiled 5 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 System.Threading;
using UnityEngine;
using shadcnui.GUIComponents.Controls;
using shadcnui.GUIComponents.Core.Base;
using shadcnui.GUIComponents.Core.Styling;
using shadcnui.GUIComponents.Core.Theming;
using shadcnui.GUIComponents.Core.Utils;
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.GUIComponents.Layout
{
	public class Card : BaseComponent
	{
		public Card(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawCard(CardConfig config)
		{
			BeginCard(config.Width, config.Height);
			if ((Object)(object)config.Avatar != (Object)null)
			{
				CardWithAvatar(config.Avatar, config.Title, config.Subtitle);
			}
			else if (config.HeaderContent != null)
			{
				CardHeader(config.Title, config.Description, config.HeaderContent);
			}
			else if (!string.IsNullOrEmpty(config.Title) || !string.IsNullOrEmpty(config.Description))
			{
				CardHeader(delegate
				{
					if (!string.IsNullOrEmpty(config.Title))
					{
						CardTitle(config.Title);
					}
					if (!string.IsNullOrEmpty(config.Description))
					{
						CardDescription(config.Description);
					}
				});
			}
			if ((Object)(object)config.Image != (Object)null)
			{
				CardImage(config.Image);
			}
			if (!string.IsNullOrEmpty(config.Content))
			{
				CardContent(delegate
				{
					StyleManager styleManager = guiHelper.GetStyleManager();
					UnityHelpers.Label(config.Content, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Default));
				});
			}
			if (config.FooterContent != null)
			{
				CardFooter(config.FooterContent);
			}
			EndCard();
		}

		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 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 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 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 DrawCard(string title, string description, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			DrawCard(new CardConfig
			{
				Title = title,
				Description = description,
				Content = content,
				FooterContent = footerContent,
				Width = width,
				Height = height
			});
		}

		public void DrawCardWithImage(Texture2D image, string title, string description, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			DrawCard(new CardConfig
			{
				Image = image,
				Title = title,
				Description = description,
				Content = content,
				FooterContent = footerContent,
				Width = width,
				Height = height
			});
		}

		public void DrawCardWithAvatar(Texture2D avatar, string title, string subtitle, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			DrawCard(new CardConfig
			{
				Avatar = avatar,
				Title = title,
				Subtitle = subtitle,
				Content = content,
				FooterContent = footerContent,
				Width = width,
				Height = height
			});
		}

		public void DrawCardWithHeader(string title, string description, Action header, string content, Action footerContent = null, float width = -1f, float height = -1f)
		{
			DrawCard(new CardConfig
			{
				Title = title,
				Description = description,
				HeaderContent = header,
				Content = content,
				FooterContent = footerContent,
				Width = width,
				Height = height
			});
		}

		public void DrawSimpleCard(string content, float width = -1f, float height = -1f)
		{
			DrawCard(new CardConfig
			{
				Content = content,
				Width = width,
				Height = height
			});
		}
	}
	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;

		private string _menuId;

		private const float AnimationDuration = 0.1f;

		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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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 menuBarItemStyle = styleManager.GetMenuBarItemStyle(ControlVariant.Default, ControlSize.Default, isShortcut: false, _isDropdownOpen && _activeMenuIndex == i);
				menuBarItemStyle.alignment = (TextAnchor)4;
				bool enabled = GUI.enabled;
				if (menuItem.Disabled)
				{
					GUI.enabled = false;
				}
				bool num = UnityHelpers.Button(menuItem.Text, menuBarItemStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				GUI.enabled = enabled;
				if (num)
				{
					if (menuItem.SubItems.Count > 0)
					{
						_activeMenuIndex = i;
						_menuId = $"menu_{i}";
						_menuStack.Clear();
						_menuStack.Push(new MenuData(menuItem.SubItems, i));
						_isDropdownOpen = true;
						AnimationManager animationManager = guiHelper.GetAnimationManager();
						animationManager.FadeIn("menubar_alpha_" + _menuId, 0.1f, EasingFunctions.EaseOutCubic);
						animationManager.ScaleIn("menubar_scale_" + _menuId, 0.1f, 0.92f, EasingFunctions.EaseOutCubic);
						animationManager.SlideIn("menubar_slide_" + _menuId, Vector2.zero, new Vector2(0f, -12f), 0.1f, EasingFunctions.EaseOutCubic);
					}
					else
					{
						menuItem.OnClick?.Invoke();
						CloseDropdown();
					}
				}
			}
			layoutComponents.EndHorizontalGroup();
			_menuBarRect = GUILayoutUtility.GetLastRect();
			if (_isDropdownOpen && _menuStack.Count > 0)
			{
				DrawDropdownMenu();
			}
			HandleClickOutside();
		}

		private void DrawDropdownMenu()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_009b: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			AnimationManager animationManager = guiHelper.GetAnimationManager();
			MenuData menuData = _menuStack.Peek();
			float @float = animationManager.GetFloat("menubar_alpha_" + _menuId, 1f);
			float float2 = animationManager.GetFloat("menubar_scale_" + _menuId, 1f);
			Vector2 vector = animationManager.GetVector2("menubar_slide_" + _menuId, Vector2.zero);
			Color color = GUI.color;
			Matrix4x4 matrix = GUI.matrix;
			if (@float < 1f)
			{
				GUI.color = new Color(color.r, color.g, color.b, color.a * @float);
			}
			if (float2 < 1f || vector != Vector2.zero)
			{
				GUIUtility.ScaleAroundPivot(Vector2.op_Implicit(new Vector3(float2, float2, 1f)), Vector2.zero);
				GUI.matrix = Matrix4x4.Translate(new Vector3(vector.x, vector.y, 0f)) * GUI.matrix;
			}
			layoutComponents.BeginVerticalGroup(styleManager.GetMenuDropdownStyle(), GUILayout.Width(220f * guiHelper.uiScale));
			if (_menuStack.Count > 1)
			{
				if (UnityHelpers.Button("<- Back", styleManager.GetMenuBarItemStyle()))
				{
					_menuStack.Pop();
					if (_menuStack.Count == 1)
					{
						_activeMenuIndex = _menuStack.Peek().ParentIndex;
					}
					layoutComponents.EndVerticalGroup();
					GUI.matrix = matrix;
					GUI.color = color;
					return;
				}
				UnityHelpers.Box("", GUI.skin.horizontalSlider);
			}
			foreach (MenuItem item in menuData.Items)
			{
				DrawMenuItem(item);
			}
			layoutComponents.EndVerticalGroup();
			GUI.matrix = matrix;
			GUI.color = color;
		}

		private void DrawMenuItem(MenuItem item)
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_013f: 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.GetMenuBarItemStyle(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					_menuStack.Push(new MenuData(item.SubItems, _activeMenuIndex));
				}
			}
			else
			{
				GUIStyle menuBarItemStyle = styleManager.GetMenuBarItemStyle();
				GUIStyle menuBarItemStyle2 = styleManager.GetMenuBarItemStyle();
				Rect rect = GUILayoutUtility.GetRect(GUIContent.none, menuBarItemStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				if (GUI.Button(rect, "", menuBarItemStyle))
				{
					item.OnClick?.Invoke();
					CloseDropdown();
				}
				GUI.Label(rect, item.Text, menuBarItemStyle2);
				if (!string.IsNullOrEmpty(item.Shortcut))
				{
					GUIStyle menuBarItemStyle3 = styleManager.GetMenuBarItemStyle(ControlVariant.Default, ControlSize.Default, isShortcut: true);
					GUI.Label(rect, item.Shortcut, menuBarItemStyle3);
				}
			}
			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()
		{
			if (_menuId != null)
			{
				AnimationManager animationManager = guiHelper.GetAnimationManager();
				animationManager.FadeOut("menubar_alpha_" + _menuId, 0.080000006f, EasingFunctions.EaseInCubic);
				animationManager.ScaleOut("menubar_scale_" + _menuId, 0.080000006f, 0.92f, EasingFunctions.EaseInCubic);
			}
			_activeMenuIndex = -1;
			_isDropdownOpen = false;
			_menuStack.Clear();
			_menuId = null;
		}
	}
	public class Separator : BaseComponent
	{
		public Separator(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawSeparator(SeparatorConfig config)
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (config.SpacingBefore > 0f)
			{
				GUILayout.Space(config.SpacingBefore * guiHelper.uiScale);
			}
			if (!string.IsNullOrEmpty(config.Text))
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				DrawSeparatorInternal(SeparatorOrientation.Horizontal, config.Options);
				GUILayout.Space(8f * guiHelper.uiScale);
				UnityHelpers.Label(config.Text, (UnityHelpers.GUIStyle)styleManager.GetLabelStyle(ControlVariant.Muted));
				GUILayout.Space(8f * guiHelper.uiScale);
				DrawSeparatorInternal(SeparatorOrientation.Horizontal, config.Options);
				GUILayout.EndHorizontal();
			}
			else if (config.Rect.HasValue)
			{
				DrawSeparatorRect(config.Rect.Value, config.Orientation);
			}
			else
			{
				DrawSeparatorInternal(config.Orientation, config.Options);
			}
			if (config.SpacingAfter > 0f)
			{
				GUILayout.Space(config.SpacingAfter * guiHelper.uiScale);
			}
		}

		private void DrawSeparatorInternal(SeparatorOrientation orientation, 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());
		}

		private void DrawSeparatorRect(Rect rect, SeparatorOrientation orientation)
		{
			//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 DrawSeparator(SeparatorOrientation orientation = SeparatorOrientation.Horizontal, bool decorative = true, params GUILayoutOption[] options)
		{
			DrawSeparator(new SeparatorConfig
			{
				Orientation = orientation,
				Decorative = decorative,
				SpacingBefore = 0f,
				SpacingAfter = 0f,
				Options = options
			});
		}

		public void HorizontalSeparator(params GUILayoutOption[] options)
		{
			DrawSeparator(new SeparatorConfig
			{
				Orientation = SeparatorOrientation.Horizontal,
				SpacingBefore = 0f,
				SpacingAfter = 0f,
				Options = options
			});
		}

		public void VerticalSeparator(params GUILayoutOption[] options)
		{
			DrawSeparator(new SeparatorConfig
			{
				Orientation = SeparatorOrientation.Vertical,
				SpacingBefore = 0f,
				SpacingAfter = 0f,
				Options = options
			});
		}

		public void DrawSeparator(Rect rect, SeparatorOrientation orientation = SeparatorOrientation.Horizontal)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			DrawSeparator(new SeparatorConfig
			{
				Rect = rect,
				Orientation = orientation,
				SpacingBefore = 0f,
				SpacingAfter = 0f
			});
		}

		public void SeparatorWithSpacing(SeparatorOrientation orientation = SeparatorOrientation.Horizontal, float spacingBefore = 8f, float spacingAfter = 8f, params GUILayoutOption[] options)
		{
			DrawSeparator(new SeparatorConfig
			{
				Orientation = orientation,
				SpacingBefore = spacingBefore,
				SpacingAfter = spacingAfter,
				Options = options
			});
		}

		public void LabeledSeparator(string text, params GUILayoutOption[] options)
		{
			DrawSeparator(new SeparatorConfig
			{
				Text = text,
				SpacingBefore = 0f,
				SpacingAfter = 0f,
				Options = options
			});
		}
	}
	public class Table : BaseComponent
	{
		public Table(GUIHelper helper)
			: base(helper)
		{
		}

		public void DrawTable(TableConfig config)
		{
			if (config.Headers == null || config.Data == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(config.Headers, config.Data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(config.Variant, config.Size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(config.Variant, config.Size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(config.Variant, config.Size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, config.Options);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < config.Headers.Length; i++)
			{
				UnityHelpers.Label(config.Headers[i], (UnityHelpers.GUIStyle)tableHeaderStyle);
			}
			layoutComponents.EndHorizontalGroup();
			int length = config.Data.GetLength(0);
			int length2 = config.Data.GetLength(1);
			GUIStyle tableRowStyle = styleManager.GetTableRowStyle(config.Variant, config.Size);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup(tableRowStyle);
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(config.Data[j, k] ?? "", (UnityHelpers.GUIStyle)tableCellStyle);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		public void DrawRectTable(TableConfig config)
		{
			//IL_006f: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (config.Headers != null && config.Data != null && config.Rect.HasValue)
			{
				StyleManager styleManager = guiHelper.GetStyleManager();
				if (styleManager == null)
				{
					GUI.Box(config.Rect.Value, "Table", GUI.skin.box);
					return;
				}
				GUIStyle tableStyle = styleManager.GetTableStyle(config.Variant, config.Size);
				Rect value = config.Rect.Value;
				Rect val = new Rect(((Rect)(ref value)).x * guiHelper.uiScale, ((Rect)(ref value)).y * guiHelper.uiScale, ((Rect)(ref value)).width * guiHelper.uiScale, ((Rect)(ref value)).height * guiHelper.uiScale);
				GUI.Box(val, "", tableStyle);
				GUILayout.BeginArea(val);
				DrawTable(config);
				GUILayout.EndArea();
			}
		}

		public void DrawTable(string[] headers, string[,] data, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawTable(new TableConfig
			{
				Headers = headers,
				Data = data,
				Variant = variant,
				Size = size,
				Options = options
			});
		}

		public void DrawTable(Rect rect, string[] headers, string[,] data, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			DrawRectTable(new TableConfig
			{
				Rect = rect,
				Headers = headers,
				Data = data,
				Variant = variant,
				Size = size
			});
		}

		public void SortableTable(TableConfig config)
		{
			if (config.Headers == null || config.Data == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(config.Headers, config.Data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(config.Variant, config.Size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(config.Variant, config.Size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(config.Variant, config.Size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, config.Options);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < config.Headers.Length; i++)
			{
				int arg = i;
				string text = config.Headers[i];
				if (config.SortColumns != null && config.SortAscending != null && i < config.SortColumns.Length && config.SortColumns[i] == i)
				{
					text += (config.SortAscending[i] ? " ↑" : " ↓");
				}
				if (UnityHelpers.Button(text, tableHeaderStyle, config.Options) && config.OnSort != null)
				{
					bool arg2 = true;
					if (config.SortColumns != null && config.SortAscending != null && i < config.SortColumns.Length && config.SortColumns[i] == i)
					{
						arg2 = !config.SortAscending[i];
					}
					config.OnSort(arg, arg2);
				}
			}
			layoutComponents.EndHorizontalGroup();
			int length = config.Data.GetLength(0);
			int length2 = config.Data.GetLength(1);
			GUIStyle tableRowStyle = styleManager.GetTableRowStyle(config.Variant, config.Size);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup(tableRowStyle);
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(config.Data[j, k] ?? "", (UnityHelpers.GUIStyle)tableCellStyle);
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		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)
		{
			SortableTable(new TableConfig
			{
				Headers = headers,
				Data = data,
				SortColumns = sortColumns,
				SortAscending = sortAscending,
				Variant = variant,
				Size = size,
				OnSort = onSort,
				Options = options
			});
		}

		public void SelectableTable(TableConfig config)
		{
			if (config.Headers == null || config.Data == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(config.Headers, config.Data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(config.Variant, config.Size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(config.Variant, config.Size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(config.Variant, config.Size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, config.Options);
			layoutComponents.BeginHorizontalGroup(tableHeaderStyle);
			UnityHelpers.Label("", tableHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f * guiHelper.uiScale) });
			for (int i = 0; i < config.Headers.Length; i++)
			{
				UnityHelpers.Label(config.Headers[i], (UnityHelpers.GUIStyle)tableHeaderStyle);
			}
			layoutComponents.EndHorizontalGroup();
			int length = config.Data.GetLength(0);
			int length2 = config.Data.GetLength(1);
			bool[] array = config.SelectedRows ?? new bool[length];
			GUIStyle tableRowStyle = styleManager.GetTableRowStyle(config.Variant, config.Size);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup(tableRowStyle);
				bool flag = UnityHelpers.Toggle(array[j], "", GUILayout.Width(20f * guiHelper.uiScale));
				if (flag != array[j])
				{
					array[j] = flag;
					config.OnSelectionChange?.Invoke(j, flag);
				}
				for (int k = 0; k < length2; k++)
				{
					UnityHelpers.Label(config.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)
		{
			int length = data.GetLength(0);
			if (selectedRows == null || selectedRows.Length != length)
			{
				selectedRows = new bool[length];
			}
			TableConfig config = new TableConfig
			{
				Headers = headers,
				Data = data,
				SelectedRows = selectedRows,
				Variant = variant,
				Size = size,
				OnSelectionChange = onSelectionChange,
				Options = options
			};
			SelectableTable(config);
		}

		public void CustomTable(TableConfig config)
		{
			if (config.Headers == null || config.ObjectData == null || config.CellRenderer == null)
			{
				return;
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(config.Headers, config.ObjectData);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(config.Variant, config.Size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(config.Variant, config.Size);
			layoutComponents.BeginVerticalGroup(tableStyle, config.Options);
			layoutComponents.BeginHorizontalGroup();
			for (int i = 0; i < config.Headers.Length; i++)
			{
				UnityHelpers.Label(config.Headers[i], (UnityHelpers.GUIStyle)tableHeaderStyle);
			}
			layoutComponents.EndHorizontalGroup();
			int length = config.ObjectData.GetLength(0);
			int length2 = config.ObjectData.GetLength(1);
			GUIStyle tableRowStyle = styleManager.GetTableRowStyle(config.Variant, config.Size);
			for (int j = 0; j < length; j++)
			{
				layoutComponents.BeginHorizontalGroup(tableRowStyle);
				for (int k = 0; k < length2; k++)
				{
					object arg = config.ObjectData[j, k];
					config.CellRenderer(arg, j, k);
				}
				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)
		{
			CustomTable(new TableConfig
			{
				Headers = headers,
				ObjectData = data,
				CellRenderer = cellRenderer,
				Variant = variant,
				Size = size,
				Options = options
			});
		}

		public void PaginatedTable(TableConfig config)
		{
			if (config.Headers == null || config.Data == null)
			{
				return;
			}
			int length = config.Data.GetLength(0);
			int num = ((config.PageSize > 0) ? config.PageSize : 10);
			int num2 = Mathf.Max(1, Mathf.CeilToInt((float)length / (float)num));
			int num3 = Mathf.Clamp(config.CurrentPage, 0, num2 - 1);
			int num4 = num3 * num;
			int num5 = Mathf.Min(num4 + num, length) - num4;
			string[,] array = new string[num5, config.Data.GetLength(1)];
			for (int i = 0; i < num5; i++)
			{
				for (int j = 0; j < config.Data.GetLength(1); j++)
				{
					array[i, j] = config.Data[num4 + i, j];
				}
			}
			DrawTable(new TableConfig
			{
				Headers = config.Headers,
				Data = array,
				Variant = config.Variant,
				Size = config.Size,
				Options = config.Options
			});
			layoutComponents.AddSpace(8f);
			layoutComponents.BeginHorizontalGroup();
			if (guiHelper.Button("← Previous", ControlVariant.Outline, ControlSize.Default, null, false, 1f, GUILayout.Width(100f * guiHelper.uiScale)) && num3 > 0)
			{
				num3--;
				config.OnPageChange?.Invoke(num3);
			}
			GUILayout.FlexibleSpace();
			string text = $"Page {num3 + 1} of {num2}";
			GUIStyle val = guiHelper.GetStyleManager()?.GetLabelStyle(ControlVariant.Muted) ?? GUI.skin.label;
			UnityHelpers.Label(text, (UnityHelpers.GUIStyle)val);
			GUILayout.FlexibleSpace();
			if (guiHelper.Button("Next →", ControlVariant.Outline, ControlSize.Default, null, false, 1f, GUILayout.Width(100f * guiHelper.uiScale)) && num3 < num2 - 1)
			{
				num3++;
				config.OnPageChange?.Invoke(num3);
			}
			layoutComponents.EndHorizontalGroup();
			config.CurrentPage = num3;
		}

		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)
		{
			TableConfig tableConfig = new TableConfig
			{
				Headers = headers,
				Data = data,
				CurrentPage = currentPage,
				PageSize = pageSize,
				Variant = variant,
				Size = size,
				OnPageChange = onPageChange,
				Options = options
			};
			PaginatedTable(tableConfig);
			currentPage = tableConfig.CurrentPage;
		}

		public void SearchableTable(TableConfig config)
		{
			if (config.Headers != null && config.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(config.SearchQuery ?? "", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f * guiHelper.uiScale) });
				if (text != config.SearchQuery)
				{
					config.SearchQuery = text;
					config.OnSearch?.Invoke(config.SearchQuery);
					config.FilteredData = FilterTableData(config.Data, config.SearchQuery);
				}
				layoutComponents.EndHorizontalGroup();
				layoutComponents.AddSpace(8f);
				string[,] data = config.FilteredData ?? config.Data;
				DrawTable(new TableConfig
				{
					Headers = config.Headers,
					Data = data,
					Variant = config.Variant,
					Size = config.Size,
					Options = config.Options
				});
			}
		}

		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)
		{
			TableConfig tableConfig = new TableConfig
			{
				Headers = headers,
				Data = data,
				SearchQuery = searchQuery,
				FilteredData = filteredData,
				Variant = variant,
				Size = size,
				OnSearch = onSearch,
				Options = options
			};
			SearchableTable(tableConfig);
			searchQuery = tableConfig.SearchQuery;
			filteredData = tableConfig.FilteredData;
		}

		public void ResizableTable(TableConfig config)
		{
			if (config.Headers == null || config.Data == null)
			{
				return;
			}
			if (config.ColumnWidths == null || config.ColumnWidths.Length != config.Headers.Length)
			{
				config.ColumnWidths = new float[config.Headers.Length];
				for (int i = 0; i < config.ColumnWidths.Length; i++)
				{
					config.ColumnWidths[i] = 100f;
				}
			}
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (styleManager == null)
			{
				DrawSimpleTable(config.Headers, config.Data);
				return;
			}
			GUIStyle tableStyle = styleManager.GetTableStyle(config.Variant, config.Size);
			GUIStyle tableHeaderStyle = styleManager.GetTableHeaderStyle(config.Variant, config.Size);
			GUIStyle tableCellStyle = styleManager.GetTableCellStyle(config.Variant, config.Size, (TextAnchor)3);
			layoutComponents.BeginVerticalGroup(tableStyle, config.Options);
			layoutComponents.BeginHorizontalGroup();
			for (int j = 0; j < config.Headers.Length; j++)
			{
				float num = config.ColumnWidths[j] * guiHelper.uiScale;
				UnityHelpers.Label(config.Headers[j], tableHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num) });
			}
			layoutComponents.EndHorizontalGroup();
			int length = config.Data.GetLength(0);
			int length2 = config.Data.GetLength(1);
			GUIStyle tableRowStyle = styleManager.GetTableRowStyle(config.Variant, config.Size);
			for (int k = 0; k < length; k++)
			{
				layoutComponents.BeginHorizontalGroup(tableRowStyle);
				for (int l = 0; l < length2; l++)
				{
					string text = config.Data[k, l] ?? "";
					float num2 = config.ColumnWidths[l] * guiHelper.uiScale;
					UnityHelpers.Label(text, tableCellStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(num2) });
				}
				layoutComponents.EndHorizontalGroup();
			}
			layoutComponents.EndVerticalGroup();
		}

		public void ResizableTable(string[] headers, string[,] data, ref float[] columnWidths, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			if (columnWidths == null || columnWidths.Length != headers.Length)
			{
				columnWidths = new float[headers.Length];
				for (int i = 0; i < columnWidths.Length; i++)
				{
					columnWidths[i] = 100f;
				}
			}
			TableConfig config = new TableConfig
			{
				Headers = headers,
				Data = data,
				ColumnWidths = columnWidths,
				Variant = variant,
				Size = size,
				Options = options
			};
			ResizableTable(config);
		}

		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 enum TabSide
	{
		Left,
		Right
	}
	public enum TabPosition
	{
		Top,
		Bottom,
		Left,
		Right
	}
	public enum IndicatorStyle
	{
		Underline,
		Background,
		Border,
		Pill
	}
	public struct TabConfig
	{
		public string Name;

		public Action Content;

		public bool Disabled;

		public Texture2D Icon;

		public bool Closable;

		public TabConfig(string name, Action content, bool disabled = false, Texture2D icon = null, bool closable = false)
		{
			Name = name;
			Content = content;
			Disabled = disabled;
			Icon = icon;
			Closable = closable;
		}
	}
	public class TabItem
	{
		public string Id { get; }

		public string Name { get; set; }

		public Action Content { get; set; }

		public bool Disabled { get; set; }

		public Texture2D Icon { get; set; }

		public bool Closable { get; set; }

		public object UserData { get; set; }

		public TabItem(string name, Action content, bool disabled = false, Texture2D icon = null, bool closable = false)
		{
			Id = Guid.NewGuid().ToString();
			Name = name;
			Content = content;
			Disabled = disabled;
			Icon = icon;
			Closable = closable;
		}
	}
	public class Tabs : BaseComponent
	{
		private const float CLOSE_BUTTON_HIT_AREA = 20f;

		private const float CLOSE_BUTTON_ICON_SIZE = 12f;

		private const float CLOSE_BUTTON_FONT_SIZE = 14f;

		private const float TAB_INDICATOR_HEIGHT = 2f;

		private const float TAB_BORDER_WIDTH = 2f;

		private const float TAB_HEIGHT = 36f;

		private int _pendingCloseIndex = -1;

		private Action<int> _pendingCloseCallback;

		private Vector2 _tabScrollPosition = Vector2.zero;

		public Tabs(GUIHelper helper)
			: base(helper)
		{
		}//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)


		public int Draw(TabsConfig config)
		{
			if (config.TabNames == null || config.TabNames.Length == 0)
			{
				config.Content?.Invoke();
				return config.SelectedIndex;
			}
			ProcessPendingClose(config);
			return DrawTabs(config);
		}

		public int DrawWithAutoClose(ref string[] tabNames, ref bool[] closableTabs, int selectedIndex, Action content = null, Action<int> onTabChange = null)
		{
			if (tabNames == null || tabNames.Length == 0)
			{
				content?.Invoke();
				return selectedIndex;
			}
			TabsConfig config = new TabsConfig(tabNames, selectedIndex)
			{
				ClosableTabs = closableTabs,
				Content = content,
				OnTabChange = onTabChange
			};
			return HandleAutoClose(ref tabNames, ref closableTabs, ref selectedIndex, config);
		}

		private int DrawTabs(TabsConfig config)
		{
			int num = Mathf.Clamp(config.SelectedIndex, 0, config.TabNames.Length - 1);
			int num2 = num;
			switch (config.Position)
			{
			case TabPosition.Top:
				num2 = DrawMultiLineTabs(config, num, isVertical: false);
				RenderTabContent(config, num2);
				break;
			case TabPosition.Bottom:
				RenderTabContent(config, num2);
				num2 = DrawMultiLineTabs(config, num, isVertical: false);
				break;
			case TabPosition.Left:
				num2 = DrawVerticalTabsWithContent(config, num, tabsOnRight: false);
				break;
			case TabPosition.Right:
				num2 = DrawVerticalTabsWithContent(config, num, tabsOnRight: true);
				break;
			}
			return num2;
		}

		private int DrawVerticalTabsWithContent(TabsConfig config, int selectedIndex, bool tabsOnRight)
		{
			int num = selectedIndex;
			bool flag = false;
			try
			{
				layoutComponents.BeginHorizontalGroup(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
				flag = true;
				if (tabsOnRight)
				{
					RenderTabContent(config, num);
					num = DrawMultiLineTabs(config, selectedIndex, isVertical: true);
				}
				else
				{
					num = DrawMultiLineTabs(config, selectedIndex, isVertical: true);
					RenderTabContent(config, num);
				}
			}
			finally
			{
				if (flag)
				{
					layoutComponents.EndHorizontalGroup();
				}
			}
			return num;
		}

		private int DrawMultiLineTabs(TabsConfig config, int selectedIndex, bool isVertical)
		{
			int num = config.TabNames.Length;
			StyleManager localStyleManager = guiHelper.GetStyleManager();
			if (config.MaxLines <= 1)
			{
				return DrawSingleLineTabs(config, localStyleManager, selectedIndex, isVertical);
			}
			int num2 = (int)Mathf.Ceil((float)num / (float)config.MaxLines);
			if (isVertical)
			{
				return DrawVerticalTabColumns(config, localStyleManager, selectedIndex, num2);
			}
			return DrawMultiLineHorizontalTabs(config, localStyleManager, selectedIndex, num2);
		}

		private int DrawSingleLineTabs(TabsConfig config, StyleManager localStyleManager, int selectedIndex, bool isVertical)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_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)
			int num = selectedIndex;
			if (config.EnableOverflowScroll)
			{
				if (isVertical)
				{
					_tabScrollPosition = GUILayout.BeginScrollView(_tabScrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(config.TabWidth * guiHelper.uiScale),
						GUILayout.ExpandHeight(true)
					});
				}
				else
				{
					_tabScrollPosition = GUILayout.BeginScrollView(_tabScrollPosition, GUIStyle.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f * guiHelper.uiScale + 4f) });
				}
			}
			try
			{
				if (isVertical)
				{
					layoutComponents.BeginVerticalGroup(localStyleManager.GetTabsListStyle(), GUILayout.Width(config.TabWidth * guiHelper.uiScale));
					for (int i = 0; i < config.TabNames.Length; i++)
					{
						num = DrawSingleTab(config, localStyleManager, i, selectedIndex, num, isVertical: true);
						if (i < config.TabNames.Length - 1)
						{
							layoutComponents.AddSpace((int)(2f * guiHelper.uiScale));
						}
					}
				}
				else
				{
					layoutComponents.BeginHorizontalGroup(localStyleManager.GetTabsListStyle());
					for (int j = 0; j < config.TabNames.Length; j++)
					{
						num = DrawSingleTab(config, localStyleManager, j, selectedIndex, num);
						if (j < config.TabNames.Length - 1)
						{
							layoutComponents.AddSpace((int)(2f * guiHelper.uiScale));
						}
					}
				}
			}
			finally
			{
				if (isVertical)
				{
					layoutComponents.EndVerticalGroup();
				}
				else
				{
					layoutComponents.EndHorizontalGroup();
				}
				if (config.EnableOverflowScroll)
				{
					GUILayout.EndScrollView();
				}
			}
			return num;
		}

		private int DrawMultiLineHorizontalTabs(TabsConfig config, StyleManager localStyleManager, int selectedIndex, int tabsPerLine)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			int num = selectedIndex;
			int num2 = Mathf.Min(config.MaxLines, (int)Mathf.Ceil((float)config.TabNames.Length / (float)tabsPerLine));
			if (config.EnableOverflowScroll)
			{
				float num3 = 36f * guiHelper.uiScale * (float)num2 + 2f * guiHelper.uiScale * (float)(num2 - 1) + 4f;
				_tabScrollPosition = GUILayout.BeginScrollView(_tabScrollPosition, GUIStyle.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num3) });
			}
			try
			{
				layoutComponents.BeginVerticalGroup(localStyleManager.GetTabsListStyle());
				for (int i = 0; i < num2; i++)
				{
					layoutComponents.BeginHorizontalGroup();
					for (int j = i * tabsPerLine; j < (i + 1) * tabsPerLine && j < config.TabNames.Length; j++)
					{
						num = DrawSingleTab(config, localStyleManager, j, selectedIndex, num);
						if (j < (i + 1) * tabsPerLine - 1 && j < config.TabNames.Length - 1)
						{
							layoutComponents.AddSpace((int)(2f * guiHelper.uiScale));
						}
					}
					layoutComponents.EndHorizontalGroup();
					if (i < num2 - 1)
					{
						layoutComponents.AddSpace((int)(2f * guiHelper.uiScale));
					}
				}
				return num;
			}
			finally
			{
				layoutComponents.EndVerticalGroup();
				if (config.EnableOverflowScroll)
				{
					GUILayout.EndScrollView();
				}
			}
		}

		private int DrawVerticalTabColumns(TabsConfig config, StyleManager localStyleManager, int selectedIndex, int tabsPerColumn)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			int num = selectedIndex;
			int num2 = Mathf.Min(config.MaxLines, (int)Mathf.Ceil((float)config.TabNames.Length / (float)tabsPerColumn));
			if (config.EnableOverflowScroll)
			{
				float num3 = config.TabWidth * guiHelper.uiScale * (float)num2 + 2f * guiHelper.uiScale * (float)(num2 - 1) + 4f;
				_tabScrollPosition = GUILayout.BeginScrollView(_tabScrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(num3),
					GUILayout.ExpandHeight(true)
				});
			}
			try
			{
				layoutComponents.BeginHorizontalGroup(localStyleManager.GetTabsListStyle());
				for (int i = 0; i < num2; i++)
				{
					layoutComponents.BeginVerticalGroup(GUILayout.Width(config.TabWidth * guiHelper.uiScale));
					for (int j = i * tabsPerColumn; j < (i + 1) * tabsPerColumn && j < config.TabNames.Length; j++)
					{
						num = DrawSingleTab(config, localStyleManager, j, selectedIndex, num, isVertical: true);
						if (j < (i + 1) * tabsPerColumn - 1 && j < config.TabNames.Length - 1)
						{
							layoutComponents.AddSpace((int)(2f * guiHelper.uiScale));
						}
					}
					layoutComponents.EndVerticalGroup();
					if (i < num2 - 1)
					{
						layoutComponents.AddSpace((int)(2f * guiHelper.uiScale));
					}
				}
				return num;
			}
			finally
			{
				layoutComponents.EndHorizontalGroup();
				if (config.EnableOverflowScroll)
				{
					GUILayout.EndScrollView();
				}
			}
		}

		private int DrawSingleTab(TabsConfig config, StyleManager localStyleManager, int index, int selectedIndex, int currentNewIndex, bool isVertical = false)
		{
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			//IL_0125: 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)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			bool flag = index == selectedIndex;
			bool flag2 = config.DisabledTabs != null && index < config.DisabledTabs.Length && config.DisabledTabs[index];
			bool flag3 = config.TabIcons != null && index < config.TabIcons.Length && (Object)(object)config.TabIcons[index] != (Object)null;
			bool flag4 = config.ClosableTabs != null && index < config.ClosableTabs.Length && config.ClosableTabs[index];
			GUIStyle tabsTriggerStyle = localStyleManager.GetTabsTriggerStyle(flag);
			string text = config.TabNames[index] ?? $"Tab {index + 1}";
			GUILayoutOption[] array = (GUILayoutOption[])((!isVertical) ? (((object)config.Options) ?? ((object)new GUILayoutOption[1] { GUILayout.Height(36f * guiHelper.uiScale) })) : new GUILayoutOption[2]
			{
				GUILayout.Width(config.TabWidth * guiHelper.uiScale),
				GUILayout.Height(36f * guiHelper.uiScale)
			});
			GUI.enabled = !flag2;
			Rect rect = GUILayoutUtility.GetRect(new GUIContent(flag4 ? (text + "  ×") : text), tabsTriggerStyle, array);
			bool flag5 = false;
			if (flag4)
			{
				flag5 = HandleCloseButton(rect, index, config);
			}
			bool num = !flag2 && !flag5 && GUI.Button(rect, "", tabsTriggerStyle);
			DrawTabContent(rect, text, tabsTriggerStyle, flag3 ? config.TabIcons[index] : null, flag4, isVertical);
			if (flag4 && !flag5)
			{
				DrawCloseButton(rect);
			}
			GUI.enabled = true;
			if (num && index != selectedIndex)
			{
				currentNewIndex = index;
				config.OnTabChange?.Invoke(index);
			}
			if (config.ShowIndicator && flag)
			{
				DrawTabIndicator(rect, config.IndicatorStyle, isVertical, config.Position);
			}
			return currentNewIndex;
		}

		private void DrawTabContent(Rect tabRect, string label, GUIStyle triggerStyle, Texture2D icon, bool isClosable, bool isVertical)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_002f: 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_0139: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			UnityHelpers.GUIStyle gUIStyle = new UnityHelpers.GUIStyle(triggerStyle);
			if ((Object)(object)icon != (Object)null)
			{
				float num = 16f * guiHelper.uiScale;
				GUIContent val = new GUIContent(label);
				float x = triggerStyle.CalcSize(val).x;
				float num2 = num + 4f * guiHelper.uiScale + x;
				float num3 = ((Rect)(ref tabRect)).x + (((Rect)(ref tabRect)).width - num2) / 2f;
				if (isClosable)
				{
					num3 -= 12f * guiHelper.uiScale;
				}
				float num4 = ((Rect)(ref tabRect)).y + (((Rect)(ref tabRect)).height - num) / 2f;
				GUI.DrawTexture(new Rect(num3, num4, num, num), (Texture)(object)icon, (ScaleMode)2);
				gUIStyle.alignment = (TextAnchor)(isVertical ? 3 : 4);
				GUI.Label(new Rect(num3 + num + 4f * guiHelper.uiScale, ((Rect)(ref tabRect)).y, x, ((Rect)(ref tabRect)).height), label, (GUIStyle)gUIStyle);
			}
			else
			{
				gUIStyle.alignment = (TextAnchor)(isVertical ? 3 : 4);
				GUI.Label((Rect)(isClosable ? new Rect(((Rect)(ref tabRect)).x, ((Rect)(ref tabRect)).y, ((Rect)(ref tabRect)).width - 20f * guiHelper.uiScale, ((Rect)(ref tabRect)).height) : tabRect), label, (GUIStyle)gUIStyle);
			}
		}

		private bool HandleCloseButton(Rect tabRect, int index, TabsConfig config)
		{
			//IL_005a: 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)
			float num = 20f * guiHelper.uiScale;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref tabRect)).x + ((Rect)(ref tabRect)).width - num - 4f * guiHelper.uiScale, ((Rect)(ref tabRect)).y + (((Rect)(ref tabRect)).height - num) / 2f, num, num);
			if ((int)Event.current.type == 0 && Event.current.button == 0 && ((Rect)(ref val)).Contains(Event.current.mousePosition))
			{
				_pendingCloseIndex = index;
				_pendingCloseCallback = config.OnTabClose;
				Event.current.Use();
				return true;
			}
			return false;
		}

		private void DrawCloseButton(Rect tabRect)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			float num = 12f * guiHelper.uiScale;
			float num2 = ((Rect)(ref tabRect)).x + ((Rect)(ref tabRect)).width - num - 8f * guiHelper.uiScale;
			float num3 = ((Rect)(ref tabRect)).y + (((Rect)(ref tabRect)).height - num) / 2f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num2, num3, num, num);
			UnityHelpers.GUIStyle obj = new UnityHelpers.GUIStyle(GUI.skin.label)
			{
				fontSize = Mathf.RoundToInt(14f * guiHelper.uiScale),
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)4
			};
			obj.normal.textColor = (((Rect)(ref val)).Contains(Event.current.mousePosition) ? ThemeManager.Instance.CurrentTheme.Destructive : ThemeManager.Instance.CurrentTheme.Muted);
			UnityHelpers.GUIStyle gUIStyle = obj;
			GUI.Label(val, "×", (GUIStyle)gUIStyle);
		}

		private void DrawTabIndicator(Rect tabRect, IndicatorStyle style, bool isVertical, TabPosition position)
		{
			//IL_0002: 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_0037: 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_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)
			//IL_004c: 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_0058: 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)
			if (!((Rect)(ref tabRect)).Equals(Rect.zero))
			{
				Color accent = ThemeManager.Instance.CurrentTheme.Accent;
				switch (style)
				{
				case IndicatorStyle.Underline:
					DrawUnderlineIndicator(tabRect, accent, isVertical, position);
					break;
				case IndicatorStyle.Background:
					DrawBackgroundIndicator(tabRect, accent);
					break;
				case IndicatorStyle.Border:
					DrawBorderIndicator(tabRect, accent, isVertical, position);
					break;
				case IndicatorStyle.Pill:
					DrawPillIndicator(tabRect, accent);
					break;
				}
			}
		}

		private void DrawUnderlineIndicator(Rect tabRect, Color color, bool isVertical, TabPosition position)
		{
			//IL_009b: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			if (isVertical)
			{
				float num = 2f * guiHelper.uiScale;
				if (position == TabPosition.Left)
				{
					((Rect)(ref val))..ctor(((Rect)(ref tabRect)).x + ((Rect)(ref tabRect)).width - num, ((Rect)(ref tabRect)).y, num, ((Rect)(ref tabRect)).height);
				}
				else
				{
					((Rect)(ref val))..ctor(((Rect)(ref tabRect)).x, ((Rect)(ref tabRect)).y, num, ((Rect)(ref tabRect)).height);
				}
			}
			else
			{
				float num2 = 2f * guiHelper.uiScale;
				((Rect)(ref val))..ctor(((Rect)(ref tabRect)).x, ((Rect)(ref tabRect)).y + ((Rect)(ref tabRect)).height - num2, ((Rect)(ref tabRect)).width, num2);
			}
			GUI.color = color;
			GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
		}

		private void DrawBackgroundIndicator(Rect tabRect, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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_0021: 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)
			GUI.color = new Color(color.r, color.g, color.b, 0.1f);
			GUI.DrawTexture(tabRect, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
		}

		private void DrawBorderIndicator(Rect tabRect, Color color, bool isVertical, TabPosition position)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			float num = 2f * guiHelper.uiScale;
			GUI.color = color;
			if (isVertical)
			{
				if (position == TabPosition.Left)
				{
					GUI.DrawTexture(new Rect(((Rect)(ref tabRect)).x + ((Rect)(ref tabRect)).width - num, ((Rect)(ref tabRect)).y, num, ((Rect)(ref tabRect)).height), (Texture)(object)Texture2D.whiteTexture);
				}
				else
				{
					GUI.DrawTexture(new Rect(((Rect)(ref tabRect)).x, ((Rect)(ref tabRect)).y, num, ((Rect)(ref tabRect)).height), (Texture)(object)Texture2D.whiteTexture);
				}
			}
			else
			{
				GUI.DrawTexture(new Rect(((Rect)(ref tabRect)).x, ((Rect)(ref tabRect)).y + ((Rect)(ref tabRect)).height - num, ((Rect)(ref tabRect)).width, num), (Texture)(object)Texture2D.whiteTexture);
			}
			GUI.color = Color.white;
		}

		private void DrawPillIndicator(Rect tabRect, Color color)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			float num = 2f * guiHelper.uiScale;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref tabRect)).x + num, ((Rect)(ref tabRect)).y + num, ((Rect)(ref tabRect)).width - num * 2f, ((Rect)(ref tabRect)).height - num * 2f);
			Texture2D val2 = CreatePillTexture((int)((Rect)(ref val)).width, (int)((Rect)(ref val)).height, (int)(Mathf.Min(((Rect)(ref val)).width, ((Rect)(ref val)).height) / 2f), color);
			GUI.DrawTexture(val, (Texture)(object)val2);
		}

		private Texture2D CreatePillTexture(int width, int height, int radius, Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0053: 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)
			Texture2D val = new Texture2D(width, height);
			float num = (float)width / 2f;
			float num2 = (float)height / 2f;
			int num3 = radius * radius;
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < width; j++)
				{
					float num4 = (float)j - num;
					float num5 = (float)i - num2;
					if (num4 * num4 + num5 * num5 <= (float)num3)
					{
						val.SetPixel(j, i, color);
					}
					else
					{
						val.SetPixel(j, i, Color.clear);
					}
				}
			}
			val.Apply();
			return val;
		}

		private int HandleAutoClose(ref string[] tabNames, ref bool[] closableTabs, ref int selectedIndex, TabsConfig config)
		{
			if (_pendingCloseIndex >= 0 && _pendingCloseCallback == null)
			{
				int pendingCloseIndex = _pendingCloseIndex;
				_pendingCloseIndex = -1;
				if (pendingCloseIndex >= 0 && pendingCloseIndex < tabNames.Length)
				{
					List<string> list = new List<string>(tabNames);
					List<bool> list2 = new List<bool>(closableTabs ?? Array.Empty<bool>());
					list.RemoveAt(pendingCloseIndex);
					if (pendingCloseIndex < list2.Count)
					{
						list2.RemoveAt(pendingCloseIndex);
					}
					tabNames = list.ToArray();
					closableTabs = list2.ToArray();
					if (selectedIndex >= tabNames.Length)
					{
						selectedIndex = Math.Max(0, tabNames.Length - 1);
					}
					else if (selectedIndex > pendingCloseIndex)
					{
						selectedIndex--;
					}
					config.SelectedIndex = selectedIndex;
				}
			}
			return Draw(config);
		}

		private void ProcessPendingClose(TabsConfig config)
		{
			if (_pendingCloseIndex >= 0 && _pendingCloseCallback != null)
			{
				int pendingCloseIndex = _pendingCloseIndex;
				Action<int> pendingCloseCallback = _pendingCloseCallback;
				_pendingCloseIndex = -1;
				_pendingCloseCallback = null;
				pendingCloseCallback?.Invoke(pendingCloseIndex);
			}
		}

		private void RenderTabContent(TabsConfig config, int selectedIndex)
		{
			GUIStyle style = guiHelper.GetStyleManager()?.GetTabsContentStyle() ?? GUIStyle.none;
			layoutComponents.BeginVerticalGroup(style, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
			try
			{
				config.Content?.Invoke();
			}
			finally
			{
				layoutComponents.EndVerticalGroup();
			}
		}

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

		public void EndTabContent()
		{
			layoutComponents.EndVerticalGroup();
		}
	}
}
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(AvatarConfig config)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			if (config.BorderColor != Color.clear)
			{
				GUIStyle val = new UnityHelpers.GUIStyle(GUI.skin.box);
				val.normal.background = styleManager.CreateSolidTexture(config.BorderColor);
				val.alignment = (TextAnchor)4;
				val.padding = new UnityHelpers.RectOffset(2, 2, 2, 2);
				layoutComponents.BeginVerticalGroup(val, config.Options);
			}
			if (!string.IsNullOrEmpty(config.Name))
			{
				if (config.ShowNameBelow)
				{
					layoutComponents.BeginVerticalGroup();
				}
				else
				{
					layoutComponents.BeginHorizontalGroup();
				}
			}
			else if (config.IsOnline)
			{
				layoutComponents.BeginVerticalGroup();
			}
			if (config.Rect.HasValue)
			{
				DrawAvatarRect(config.Rect.Value, config.Image, config.FallbackText, config.Size, config.Shape);
			}
			else
			{
				DrawAvatarInternal(config.Image, config.FallbackText, config.Size, config.Shape, config.Options);
			}
			if (config.IsOnline && styleManager != null && !config.Rect.HasValue)
			{
				Rect lastRect = GUILayoutUtility.GetLastRect();
				float num = styleManager.GetStatusIndicatorSize(config.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);
			}
			if (!string.IsNullOrEmpty(config.Name))
			{
				if (config.ShowNameBelow)
				{
					layoutComponents.AddSpace(4f);
					GUIStyle val2 = new UnityHelpers.GUIStyle(styleManager?.GetLabelStyle(ControlVariant.Default) ?? GUI.skin.label);
					UnityHelpers.Label(config.Name, (UnityHelpers.GUIStyle)val2);
					layoutComponents.EndVerticalGroup();
				}
				else
				{
					layoutComponents.AddSpace(8f);
					GUIStyle val3 = new UnityHelpers.GUIStyle(styleManager?.GetLabelStyle(ControlVariant.Default) ?? GUI.skin.label);
					val3.alignment = (TextAnchor)3;
					UnityHelpers.Label(config.Name, (UnityHelpers.GUIStyle)val3);
					layoutComponents.EndHorizontalGroup();
				}
			}
			else if (config.IsOnline)
			{
				layoutComponents.EndVerticalGroup();
			}
			if (config.BorderColor != Color.clear)
			{
				layoutComponents.EndVerticalGroup();
			}
		}

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

		private void DrawAvatarRect(Rect rect, Texture2D image, string fallbackText, ControlSize size, AvatarShape shape)
		{
			//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);
		}

		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 DrawAvatar(Texture2D image, string fallbackText, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, params GUILayoutOption[] options)
		{
			DrawAvatar(new AvatarConfig
			{
				Image = image,
				FallbackText = fallbackText,
				Size = size,
				Shape = shape,
				Options = options
			});
		}

		public void DrawAvatar(Rect rect, Texture2D image, string fallbackText, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			DrawAvatar(new AvatarConfig
			{
				Rect = rect,
				Image = image,
				FallbackText = fallbackText,
				Size = size,
				Shape = shape
			});
		}

		public void AvatarWithStatus(Texture2D image, string fallbackText, bool isOnline, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, params GUILayoutOption[] options)
		{
			DrawAvatar(new AvatarConfig
			{
				Image = image,
				FallbackText = fallbackText,
				Size = size,
				Shape = shape,
				IsOnline = isOnline,
				Options = options
			});
		}

		public void AvatarWithName(Texture2D image, string fallbackText, string name, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, bool showNameBelow = false, params GUILayoutOption[] options)
		{
			DrawAvatar(new AvatarConfig
			{
				Image = image,
				FallbackText = fallbackText,
				Name = name,
				Size = size,
				Shape = shape,
				ShowNameBelow = showNameBelow,
				Options = options
			});
		}

		public void AvatarWithBorder(Texture2D image, string fallbackText, Color borderColor, ControlSize size = ControlSize.Default, AvatarShape shape = AvatarShape.Circle, params GUILayoutOption[] options)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			DrawAvatar(new AvatarConfig
			{
				Image = image,
				FallbackText = fallbackText,
				BorderColor = borderColor,
				Size = size,
				Shape = shape,
				Options = options
			});
		}
	}
	public class Badge : BaseComponent
	{
		private Dictionary<string, bool> _pulseStarted = new Dictionary<string, bool>();

		private int _animatedBadgeCounter;

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

		private void RenderIcon(IconConfig iconConfig)
		{
			float num = iconConfig.Size * guiHelper.uiScale;
			UnityHelpers.Label((Texture)(object)iconConfig.Image, GUILayout.Width(num), GUILayout.Height(num));
		}

		public void DrawBadge(BadgeConfig config)
		{
			DrawBadgeInternal(config, isAnimated: false, null);
		}

		private void DrawBadgeInternal(BadgeConfig config, bool isAnimated, string animationId)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			StyleManager styleManager = guiHelper.GetStyleManager();
			GUIStyle val = styleManager.GetBadgeStyle(config.Variant, config.Size);
			Color color = GUI.color;
			if (isAnimated)
			{
				string animId = animationId ?? $"badge_pulse_{_animatedBadgeCounter++}";
				AnimationManager animManager = guiHelper.GetAnimationManager();
				if (!_pulseStarted.ContainsKey(animId) || !_pulseStarted[animId])
				{
					animManager.StartFloat(animId, 0.7f, 1f, 0.5f, EasingFunctions.EaseInOut, delegate
					{
						animManager.StartFloat(animId, 1f, 0.7f, 0.5f, EasingFunctions.EaseInOut);
					});
					_pulseStarted[animId] = true;
				}
				float @float = animManager.GetFloat(animId, 1f);
				if (animManager.IsComplete(animId))
				{
					if (animManager.GetFloat(animId, 1f) <= 0.71f)
					{
						animManager.StartFloat(animId, 0.7f, 1f, 0.5f, EasingFunctions.EaseInOut);
					}
					else
					{
						animManager.StartFloat(animId, 1f, 0.7f, 0.5f, EasingFunctions.EaseInOut);
					}
				}
				GUI.color = new Color(color.r, color.g, color.b, @float);
			}
			if (config.CornerRadius > 0f && config.CornerRadius != 16f)
			{
				UnityHelpers.GUIStyle gUIStyle = new UnityHelpers.GUIStyle(val);
				int num = Mathf.RoundToInt(config.CornerRadius * guiHelper.uiScale);
				gUIStyle.border = new UnityHelpers.RectOffset(num, num, num, num);
				gUIStyle.padding = new UnityHelpers.RectOffset(val.padding.left + 4, val.padding.right + 4, val.padding.top + 2, val.padding.bottom + 2);
				val = gUIStyle;
			}
			bool flag = false;
			if (config.Progress > 0f)
			{
				layoutComponents.BeginVerticalGroup();
				flag = true;
			}
			bool flag2 = false;
			if ((Object)(object)config.Icon?.Image != (Object)null || config.ShowStatusDot)
			{
				layoutComponents.BeginHorizontalGroup();
				flag2 = true;
			}
			if (config.ShowStatusDot)
			{
				Color color2 = (config.IsActive ? Color.green : Color.gray);
				GUIStyle val2 = new UnityHelpers.GUIStyle(GUI.skin.box);
				val2.normal.background = styleManager.CreateSolidTexture(color2);
				val2.fixedWidth = 8f * guiHelper.uiScale;
				val2.fixedHeight = 8f * guiHelper.uiScale;
				val2.border = new UnityHelpers.RectOffset(0, 0, 0, 0);
				val2.padding = new UnityHelpers.RectOffset(0, 0, 0, 0);
				val2.margin = new UnityHelpers.RectOffset(0, 0, 0, 0);
				UnityHelpers.Label("", (UnityHelpers.GUIStyle)val2);
				layoutComponents.AddSpace(4f);
			}
			if ((Object)(object)config.Icon?.Image != (Object)null)
			{
				RenderIcon(config.Icon);
				layoutComponents.AddSpace(config.Icon.Spacing * guiHelper.uiScale);
			}
			if (config.Rect.HasValue)
			{
				Rect value = config.Rect.Value;
				float num2 = ((Rect)(ref value)).x * guiHelper.uiScale;
				value = config.Rect.Value;
				float num3 = ((Rect)(ref value)).y * guiHelper.uiScale;
				value = config.Rect.Value;
				float num4 = ((Rect)(ref value)).width * guiHelper.uiScale;
				value = config.Rect.Value;
				UnityHelpers.Label(new Rect(num2, num3, num4, ((Rect)(ref value)).height * guiHelper.uiScale), config.Text ?? "Badge", val);
			}
			else
			{
				UnityHelpers.Label(config.Text ?? "Badge", val, config.Options);
			}
			if (flag2)
			{
				layoutComponents.EndHorizontalGroup();
			}
			if (config.Progress > 0f)
			{
				layoutComponents.AddSpace(2f);
				Rect rect = GUILayoutUtility.GetRect(60f * guiHelper.uiScale, 4f * guiHelper.uiScale);
				GUIStyle val3 = new UnityHelpers.GUIStyle(GUI.skin.box);
				val3.normal.background = styleManager.CreateSolidTexture(Color.gray);
				GUI.Box(rect, "", val3);
				Rect val4 = new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width * Mathf.Clamp01(config.Progress), ((Rect)(ref rect)).height);
				GUIStyle val5 = new UnityHelpers.GUIStyle(GUI.skin.box);
				val5.normal.background = styleManager.CreateSolidTexture(Color.green);
				GUI.Box(val4, "", val5);
			}
			if (flag)
			{
				layoutComponents.EndVerticalGroup();
			}
			if (isAnimated)
			{
				GUI.color = color;
			}
		}

		public void DrawBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawBadge(new BadgeConfig
			{
				Text = text,
				Variant = variant,
				Size = size,
				Options = options
			});
		}

		public void DrawBadge(Rect rect, string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			DrawBadge(new BadgeConfig
			{
				Rect = rect,
				Text = text,
				Variant = variant,
				Size = size
			});
		}

		public void BadgeWithIcon(string text, Texture2D icon, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawBadge(new BadgeConfig
			{
				Text = text,
				Icon = (((Object)(object)icon != (Object)null) ? new IconConfig(icon) : null),
				Variant = variant,
				Size = size,
				Options = options
			});
		}

		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(new BadgeConfig
			{
				Text = text,
				Variant = variant,
				Size = size,
				Count = count,
				MaxCount = maxCount,
				Options = options
			});
		}

		public void StatusBadge(string text, bool isActive, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawBadge(new BadgeConfig
			{
				Text = text,
				IsActive = isActive,
				ShowStatusDot = true,
				Variant = variant,
				Size = size,
				Options = options
			});
		}

		public void ProgressBadge(string text, float progress, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawBadge(new BadgeConfig
			{
				Text = text,
				Progress = progress,
				Variant = variant,
				Size = size,
				Options = options
			});
		}

		public void AnimatedBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawBadgeInternal(new BadgeConfig
			{
				Text = text,
				Variant = variant,
				Size = size,
				Options = options
			}, isAnimated: true, null);
		}

		public void AnimatedBadge(string text, string animationId, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			DrawBadgeInternal(new BadgeConfig
			{
				Text = text,
				Variant = variant,
				Size = size,
				Options = options
			}, isAnimated: true, animationId);
		}

		public void RoundedBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, float cornerRadius = 16f, params GUILayoutOption[] options)
		{
			DrawBadge(new BadgeConfig
			{
				Text = text,
				Variant = variant,
				Size = size,
				CornerRadius = cornerRadius,
				Options = options
			});
		}

		public void PillBadge(string text, ControlVariant variant = ControlVariant.Default, ControlSize size = ControlSize.Default, params GUILayoutOption[] options)
		{
			RoundedBadge(text, variant, size, 9999f, options);
		}
	}
	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);
		}

		pri

MimesisModMenu.dll

Decompiled 5 days ago
using System;
using System.Collections;
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.Base;
using shadcnui.GUIComponents.Core.Styling;
using shadcnui.GUIComponents.Layout;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Loader), "ModMenu", "2.7.0", "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+76414c1450894e06382a3303d4b6ed19ed68ed18")]
[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;

			public bool Fly;

			public float FlySpeed = 10f;

			public bool DamageMultiplier;

			public float DamageMultiplierValue = 10f;

			public bool CustomScale;

			public float PlayerScale = 1f;

			public Vector3[] SavedPositions = (Vector3[])(object)new Vector3[3];

			public Vector3 SavedPosition1;

			public Vector3 SavedPosition2;

			public Vector3 SavedPosition3;
		}

		private GUIHelper guiHelper;

		private ConfigManager configManager;

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

		private Vector2 scrollPosition;

		private int currentTab;

		private TabConfig[] tabs;

		private PickupManager pickupManager;

		private MovementManager movementManager;

		private AutoLootManager autoLootManager;

		private FullbrightManager fullbrightManager;

		private ItemSpawnerManager itemSpawnerManager;

		private bool isListeningForHotkey;

		private string activeHotkeyId = "";

		private string itemSpawnIDInput = "1001";

		private string itemSearchFilter = "";

		private Vector2 itemListScrollPosition;

		private List<(int id, string name)> cachedItemList = new List<(int, string)>();

		private bool itemListLoaded;

		private bool showMenu = true;

		private float lastMenuToggleTime;

		private const float HOTKEY_COOLDOWN = 0.2f;

		private ProtoActor[] cachedPlayers = (ProtoActor[])(object)new ProtoActor[0];

		private ProtoActor selectedPlayer;

		private float lastPlayerCacheTime;

		private const float PLAYER_CACHE_INTERVAL = 1f;

		private readonly 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_006a: 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_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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			guiHelper = new GUIHelper();
			configManager = new ConfigManager();
			autoLootManager = new AutoLootManager();
			fullbrightManager = new FullbrightManager();
			pickupManager = new PickupManager();
			movementManager = new MovementManager();
			itemSpawnerManager = new ItemSpawnerManager();
			tabs = (TabConfig[])(object)new TabConfig[6]
			{
				new TabConfig("Player", (Action)DrawPlayerTab, false, (Texture2D)null, false),
				new TabConfig("Combat", (Action)DrawCombatTab, false, (Texture2D)null, false),
				new TabConfig("Loot", (Action)DrawLootTab, false, (Texture2D)null, false),
				new TabConfig("Visual", (Action)DrawVisualTab, false, (Texture2D)null, false),
				new TabConfig("Entities", (Action)DrawEntitiesTab, false, (Texture2D)null, false),
				new TabConfig("Settings", (Action)DrawSettingsTab, false, (Texture2D)null, false)
			};
			if ((int)configManager.GetHotkey("ToggleMenu").Key == 0)
			{
				configManager.SetHotkey("ToggleMenu", new HotkeyConfig((KeyCode)277));
			}
			ESPManager.Initialize();
			Patches.ApplyPatches(configManager);
			if (!configManager.GetValue("Enabled", defaultValue: true))
			{
				showMenu = false;
			}
			MelonLogger.Msg("Mimesis Mod Menu initialized");
		}

		private void Update()
		{
			if (configManager != null)
			{
				autoLootManager?.Update();
				fullbrightManager?.Update();
				pickupManager?.Update();
				movementManager?.Update();
				itemSpawnerManager?.Update();
				if (configManager.GetValue("Enabled", defaultValue: true))
				{
					HandleInput();
				}
			}
		}

		private void HandleInput()
		{
			if (isListeningForHotkey)
			{
				return;
			}
			if (CheckHotkey("ToggleMenu") && Time.time - lastMenuToggleTime > 0.2f)
			{
				showMenu = !showMenu;
				lastMenuToggleTime = Time.time;
			}
			if (!showMenu && !configManager.GetValue("BackgroundInput", defaultValue: true))
			{
				return;
			}
			if (CheckHotkey("ToggleGodMode"))
			{
				ToggleBool(delegate(bool v)
				{
					state.GodMode = v;
				}, state.GodMode);
			}
			if (CheckHotkey("ToggleInfiniteStamina"))
			{
				ToggleBool(delegate(bool v)
				{
					state.InfiniteStamina = v;
				}, state.InfiniteStamina);
			}
			if (CheckHotkey("ToggleNoFallDamage"))
			{
				ToggleBool(delegate(bool v)
				{
					state.NoFallDamage = v;
				}, state.NoFallDamage);
			}
			if (CheckHotkey("ToggleSpeedBoost"))
			{
				ToggleBool(delegate(bool v)
				{
					state.SpeedBoost = v;
				}, state.SpeedBoost);
			}
			if (CheckHotkey("ToggleESP"))
			{
				ToggleBool(delegate(bool v)
				{
					state.ESP = v;
				}, state.ESP);
			}
			if (CheckHotkey("ToggleAutoLoot"))
			{
				state.AutoLoot = !state.AutoLoot;
				autoLootManager.SetEnabled(state.AutoLoot);
			}
			if (CheckHotkey("ToggleFullbright"))
			{
				state.Fullbright = !state.Fullbright;
				fullbrightManager.SetEnabled(state.Fullbright);
			}
			if (state.Fly)
			{
				UpdateFly();
			}
		}

		private bool CheckHotkey(string name)
		{
			return configManager.GetHotkey(name).IsPressed();
		}

		private void ToggleBool(Action<bool> setter, bool currentValue)
		{
			setter(!currentValue);
		}

		private void OnGUI()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if (configManager.GetValue("Enabled", defaultValue: true))
			{
				GUI.skin.horizontalScrollbar = GUIStyle.none;
				GUI.skin.verticalScrollbar = GUIStyle.none;
				if (isListeningForHotkey)
				{
					HandleHotkeyBindingEvent();
				}
				if (showMenu)
				{
					windowRect = GUI.Window(101, windowRect, new WindowFunction(DrawWindow), "Mimesis Mod Menu");
				}
				ESPManager.UpdateESP();
				guiHelper.DrawOverlay();
			}
		}

		private void HandleHotkeyBindingEvent()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_0010: 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_001f: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			Event current = Event.current;
			if ((int)current.type == 4)
			{
				if ((int)current.keyCode != 0 && (int)current.keyCode != 27)
				{
					configManager.SetHotkey(activeHotkeyId, new HotkeyConfig(current.keyCode, current.shift, current.control, current.alt));
				}
				isListeningForHotkey = false;
				activeHotkeyId = "";
			}
		}

		private void DrawWindow(int windowID)
		{
			guiHelper.UpdateGUI(showMenu);
			if (!guiHelper.BeginGUI())
			{
				GUI.DragWindow();
				return;
			}
			currentTab = guiHelper.VerticalTabs(tabs.Select((TabConfig t) => t.Name).ToArray(), currentTab, (Action)DrawActiveTab, 120f, 1, (TabSide)0, Array.Empty<GUILayoutOption>());
			guiHelper.EndGUI();
			GUI.DragWindow();
		}

		private void DrawActiveTab()
		{
			//IL_0008: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			scrollPosition = guiHelper.ScrollView(scrollPosition, (Action)delegate
			{
				guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
				tabs[currentTab].Content();
				guiHelper.EndVerticalGroup();
			}, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(700f) });
		}

		private void DrawPlayerTab()
		{
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DrawCard("Defense", delegate
			{
				DrawCheckbox("God Mode", delegate(bool v)
				{
					state.GodMode = v;
				}, state.GodMode, "ToggleGodMode");
				guiHelper.AddSpace(8f);
				DrawCheckbox("No Fall Damage", delegate(bool v)
				{
					state.NoFallDamage = v;
				}, state.NoFallDamage, "ToggleNoFallDamage");
				guiHelper.AddSpace(8f);
				DrawCheckbox("Infinite Stamina", delegate(bool v)
				{
					state.InfiniteStamina = v;
				}, state.InfiniteStamina, "ToggleInfiniteStamina");
			});
			guiHelper.AddSpace(12f);
			DrawCard("Movement", delegate
			{
				DrawCheckbox("Speed Boost", delegate(bool v)
				{
					state.SpeedBoost = v;
				}, state.SpeedBoost, "ToggleSpeedBoost");
				if (state.SpeedBoost)
				{
					guiHelper.AddSpace(8f);
					DrawSlider("Multiplier", delegate(float v)
					{
						state.SpeedMultiplier = v;
					}, state.SpeedMultiplier, 1f, 5f, "x");
				}
				guiHelper.AddSpace(10f);
				DrawCheckbox("Fly", delegate(bool v)
				{
					state.Fly = v;
					if (v)
					{
						EnableFly();
					}
					else
					{
						DisableFly();
					}
				}, state.Fly);
				if (state.Fly)
				{
					guiHelper.AddSpace(8f);
					DrawSlider("Fly Speed", delegate(float v)
					{
						state.FlySpeed = v;
					}, state.FlySpeed, 5f, 50f, "m/s");
				}
				guiHelper.AddSpace(10f);
				DrawTeleportControls();
			});
			guiHelper.AddSpace(12f);
			DrawCard("Appearance", delegate
			{
				DrawCheckbox("Custom Scale", delegate(bool v)
				{
					state.CustomScale = v;
					ApplyPlayerScale();
				}, state.CustomScale);
				if (state.CustomScale)
				{
					guiHelper.AddSpace(8f);
					DrawSlider("Scale", delegate(float v)
					{
						state.PlayerScale = v;
						ApplyPlayerScale();
					}, state.PlayerScale, 0.1f, 5f, "x");
				}
			});
			guiHelper.EndVerticalGroup();
		}

		private void DrawCombatTab()
		{
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DrawCard("Damage", delegate
			{
				DrawCheckbox("Damage Multiplier", delegate(bool v)
				{
					state.DamageMultiplier = v;
				}, state.DamageMultiplier);
				if (state.DamageMultiplier)
				{
					guiHelper.AddSpace(8f);
					DrawSlider("Multiplier", delegate(float v)
					{
						state.DamageMultiplierValue = v;
					}, state.DamageMultiplierValue, 1f, 100f, "x");
				}
			});
			guiHelper.AddSpace(12f);
			DrawCard("Bulk Actions", delegate
			{
				if (guiHelper.Button("Kill All Players", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					KillAllActors((ActorType)1);
				}
				guiHelper.AddSpace(10f);
				if (guiHelper.Button("Kill All Monsters", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					KillAllActors((ActorType)2);
				}
				guiHelper.AddSpace(10f);
				if (guiHelper.Button("Clear All Monsters", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					ClearAllMonsters();
				}
			});
			guiHelper.EndVerticalGroup();
		}

		private void DrawLootTab()
		{
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DrawCard("Item Collection", delegate
			{
				bool isActive = pickupManager.isActive;
				if (guiHelper.Button(isActive ? "Stop Picking Up" : "Pickup All Items", (ControlVariant)(isActive ? 2 : 0), (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					if (isActive)
					{
						pickupManager.Stop();
					}
					else
					{
						pickupManager.StartPickupAll();
					}
				}
			});
			guiHelper.AddSpace(12f);
			DrawCard("Auto Loot", delegate
			{
				DrawCheckbox("Auto Loot Enabled", delegate(bool v)
				{
					state.AutoLoot = v;
					autoLootManager.SetEnabled(v);
				}, state.AutoLoot, "ToggleAutoLoot");
				if (state.AutoLoot)
				{
					guiHelper.AddSpace(8f);
					DrawSlider("Detection Range", delegate(float v)
					{
						state.AutoLootDistance = v;
						autoLootManager.SetDistance(v);
					}, state.AutoLootDistance, 10f, 200f, "m");
				}
			});
			guiHelper.AddSpace(12f);
			DrawCard("Equipment & Shop", delegate
			{
				DrawCheckbox("Infinite Durability", delegate(bool v)
				{
					state.InfiniteDurability = v;
				}, state.InfiniteDurability);
				guiHelper.AddSpace(8f);
				DrawCheckbox("Infinite Gauge", delegate(bool v)
				{
					state.InfiniteGauge = v;
				}, state.InfiniteGauge);
				guiHelper.AddSpace(8f);
				DrawCheckbox("Infinite Currency", delegate(bool v)
				{
					state.InfiniteCurrency = v;
				}, state.InfiniteCurrency);
				guiHelper.AddSpace(8f);
				if (guiHelper.Button("Add 10k Currency", (ControlVariant)0, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					AddCurrency(10000);
				}
			});
			guiHelper.AddSpace(12f);
			DrawItemSpawner();
			guiHelper.EndVerticalGroup();
		}

		private void DrawVisualTab()
		{
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DrawCard("ESP Settings", delegate
			{
				DrawCheckbox("Enable ESP", delegate(bool v)
				{
					state.ESP = v;
				}, state.ESP, "ToggleESP");
				if (state.ESP)
				{
					guiHelper.AddSpace(10f);
					DrawSlider("Distance", delegate(float v)
					{
						state.ESPDistance = v;
					}, state.ESPDistance, 50f, 500f, "m");
					guiHelper.AddSpace(12f);
					guiHelper.BeginHorizontalGroup();
					guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
					DrawCheckbox("Players", delegate(bool v)
					{
						state.ESPShowPlayers = v;
					}, state.ESPShowPlayers);
					DrawCheckbox("Monsters", delegate(bool v)
					{
						state.ESPShowMonsters = v;
					}, state.ESPShowMonsters);
					DrawCheckbox("Loot", delegate(bool v)
					{
						state.ESPShowLoot = v;
					}, state.ESPShowLoot);
					guiHelper.EndVerticalGroup();
					guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
					DrawCheckbox("Interactors", delegate(bool v)
					{
						state.ESPShowInteractors = v;
					}, state.ESPShowInteractors);
					DrawCheckbox("NPCs", delegate(bool v)
					{
						state.ESPShowNPCs = v;
					}, state.ESPShowNPCs);
					DrawCheckbox("Field Skills", delegate(bool v)
					{
						state.ESPShowFieldSkills = v;
					}, state.ESPShowFieldSkills);
					guiHelper.EndVerticalGroup();
					guiHelper.EndHorizontalGroup();
				}
			});
			guiHelper.AddSpace(12f);
			DrawCard("Lighting", delegate
			{
				DrawCheckbox("Fullbright", delegate(bool v)
				{
					state.Fullbright = v;
					fullbrightManager.SetEnabled(v);
				}, state.Fullbright, "ToggleFullbright");
			});
			guiHelper.EndVerticalGroup();
		}

		private void DrawCard(string title, Action content)
		{
			guiHelper.BeginCard(-1f, -1f);
			guiHelper.CardTitle(title);
			guiHelper.CardContent(content);
			guiHelper.EndCard();
		}

		private void DrawCheckbox(string label, Action<bool> onChange, bool value, string hotkeyId = null)
		{
			Action<bool> onChange2 = onChange;
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			bool flag = guiHelper.Toggle(label, value, (ControlVariant)0, (ControlSize)0, (Action<bool>)delegate(bool v)
			{
				onChange2(v);
			}, false, Array.Empty<GUILayoutOption>());
			if (!string.IsNullOrEmpty(hotkeyId))
			{
				GUILayout.FlexibleSpace();
				guiHelper.MutedLabel($"[{configManager.GetHotkey(hotkeyId)}]", Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSlider(string label, Action<float> onChange, float value, float min, float max, string suffix)
		{
			guiHelper.Label(label, (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
			float num = guiHelper.Slider(value, min, max, Array.Empty<GUILayoutOption>());
			if (num != value)
			{
				onChange(num);
			}
			guiHelper.MutedLabel($"{num:F1}{suffix}", Array.Empty<GUILayoutOption>());
		}

		private void DrawTeleportControls()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (guiHelper.Button("Fwd 50m", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
			{
				movementManager.TeleportForward(50f);
			}
			if (guiHelper.Button("Fwd 100m", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
			{
				movementManager.TeleportForward(100f);
			}
			GUILayout.EndHorizontal();
			guiHelper.AddSpace(8f);
			for (int i = 0; i < 3; i++)
			{
				int num = i;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				if (guiHelper.Button($"Save Pos {num + 1}", (ControlVariant)0, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					SavePosition(num + 1);
				}
				if (guiHelper.Button($"Load Pos {num + 1}", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					LoadPosition(num + 1);
				}
				GUILayout.EndHorizontal();
				guiHelper.AddSpace(4f);
			}
		}

		private void DrawItemSpawner()
		{
			DrawCard("Item Spawner", delegate
			{
				//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				guiHelper.Label("ID:", (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
				guiHelper.Label(itemSpawnIDInput, (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
				if (guiHelper.Button("Spawn", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()) && int.TryParse(itemSpawnIDInput, out var result))
				{
					ItemSpawnerPatches.SetItemToSpawn(result, 1);
				}
				GUILayout.EndHorizontal();
				guiHelper.AddSpace(12f);
				if (guiHelper.Button(itemListLoaded ? "Refresh List" : "Load Items", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					LoadItemList();
				}
				if (itemListLoaded)
				{
					guiHelper.AddSpace(4f);
					guiHelper.Label(itemSearchFilter, (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
					itemListScrollPosition = GUILayout.BeginScrollView(itemListScrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(200f) });
					IEnumerable<(int, string)> enumerable = cachedItemList.Where<(int, string)>(((int id, string name) x) => string.IsNullOrEmpty(itemSearchFilter) || x.name.IndexOf(itemSearchFilter, StringComparison.OrdinalIgnoreCase) >= 0).Take(100);
					foreach (var item in enumerable)
					{
						if (guiHelper.Button($"{item.Item2} ({item.Item1})", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							itemSpawnIDInput = item.Item1.ToString();
						}
					}
					GUILayout.EndScrollView();
				}
			});
		}

		private void DrawHotkeyButton(string label, string id)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			guiHelper.Label(label, (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			string text = configManager.GetHotkey(id).ToString();
			if (guiHelper.Button(text, (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
			{
				activeHotkeyId = id;
				isListeningForHotkey = true;
			}
			GUILayout.EndHorizontal();
			guiHelper.AddSpace(4f);
		}

		public FeatureState GetFeatureState()
		{
			return state;
		}

		private void OnDestroy()
		{
			fullbrightManager?.Cleanup();
			ESPManager.Cleanup();
			pickupManager?.Stop();
		}

		private void DrawEntitiesTab()
		{
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			UpdatePlayerCache();
			guiHelper.BeginHorizontalGroup();
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
			DrawCard("Entity List", delegate
			{
				guiHelper.MutedLabel($"Total: {cachedPlayers.Length}", Array.Empty<GUILayoutOption>());
				guiHelper.AddSpace(8f);
				if (cachedPlayers.Length == 0)
				{
					guiHelper.MutedLabel("No entities found", Array.Empty<GUILayoutOption>());
				}
				else
				{
					int num = Mathf.Min(cachedPlayers.Length, 15);
					for (int i = 0; i < num; i++)
					{
						DrawActorListItem(cachedPlayers[i]);
					}
					if (cachedPlayers.Length > num)
					{
						guiHelper.MutedLabel($"...and {cachedPlayers.Length - num} more", Array.Empty<GUILayoutOption>());
					}
				}
			});
			guiHelper.EndVerticalGroup();
			guiHelper.AddSpace(12f);
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DrawEntityActionsPanel();
			guiHelper.EndVerticalGroup();
			guiHelper.EndHorizontalGroup();
			guiHelper.EndVerticalGroup();
		}

		private void DrawEntityActionsPanel()
		{
			ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
			DrawCard("Entity Actions", delegate
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Invalid comparison between Unknown and I4
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fe: Invalid comparison between Unknown and I4
				//IL_0247: Unknown result type (might be due to invalid IL or missing references)
				//IL_024d: Invalid comparison between Unknown and I4
				if ((Object)(object)selectedPlayer != (Object)null)
				{
					string text = (((int)selectedPlayer.ActorType == 1) ? "Player" : "Monster");
					guiHelper.MutedLabel("Target: " + selectedPlayer.nickName + " (" + text + ")", Array.Empty<GUILayoutOption>());
				}
				else
				{
					guiHelper.MutedLabel("Select an entity to perform actions", Array.Empty<GUILayoutOption>());
				}
				guiHelper.AddSpace(8f);
				if ((Object)(object)selectedPlayer == (Object)null)
				{
					guiHelper.MutedLabel("No entity selected", Array.Empty<GUILayoutOption>());
				}
				else
				{
					DrawActorInfo(selectedPlayer, localPlayer);
					guiHelper.AddSpace(14f);
					if ((Object)(object)localPlayer != (Object)null)
					{
						if (guiHelper.Button("Teleport To Target", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
						{
							movementManager.TeleportToPlayer(selectedPlayer);
						}
						if (selectedPlayer.ActorID != localPlayer.ActorID)
						{
							guiHelper.AddSpace(8f);
							if (guiHelper.Button("Teleport Target To Me", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
							{
								movementManager.TeleportPlayerToSelf(selectedPlayer);
							}
							guiHelper.AddSpace(8f);
							if ((int)selectedPlayer.ActorType == 1)
							{
								if (guiHelper.Button("Kill Player", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
								{
									KillActor(selectedPlayer);
								}
							}
							else if ((int)selectedPlayer.ActorType == 2 && guiHelper.Button("Kill Monster", (ControlVariant)2, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
							{
								KillActor(selectedPlayer);
							}
						}
					}
				}
			});
		}

		private void DrawSettingsTab()
		{
			guiHelper.BeginVerticalGroup((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DrawCard("Hotkeys", delegate
			{
				if (isListeningForHotkey)
				{
					guiHelper.Label("Press any key to bind " + activeHotkeyId + "...", (ControlVariant)0, false, Array.Empty<GUILayoutOption>());
					if (guiHelper.Button("Cancel", (ControlVariant)1, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
					{
						isListeningForHotkey = false;
						activeHotkeyId = "";
					}
				}
				else
				{
					DrawHotkeyButton("Toggle Menu", "ToggleMenu");
					DrawHotkeyButton("God Mode", "ToggleGodMode");
					DrawHotkeyButton("ESP", "ToggleESP");
					DrawHotkeyButton("Auto Loot", "ToggleAutoLoot");
					DrawHotkeyButton("Fullbright", "ToggleFullbright");
					DrawHotkeyButton("Speed Boost", "ToggleSpeedBoost");
					DrawHotkeyButton("Infinite Stamina", "ToggleInfiniteStamina");
					DrawHotkeyButton("No Fall Damage", "ToggleNoFallDamage");
				}
			});
			guiHelper.AddSpace(12f);
			DrawCard("Configuration", delegate
			{
				if (guiHelper.Button("Save Configuration", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					MelonPreferences.Save();
					MelonLogger.Msg("Configuration saved");
				}
				guiHelper.AddSpace(6f);
				if (guiHelper.Button("Reload Configuration", (ControlVariant)0, (ControlSize)0, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
				{
					configManager.LoadAllConfigs();
					MelonLogger.Msg("Configuration reloaded");
				}
			});
			guiHelper.EndVerticalGroup();
		}

		private void UpdatePlayerCache()
		{
			if (!(Time.time - lastPlayerCacheTime < 1f))
			{
				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;
			}
		}

		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_0088: Unknown result type (might be due to invalid IL or missing references)
			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);
			if (guiHelper.Button(text, val, (ControlSize)1, (Action)null, false, 1f, Array.Empty<GUILayoutOption>()))
			{
				selectedPlayer = actor;
			}
		}

		private void DrawActorInfo(ProtoActor selectedTarget, ProtoActor localPlayer)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)selectedTarget == (Object)null))
			{
				guiHelper.MutedLabel("Name: " + selectedTarget.nickName, Array.Empty<GUILayoutOption>());
				guiHelper.MutedLabel("Type: " + (((int)selectedTarget.ActorType == 1) ? "Player" : "Monster"), Array.Empty<GUILayoutOption>());
				guiHelper.MutedLabel($"Actor ID: {selectedTarget.ActorID}", 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.MutedLabel($"Distance: {num:F1}m", Array.Empty<GUILayoutOption>());
				}
			}
		}

		private void KillActor(ProtoActor target)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)target == (Object)null))
			{
				ActorDeathInfo val = new ActorDeathInfo
				{
					DeadActorID = target.ActorID,
					ReasonOfDeath = (ReasonOfDeath)0,
					AttackerActorID = 0,
					LinkedMasterID = 0
				};
				target.OnActorDeath(ref val);
			}
		}

		private void AddCurrency(int amount)
		{
			try
			{
				Hub val = Object.FindObjectOfType<Hub>();
				if (!((Object)(object)val != (Object)null))
				{
					return;
				}
				object obj = ReflectionHelper.GetFieldValue((object)val, "vworld") ?? ReflectionHelper.GetPropertyValue((object)val, "vworld");
				if (obj == null)
				{
					return;
				}
				object obj2 = ReflectionHelper.GetFieldValue(obj, "_vRoomManager") ?? ReflectionHelper.GetPropertyValue(obj, "VRoomManager");
				if (obj2 == null || !(ReflectionHelper.GetFieldValue(obj2, "_vrooms") is IDictionary dictionary))
				{
					return;
				}
				foreach (DictionaryEntry item in dictionary)
				{
					object value = item.Value;
					if (value != null)
					{
						MaintenanceRoom val2 = (MaintenanceRoom)((value is MaintenanceRoom) ? value : null);
						if (val2 != null)
						{
							ReflectionHelper.InvokeMethod((object)val2, "AddCurrency", new object[1] { amount });
							MelonLogger.Msg($"[AddCurrency] Added {amount} currency successfully!");
							break;
						}
						object propertyValue = ReflectionHelper.GetPropertyValue(value, "Currency");
						if (propertyValue != null)
						{
							ReflectionHelper.SetPropertyValue(value, "Currency", (object)((int)propertyValue + amount));
							MelonLogger.Msg($"[AddCurrency] Added {amount} currency successfully!");
							break;
						}
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[AddCurrency] Error: " + ex.Message);
			}
		}

		private void LoadItemList()
		{
			try
			{
				cachedItemList.Clear();
				object obj = null;
				DataManager val = Object.FindObjectOfType<DataManager>();
				if ((Object)(object)val != (Object)null)
				{
					obj = ReflectionHelper.GetFieldValue((object)val, "_excelDataManager");
				}
				if (obj == null)
				{
					Hub val2 = Object.FindObjectOfType<Hub>();
					if ((Object)(object)val2 != (Object)null)
					{
						obj = ReflectionHelper.GetFieldValue((object)val2, "_excelDataManager") ?? ReflectionHelper.GetPropertyValue((object)val2, "ExcelDataManager");
					}
				}
				if (obj != null)
				{
					IDictionary dictionary = ReflectionHelper.GetPropertyValue(obj, "ItemInfoDict") as IDictionary;
					IDictionary dictionary2 = ReflectionHelper.GetPropertyValue(obj, "LocalizationDict") as IDictionary;
					if (dictionary != null)
					{
						foreach (DictionaryEntry item3 in dictionary)
						{
							int item = (int)item3.Key;
							object value = item3.Value;
							string item2 = "Unknown";
							try
							{
								string text = ReflectionHelper.GetFieldValue(value, "Name")?.ToString() ?? "";
								if (dictionary2 != null && !string.IsNullOrEmpty(text) && dictionary2.Contains(text))
								{
									object obj2 = dictionary2[text];
									if (obj2 != null)
									{
										string text2 = ReflectionHelper.GetFieldValue(obj2, "en")?.ToString();
										item2 = (string.IsNullOrEmpty(text2) ? text : text2);
									}
									else
									{
										item2 = text;
									}
								}
								else
								{
									item2 = text;
								}
							}
							catch
							{
							}
							cachedItemList.Add((item, item2));
						}
						cachedItemList = cachedItemList.OrderBy<(int, string), int>(((int id, string name) x) => x.id).ToList();
						itemListLoaded = true;
						MelonLogger.Msg($"[ItemSpawner] Loaded {cachedItemList.Count} items from game data");
						return;
					}
				}
				MelonLogger.Warning("[ItemSpawner] Could not load item list - DataManager not found");
				itemListLoaded = true;
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[ItemSpawner] LoadItemList error: " + ex.Message);
				itemListLoaded = true;
			}
		}

		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);
			}
		}

		private void ClearAllMonsters()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			try
			{
				ProtoActor[] allPlayers = PlayerAPI.GetAllPlayers();
				int num = 0;
				ProtoActor[] array = allPlayers;
				foreach (ProtoActor val in array)
				{
					if ((Object)(object)val != (Object)null && (int)val.ActorType == 2)
					{
						KillActor(val);
						num++;
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ClearAllMonsters error: " + ex.Message);
			}
		}

		private void EnableFly()
		{
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if (!((Object)(object)localPlayer == (Object)null))
				{
					CharacterController component = ((Component)localPlayer).GetComponent<CharacterController>();
					if ((Object)(object)component != (Object)null)
					{
						((Collider)component).enabled = false;
					}
					Rigidbody component2 = ((Component)localPlayer).GetComponent<Rigidbody>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.isKinematic = true;
						component2.useGravity = false;
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("EnableFly error: " + ex.Message);
			}
		}

		private void DisableFly()
		{
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if (!((Object)(object)localPlayer == (Object)null))
				{
					CharacterController component = ((Component)localPlayer).GetComponent<CharacterController>();
					if ((Object)(object)component != (Object)null)
					{
						((Collider)component).enabled = true;
					}
					Rigidbody component2 = ((Component)localPlayer).GetComponent<Rigidbody>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.isKinematic = false;
						component2.useGravity = true;
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("DisableFly error: " + ex.Message);
			}
		}

		private void UpdateFly()
		{
			//IL_0037: 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_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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0096: 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)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			if (!state.Fly)
			{
				return;
			}
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if ((Object)(object)localPlayer == (Object)null)
				{
					return;
				}
				Camera main = Camera.main;
				if (!((Object)(object)main == (Object)null))
				{
					Vector3 val = Vector3.zero;
					Keyboard current = Keyboard.current;
					Vector3 forward = ((Component)main).transform.forward;
					Vector3 right = ((Component)main).transform.right;
					if (((ButtonControl)current.wKey).isPressed)
					{
						val += forward;
					}
					if (((ButtonControl)current.sKey).isPressed)
					{
						val -= forward;
					}
					if (((ButtonControl)current.aKey).isPressed)
					{
						val -= right;
					}
					if (((ButtonControl)current.dKey).isPressed)
					{
						val += right;
					}
					if (((ButtonControl)current.spaceKey).isPressed)
					{
						val += Vector3.up;
					}
					if (((ButtonControl)current.leftCtrlKey).isPressed)
					{
						val -= Vector3.up;
					}
					if (val != Vector3.zero)
					{
						Transform transform = ((Component)localPlayer).transform;
						transform.position += ((Vector3)(ref val)).normalized * state.FlySpeed * Time.deltaTime;
					}
				}
			}
			catch
			{
			}
		}

		private void SavePosition(int slot)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if (!((Object)(object)localPlayer == (Object)null))
				{
					Vector3 position = ((Component)localPlayer).transform.position;
					switch (slot)
					{
					case 1:
						state.SavedPosition1 = position;
						break;
					case 2:
						state.SavedPosition2 = position;
						break;
					case 3:
						state.SavedPosition3 = position;
						break;
					}
					MelonLogger.Msg($"Saved position {slot}: {position}");
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("SavePosition error: " + ex.Message);
			}
		}

		private void LoadPosition(int slot)
		{
			//IL_0014: 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_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_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_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_0058: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if ((Object)(object)localPlayer == (Object)null)
				{
					return;
				}
				Vector3 val = Vector3.zero;
				switch (slot)
				{
				case 1:
					val = state.SavedPosition1;
					break;
				case 2:
					val = state.SavedPosition2;
					break;
				case 3:
					val = state.SavedPosition3;
					break;
				}
				if (val == Vector3.zero)
				{
					MelonLogger.Warning($"Position {slot} not saved yet");
					return;
				}
				CharacterController component = ((Component)localPlayer).GetComponent<CharacterController>();
				if ((Object)(object)component != (Object)null)
				{
					((Collider)component).enabled = false;
				}
				((Component)localPlayer).transform.position = val;
				if ((Object)(object)component != (Object)null)
				{
					((Collider)component).enabled = true;
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("LoadPosition error: " + ex.Message);
			}
		}

		private void ApplyPlayerScale()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ProtoActor localPlayer = PlayerAPI.GetLocalPlayer();
				if (!((Object)(object)localPlayer == (Object)null))
				{
					if (state.CustomScale)
					{
						((Component)localPlayer).transform.localScale = Vector3.one * state.PlayerScale;
					}
					else
					{
						((Component)localPlayer).transform.localScale = Vector3.one;
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("ApplyPlayerScale 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);
			}
		}
	}
	[HarmonyPatch(typeof(StatManager), "ApplyDamage")]
	internal static class StatManagerApplyDamageMultiplierPatch
	{
		private static void Prefix(object args)
		{
			try
			{
				MainGUI.FeatureState featureState = Patches.GetFeatureState();
				if (featureState != null && featureState.DamageMultiplier)
				{
					FieldInfo field = args.GetType().GetField("Damage", BindingFlags.Instance | BindingFlags.Public);
					if (field != null)
					{
						long num = (long)field.GetValue(args);
						long num2 = (long)((float)num * featureState.DamageMultiplierValue);
						field.SetValue(args, num2);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("StatManagerApplyDamageMultiplierPatch 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);
			}
		}
	}
}