Decompiled source of SewerMenu v1.0.6

SewerMenu.dll

Decompiled 3 weeks 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 Il2CppFishNet.Object;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.GameTime;
using Il2CppScheduleOne.Growing;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Law;
using Il2CppScheduleOne.Levelling;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.Persistence.Datas;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.PlayerScripts.Health;
using Il2CppScheduleOne.Police;
using Il2CppScheduleOne.Product;
using Il2CppScheduleOne.Property;
using Il2CppScheduleOne.Vehicles;
using Il2CppScheduleOne.Vehicles.Modification;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using SewerMenu;
using SewerMenu.Core;
using SewerMenu.Core.Config;
using SewerMenu.Core.Keybinds;
using SewerMenu.Core.Logging;
using SewerMenu.Features.Base;
using SewerMenu.Features.Economy;
using SewerMenu.Features.Items;
using SewerMenu.Features.Misc;
using SewerMenu.Features.Player;
using SewerMenu.Features.Vehicles;
using SewerMenu.Features.World;
using SewerMenu.UI;
using SewerMenu.UI.Pages;
using SewerMenu.UI.Windows;
using SewerMenu.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(SewerMenuMod), "SewerMenu", "1.0.6", "zampx", "https://www.nexusmods.com/schedule1/mods/1379")]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonColor(255, 233, 69, 96)]
[assembly: MelonAuthorColor(255, 26, 26, 46)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("zampx")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("The Ultimate Schedule I Mod Menu")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+69574a24b16cfa3fbe1c4ba71a4d92fa7f0a52ec")]
[assembly: AssemblyProduct("SewerMenu")]
[assembly: AssemblyTitle("SewerMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SewerMenu
{
	public class SewerMenuMod : MelonMod
	{
		private bool _initialized;

		private bool _gameReady;

		private string _currentScene = "";

		public static SewerMenuMod Instance { get; private set; }

		public bool IsGameReady
		{
			get
			{
				if (_gameReady)
				{
					return !string.IsNullOrEmpty(_currentScene);
				}
				return false;
			}
		}

		public string CurrentScene => _currentScene;

		public override void OnInitializeMelon()
		{
			Instance = this;
			SewerLogger.Initialize(((MelonBase)this).LoggerInstance);
			SewerLogger.Info("========================================");
			SewerLogger.Info(ModInfo.GetFullInfo());
			SewerLogger.Info("========================================");
			try
			{
				ConfigManager.Instance.Initialize();
				KeybindManager.Instance.Initialize();
				FeatureManager.Instance.Initialize();
				SewerSkin.Initialize();
				MenuController.Instance.Initialize();
				_initialized = true;
				SewerLogger.Success("SewerMenu initialized successfully!");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Failed to initialize SewerMenu", ex);
			}
		}

		public override void OnLateInitializeMelon()
		{
			if (_initialized)
			{
				SewerLogger.Info("Late initialization - Game is ready");
				_gameReady = true;
				ConfigManager.Instance.Load();
				ApplySavedFeatureStates();
			}
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			_currentScene = sceneName;
			SewerLogger.Debug($"Scene loaded: {sceneName} (index: {buildIndex})");
			GameFinder.OnSceneChanged();
			GameTypes.ClearCache();
			if (sceneName == "Main" || sceneName == "Game")
			{
				MelonCoroutines.Start(InitializeGameTypesDelayed());
			}
		}

		private IEnumerator InitializeGameTypesDelayed()
		{
			yield return null;
			yield return null;
			yield return null;
			SewerLogger.Info("Initializing game types...");
			GameTypes.Initialize();
			GameTypes.LogDiagnostics();
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			SewerLogger.Debug("Scene initialized: " + sceneName);
		}

		public override void OnUpdate()
		{
			if (!_initialized || !_gameReady)
			{
				return;
			}
			try
			{
				MenuController.Instance.Update();
				FeatureManager.Instance.Update();
				KeybindManager.Instance.Update();
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error in OnUpdate", ex);
			}
		}

		public override void OnFixedUpdate()
		{
			if (!_initialized || !_gameReady)
			{
				return;
			}
			try
			{
				FeatureManager.Instance.FixedUpdate();
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error in OnFixedUpdate", ex);
			}
		}

		public override void OnGUI()
		{
			if (!_initialized || !_gameReady)
			{
				return;
			}
			try
			{
				MenuController.Instance.OnGUI();
				FeatureManager.Instance.OnGUI();
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error in OnGUI", ex);
			}
		}

		public override void OnApplicationQuit()
		{
			SewerLogger.Info("SewerMenu shutting down...");
			try
			{
				ConfigManager.Instance.Save();
				FeatureManager.Instance.Shutdown();
				MenuController.Instance.Shutdown();
				SewerLogger.Success("SewerMenu shutdown complete");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error during shutdown", ex);
			}
		}

		public override void OnDeinitializeMelon()
		{
			if (_initialized)
			{
				((MelonBase)this).OnApplicationQuit();
			}
			Instance = null;
		}

		private void ApplySavedFeatureStates()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			SewerConfig config = ConfigManager.Instance.Config;
			if (config?.Features == null)
			{
				return;
			}
			foreach (KeyValuePair<string, FeatureConfig> feature2 in config.Features)
			{
				IFeature feature = FeatureManager.Instance.GetFeature(feature2.Key);
				if (feature != null)
				{
					feature.IsEnabled = feature2.Value.Enabled;
					if (!string.IsNullOrEmpty(feature2.Value.Hotkey) && Enum.TryParse<KeyCode>(feature2.Value.Hotkey, out KeyCode result))
					{
						feature.Hotkey = result;
					}
				}
			}
			SewerLogger.Debug("Applied saved feature states");
		}
	}
}
namespace SewerMenu.Utils
{
	public static class GameFinder
	{
		private static GameObject _localPlayer;

		private static object _playerHealth;

		private static object _playerMovement;

		private static object _playerInventory;

		private static object _moneyManager;

		private static object _levelManager;

		private static object _timeManager;

		private static object _lawManager;

		private static object _productManager;

		private static object _propertyManager;

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

		private static float _lastFailedLookupClearTime;

		private static readonly float FailedLookupClearInterval = 30f;

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

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

		public static void DiscoverGameTypes()
		{
			SewerLogger.Info("=== DISCOVERING GAME TYPES ===");
			try
			{
				Il2CppArrayBase<MonoBehaviour> val = Object.FindObjectsOfType<MonoBehaviour>();
				SewerLogger.Info($"Found {val.Length} MonoBehaviours in scene");
				HashSet<string> hashSet = new HashSet<string>();
				int num = 0;
				foreach (MonoBehaviour item in val)
				{
					if ((Object)(object)item == (Object)null)
					{
						continue;
					}
					string text;
					try
					{
						Type obj = Il2CppType.From(((object)item).GetType());
						text = ((obj != null) ? obj.FullName : null) ?? ((object)item).GetType().FullName ?? ((object)item).GetType().Name;
					}
					catch
					{
						try
						{
							Type il2CppType = ((Object)item).GetIl2CppType();
							text = ((il2CppType != null) ? il2CppType.FullName : null) ?? "Unknown";
						}
						catch
						{
							text = ((object)item).GetType().FullName ?? ((object)item).GetType().Name;
						}
					}
					if (!string.IsNullOrEmpty(text) && !(text == "UnityEngine.MonoBehaviour") && !hashSet.Contains(text))
					{
						hashSet.Add(text);
						if (text.Contains("Player") || text.Contains("Money") || text.Contains("Health") || text.Contains("Level") || text.Contains("Movement") || text.Contains("Manager") || text.Contains("Controller") || text.Contains("Character") || text.Contains("Inventory") || text.Contains("Time") || text.Contains("Police") || text.Contains("Law") || text.Contains("NPC") || text.Contains("Drug") || text.Contains("Product") || text.Contains("Cash") || text.Contains("Bank") || text.Contains("XP") || text.Contains("Rank") || text.Contains("Schedule"))
						{
							SewerLogger.Info("[TYPE] " + text);
							num++;
						}
					}
				}
				SewerLogger.Info($"=== DISCOVERED {num} RELEVANT TYPES out of {hashSet.Count} unique types ===");
				int num2 = 0;
				foreach (string item2 in hashSet.OrderBy((string n) => n))
				{
					if (num2++ < 100)
					{
						SewerLogger.Debug("[ALL] " + item2);
					}
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error discovering game types", ex);
			}
		}

		public static GameObject GetLocalPlayer()
		{
			if ((Object)(object)_localPlayer != (Object)null)
			{
				return _localPlayer;
			}
			if (IsFailedLookup("LocalPlayer"))
			{
				return null;
			}
			try
			{
				_localPlayer = GameObject.FindGameObjectWithTag("Player");
				if ((Object)(object)_localPlayer != (Object)null)
				{
					SewerLogger.Debug("Found player by tag: " + ((Object)_localPlayer).name);
					return _localPlayer;
				}
				string[] array = new string[4] { "Player", "LocalPlayer", "Player(Clone)", "PlayerController" };
				for (int i = 0; i < array.Length; i++)
				{
					_localPlayer = GameObject.Find(array[i]);
					if ((Object)(object)_localPlayer != (Object)null)
					{
						SewerLogger.Debug("Found player by name: " + ((Object)_localPlayer).name);
						return _localPlayer;
					}
				}
				foreach (MonoBehaviour item in Object.FindObjectsOfType<MonoBehaviour>())
				{
					string name = ((object)item).GetType().Name;
					string text = ((object)item).GetType().FullName ?? "";
					if (!(name == "Player") && !text.Contains("PlayerScripts.Player") && !text.Contains("ScheduleOne.Player"))
					{
						continue;
					}
					PropertyInfo propertyInfo = ((object)item).GetType().GetProperty("IsLocal") ?? ((object)item).GetType().GetProperty("isLocalPlayer") ?? ((object)item).GetType().GetProperty("IsOwner");
					if (propertyInfo != null)
					{
						try
						{
							if ((bool)propertyInfo.GetValue(item))
							{
								_localPlayer = ((Component)item).gameObject;
								SewerLogger.Debug($"Found local player: {((Object)_localPlayer).name} ({text})");
								return _localPlayer;
							}
						}
						catch
						{
						}
						continue;
					}
					_localPlayer = ((Component)item).gameObject;
					SewerLogger.Debug($"Found player component: {((Object)_localPlayer).name} ({text})");
					return _localPlayer;
				}
				MarkFailedLookup("LocalPlayer");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding local player", ex);
				MarkFailedLookup("LocalPlayer");
			}
			return null;
		}

		public static object GetPlayerHealth()
		{
			if (_playerHealth != null)
			{
				return _playerHealth;
			}
			if (IsFailedLookup("PlayerHealth"))
			{
				return null;
			}
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer == (Object)null)
			{
				return null;
			}
			try
			{
				Il2CppArrayBase<MonoBehaviour> componentsInChildren = localPlayer.GetComponentsInChildren<MonoBehaviour>(true);
				foreach (MonoBehaviour item in componentsInChildren)
				{
					string name = ((object)item).GetType().Name;
					if (name.Contains("Health"))
					{
						_playerHealth = item;
						SewerLogger.Debug("Found health component: " + name);
						return _playerHealth;
					}
				}
				foreach (MonoBehaviour item2 in componentsInChildren)
				{
					PropertyInfo property = ((object)item2).GetType().GetProperty("Health");
					if (property != null)
					{
						_playerHealth = property.GetValue(item2);
						if (_playerHealth != null)
						{
							SewerLogger.Debug("Found health via property on " + ((object)item2).GetType().Name);
							return _playerHealth;
						}
					}
				}
				MarkFailedLookup("PlayerHealth");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding player health", ex);
				MarkFailedLookup("PlayerHealth");
			}
			return null;
		}

		public static object GetPlayerMovement()
		{
			if (_playerMovement != null)
			{
				return _playerMovement;
			}
			if (IsFailedLookup("PlayerMovement"))
			{
				return null;
			}
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer == (Object)null)
			{
				return null;
			}
			try
			{
				Il2CppArrayBase<MonoBehaviour> componentsInChildren = localPlayer.GetComponentsInChildren<MonoBehaviour>(true);
				string[] array = new string[5] { "PlayerMovement", "Movement", "CharacterController", "Motor", "Locomotion" };
				foreach (string value in array)
				{
					foreach (MonoBehaviour item in componentsInChildren)
					{
						string name = ((object)item).GetType().Name;
						if (name.Contains(value))
						{
							_playerMovement = item;
							SewerLogger.Debug("Found movement component: " + name);
							return _playerMovement;
						}
					}
				}
				CharacterController component = localPlayer.GetComponent<CharacterController>();
				if ((Object)(object)component != (Object)null)
				{
					_playerMovement = component;
					SewerLogger.Debug("Found CharacterController as movement");
					return _playerMovement;
				}
				MarkFailedLookup("PlayerMovement");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding player movement", ex);
				MarkFailedLookup("PlayerMovement");
			}
			return null;
		}

		public static object GetPlayerInventory()
		{
			if (_playerInventory != null)
			{
				return _playerInventory;
			}
			if (IsFailedLookup("PlayerInventory"))
			{
				return null;
			}
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer == (Object)null)
			{
				return null;
			}
			try
			{
				foreach (MonoBehaviour componentsInChild in localPlayer.GetComponentsInChildren<MonoBehaviour>(true))
				{
					string name = ((object)componentsInChild).GetType().Name;
					if (name.Contains("Inventory"))
					{
						_playerInventory = componentsInChild;
						SewerLogger.Debug("Found inventory component: " + name);
						return _playerInventory;
					}
				}
				MarkFailedLookup("PlayerInventory");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding player inventory", ex);
				MarkFailedLookup("PlayerInventory");
			}
			return null;
		}

		public static object GetMoneyManager()
		{
			return _moneyManager ?? (_moneyManager = FindManager("MoneyManager"));
		}

		public static object GetLevelManager()
		{
			return _levelManager ?? (_levelManager = FindManager("LevelManager"));
		}

		public static object GetTimeManager()
		{
			return _timeManager ?? (_timeManager = FindManager("TimeManager"));
		}

		public static object GetLawManager()
		{
			return _lawManager ?? (_lawManager = FindManager("LawManager"));
		}

		public static object GetProductManager()
		{
			return _productManager ?? (_productManager = FindManager("ProductManager"));
		}

		public static object GetPropertyManager()
		{
			return _propertyManager ?? (_propertyManager = FindManager("PropertyManager"));
		}

		public static object FindManager(params string[] possibleNames)
		{
			string key = string.Join("|", possibleNames);
			if (_managerCache.TryGetValue(key, out var value) && value != null)
			{
				return value;
			}
			if (IsFailedLookup(key))
			{
				return null;
			}
			try
			{
				string[] array = possibleNames;
				foreach (string text in array)
				{
					GameObject val = GameObject.Find(text);
					if ((Object)(object)val != (Object)null)
					{
						MonoBehaviour component = val.GetComponent<MonoBehaviour>();
						if ((Object)(object)component != (Object)null)
						{
							_managerCache[key] = component;
							SewerLogger.Debug("Found manager by GameObject: " + text);
							return component;
						}
					}
				}
				Il2CppArrayBase<MonoBehaviour> val2 = Object.FindObjectsOfType<MonoBehaviour>();
				array = possibleNames;
				foreach (string text2 in array)
				{
					foreach (MonoBehaviour item in val2)
					{
						string name = ((object)item).GetType().Name;
						if (name == text2 || name.EndsWith(text2))
						{
							_managerCache[key] = item;
							SewerLogger.Debug("Found manager by type: " + name);
							return item;
						}
					}
				}
				array = possibleNames;
				foreach (string text3 in array)
				{
					foreach (MonoBehaviour item2 in val2)
					{
						Type type = ((object)item2).GetType();
						if (!(type.Name == text3))
						{
							continue;
						}
						PropertyInfo property = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
						if (property != null)
						{
							object value2 = property.GetValue(null);
							if (value2 != null)
							{
								_managerCache[key] = value2;
								SewerLogger.Debug("Found manager singleton: " + text3);
								return value2;
							}
						}
					}
				}
				MarkFailedLookup(key);
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding manager: " + possibleNames[0], ex);
				MarkFailedLookup(key);
			}
			return null;
		}

		private static bool IsFailedLookup(string key)
		{
			if (Time.time - _lastFailedLookupClearTime > FailedLookupClearInterval)
			{
				_failedLookups.Clear();
				_lastFailedLookupClearTime = Time.time;
				return false;
			}
			return _failedLookups.Contains(key);
		}

		private static void MarkFailedLookup(string key)
		{
			_failedLookups.Add(key);
		}

		public static void LogPlayerComponents()
		{
			GameObject localPlayer = GetLocalPlayer();
			if ((Object)(object)localPlayer == (Object)null)
			{
				SewerLogger.Warning("Cannot log player components - player not found");
				return;
			}
			SewerLogger.Info("=== PLAYER COMPONENTS (" + ((Object)localPlayer).name + ") ===");
			foreach (Component component in localPlayer.GetComponents<Component>())
			{
				if (!((Object)(object)component == (Object)null))
				{
					string text;
					try
					{
						Type il2CppType = ((Object)component).GetIl2CppType();
						text = ((il2CppType != null) ? il2CppType.FullName : null) ?? ((object)component).GetType().Name;
					}
					catch
					{
						text = ((object)component).GetType().Name;
					}
					SewerLogger.Info("[COMPONENT] " + text);
				}
			}
			SewerLogger.Info("=== CHILD COMPONENTS ===");
			Il2CppArrayBase<MonoBehaviour> componentsInChildren = localPlayer.GetComponentsInChildren<MonoBehaviour>(true);
			HashSet<string> hashSet = new HashSet<string>();
			foreach (MonoBehaviour item in componentsInChildren)
			{
				if (!((Object)(object)item == (Object)null))
				{
					string text2;
					try
					{
						Type il2CppType2 = ((Object)item).GetIl2CppType();
						text2 = ((il2CppType2 != null) ? il2CppType2.FullName : null) ?? ((object)item).GetType().Name;
					}
					catch
					{
						text2 = ((object)item).GetType().Name;
					}
					if (!hashSet.Contains(text2) && text2 != "UnityEngine.MonoBehaviour")
					{
						hashSet.Add(text2);
						SewerLogger.Info("[CHILD] " + text2);
					}
				}
			}
			SewerLogger.Info("=== END PLAYER COMPONENTS ===");
		}

		public static void ClearCache()
		{
			_localPlayer = null;
			_playerHealth = null;
			_playerMovement = null;
			_playerInventory = null;
			_moneyManager = null;
			_levelManager = null;
			_timeManager = null;
			_lawManager = null;
			_productManager = null;
			_propertyManager = null;
			_managerCache.Clear();
			_failedLookups.Clear();
			_lastFailedLookupClearTime = 0f;
			SewerLogger.Debug("GameFinder cache cleared");
		}

		public static void OnSceneChanged()
		{
			ClearCache();
		}
	}
	public static class GameTypes
	{
		private static Player _localPlayer;

		private static PlayerMovement _playerMovement;

		private static PlayerHealth _playerHealth;

		private static PlayerEnergy _playerEnergy;

		private static PlayerCamera _playerCamera;

		private static PlayerInventory _playerInventory;

		private static MoneyManager _moneyManager;

		private static LawManager _lawManager;

		private static TimeManager _timeManager;

		private static LevelManager _levelManager;

		private static ProductManager _productManager;

		private static PropertyManager _propertyManager;

		private static VehicleManager _vehicleManager;

		private static bool _initialized;

		private static float _lastRefreshTime;

		private const float RefreshInterval = 2f;

		public static Player LocalPlayer
		{
			get
			{
				if ((Object)(object)_localPlayer == (Object)null || !Object.op_Implicit((Object)(object)_localPlayer))
				{
					FindLocalPlayer();
				}
				return _localPlayer;
			}
		}

		public static PlayerMovement Movement
		{
			get
			{
				if ((Object)(object)_playerMovement == (Object)null || !Object.op_Implicit((Object)(object)_playerMovement))
				{
					Player localPlayer = LocalPlayer;
					if ((Object)(object)localPlayer != (Object)null)
					{
						_playerMovement = ((Component)localPlayer).GetComponent<PlayerMovement>();
						if ((Object)(object)_playerMovement == (Object)null)
						{
							_playerMovement = ((Component)localPlayer).GetComponentInChildren<PlayerMovement>();
						}
					}
				}
				return _playerMovement;
			}
		}

		public static PlayerHealth Health
		{
			get
			{
				if ((Object)(object)_playerHealth == (Object)null || !Object.op_Implicit((Object)(object)_playerHealth))
				{
					Player localPlayer = LocalPlayer;
					if ((Object)(object)localPlayer != (Object)null)
					{
						_playerHealth = localPlayer.Health;
						if ((Object)(object)_playerHealth == (Object)null)
						{
							_playerHealth = ((Component)localPlayer).GetComponent<PlayerHealth>();
							if ((Object)(object)_playerHealth == (Object)null)
							{
								_playerHealth = ((Component)localPlayer).GetComponentInChildren<PlayerHealth>();
							}
						}
					}
				}
				return _playerHealth;
			}
		}

		public static PlayerEnergy Energy
		{
			get
			{
				if ((Object)(object)_playerEnergy == (Object)null || !Object.op_Implicit((Object)(object)_playerEnergy))
				{
					Player localPlayer = LocalPlayer;
					if ((Object)(object)localPlayer != (Object)null)
					{
						_playerEnergy = localPlayer.Energy;
						if ((Object)(object)_playerEnergy == (Object)null)
						{
							_playerEnergy = ((Component)localPlayer).GetComponent<PlayerEnergy>();
							if ((Object)(object)_playerEnergy == (Object)null)
							{
								_playerEnergy = ((Component)localPlayer).GetComponentInChildren<PlayerEnergy>();
							}
						}
					}
				}
				return _playerEnergy;
			}
		}

		public static PlayerCamera Camera
		{
			get
			{
				if ((Object)(object)_playerCamera == (Object)null || !Object.op_Implicit((Object)(object)_playerCamera))
				{
					Player localPlayer = LocalPlayer;
					if ((Object)(object)localPlayer != (Object)null)
					{
						_playerCamera = ((Component)localPlayer).GetComponent<PlayerCamera>();
						if ((Object)(object)_playerCamera == (Object)null)
						{
							_playerCamera = ((Component)localPlayer).GetComponentInChildren<PlayerCamera>();
						}
						if ((Object)(object)_playerCamera == (Object)null)
						{
							_playerCamera = Object.FindObjectOfType<PlayerCamera>();
						}
					}
				}
				return _playerCamera;
			}
		}

		public static PlayerInventory Inventory
		{
			get
			{
				if ((Object)(object)_playerInventory == (Object)null || !Object.op_Implicit((Object)(object)_playerInventory))
				{
					_playerInventory = Object.FindObjectOfType<PlayerInventory>();
				}
				return _playerInventory;
			}
		}

		public static Transform PlayerTransform
		{
			get
			{
				Player localPlayer = LocalPlayer;
				if (localPlayer == null)
				{
					return null;
				}
				return ((Component)localPlayer).transform;
			}
		}

		public static Vector3 PlayerPosition
		{
			get
			{
				//IL_0018: 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)
				if (!((Object)(object)PlayerTransform != (Object)null))
				{
					return Vector3.zero;
				}
				return PlayerTransform.position;
			}
			set
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)PlayerTransform != (Object)null)
				{
					PlayerTransform.position = value;
				}
			}
		}

		public static GameObject PlayerGameObject
		{
			get
			{
				Player localPlayer = LocalPlayer;
				if (localPlayer == null)
				{
					return null;
				}
				return ((Component)localPlayer).gameObject;
			}
		}

		public static MoneyManager Money
		{
			get
			{
				if ((Object)(object)_moneyManager == (Object)null || !Object.op_Implicit((Object)(object)_moneyManager))
				{
					_moneyManager = Object.FindObjectOfType<MoneyManager>();
					if ((Object)(object)_moneyManager != (Object)null)
					{
						SewerLogger.Debug("Found MoneyManager");
					}
				}
				return _moneyManager;
			}
		}

		public static LawManager Law
		{
			get
			{
				if ((Object)(object)_lawManager == (Object)null || !Object.op_Implicit((Object)(object)_lawManager))
				{
					_lawManager = Object.FindObjectOfType<LawManager>();
					if ((Object)(object)_lawManager != (Object)null)
					{
						SewerLogger.Debug("Found LawManager");
					}
				}
				return _lawManager;
			}
		}

		public static TimeManager Time
		{
			get
			{
				if ((Object)(object)_timeManager == (Object)null || !Object.op_Implicit((Object)(object)_timeManager))
				{
					_timeManager = Object.FindObjectOfType<TimeManager>();
					if ((Object)(object)_timeManager != (Object)null)
					{
						SewerLogger.Debug("Found TimeManager");
					}
				}
				return _timeManager;
			}
		}

		public static LevelManager Level
		{
			get
			{
				if ((Object)(object)_levelManager == (Object)null || !Object.op_Implicit((Object)(object)_levelManager))
				{
					_levelManager = Object.FindObjectOfType<LevelManager>();
					if ((Object)(object)_levelManager != (Object)null)
					{
						SewerLogger.Debug("Found LevelManager");
					}
				}
				return _levelManager;
			}
		}

		public static ProductManager Products
		{
			get
			{
				if ((Object)(object)_productManager == (Object)null || !Object.op_Implicit((Object)(object)_productManager))
				{
					_productManager = Object.FindObjectOfType<ProductManager>();
					if ((Object)(object)_productManager != (Object)null)
					{
						SewerLogger.Debug("Found ProductManager");
					}
				}
				return _productManager;
			}
		}

		public static PropertyManager Properties
		{
			get
			{
				if ((Object)(object)_propertyManager == (Object)null || !Object.op_Implicit((Object)(object)_propertyManager))
				{
					_propertyManager = Object.FindObjectOfType<PropertyManager>();
					if ((Object)(object)_propertyManager != (Object)null)
					{
						SewerLogger.Debug("Found PropertyManager");
					}
				}
				return _propertyManager;
			}
		}

		public static VehicleManager Vehicles
		{
			get
			{
				if ((Object)(object)_vehicleManager == (Object)null || !Object.op_Implicit((Object)(object)_vehicleManager))
				{
					_vehicleManager = Object.FindObjectOfType<VehicleManager>();
					if ((Object)(object)_vehicleManager != (Object)null)
					{
						SewerLogger.Debug("Found VehicleManager");
					}
				}
				return _vehicleManager;
			}
		}

		public static bool IsGameReady => (Object)(object)LocalPlayer != (Object)null;

		public static void Initialize()
		{
			if (_initialized && Time.time - _lastRefreshTime < 2f)
			{
				return;
			}
			try
			{
				FindLocalPlayer();
				FindManagers();
				_initialized = true;
				_lastRefreshTime = Time.time;
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Failed to initialize GameTypes", ex);
			}
		}

		public static void Refresh()
		{
			ClearCache();
			Initialize();
		}

		public static void ClearCache()
		{
			_localPlayer = null;
			_playerMovement = null;
			_playerHealth = null;
			_playerEnergy = null;
			_playerCamera = null;
			_playerInventory = null;
			_moneyManager = null;
			_lawManager = null;
			_timeManager = null;
			_levelManager = null;
			_productManager = null;
			_propertyManager = null;
			_vehicleManager = null;
			_initialized = false;
			SewerLogger.Debug("GameTypes cache cleared");
		}

		private static void FindLocalPlayer()
		{
			try
			{
				Il2CppArrayBase<Player> val = Object.FindObjectsOfType<Player>();
				foreach (Player item in val)
				{
					if ((Object)(object)item == (Object)null)
					{
						continue;
					}
					try
					{
						if (((NetworkBehaviour)item).IsOwner)
						{
							_localPlayer = item;
							SewerLogger.Debug("Found local player via IsOwner: " + ((Object)item).name);
							return;
						}
					}
					catch
					{
					}
					try
					{
						if (item.IsLocalPlayer)
						{
							_localPlayer = item;
							SewerLogger.Debug("Found local player via IsLocalPlayer: " + ((Object)item).name);
							return;
						}
					}
					catch
					{
					}
				}
				GameObject val2 = GameObject.Find("Player");
				if ((Object)(object)val2 != (Object)null)
				{
					_localPlayer = val2.GetComponent<Player>();
					if ((Object)(object)_localPlayer != (Object)null)
					{
						SewerLogger.Debug("Found player by name: " + ((Object)val2).name);
						return;
					}
				}
				if (val.Length == 1)
				{
					_localPlayer = val[0];
					SewerLogger.Debug("Found single player: " + ((Object)_localPlayer).name);
					return;
				}
				val2 = GameObject.FindGameObjectWithTag("Player");
				if ((Object)(object)val2 != (Object)null)
				{
					_localPlayer = val2.GetComponent<Player>();
					if ((Object)(object)_localPlayer != (Object)null)
					{
						SewerLogger.Debug("Found player by tag: " + ((Object)val2).name);
					}
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding local player", ex);
			}
		}

		private static void FindManagers()
		{
			try
			{
				_ = Money;
				_ = Law;
				_ = Time;
				_ = Level;
				_ = Products;
				_ = Properties;
				_ = Vehicles;
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error finding managers", ex);
			}
		}

		public static NPC[] GetAllNPCs()
		{
			try
			{
				return Il2CppArrayBase<NPC>.op_Implicit(Object.FindObjectsOfType<NPC>());
			}
			catch
			{
				return (NPC[])(object)new NPC[0];
			}
		}

		public static PoliceOfficer[] GetAllPolice()
		{
			try
			{
				return Il2CppArrayBase<PoliceOfficer>.op_Implicit(Object.FindObjectsOfType<PoliceOfficer>());
			}
			catch
			{
				return (PoliceOfficer[])(object)new PoliceOfficer[0];
			}
		}

		public static List<ItemDefinition> GetAllItemDefinitions()
		{
			List<ItemDefinition> list = new List<ItemDefinition>();
			try
			{
				Registry val = Object.FindObjectOfType<Registry>();
				if ((Object)(object)val != (Object)null)
				{
					List<ItemDefinition> allItems = val.GetAllItems();
					if (allItems != null)
					{
						Enumerator<ItemDefinition> enumerator = allItems.GetEnumerator();
						while (enumerator.MoveNext())
						{
							ItemDefinition current = enumerator.Current;
							if ((Object)(object)current != (Object)null)
							{
								list.Add(current);
							}
						}
					}
				}
				if (list.Count == 0)
				{
					Il2CppArrayBase<ItemDefinition> val2 = Resources.FindObjectsOfTypeAll<ItemDefinition>();
					if (val2 != null)
					{
						foreach (ItemDefinition item in val2)
						{
							if ((Object)(object)item != (Object)null && !string.IsNullOrEmpty(item.ID))
							{
								list.Add(item);
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Failed to get item definitions", ex);
			}
			return list;
		}

		public static ItemDefinition GetItemById(string id)
		{
			try
			{
				foreach (ItemDefinition allItemDefinition in GetAllItemDefinitions())
				{
					if ((Object)(object)allItemDefinition != (Object)null && allItemDefinition.ID == id)
					{
						return allItemDefinition;
					}
				}
			}
			catch
			{
			}
			return null;
		}

		public static ItemInstance CreateItemInstance(ItemDefinition definition, int quantity = 1)
		{
			try
			{
				if ((Object)(object)definition != (Object)null)
				{
					return definition.GetDefaultInstance(quantity);
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Failed to create item instance for " + ((definition != null) ? definition.ID : null), ex);
			}
			return null;
		}

		public static bool AddItemToInventory(ItemDefinition definition, int quantity = 1)
		{
			try
			{
				PlayerInventory inventory = Inventory;
				if ((Object)(object)inventory == (Object)null)
				{
					SewerLogger.Warning("Player inventory not found");
					return false;
				}
				ItemInstance val = CreateItemInstance(definition, quantity);
				if (val != null)
				{
					inventory.AddItemToInventory(val);
					return true;
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Failed to add item to inventory", ex);
			}
			return false;
		}

		public static void LogDiagnostics()
		{
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			SewerLogger.Info("=== GAME TYPES DIAGNOSTICS ===");
			SewerLogger.Info("LocalPlayer: " + (((Object)(object)LocalPlayer != (Object)null) ? ((Object)LocalPlayer).name : "NOT FOUND"));
			SewerLogger.Info("Movement: " + (((Object)(object)Movement != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("Health: " + (((Object)(object)Health != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("Energy: " + (((Object)(object)Energy != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("Camera: " + (((Object)(object)Camera != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("Inventory: " + (((Object)(object)Inventory != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("MoneyManager: " + (((Object)(object)Money != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("LawManager: " + (((Object)(object)Law != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("TimeManager: " + (((Object)(object)Time != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("LevelManager: " + (((Object)(object)Level != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("ProductManager: " + (((Object)(object)Products != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("PropertyManager: " + (((Object)(object)Properties != (Object)null) ? "FOUND" : "NOT FOUND"));
			SewerLogger.Info("VehicleManager: " + (((Object)(object)Vehicles != (Object)null) ? "FOUND" : "NOT FOUND"));
			if ((Object)(object)LocalPlayer != (Object)null)
			{
				SewerLogger.Info($"Player Position: {PlayerPosition}");
			}
			SewerLogger.Info("=== END DIAGNOSTICS ===");
		}
	}
	public static class TypeDiscovery
	{
		public static void TestTypes()
		{
		}
	}
}
namespace SewerMenu.UI
{
	public static class InputHelper
	{
		private static string _focusedControlName = "";

		private static int _controlCounter = 0;

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

		public static void BeginFrame()
		{
			_controlCounter = 0;
		}

		public static string TextField(string value, float width = 100f, string controlId = null)
		{
			//IL_002f: 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_0076: 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_00ab: 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_00bd: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(controlId))
			{
				controlId = "SewerInput_" + _controlCounter++;
			}
			GUI.SetNextControlName(controlId);
			Color backgroundColor = GUI.backgroundColor;
			if (GUI.GetNameOfFocusedControl() == controlId)
			{
				GUI.backgroundColor = new Color(0.2f, 0.3f, 0.35f, 1f);
			}
			else
			{
				GUI.backgroundColor = new Color(0.15f, 0.15f, 0.18f, 1f);
			}
			string result = GUILayout.TextField(value ?? "", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(width),
				GUILayout.Height(24f)
			});
			GUI.backgroundColor = backgroundColor;
			if ((int)Event.current.type == 0)
			{
				Rect lastRect = GUILayoutUtility.GetLastRect();
				if (((Rect)(ref lastRect)).Contains(Event.current.mousePosition))
				{
					GUI.FocusControl(controlId);
					_focusedControlName = controlId;
				}
			}
			return result;
		}

		public static int IntFieldWithButtons(string label, int value, int min = 1, int max = 9999, int step = 1)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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)
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!string.IsNullOrEmpty(label))
			{
				GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			}
			if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(30f),
				GUILayout.Height(24f)
			}))
			{
				value = Mathf.Max(min, value - step);
			}
			Color backgroundColor = GUI.backgroundColor;
			GUI.backgroundColor = new Color(0.15f, 0.15f, 0.18f, 1f);
			if (int.TryParse(GUILayout.TextField(value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(60f),
				GUILayout.Height(24f)
			}), out var result))
			{
				value = Mathf.Clamp(result, min, max);
			}
			GUI.backgroundColor = backgroundColor;
			if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(30f),
				GUILayout.Height(24f)
			}))
			{
				value = Mathf.Min(max, value + step);
			}
			GUILayout.EndHorizontal();
			return value;
		}

		public static int NumberWithPresets(string label, int value, int[] presets, int min = 1, int max = 9999)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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)
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!string.IsNullOrEmpty(label))
			{
				GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			}
			if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(25f),
				GUILayout.Height(24f)
			}))
			{
				value = Mathf.Max(min, value - 1);
			}
			Color backgroundColor = GUI.backgroundColor;
			GUI.backgroundColor = new Color(0.15f, 0.15f, 0.18f, 1f);
			if (int.TryParse(GUILayout.TextField(value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(50f),
				GUILayout.Height(24f)
			}), out var result))
			{
				value = Mathf.Clamp(result, min, max);
			}
			GUI.backgroundColor = backgroundColor;
			if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(25f),
				GUILayout.Height(24f)
			}))
			{
				value = Mathf.Min(max, value + 1);
			}
			GUILayout.Space(10f);
			for (int i = 0; i < presets.Length; i++)
			{
				int num = presets[i];
				if (GUILayout.Button(num.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(40f),
					GUILayout.Height(24f)
				}))
				{
					value = num;
				}
			}
			GUILayout.EndHorizontal();
			return value;
		}

		public static float FloatField(float value, float width = 80f)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			GUI.SetNextControlName("SewerFloat_" + _controlCounter++);
			Color backgroundColor = GUI.backgroundColor;
			GUI.backgroundColor = new Color(0.15f, 0.15f, 0.18f, 1f);
			string s = GUILayout.TextField(value.ToString("F0"), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(width),
				GUILayout.Height(24f)
			});
			GUI.backgroundColor = backgroundColor;
			if (float.TryParse(s, out var result))
			{
				return result;
			}
			return value;
		}

		public static void ClearFocus()
		{
			GUI.FocusControl("");
			_focusedControlName = "";
		}

		public static bool IsAnyFieldFocused()
		{
			string nameOfFocusedControl = GUI.GetNameOfFocusedControl();
			if (!string.IsNullOrEmpty(nameOfFocusedControl))
			{
				return nameOfFocusedControl.StartsWith("Sewer");
			}
			return false;
		}
	}
	public class MenuController
	{
		private static MenuController _instance;

		private static Action<int> _managedWindowFunc;

		private static WindowFunction _cachedWindowFunc;

		private static PlayerCamera _playerCamera;

		private static bool _cameraWasEnabled;

		private bool _initialized;

		private bool _isVisible;

		private int _currentTab;

		private Vector2 _scrollPosition;

		private Rect _windowRect;

		private readonly int _windowId = 12345;

		private bool _isResizing;

		private Vector2 _resizeStartMousePos;

		private Vector2 _resizeStartSize;

		private const float MinWidth = 500f;

		private const float MaxWidth = 1400f;

		private const float MinHeight = 400f;

		private const float MaxHeight = 1000f;

		private const float ResizeHandleSize = 20f;

		private readonly string[] _tabNames = new string[7] { "Player", "Economy", "Items", "World", "Vehicles", "Misc", "Settings" };

		private readonly FeatureCategory[] _tabCategories = new FeatureCategory[7]
		{
			FeatureCategory.Player,
			FeatureCategory.Economy,
			FeatureCategory.Items,
			FeatureCategory.World,
			FeatureCategory.Vehicles,
			FeatureCategory.Misc,
			FeatureCategory.Settings
		};

		private Dictionary<FeatureCategory, IPage> _pages = new Dictionary<FeatureCategory, IPage>();

		private bool _isHoveringResize;

		public static MenuController Instance => _instance ?? (_instance = new MenuController());

		public bool IsVisible => _isVisible;

		public bool IsCapturingInput => _isVisible;

		public Rect WindowRect => _windowRect;

		private MenuController()
		{
		}

		public void Initialize()
		{
			//IL_0061: 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)
			if (!_initialized)
			{
				_managedWindowFunc = DrawWindowInternal;
				_cachedWindowFunc = DelegateSupport.ConvertDelegate<WindowFunction>((Delegate)_managedWindowFunc);
				SewerConfig config = ConfigManager.Instance.Config;
				_windowRect = new Rect(config.UI.WindowX, config.UI.WindowY, config.UI.WindowWidth, config.UI.WindowHeight);
				_currentTab = Mathf.Clamp(config.UI.LastTab, 0, _tabNames.Length - 1);
				InitializePages();
				_initialized = true;
				SewerLogger.Info("MenuController initialized");
			}
		}

		private void InitializePages()
		{
			_pages[FeatureCategory.Player] = new PlayerPage();
			_pages[FeatureCategory.Economy] = new EconomyPage();
			_pages[FeatureCategory.Items] = new ItemsPage();
			_pages[FeatureCategory.World] = new WorldPage();
			_pages[FeatureCategory.Vehicles] = new VehiclesPage();
			_pages[FeatureCategory.Misc] = new MiscPage();
			_pages[FeatureCategory.Settings] = new SettingsPage();
			foreach (IPage value in _pages.Values)
			{
				value.Initialize();
			}
		}

		public void Toggle()
		{
			if (_isVisible)
			{
				Hide();
			}
			else
			{
				Show();
			}
		}

		public void Show()
		{
			if (!_isVisible)
			{
				_isVisible = true;
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				DisablePlayerCamera();
				SewerLogger.Info("Menu opened");
			}
		}

		public void Hide()
		{
			if (_isVisible)
			{
				_isVisible = false;
				EnablePlayerCamera();
				Cursor.lockState = (CursorLockMode)1;
				Cursor.visible = false;
				SaveWindowState();
				SewerLogger.Info("Menu closed");
			}
		}

		private void DisablePlayerCamera()
		{
			try
			{
				_playerCamera = GameTypes.Camera;
				if ((Object)(object)_playerCamera != (Object)null)
				{
					_cameraWasEnabled = ((Behaviour)_playerCamera).enabled;
					((Behaviour)_playerCamera).enabled = false;
					SewerLogger.Debug("Disabled PlayerCamera");
					return;
				}
				SewerLogger.Debug("PlayerCamera not found, trying fallback...");
				Player localPlayer = GameTypes.LocalPlayer;
				if (!((Object)(object)localPlayer != (Object)null))
				{
					return;
				}
				foreach (MonoBehaviour componentsInChild in ((Component)localPlayer).GetComponentsInChildren<MonoBehaviour>(true))
				{
					if (!((Object)(object)componentsInChild == (Object)null))
					{
						string text = ((object)componentsInChild).GetType().Name.ToLower();
						if (text.Contains("camera") || text.Contains("look") || text.Contains("mouse"))
						{
							((Behaviour)componentsInChild).enabled = false;
							SewerLogger.Debug("Disabled fallback component: " + ((object)componentsInChild).GetType().Name);
						}
					}
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Warning("Could not disable player camera: " + ex.Message);
			}
		}

		private void EnablePlayerCamera()
		{
			try
			{
				if ((Object)(object)_playerCamera != (Object)null && _cameraWasEnabled)
				{
					((Behaviour)_playerCamera).enabled = true;
					SewerLogger.Debug("Re-enabled PlayerCamera");
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Warning("Could not re-enable player camera: " + ex.Message);
			}
		}

		public void Update()
		{
			if (!_isVisible)
			{
				return;
			}
			try
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
				if ((Object)(object)_playerCamera != (Object)null && ((Behaviour)_playerCamera).enabled)
				{
					((Behaviour)_playerCamera).enabled = false;
				}
				if (Input.GetKeyDown((KeyCode)27))
				{
					Hide();
				}
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Error in MenuController.Update", ex);
			}
		}

		public void OnGUI()
		{
			//IL_00c0: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (_initialized && _isVisible)
			{
				SewerSkin.BeginUI();
				HandleResize();
				((Rect)(ref _windowRect)).x = Mathf.Clamp(((Rect)(ref _windowRect)).x, 0f, (float)(Screen.width - 100));
				((Rect)(ref _windowRect)).y = Mathf.Clamp(((Rect)(ref _windowRect)).y, 0f, (float)(Screen.height - 100));
				((Rect)(ref _windowRect)).width = Mathf.Clamp(((Rect)(ref _windowRect)).width, 500f, 1400f);
				((Rect)(ref _windowRect)).height = Mathf.Clamp(((Rect)(ref _windowRect)).height, 400f, 1000f);
				_windowRect = GUI.Window(_windowId, _windowRect, _cachedWindowFunc, "");
				DrawResizeGrip();
				ItemSpawnerWindow.Instance.OnGUI();
				SewerSkin.EndUI();
			}
		}

		private void HandleResize()
		{
			//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_005b: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Invalid comparison between Unknown and I4
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Invalid comparison between Unknown and I4
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref _windowRect)).x + ((Rect)(ref _windowRect)).width - 20f, ((Rect)(ref _windowRect)).y + ((Rect)(ref _windowRect)).height - 20f, 20f, 20f);
			Event current = Event.current;
			Vector2 mousePosition = current.mousePosition;
			_isHoveringResize = ((Rect)(ref val)).Contains(mousePosition);
			if ((int)current.type == 0 && current.button == 0 && _isHoveringResize)
			{
				_isResizing = true;
				_resizeStartMousePos = mousePosition;
				_resizeStartSize = new Vector2(((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height);
				current.Use();
			}
			else if ((int)current.type == 1 && current.button == 0 && _isResizing)
			{
				_isResizing = false;
				SaveWindowState();
				current.Use();
			}
			else if ((int)current.type == 3 && _isResizing)
			{
				Vector2 val2 = mousePosition - _resizeStartMousePos;
				((Rect)(ref _windowRect)).width = Mathf.Clamp(_resizeStartSize.x + val2.x, 500f, 1400f);
				((Rect)(ref _windowRect)).height = Mathf.Clamp(_resizeStartSize.y + val2.y, 400f, 1000f);
				current.Use();
			}
		}

		private void DrawResizeGrip()
		{
			//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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			float num = 24f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref _windowRect)).x + ((Rect)(ref _windowRect)).width - num, ((Rect)(ref _windowRect)).y + ((Rect)(ref _windowRect)).height - num, num, num);
			Color accentColor = default(Color);
			if (_isResizing)
			{
				accentColor = SewerSkin.AccentColor;
			}
			else if (_isHoveringResize)
			{
				((Color)(ref accentColor))..ctor(SewerSkin.AccentColor.r, SewerSkin.AccentColor.g, SewerSkin.AccentColor.b, 0.7f);
			}
			else
			{
				((Color)(ref accentColor))..ctor(0.6f, 0.6f, 0.6f, 0.6f);
			}
			Color backgroundColor = GUI.backgroundColor;
			Color color = GUI.color;
			GUI.color = new Color(0.1f, 0.1f, 0.12f, 0.9f);
			GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = accentColor;
			float num2 = 3f;
			float num3 = 5f;
			float num4 = ((Rect)(ref val)).x + ((Rect)(ref val)).width - 18f;
			float num5 = ((Rect)(ref val)).y + ((Rect)(ref val)).height - 18f;
			for (int i = 0; i < 3; i++)
			{
				for (int j = 0; j <= i; j++)
				{
					float num6 = num4 + (float)(2 - i + j) * num3;
					float num7 = num5 + (float)i * num3;
					GUI.DrawTexture(new Rect(num6, num7, num2, num2), (Texture)(object)Texture2D.whiteTexture);
				}
			}
			if (_isHoveringResize || _isResizing)
			{
				GUI.color = SewerSkin.AccentColor;
				GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + ((Rect)(ref val)).height - 2f, ((Rect)(ref val)).width, 2f), (Texture)(object)Texture2D.whiteTexture);
				GUI.DrawTexture(new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - 2f, ((Rect)(ref val)).y, 2f, ((Rect)(ref val)).height), (Texture)(object)Texture2D.whiteTexture);
			}
			GUI.backgroundColor = backgroundColor;
			GUI.color = color;
		}

		private void DrawWindowInternal(int id)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				DrawWindowContent();
			}
			catch (Exception ex)
			{
				SewerSkin.DrawStatus("Error: " + ex.Message, SewerSkin.StatusType.Error);
			}
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, 25f));
		}

		private void DrawWindowContent()
		{
			//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_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_0039: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0073: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Expected O, but got Unknown
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0713: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0724: Expected O, but got Unknown
			//IL_0750: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Expected O, but got Unknown
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = GUILayoutUtility.GetRect(0f, 32f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			Color color = GUI.color;
			GUI.color = new Color(0.04f, 0.05f, 0.07f, 1f);
			GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = 15,
				fontStyle = (FontStyle)1
			};
			Color contentColor = GUI.contentColor;
			GUI.contentColor = SewerSkin.AccentColor;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 6f, 60f, 20f), "SEWER", val);
			GUI.contentColor = SewerSkin.TextColor;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 70f, ((Rect)(ref rect)).y + 6f, 50f, 20f), "MENU", val);
			string text = "v1.0.6";
			new GUIStyle(GUI.skin.label)
			{
				fontSize = 10,
				alignment = (TextAnchor)5
			};
			float num = 42f;
			Rect val2 = new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - num - 10f, ((Rect)(ref rect)).y + 8f, num, 16f);
			GUI.color = new Color(SewerSkin.AccentColor.r, SewerSkin.AccentColor.g, SewerSkin.AccentColor.b, 0.15f);
			GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			GUI.contentColor = SewerSkin.AccentGlow;
			GUI.Label(val2, text, new GUIStyle(GUI.skin.label)
			{
				fontSize = 10,
				alignment = (TextAnchor)4
			});
			GUI.contentColor = contentColor;
			GUI.color = new Color(SewerSkin.BorderColor.r, SewerSkin.BorderColor.g, SewerSkin.BorderColor.b, 0.4f);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 1f, ((Rect)(ref rect)).width, 1f), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			GUILayout.Space(4f);
			Rect rect2 = GUILayoutUtility.GetRect(0f, 36f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			color = GUI.color;
			GUI.color = new Color(0.06f, 0.075f, 0.09f, 1f);
			GUI.DrawTexture(rect2, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			float num2 = ((Rect)(ref rect2)).width / (float)_tabNames.Length;
			float num3 = 34f;
			Rect val3 = default(Rect);
			for (int i = 0; i < _tabNames.Length; i++)
			{
				bool flag = _currentTab == i;
				((Rect)(ref val3))..ctor(((Rect)(ref rect2)).x + (float)i * num2, ((Rect)(ref rect2)).y, num2, num3);
				bool flag2 = ((Rect)(ref val3)).Contains(Event.current.mousePosition);
				if (flag2 && !flag)
				{
					color = GUI.color;
					GUI.color = new Color(0.1f, 0.12f, 0.15f, 1f);
					GUI.DrawTexture(new Rect(((Rect)(ref val3)).x + 2f, ((Rect)(ref val3)).y + 2f, ((Rect)(ref val3)).width - 4f, ((Rect)(ref val3)).height - 4f), (Texture)(object)Texture2D.whiteTexture);
					GUI.color = color;
				}
				Color contentColor2 = GUI.contentColor;
				GUI.contentColor = (flag ? SewerSkin.TextColor : (flag2 ? SewerSkin.TextColor : SewerSkin.TextMutedColor));
				GUIStyle val4 = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = 12,
					fontStyle = (FontStyle)(flag ? 1 : 0)
				};
				GUI.Label(val3, _tabNames[i], val4);
				GUI.contentColor = contentColor2;
				if (flag)
				{
					color = GUI.color;
					GUI.color = SewerSkin.AccentColor;
					float num4 = num2 * 0.6f;
					GUI.DrawTexture(new Rect(((Rect)(ref val3)).x + (num2 - num4) / 2f, ((Rect)(ref val3)).y + num3 - 3f, num4, 3f), (Texture)(object)Texture2D.whiteTexture);
					GUI.color = color;
				}
				if (GUI.Button(val3, "", GUIStyle.none) && _currentTab != i)
				{
					_currentTab = i;
					_scrollPosition = Vector2.zero;
				}
			}
			color = GUI.color;
			GUI.color = new Color(SewerSkin.BorderColor.r, SewerSkin.BorderColor.g, SewerSkin.BorderColor.b, 0.5f);
			GUI.DrawTexture(new Rect(((Rect)(ref rect2)).x, ((Rect)(ref rect2)).y + num3, ((Rect)(ref rect2)).width, 1f), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			GUILayout.Space(8f);
			Color backgroundColor = GUI.backgroundColor;
			GUI.backgroundColor = new Color(0.055f, 0.07f, 0.085f, 1f);
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			GUI.backgroundColor = backgroundColor;
			try
			{
				FeatureCategory key = _tabCategories[_currentTab];
				if (_pages.TryGetValue(key, out var value))
				{
					value.Draw();
				}
			}
			catch (Exception ex)
			{
				SewerSkin.DrawStatus("Tab Error: " + ex.Message, SewerSkin.StatusType.Error);
			}
			GUILayout.EndScrollView();
			GUILayout.Space(2f);
			Rect rect3 = GUILayoutUtility.GetRect(0f, 26f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			color = GUI.color;
			GUI.color = new Color(0.04f, 0.05f, 0.065f, 1f);
			GUI.DrawTexture(rect3, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = new Color(SewerSkin.BorderColor.r, SewerSkin.BorderColor.g, SewerSkin.BorderColor.b, 0.3f);
			GUI.DrawTexture(new Rect(((Rect)(ref rect3)).x, ((Rect)(ref rect3)).y, ((Rect)(ref rect3)).width, 1f), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			int enabledCount = FeatureManager.Instance.EnabledCount;
			GUIStyle val5 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 11
			};
			Color contentColor3 = GUI.contentColor;
			GUI.contentColor = SewerSkin.SuccessColor;
			GUI.Label(new Rect(((Rect)(ref rect3)).x + 10f, ((Rect)(ref rect3)).y + 5f, 14f, 16f), "●", val5);
			GUI.contentColor = SewerSkin.TextMutedColor;
			GUI.Label(new Rect(((Rect)(ref rect3)).x + 24f, ((Rect)(ref rect3)).y + 5f, 80f, 16f), enabledCount + " active", val5);
			GUI.contentColor = new Color(0.35f, 0.38f, 0.42f, 1f);
			GUIStyle val6 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 10,
				alignment = (TextAnchor)5
			};
			GUI.Label(new Rect(((Rect)(ref rect3)).x + ((Rect)(ref rect3)).width - 140f, ((Rect)(ref rect3)).y + 6f, 130f, 14f), "F8 toggle  ·  ESC close", val6);
			GUI.contentColor = contentColor3;
		}

		private void SaveWindowState()
		{
			try
			{
				SewerConfig config = ConfigManager.Instance.Config;
				config.UI.WindowX = ((Rect)(ref _windowRect)).x;
				config.UI.WindowY = ((Rect)(ref _windowRect)).y;
				config.UI.WindowWidth = ((Rect)(ref _windowRect)).width;
				config.UI.WindowHeight = ((Rect)(ref _windowRect)).height;
				config.UI.LastTab = _currentTab;
				ConfigManager.Instance.QueueSave();
			}
			catch
			{
			}
		}

		public void Shutdown()
		{
			if (_isVisible)
			{
				Hide();
			}
			_pages.Clear();
			_initialized = false;
		}
	}
	public static class SewerSkin
	{
		public enum StatusType
		{
			Normal,
			Success,
			Warning,
			Error
		}

		private static bool _initialized = false;

		private static GUISkin _customSkin;

		private static Texture2D _windowBackground;

		private static Texture2D _buttonNormal;

		private static Texture2D _buttonHover;

		private static Texture2D _buttonActive;

		private static Texture2D _boxBackground;

		private static Texture2D _toggleOn;

		private static Texture2D _toggleOff;

		private static Texture2D _sliderBackground;

		private static Texture2D _sliderThumb;

		private static Texture2D _textFieldBackground;

		private static Texture2D _solidWhite;

		private static Texture2D _gradientHeader;

		private static Texture2D _togglePillOn;

		private static Texture2D _togglePillOff;

		private static Texture2D _toggleKnob;

		private static Texture2D _sliderTrackBg;

		private static Texture2D _sliderTrackFill;

		private static Texture2D _sliderKnob;

		public static readonly Color AccentColor = new Color(0.345f, 0.651f, 1f, 1f);

		public static readonly Color AccentDark = new Color(0.22f, 0.545f, 0.992f, 1f);

		public static readonly Color AccentGlow = new Color(0.475f, 0.753f, 1f, 1f);

		public static readonly Color BackgroundColor = new Color(0.051f, 0.067f, 0.09f, 0.98f);

		public static readonly Color PanelColor = new Color(0.086f, 0.106f, 0.133f, 1f);

		public static readonly Color PanelLightColor = new Color(0.11f, 0.129f, 0.157f, 1f);

		public static readonly Color ButtonColor = new Color(0.129f, 0.157f, 0.188f, 1f);

		public static readonly Color ButtonHoverColor = new Color(0.18f, 0.212f, 0.251f, 1f);

		public static readonly Color ButtonActiveColor = new Color(0.22f, 0.545f, 0.992f, 1f);

		public static readonly Color TextColor = new Color(0.902f, 0.929f, 0.953f, 1f);

		public static readonly Color TextMutedColor = new Color(0.49f, 0.522f, 0.565f, 1f);

		public static readonly Color SuccessColor = new Color(0.247f, 0.725f, 0.314f, 1f);

		public static readonly Color WarningColor = new Color(0.824f, 0.6f, 0.133f, 1f);

		public static readonly Color ErrorColor = new Color(0.973f, 0.318f, 0.286f, 1f);

		public static readonly Color BorderColor = new Color(0.188f, 0.212f, 0.239f, 1f);

		public static readonly Color BorderLightColor = new Color(0.282f, 0.31f, 0.345f, 1f);

		private static GUIStyle _headerStyle;

		private static GUIStyle _sectionStyle;

		private static GUIStyle _labelStyle;

		private static GUIStyle _buttonStyle;

		private static GUIStyle _buttonAccentStyle;

		private static GUIStyle _buttonDangerStyle;

		private static GUIStyle _toggleStyle;

		private static GUIStyle _boxStyle;

		private static bool _stylesInitialized = false;

		public static void Initialize()
		{
			if (_initialized)
			{
				return;
			}
			try
			{
				CreateTextures();
				_initialized = true;
				SewerLogger.Debug("SewerSkin initialized");
			}
			catch (Exception ex)
			{
				SewerLogger.Error("Failed to initialize SewerSkin", ex);
			}
		}

		private static void CreateTextures()
		{
			//IL_0002: 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_0026: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			_solidWhite = MakeTexture(2, 2, Color.white);
			_windowBackground = MakeTexture(2, 2, BackgroundColor);
			_buttonNormal = MakeRoundedTexture(64, 28, ButtonColor, new Color(BorderColor.r, BorderColor.g, BorderColor.b, 0.5f));
			_buttonHover = MakeRoundedTexture(64, 28, ButtonHoverColor, BorderLightColor);
			_buttonActive = MakeRoundedTexture(64, 28, ButtonActiveColor, AccentColor);
			_boxBackground = MakeRoundedTexture(64, 64, PanelColor, new Color(BorderColor.r, BorderColor.g, BorderColor.b, 0.4f));
			_toggleOn = MakeToggleTexture(20, 20, isOn: true);
			_toggleOff = MakeToggleTexture(20, 20, isOn: false);
			_sliderBackground = MakeTexture(8, 8, new Color(0.1f, 0.12f, 0.15f, 1f));
			_sliderThumb = MakeRoundedTexture(16, 22, AccentColor, AccentDark);
			_textFieldBackground = MakeRoundedTexture(64, 26, new Color(0.04f, 0.05f, 0.065f, 1f), BorderColor);
			_gradientHeader = MakeGradientTexture(1, 32, new Color(AccentColor.r, AccentColor.g, AccentColor.b, 0.15f), new Color(AccentColor.r, AccentColor.g, AccentColor.b, 0f));
			_togglePillOn = MakePillTexture(44, 22, AccentColor, AccentDark);
			_togglePillOff = MakePillTexture(44, 22, new Color(0.15f, 0.17f, 0.2f, 1f), new Color(0.22f, 0.24f, 0.28f, 1f));
			_toggleKnob = MakeCircleTexture(18, Color.white);
			_sliderTrackBg = MakePillTexture(100, 8, new Color(0.1f, 0.12f, 0.15f, 1f), new Color(0.15f, 0.17f, 0.2f, 1f));
			_sliderTrackFill = MakePillTexture(100, 8, AccentColor, AccentDark);
			_sliderKnob = MakeCircleTexture(16, Color.white);
		}

		private static Texture2D MakeGradientTexture(int width, int height, Color top, Color bottom)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0044: 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)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < height; i++)
			{
				float num = (float)i / (float)(height - 1);
				Color val2 = Color.Lerp(bottom, top, num);
				for (int j = 0; j < width; j++)
				{
					array[i * width + j] = val2;
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private static Texture2D MakeTexture(int width, int height, Color color)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0021: 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)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = color;
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private static Texture2D MakeRoundedTexture(int width, int height, Color fillColor, Color borderColor)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_00bd: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			int num = 3;
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < width; j++)
				{
					bool flag = j == 0 || j == width - 1 || i == 0 || i == height - 1;
					bool flag2 = false;
					if ((j < num && i < num) || (j < num && i >= height - num) || (j >= width - num && i < num) || (j >= width - num && i >= height - num))
					{
						int num2 = ((j < num) ? num : (width - num - 1));
						int num3 = ((i < num) ? num : (height - num - 1));
						flag2 = Mathf.Sqrt((float)((j - num2) * (j - num2) + (i - num3) * (i - num3))) > (float)num;
					}
					if (flag2)
					{
						array[i * width + j] = Color.clear;
					}
					else if (flag)
					{
						array[i * width + j] = borderColor;
					}
					else
					{
						array[i * width + j] = fillColor;
					}
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private static Texture2D MakePillTexture(int width, int height, Color fillColor, Color borderColor)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_009c: 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_00c7: 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_00d3: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_00fa: 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)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			((Texture)val).filterMode = (FilterMode)1;
			int num = height / 2;
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < width; j++)
				{
					float num2 = float.MaxValue;
					if (j < num)
					{
						float num3 = j - num;
						float num4 = i - num;
						num2 = Mathf.Sqrt(num3 * num3 + num4 * num4);
					}
					else if (j >= width - num)
					{
						float num5 = j - (width - num - 1);
						float num6 = i - num;
						num2 = Mathf.Sqrt(num5 * num5 + num6 * num6);
					}
					else
					{
						num2 = Mathf.Abs(i - num);
					}
					if (num2 > (float)num)
					{
						array[i * width + j] = Color.clear;
					}
					else if (num2 > (float)num - 1.5f)
					{
						float num7 = Mathf.Clamp01((float)num - num2);
						array[i * width + j] = new Color(borderColor.r, borderColor.g, borderColor.b, num7);
					}
					else if (num2 > (float)num - 2.5f)
					{
						array[i * width + j] = borderColor;
					}
					else
					{
						array[i * width + j] = fillColor;
					}
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private static Texture2D MakeCircleTexture(int diameter, Color color)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_00a1: 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_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)
			Texture2D val = new Texture2D(diameter, diameter, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			((Texture)val).filterMode = (FilterMode)1;
			float num = (float)diameter / 2f;
			float num2 = (float)(diameter - 1) / 2f;
			Color[] array = (Color[])(object)new Color[diameter * diameter];
			for (int i = 0; i < diameter; i++)
			{
				for (int j = 0; j < diameter; j++)
				{
					float num3 = (float)j - num2;
					float num4 = (float)i - num2;
					float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
					if (num5 > num)
					{
						array[i * diameter + j] = Color.clear;
					}
					else if (num5 > num - 1.2f)
					{
						float num6 = Mathf.Clamp01(num - num5);
						array[i * diameter + j] = new Color(color.r, color.g, color.b, num6);
					}
					else
					{
						float num7 = 1f - num5 / num * 0.15f;
						array[i * diameter + j] = new Color(Mathf.Min(1f, color.r * num7 + 0.05f), Mathf.Min(1f, color.g * num7 + 0.05f), Mathf.Min(1f, color.b * num7 + 0.05f), color.a);
					}
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private static Texture2D MakeToggleTexture(int size, int height, bool isOn)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0064: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, height, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			Color val2 = (Color)(isOn ? AccentColor : new Color(0.12f, 0.14f, 0.17f, 1f));
			Color val3 = (isOn ? AccentDark : BorderColor);
			Color val4 = (Color)(isOn ? new Color(1f, 1f, 1f, 1f) : Color.clear);
			Color[] array = (Color[])(object)new Color[size * height];
			int num = 3;
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < size; j++)
				{
					bool flag = false;
					if ((j < num && i < num) || (j < num && i >= height - num) || (j >= size - num && i < num) || (j >= size - num && i >= height - num))
					{
						int num2 = ((j < num) ? num : (size - num - 1));
						int num3 = ((i < num) ? num : (height - num - 1));
						flag = Mathf.Sqrt((float)((j - num2) * (j - num2) + (i - num3) * (i - num3))) > (float)num;
					}
					bool flag2 = j <= 1 || j >= size - 2 || i <= 1 || i >= height - 2;
					if (flag)
					{
						array[i * size + j] = Color.clear;
					}
					else if (flag2)
					{
						array[i * size + j] = val3;
					}
					else if (isOn && j > 4 && j < size - 5 && i > 4 && i < height - 5)
					{
						array[i * size + j] = val4;
					}
					else
					{
						array[i * size + j] = val2;
					}
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		public static void BeginUI()
		{
			//IL_0018: 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)
			if (!_initialized)
			{
				Initialize();
			}
			if (!_stylesInitialized)
			{
				CreateStyles();
			}
			GUI.backgroundColor = Color.white;
			GUI.contentColor = TextColor;
		}

		private static void CreateStyles()
		{
			//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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0034: 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_0043: Expected O, but got Unknown
			//IL_0048: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			_buttonStyle = new GUIStyle(GUI.skin.button)
			{
				fontSize = 12,
				fontStyle = (FontStyle)0,
				alignment = (TextAnchor)4,
				padding = new RectOffset(8, 8, 4, 4),
				margin = new RectOffset(2, 2, 2, 2)
			};
			_buttonStyle.normal.background = _buttonNormal;
			_buttonStyle.normal.textColor = TextColor;
			_buttonStyle.hover.background = _buttonHover;
			_buttonStyle.hover.textColor = TextColor;
			_buttonStyle.active.background = _buttonActive;
			_buttonStyle.active.textColor = new Color(0.02f, 0.04f, 0.06f, 1f);
			_buttonStyle.focused.background = _buttonHover;
			_buttonStyle.focused.textColor = TextColor;
			_buttonAccentStyle = new GUIStyle(_buttonStyle);
			_buttonAccentStyle.normal.background = _buttonActive;
			_buttonAccentStyle.normal.textColor = new Color(0.02f, 0.04f, 0.06f, 1f);
			_buttonAccentStyle.hover.background = MakeRoundedTexture(64, 28, AccentGlow, AccentColor);
			((Object)_buttonAccentStyle.hover.background).hideFlags = (HideFlags)61;
			_buttonAccentStyle.hover.textColor = new Color(0.02f, 0.04f, 0.06f, 1f);
			_buttonAccentStyle.active.background = MakeRoundedTexture(64, 28, AccentDark, AccentColor);
			((Object)_buttonAccentStyle.active.background).hideFlags = (HideFlags)61;
			_buttonAccentStyle.active.textColor = TextColor;
			_buttonDangerStyle = new GUIStyle(_buttonStyle);
			_buttonDangerStyle.normal.background = MakeRoundedTexture(64, 28, new Color(ErrorColor.r * 0.8f, ErrorColor.g * 0.8f, ErrorColor.b * 0.8f, 1f), ErrorColor);
			((Object)_buttonDangerStyle.normal.background).hideFlags = (HideFlags)61;
			_buttonDangerStyle.normal.textColor = TextColor;
			_buttonDangerStyle.hover.background = MakeRoundedTexture(64, 28, ErrorColor, new Color(1f, 0.4f, 0.4f, 1f));
			((Object)_buttonDangerStyle.hover.background).hideFlags = (HideFlags)61;
			_buttonDangerStyle.hover.textColor = TextColor;
			_buttonDangerStyle.active.background = MakeRoundedTexture(64, 28, new Color(ErrorColor.r * 0.6f, ErrorColor.g * 0.6f, ErrorColor.b * 0.6f, 1f), ErrorColor);
			((Object)_buttonDangerStyle.active.background).hideFlags = (HideFlags)61;
			_buttonDangerStyle.active.textColor = TextColor;
			_stylesInitialized = true;
		}

		public static void EndUI()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			GUI.backgroundColor = Color.white;
			GUI.contentColor = Color.white;
		}

		public static void DrawHeader(string text)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Color contentColor = GUI.contentColor;
			GUI.contentColor = AccentColor;
			GUILayout.Label(text, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUI.contentColor = contentColor;
			GUILayout.Space(5f);
		}

		public static void DrawSection(string title)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0077: 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_0094: 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_00d7: 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_0141: 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)
			GUILayout.Space(14f);
			Rect rect = GUILayoutUtility.GetRect(0f, 26f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if ((Object)(object)_gradientHeader != (Object)null)
			{
				GUI.DrawTexture(rect, (Texture)(object)_gradientHeader, (ScaleMode)0);
			}
			Color color = GUI.color;
			GUI.color = AccentColor;
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 3f, 3f, ((Rect)(ref rect)).height - 6f), (Texture)(object)(_solidWhite ?? Texture2D.whiteTexture));
			GUI.color = color;
			Color contentColor = GUI.contentColor;
			GUI.contentColor = TextColor;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width - 12f, ((Rect)(ref rect)).height - 6f), title.ToUpper());
			GUI.contentColor = contentColor;
			GUI.color = new Color(BorderColor.r, BorderColor.g, BorderColor.b, 0.6f);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 1f, ((Rect)(ref rect)).width, 1f), (Texture)(object)(_solidWhite ?? Texture2D.whiteTexture));
			GUI.color = Color.white;
			GUILayout.Space(10f);
		}

		public static bool DrawToggle(string label, bool value, string description = null)
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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_015c: 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_007f: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Expected O, but got Unknown
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Expected O, but got Unknown
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = GUILayoutUtility.GetRect(0f, 32f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			Color color = GUI.color;
			if (value)
			{
				GUI.color = new Color(AccentColor.r, AccentColor.g, AccentColor.b, 0.04f);
				GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 1f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height - 2f), (Texture)(object)(_solidWhite ?? Texture2D.whiteTexture));
				GUI.color = AccentColor;
				GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 4f, 3f, ((Rect)(ref rect)).height - 8f), (Texture)(object)(_solidWhite ?? Texture2D.whiteTexture));
			}
			GUI.color = color;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 22f) / 2f, 44f, 22f);
			bool result = GUI.Toggle(new Rect(((Rect)(ref val)).x - 2f, ((Rect)(ref val)).y - 2f, 48f, 26f), value, "", GUIStyle.none);
			Color color2 = GUI.color;
			GUI.color = Color.white;
			if (value)
			{
				if ((Object)(object)_togglePillOn != (Object)null)
				{
					GUI.DrawTexture(val, (Texture)(object)_togglePillOn, (ScaleMode)0);
				}
				else
				{
					GUI.color = AccentColor;
					GUI.DrawTexture(val, (Texture)(object)(_solidWhite ?? Texture2D.whiteTexture));
				}
			}
			else if ((Object)(object)_togglePillOff != (Object)null)
			{
				GUI.DrawTexture(val, (Texture)(object)_togglePillOff, (ScaleMode)0);
			}
			else
			{
				GUI.col