Decompiled source of SupermarketManager v2.0.0

BepInEx/plugins/SupermarketManager.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("StoreManagerToolkit")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Shelf Manager and Price Manager for Supermarket Together - assign products to shelves and manage pricing from an in-game UI")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("StoreManagerToolkit")]
[assembly: AssemblyTitle("StoreManagerToolkit")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.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 AutoShelfAssign
{
	public static class AnalyticsManager
	{
		public struct ProductProfitInfo
		{
			public int ProductId;

			public string ProductName;

			public float BaseCostPerUnit;

			public float InflatedCostPerUnit;

			public float SellingPrice;

			public float ProfitPerUnit;

			public float ProfitMargin;

			public int Tier;

			public string Brand;
		}

		public struct DailyFinanceInfo
		{
			public float DayBenefits;

			public float MoneySpentOnProducts;

			public float LightCost;

			public float RentCost;

			public float EmployeesCost;

			public float OtherCosts;

			public float NetProfit;

			public int DailyCustomers;

			public int TimesRobbed;

			public float MoneyLostRobbing;

			public int FilthComplaints;

			public int GameDay;
		}

		public struct SalesHeatInfo
		{
			public int ProductId;

			public string ProductName;

			public int OnShelfQty;

			public bool IsTooExpensive;

			public bool IsNotFound;

			public int HeatLevel;
		}

		private static List<ProductProfitInfo> _productProfits = new List<ProductProfitInfo>();

		private static DailyFinanceInfo _dailyFinance;

		private static List<SalesHeatInfo> _salesHeat = new List<SalesHeatInfo>();

		public static List<ProductProfitInfo> GetProductProfits()
		{
			return _productProfits;
		}

		public static DailyFinanceInfo GetDailyFinance()
		{
			return _dailyFinance;
		}

		public static List<SalesHeatInfo> GetSalesHeat()
		{
			return _salesHeat;
		}

		public static void CalculateProfits()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			_productProfits.Clear();
			ProductListing instance = ProductListing.Instance;
			if ((Object)instance == (Object)null || instance.availableProducts == null || instance.productsData == null)
			{
				return;
			}
			foreach (int availableProduct in instance.availableProducts)
			{
				if (availableProduct < 0 || availableProduct >= instance.productsData.Length)
				{
					continue;
				}
				ProductData val = instance.productsData[availableProduct];
				if (val != null)
				{
					float basePricePerUnit = val.basePricePerUnit;
					float num = basePricePerUnit;
					if (instance.tierInflation != null && val.productTier >= 0 && val.productTier < instance.tierInflation.Length)
					{
						num = basePricePerUnit * instance.tierInflation[val.productTier];
					}
					float num2 = 0f;
					if (instance.productPlayerPricing != null && availableProduct < instance.productPlayerPricing.Length)
					{
						num2 = instance.productPlayerPricing[availableProduct];
					}
					float num3 = num2 - num;
					float profitMargin = ((num > 0f) ? (num3 / num * 100f) : 0f);
					_productProfits.Add(new ProductProfitInfo
					{
						ProductId = availableProduct,
						ProductName = ShelfManager.GetProductName(availableProduct),
						BaseCostPerUnit = basePricePerUnit,
						InflatedCostPerUnit = num,
						SellingPrice = num2,
						ProfitPerUnit = num3,
						ProfitMargin = profitMargin,
						Tier = val.productTier,
						Brand = val.productBrand.ToString()
					});
				}
			}
			_productProfits.Sort((ProductProfitInfo a, ProductProfitInfo b) => a.ProfitMargin.CompareTo(b.ProfitMargin));
		}

		public static void RefreshDailyFinance()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GameData instance = GameData.Instance;
			if (!((Object)instance == (Object)null))
			{
				DailyFinanceInfo dailyFinance = default(DailyFinanceInfo);
				dailyFinance.DayBenefits = instance.dayBenefits;
				dailyFinance.MoneySpentOnProducts = instance.moneySpentOnProducts;
				dailyFinance.LightCost = instance.lightCost;
				dailyFinance.RentCost = instance.rentCost;
				dailyFinance.EmployeesCost = instance.employeesCost;
				dailyFinance.OtherCosts = instance.otherCosts;
				dailyFinance.DailyCustomers = instance.dailyCustomers;
				dailyFinance.TimesRobbed = instance.timesRobbed;
				dailyFinance.MoneyLostRobbing = instance.moneyLostBecauseRobbing;
				dailyFinance.FilthComplaints = instance.complainedAboutFilth;
				dailyFinance.GameDay = instance.gameDay;
				_dailyFinance = dailyFinance;
				_dailyFinance.NetProfit = _dailyFinance.DayBenefits - _dailyFinance.MoneySpentOnProducts - _dailyFinance.LightCost - _dailyFinance.RentCost - _dailyFinance.EmployeesCost - _dailyFinance.OtherCosts;
			}
		}

		public static void RefreshSalesHeat()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			_salesHeat.Clear();
			ProductListing instance = ProductListing.Instance;
			if ((Object)instance == (Object)null || instance.availableProducts == null)
			{
				return;
			}
			HashSet<int> hashSet = new HashSet<int>();
			HashSet<int> hashSet2 = new HashSet<int>();
			try
			{
				List<int> list = GameData.Instance?.lastDayTooExpensiveList;
				if (list != null)
				{
					hashSet = new HashSet<int>(list);
				}
			}
			catch
			{
			}
			try
			{
				List<int> list2 = GameData.Instance?.lastDaysNotFoundList;
				if (list2 != null)
				{
					hashSet2 = new HashSet<int>(list2);
				}
			}
			catch
			{
			}
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			if ((Object)NPC_Manager.Instance != (Object)null && (Object)NPC_Manager.Instance.shelvesOBJ != (Object)null)
			{
				Transform transform = NPC_Manager.Instance.shelvesOBJ.transform;
				for (int i = 0; i < transform.childCount; i++)
				{
					Transform child = transform.GetChild(i);
					if ((Object)child == (Object)null)
					{
						continue;
					}
					Data_Container component = ((Component)child).GetComponent<Data_Container>();
					if ((Object)component == (Object)null || component.containerClass == 69)
					{
						continue;
					}
					int[] productInfoArray = component.productInfoArray;
					if (productInfoArray == null)
					{
						continue;
					}
					int num = productInfoArray.Length / 2;
					for (int j = 0; j < num; j++)
					{
						int num2 = productInfoArray[j * 2];
						int num3 = productInfoArray[j * 2 + 1];
						if (num2 >= 0)
						{
							if (dictionary.ContainsKey(num2))
							{
								dictionary[num2] += num3;
							}
							else
							{
								dictionary[num2] = num3;
							}
						}
					}
				}
			}
			foreach (int availableProduct in instance.availableProducts)
			{
				if (availableProduct >= 0 && availableProduct < instance.productsData.Length && instance.productsData[availableProduct] != null)
				{
					int num4 = (dictionary.ContainsKey(availableProduct) ? dictionary[availableProduct] : 0);
					bool flag = hashSet.Contains(availableProduct);
					bool flag2 = hashSet2.Contains(availableProduct);
					int num5 = 2;
					num5 = (flag2 ? 4 : (flag ? 1 : ((num4 <= 0) ? 3 : ((num4 <= 5) ? 2 : 0))));
					_salesHeat.Add(new SalesHeatInfo
					{
						ProductId = availableProduct,
						ProductName = ShelfManager.GetProductName(availableProduct),
						OnShelfQty = num4,
						IsTooExpensive = flag,
						IsNotFound = flag2,
						HeatLevel = num5
					});
				}
			}
			_salesHeat.Sort((SalesHeatInfo a, SalesHeatInfo b) => b.HeatLevel.CompareTo(a.HeatLevel));
		}

		public static string GetHeatLabel(int heatLevel)
		{
			return heatLevel switch
			{
				0 => "畅销", 
				1 => "太贵", 
				2 => "库存低", 
				3 => "缺货", 
				4 => "找不到", 
				_ => "未知", 
			};
		}

		public static Color GetHeatColor(int heatLevel)
		{
			//IL_002b: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(heatLevel switch
			{
				0 => new Color(0.3f, 0.85f, 0.3f), 
				1 => new Color(1f, 0.85f, 0.2f), 
				2 => new Color(1f, 0.6f, 0.2f), 
				3 => new Color(1f, 0.3f, 0.3f), 
				4 => new Color(0.8f, 0.2f, 0.8f), 
				_ => Color.white, 
			});
		}
	}
	public static class EnhancementManager
	{
		public struct ShelfStockInfo
		{
			public int ProductId;

			public string ProductName;

			public int TotalOnShelves;

			public int SlotCount;

			public int MaxPerSlot;

			public int LowestSlotQty;

			public int NotOnShelfCount;

			public bool IsLow;
		}

		public struct EmployeeInfo
		{
			public int Index;

			public string RawData;

			public int NPCID;

			public int Salary;

			public int CashierValue;

			public int RestockerValue;

			public int StorageValue;

			public int SecurityValue;

			public int TechnicianValue;

			public int OrderingValue;

			public int ManufacturingValue;

			public string Name;

			public int BestSkill;

			public int BestValue;
		}

		public struct TeleportLocation
		{
			public string Name;

			public Vector3 Position;

			public float Rotation;
		}

		private static List<ShelfStockInfo> _shelfStocks = new List<ShelfStockInfo>();

		private static List<EmployeeInfo> _availableEmployees = new List<EmployeeInfo>();

		private static List<TeleportLocation> _presetLocations = new List<TeleportLocation>();

		private static bool _locationsInitialized;

		public static List<ShelfStockInfo> GetShelfStocks()
		{
			return _shelfStocks;
		}

		public static List<EmployeeInfo> GetAvailableEmployees()
		{
			return _availableEmployees;
		}

		public static List<TeleportLocation> GetPresetLocations()
		{
			return _presetLocations;
		}

		public static void ScanShelfStock()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			_shelfStocks.Clear();
			if ((Object)NPC_Manager.Instance == (Object)null || (Object)NPC_Manager.Instance.shelvesOBJ == (Object)null)
			{
				return;
			}
			ProductListing instance = ProductListing.Instance;
			if ((Object)instance == (Object)null || instance.productsData == null)
			{
				return;
			}
			Dictionary<int, ShelfStockInfo> dictionary = new Dictionary<int, ShelfStockInfo>();
			Transform transform = NPC_Manager.Instance.shelvesOBJ.transform;
			HashSet<int> hashSet = new HashSet<int>();
			for (int i = 0; i < transform.childCount; i++)
			{
				Transform child = transform.GetChild(i);
				if ((Object)child == (Object)null)
				{
					continue;
				}
				Data_Container component = ((Component)child).GetComponent<Data_Container>();
				if ((Object)component == (Object)null || component.containerClass == 69)
				{
					continue;
				}
				int[] productInfoArray = component.productInfoArray;
				if (productInfoArray == null || productInfoArray.Length < 2)
				{
					continue;
				}
				int num = productInfoArray.Length / 2;
				for (int j = 0; j < num; j++)
				{
					int num2 = productInfoArray[j * 2];
					int num3 = productInfoArray[j * 2 + 1];
					if (num2 < 0)
					{
						continue;
					}
					hashSet.Add(num2);
					int maxPerSlot = 25;
					if (num2 < instance.productsData.Length && instance.productsData[num2] != null)
					{
						maxPerSlot = instance.productsData[num2].maxItemsPerBox;
					}
					if (dictionary.ContainsKey(num2))
					{
						ShelfStockInfo value = dictionary[num2];
						value.TotalOnShelves += num3;
						value.SlotCount++;
						if (num3 < value.LowestSlotQty)
						{
							value.LowestSlotQty = num3;
						}
						dictionary[num2] = value;
					}
					else
					{
						dictionary[num2] = new ShelfStockInfo
						{
							ProductId = num2,
							ProductName = ShelfManager.GetProductName(num2),
							TotalOnShelves = num3,
							SlotCount = 1,
							MaxPerSlot = maxPerSlot,
							LowestSlotQty = num3,
							NotOnShelfCount = 0,
							IsLow = false
						};
					}
				}
			}
			Dictionary<int, int> dictionary2 = ScanBoxesAtDelivery();
			if (instance.availableProducts != null)
			{
				foreach (int availableProduct in instance.availableProducts)
				{
					if (availableProduct < 0 || availableProduct >= instance.productsData.Length || instance.productsData[availableProduct] == null)
					{
						continue;
					}
					int maxItemsPerBox = instance.productsData[availableProduct].maxItemsPerBox;
					if (hashSet.Contains(availableProduct))
					{
						if (dictionary2.ContainsKey(availableProduct) && dictionary2[availableProduct] > 0)
						{
							ShelfStockInfo value2 = dictionary[availableProduct];
							value2.NotOnShelfCount = dictionary2[availableProduct];
							dictionary[availableProduct] = value2;
						}
						continue;
					}
					int num4 = (dictionary2.ContainsKey(availableProduct) ? dictionary2[availableProduct] : 0);
					dictionary[availableProduct] = new ShelfStockInfo
					{
						ProductId = availableProduct,
						ProductName = ShelfManager.GetProductName(availableProduct),
						TotalOnShelves = 0,
						SlotCount = 0,
						MaxPerSlot = maxItemsPerBox,
						LowestSlotQty = 0,
						NotOnShelfCount = ((num4 <= 0) ? 1 : num4),
						IsLow = true
					};
				}
			}
			foreach (KeyValuePair<int, ShelfStockInfo> item in dictionary)
			{
				ShelfStockInfo value3 = item.Value;
				value3.IsLow = value3.TotalOnShelves < value3.MaxPerSlot * value3.SlotCount;
				_shelfStocks.Add(value3);
			}
			_shelfStocks.Sort((ShelfStockInfo a, ShelfStockInfo b) => a.LowestSlotQty.CompareTo(b.LowestSlotQty));
		}

		private static Dictionary<int, int> ScanBoxesAtDelivery()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			try
			{
				BoxData[] array = Object.FindObjectsByType<BoxData>((FindObjectsSortMode)0);
				if (array == null)
				{
					return dictionary;
				}
				BoxData[] array2 = array;
				foreach (BoxData val in array2)
				{
					if ((Object)val == (Object)null)
					{
						continue;
					}
					try
					{
						int productID = val.productID;
						int numberOfProducts = val.numberOfProducts;
						if (productID >= 0 && numberOfProducts > 0)
						{
							if (dictionary.ContainsKey(productID))
							{
								dictionary[productID] += numberOfProducts;
							}
							else
							{
								dictionary[productID] = numberOfProducts;
							}
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			return dictionary;
		}

		public static bool RestockProduct(ShelfStockInfo stock)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			ManagerBlackboard val = Object.FindFirstObjectByType<ManagerBlackboard>();
			if ((Object)val == (Object)null)
			{
				return false;
			}
			ProductListing instance = ProductListing.Instance;
			if ((Object)instance == (Object)null || instance.productsData == null)
			{
				return false;
			}
			GameData instance2 = GameData.Instance;
			if ((Object)instance2 == (Object)null)
			{
				return false;
			}
			if (stock.ProductId < 0 || stock.ProductId >= instance.productsData.Length)
			{
				return false;
			}
			ProductData val2 = instance.productsData[stock.ProductId];
			if (val2 == null)
			{
				return false;
			}
			if ((Object)val.merchandiseSpawnpoint == (Object)null)
			{
				return false;
			}
			try
			{
				float num = CalcBoxPrice(instance, val2);
				if (instance2.gameFunds < num)
				{
					Plugin.Logger.LogWarning((object)$"采购失败: 资金不足 ({stock.ProductName}, 需要${num:F2})");
					return false;
				}
				instance2.CmdAlterFunds(0f - num);
				Vector3 val3 = val.merchandiseSpawnpoint.transform.position + new Vector3(Random.Range(-1.5f, 1.5f), 0f, Random.Range(-1.5f, 1.5f));
				val.CmdSpawnBoxFromPlayer(val3, stock.ProductId, val2.maxItemsPerBox, 0f);
				Plugin.Logger.LogInfo((object)$"采购: {stock.ProductName} 1箱({val2.maxItemsPerBox}件) ${num:F2}");
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("采购失败: " + ex.Message));
				return false;
			}
		}

		public static int RestockAllLow()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			ManagerBlackboard val = Object.FindFirstObjectByType<ManagerBlackboard>();
			if ((Object)val == (Object)null)
			{
				return 0;
			}
			ProductListing instance = ProductListing.Instance;
			if ((Object)instance == (Object)null || instance.productsData == null)
			{
				return 0;
			}
			GameData instance2 = GameData.Instance;
			if ((Object)instance2 == (Object)null)
			{
				return 0;
			}
			if ((Object)val.merchandiseSpawnpoint == (Object)null)
			{
				return 0;
			}
			int num = 0;
			float num2 = 0f;
			foreach (ShelfStockInfo shelfStock in _shelfStocks)
			{
				if (!shelfStock.IsLow || shelfStock.ProductId < 0 || shelfStock.ProductId >= instance.productsData.Length)
				{
					continue;
				}
				ProductData val2 = instance.productsData[shelfStock.ProductId];
				if (val2 == null)
				{
					continue;
				}
				try
				{
					float num3 = CalcBoxPrice(instance, val2);
					if (instance2.gameFunds < num3)
					{
						break;
					}
					instance2.CmdAlterFunds(0f - num3);
					Vector3 val3 = val.merchandiseSpawnpoint.transform.position + new Vector3(Random.Range(-1.5f, 1.5f), 0f, Random.Range(-1.5f, 1.5f));
					val.CmdSpawnBoxFromPlayer(val3, shelfStock.ProductId, val2.maxItemsPerBox, 0f);
					num2 += num3;
					num++;
					continue;
				}
				catch
				{
					continue;
				}
			}
			Plugin.Logger.LogInfo((object)$"批量采购: {num} 箱, 共${num2:F2}");
			return num;
		}

		public static int SellEmptyBoxes()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			GameData instance = GameData.Instance;
			if ((Object)instance == (Object)null)
			{
				return 0;
			}
			if (!((NetworkBehaviour)instance).isServer)
			{
				return 0;
			}
			int num = 0;
			float num2 = 0f;
			try
			{
				BoxData[] array = Object.FindObjectsByType<BoxData>((FindObjectsSortMode)0);
				if (array == null)
				{
					return 0;
				}
				List<GameObject> list = new List<GameObject>();
				BoxData[] array2 = array;
				foreach (BoxData val in array2)
				{
					if ((Object)val == (Object)null)
					{
						continue;
					}
					try
					{
						if (val.numberOfProducts <= 0)
						{
							list.Add(((Component)val).gameObject);
							num++;
							num2 += 8f;
						}
					}
					catch
					{
					}
				}
				foreach (GameObject item in list)
				{
					try
					{
						NetworkServer.Destroy(item);
					}
					catch
					{
						try
						{
							Object.Destroy((Object)(object)item);
						}
						catch
						{
						}
					}
				}
				if (num > 0)
				{
					instance.CmdAlterFunds(num2);
					Plugin.Logger.LogInfo((object)$"回收空箱: {num}个, 退回${num2:F0}");
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("回收空箱失败: " + ex.Message));
			}
			return num;
		}

		public static float CalcBoxPrice(ProductListing pl, ProductData data)
		{
			float num = data.basePricePerUnit;
			if (pl.tierInflation != null && data.productTier >= 0 && data.productTier < pl.tierInflation.Length)
			{
				num *= pl.tierInflation[data.productTier];
			}
			num = Mathf.Round(num * 100f) / 100f;
			return Mathf.Round(num * (float)data.maxItemsPerBox * 100f) / 100f;
		}

		public static void RefreshAvailableEmployees()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			_availableEmployees.Clear();
			if ((Object)NPC_Manager.Instance == (Object)null)
			{
				return;
			}
			string[] todaysEmployeesData = NPC_Manager.Instance.todaysEmployeesData;
			if (todaysEmployeesData == null)
			{
				return;
			}
			for (int i = 0; i < todaysEmployeesData.Length; i++)
			{
				if (!string.IsNullOrEmpty(todaysEmployeesData[i]))
				{
					try
					{
						EmployeeInfo item = ParseEmployeeData(i, todaysEmployeesData[i]);
						_availableEmployees.Add(item);
					}
					catch
					{
					}
				}
			}
		}

		private static EmployeeInfo ParseEmployeeData(int index, string data)
		{
			string[] array = data.Split(new char[1] { '|' });
			EmployeeInfo employeeInfo = default(EmployeeInfo);
			employeeInfo.Index = index;
			employeeInfo.RawData = data;
			EmployeeInfo result = employeeInfo;
			if (array.Length >= 9)
			{
				int.TryParse(array[0], out result.NPCID);
				int.TryParse(array[1], out result.Salary);
				int.TryParse(array[2], out result.CashierValue);
				int.TryParse(array[3], out result.RestockerValue);
				int.TryParse(array[4], out result.StorageValue);
				int.TryParse(array[5], out result.SecurityValue);
				int.TryParse(array[6], out result.TechnicianValue);
				int.TryParse(array[7], out result.OrderingValue);
				int.TryParse(array[8], out result.ManufacturingValue);
				result.Name = $"候选人#{index + 1}";
			}
			int[] array2 = new int[7] { result.CashierValue, result.RestockerValue, result.StorageValue, result.SecurityValue, result.TechnicianValue, result.OrderingValue, result.ManufacturingValue };
			int num = 0;
			int bestSkill = 0;
			for (int i = 0; i < array2.Length; i++)
			{
				if (array2[i] > num)
				{
					num = array2[i];
					bestSkill = i;
				}
			}
			result.BestSkill = bestSkill;
			result.BestValue = num;
			return result;
		}

		public static void HireEmployee(int index, string name)
		{
			try
			{
				string text = name.Replace("|", "");
				NPC_Manager.Instance.CmdHireEmployeeData(index, text);
				Plugin.Logger.LogInfo((object)$"已雇佣员工: {text} (索引{index})");
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("雇佣员工失败: " + ex.Message));
			}
		}

		public static void HireAllAvailable()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if ((Object)NPC_Manager.Instance == (Object)null)
			{
				return;
			}
			int num = NPC_Manager.Instance.maxEmployees - NPC_Manager.Instance.numberOfHiredEmployees;
			if (num <= 0)
			{
				return;
			}
			int num2 = 0;
			foreach (EmployeeInfo availableEmployee in _availableEmployees)
			{
				if (num2 >= num)
				{
					break;
				}
				try
				{
					string text = availableEmployee.Name.Replace("|", "");
					NPC_Manager.Instance.CmdHireEmployeeData(availableEmployee.Index, text);
					num2++;
				}
				catch
				{
				}
			}
			Plugin.Logger.LogInfo((object)$"批量雇佣: 已雇佣 {num2} 名员工");
		}

		public static void InitPresetLocations()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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)
			if (!_locationsInitialized)
			{
				_locationsInitialized = true;
				_presetLocations.Add(new TeleportLocation
				{
					Name = "超市正门",
					Position = new Vector3(5f, 0f, -20.5f),
					Rotation = 0f
				});
				_presetLocations.Add(new TeleportLocation
				{
					Name = "员工休息室",
					Position = new Vector3(-20f, 0f, -8f),
					Rotation = 90f
				});
				_presetLocations.Add(new TeleportLocation
				{
					Name = "出货处",
					Position = new Vector3(-25f, 0f, -20f),
					Rotation = 90f
				});
				_presetLocations.Add(new TeleportLocation
				{
					Name = "经理室",
					Position = new Vector3(-15f, 0f, -5f),
					Rotation = 90f
				});
				_presetLocations.Add(new TeleportLocation
				{
					Name = "垃圾桶旁边",
					Position = new Vector3(-10f, 0f, -15f),
					Rotation = 0f
				});
				TryUpdateLocationsFromScene();
			}
		}

		private static void TryUpdateLocationsFromScene()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_003b: 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_005d: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)NPC_Manager.Instance != (Object)null)
				{
					if ((Object)NPC_Manager.Instance.restSpotOBJ != (Object)null)
					{
						Vector3 position = NPC_Manager.Instance.restSpotOBJ.transform.position;
						_presetLocations[1] = new TeleportLocation
						{
							Name = "员工休息室",
							Position = position,
							Rotation = 90f
						};
					}
					if ((Object)NPC_Manager.Instance.trashSpotOBJ != (Object)null)
					{
						Vector3 position2 = NPC_Manager.Instance.trashSpotOBJ.transform.position;
						_presetLocations[4] = new TeleportLocation
						{
							Name = "垃圾桶旁边",
							Position = position2,
							Rotation = 0f
						};
					}
				}
				ManagerBlackboard val = Object.FindFirstObjectByType<ManagerBlackboard>();
				if ((Object)val != (Object)null && (Object)val.merchandiseSpawnpoint != (Object)null)
				{
					Vector3 position3 = val.merchandiseSpawnpoint.transform.position;
					_presetLocations[2] = new TeleportLocation
					{
						Name = "出货处",
						Position = position3,
						Rotation = 90f
					};
				}
				UpgradesManager val2 = Object.FindFirstObjectByType<UpgradesManager>();
				if ((Object)val2 != (Object)null && (Object)val2.UIPerksParent != (Object)null)
				{
					Transform transform = val2.UIPerksParent.transform;
					if ((Object)transform.parent != (Object)null)
					{
						Vector3 position4 = transform.parent.position;
						_presetLocations[3] = new TeleportLocation
						{
							Name = "经理室",
							Position = position4,
							Rotation = 90f
						};
					}
				}
			}
			catch
			{
			}
		}

		public static void TeleportTo(Vector3 position, float rotation)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				FirstPersonTransform val = Object.FindFirstObjectByType<FirstPersonTransform>();
				if ((Object)val == (Object)null)
				{
					Plugin.Logger.LogError((object)"传送失败: 找不到传送组件");
					return;
				}
				val.coroutineActivator(position, rotation);
				Plugin.Logger.LogInfo((object)$"已传送到 {position}");
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("传送失败: " + ex.Message));
			}
		}

		public static void SaveCurrentPosition(string name)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (_presetLocations.Count >= 20)
			{
				Plugin.Logger.LogWarning((object)"自定义位置已达上限(20个),无法保存更多");
				return;
			}
			try
			{
				FirstPersonTransform val = Object.FindFirstObjectByType<FirstPersonTransform>();
				if (!((Object)val == (Object)null))
				{
					Transform transform = ((Component)val).transform;
					_presetLocations.Add(new TeleportLocation
					{
						Name = name,
						Position = transform.position,
						Rotation = transform.eulerAngles.y
					});
				}
			}
			catch
			{
			}
		}
	}
	public static class FontHelper
	{
		private static Font _chineseFont;

		private static bool _initialized;

		public static Font ChineseFont
		{
			get
			{
				if (!_initialized)
				{
					_initialized = true;
					_chineseFont = LoadChineseFont();
				}
				return _chineseFont;
			}
		}

		private static Font LoadChineseFont()
		{
			Font val = TryFindGameFont();
			if ((Object)(object)val != (Object)null)
			{
				Plugin.Logger.LogInfo((object)("FontHelper: 使用游戏字体: " + ((Object)val).name));
				return val;
			}
			string[] array = new string[4] { "Microsoft YaHei", "SimHei", "SimSun", "Microsoft JhengHei" };
			foreach (string text in array)
			{
				try
				{
					Font val2 = Font.CreateDynamicFontFromOSFont(text, 14);
					if ((Object)(object)val2 != (Object)null)
					{
						Plugin.Logger.LogInfo((object)("FontHelper: 使用系统字体: " + text));
						return val2;
					}
				}
				catch
				{
				}
			}
			Plugin.Logger.LogWarning((object)"FontHelper: 未找到中文字体,使用默认字体");
			return null;
		}

		private static Font TryFindGameFont()
		{
			try
			{
				TMP_FontAsset val = Object.FindFirstObjectByType<TMP_FontAsset>();
				if ((Object)(object)val != (Object)null && (Object)(object)val.sourceFontFile != (Object)null)
				{
					Plugin.Logger.LogInfo((object)("FontHelper: 找到TMP字体源: " + ((Object)val.sourceFontFile).name));
					return val.sourceFontFile;
				}
			}
			catch
			{
			}
			return null;
		}

		public static void ApplyFont(GUIStyle style)
		{
			if ((Object)(object)ChineseFont != (Object)null && style != null)
			{
				style.font = ChineseFont;
			}
		}

		public static void ApplyFontToSkin()
		{
			if (!((Object)(object)ChineseFont == (Object)null))
			{
				GUISkin skin = GUI.skin;
				if (!((Object)(object)skin == (Object)null))
				{
					skin.font = ChineseFont;
					ApplyFont(skin.label);
					ApplyFont(skin.button);
					ApplyFont(skin.toggle);
					ApplyFont(skin.textField);
					ApplyFont(skin.textArea);
					ApplyFont(skin.box);
					ApplyFont(skin.window);
				}
			}
		}
	}
	public static class MainWindow
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static WindowFunction <0>__DrawWindowContents;
		}

		private static bool _visible;

		private static int _tab;

		private static Rect _windowRect;

		private static Vector2 _shelfScrollPos;

		private static Vector2 _productScrollPos;

		private static Vector2 _priceScrollPos;

		private static Vector2 _enhanceScrollPos;

		private static Vector2 _employeeScrollPos;

		private static Vector2 _teleportScrollPos;

		private static Vector2 _profitScrollPos;

		private static Vector2 _heatScrollPos;

		private static bool _stylesReady;

		private static GUIStyle _tabActiveStyle;

		private static GUIStyle _tabInactiveStyle;

		private static GUIStyle _headerStyle;

		private static GUIStyle _mixedStyle;

		private static GUIStyle _emptyStyle;

		private static GUIStyle _hostOnlyStyle;

		private static GUIStyle _slotStyle;

		private static GUIStyle _slotEmptyStyle;

		private static GUIStyle _expandedBg;

		private static GUIStyle _redRowStyle;

		private static GUIStyle _windowBg;

		private static GUIStyle _labelStyle;

		private static GUIStyle _greenStyle;

		private static GUIStyle _yellowStyle;

		private static GUIStyle _orangeStyle;

		private static GUIStyle _redStyle;

		private static GUIStyle _purpleStyle;

		private static GUIStyle _profitPositiveStyle;

		private static GUIStyle _profitNegativeStyle;

		private static Texture2D _tabActiveTex;

		private static Texture2D _tabInactiveTex;

		private static Texture2D _windowBgTex;

		private static List<ShelfManager.ShelfInfo> _cachedShelves = new List<ShelfManager.ShelfInfo>();

		private static float _refreshTimer;

		private const float REFRESH_INTERVAL = 5f;

		private static int _expandedShelfIndex = -1;

		private static int _pickingSlot = -2;

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

		private static readonly MethodInfo _cmdUpdateArray = AccessTools.Method(typeof(Data_Container), "CmdUpdateArrayValues", (Type[])null, (Type[])null);

		private static string _moneyInput = "10000";

		private static string _franchiseInput = "10";

		private static int _enhanceSubTab;

		private static int _analyticsSubTab;

		private static string _customLocationName = "自定义位置";

		private static readonly string[] _skillNames = new string[7] { "收银", "补货", "仓储", "安保", "技术", "订购", "制造" };

		private static GUIStyle _heatGreenStyle;

		private static GUIStyle _heatYellowStyle;

		private static GUIStyle _heatOrangeStyle;

		private static GUIStyle _heatRedStyle;

		private static GUIStyle _heatPurpleStyle;

		private static bool _heatStylesReady;

		public static bool IsVisible => _visible;

		public static void ToggleWindow()
		{
			_visible = !_visible;
			if (_visible)
			{
				CenterWindow();
				_expandedShelfIndex = -1;
				_pickingSlot = -2;
				ShelfManager.ForceRefreshPermissions();
				ShelfManager.RefreshShelfList();
				_priceInputs.Clear();
				ReadCurrentValues();
			}
			Cursor.lockState = (CursorLockMode)((!_visible) ? 1 : 0);
			Cursor.visible = _visible;
		}

		private static void CenterWindow()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			float num = 900f;
			float num2 = 600f;
			float num3 = ((float)Screen.width - num) / 2f;
			float num4 = ((float)Screen.height - num2) / 2f;
			_windowRect = new Rect(num3, num4, num, num2);
		}

		private static void ReadCurrentValues()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			try
			{
				GameData instance = GameData.Instance;
				if ((Object)instance != (Object)null)
				{
					_moneyInput = instance.gameFunds.ToString("F0", CultureInfo.InvariantCulture);
					_franchiseInput = instance.gameFranchisePoints.ToString();
				}
			}
			catch
			{
			}
		}

		public static void DrawWindow()
		{
			//IL_007b: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			if (!_visible)
			{
				return;
			}
			try
			{
				if (!_stylesReady)
				{
					InitStyles();
				}
				_refreshTimer += Time.deltaTime;
				if (_refreshTimer >= 5f)
				{
					_refreshTimer = 0f;
					int expandedShelfIndex = _expandedShelfIndex;
					ShelfManager.RefreshShelfList();
					_cachedShelves = ShelfManager.GetCachedShelves();
					_expandedShelfIndex = ((expandedShelfIndex >= 0 && expandedShelfIndex < _cachedShelves.Count) ? expandedShelfIndex : (-1));
				}
				else
				{
					_cachedShelves = ShelfManager.GetCachedShelves();
				}
				Rect windowRect = _windowRect;
				object obj = <>O.<0>__DrawWindowContents;
				if (obj == null)
				{
					WindowFunction val = DrawWindowContents;
					<>O.<0>__DrawWindowContents = val;
					obj = (object)val;
				}
				GUI.ModalWindow(948570, windowRect, (WindowFunction)obj, "", GUIStyle.none);
				GUI.Box(_windowRect, GUIContent.none, _windowBg);
			}
			catch
			{
			}
		}

		private static void InitStyles()
		{
			//IL_001b: 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_0065: 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_0088: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00d8: 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_0116: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_0198: 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_01a9: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Expected O, but got Unknown
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Expected O, but got Unknown
			//IL_03b7: 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_03df: Expected O, but got Unknown
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Expected O, but got Unknown
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Expected O, but got Unknown
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Expected O, but got Unknown
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Expected O, but got Unknown
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Expected O, but got Unknown
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			FontHelper.ApplyFontToSkin();
			_tabActiveTex = MakeTex(2, 2, new Color(0.25f, 0.35f, 0.55f, 1f));
			_tabInactiveTex = MakeTex(2, 2, new Color(0.18f, 0.18f, 0.22f, 1f));
			_windowBgTex = MakeTex(2, 2, new Color(0.15f, 0.15f, 0.18f, 1f));
			_windowBg = new GUIStyle(GUI.skin.box);
			_windowBg.normal.background = _windowBgTex;
			FontHelper.ApplyFont(_windowBg);
			_tabActiveStyle = new GUIStyle(GUI.skin.button);
			_tabActiveStyle.normal.background = _tabActiveTex;
			_tabActiveStyle.normal.textColor = Color.white;
			_tabActiveStyle.fontStyle = (FontStyle)1;
			_tabActiveStyle.alignment = (TextAnchor)4;
			FontHelper.ApplyFont(_tabActiveStyle);
			_tabInactiveStyle = new GUIStyle(GUI.skin.button);
			_tabInactiveStyle.normal.background = _tabInactiveTex;
			_tabInactiveStyle.normal.textColor = new Color(0.7f, 0.7f, 0.7f);
			_tabInactiveStyle.alignment = (TextAnchor)4;
			FontHelper.ApplyFont(_tabInactiveStyle);
			_headerStyle = new GUIStyle(GUI.skin.label)
			{
				fontStyle = (FontStyle)1,
				alignment = (TextAnchor)3
			};
			FontHelper.ApplyFont(_headerStyle);
			_labelStyle = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)3
			};
			FontHelper.ApplyFont(_labelStyle);
			_mixedStyle = new GUIStyle(GUI.skin.label);
			_mixedStyle.normal.textColor = new Color(1f, 0.7f, 0.2f);
			FontHelper.ApplyFont(_mixedStyle);
			_emptyStyle = new GUIStyle(GUI.skin.label);
			_emptyStyle.normal.textColor = new Color(0.6f, 0.6f, 0.6f);
			FontHelper.ApplyFont(_emptyStyle);
			_hostOnlyStyle = new GUIStyle(GUI.skin.label);
			_hostOnlyStyle.normal.textColor = new Color(0.7f, 0.4f, 0.4f);
			_hostOnlyStyle.fontStyle = (FontStyle)2;
			FontHelper.ApplyFont(_hostOnlyStyle);
			_slotStyle = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)3
			};
			FontHelper.ApplyFont(_slotStyle);
			_slotEmptyStyle = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)3
			};
			_slotEmptyStyle.normal.textColor = new Color(0.5f, 0.5f, 0.5f);
			FontHelper.ApplyFont(_slotEmptyStyle);
			_expandedBg = new GUIStyle(GUI.skin.box);
			Texture2D background = MakeTex(2, 2, new Color(0.2f, 0.2f, 0.25f, 0.9f));
			_expandedBg.normal.background = background;
			FontHelper.ApplyFont(_expandedBg);
			_redRowStyle = new GUIStyle(GUI.skin.box);
			_redRowStyle.normal.background = MakeTex(2, 2, new Color(0.5f, 0.15f, 0.15f, 0.7f));
			FontHelper.ApplyFont(_redRowStyle);
			_greenStyle = new GUIStyle(GUI.skin.label);
			_greenStyle.normal.textColor = new Color(0.3f, 0.85f, 0.3f);
			FontHelper.ApplyFont(_greenStyle);
			_yellowStyle = new GUIStyle(GUI.skin.label);
			_yellowStyle.normal.textColor = new Color(1f, 0.85f, 0.2f);
			FontHelper.ApplyFont(_yellowStyle);
			_orangeStyle = new GUIStyle(GUI.skin.label);
			_orangeStyle.normal.textColor = new Color(1f, 0.6f, 0.2f);
			FontHelper.ApplyFont(_orangeStyle);
			_redStyle = new GUIStyle(GUI.skin.label);
			_redStyle.normal.textColor = new Color(1f, 0.3f, 0.3f);
			FontHelper.ApplyFont(_redStyle);
			_purpleStyle = new GUIStyle(GUI.skin.label);
			_purpleStyle.normal.textColor = new Color(0.8f, 0.2f, 0.8f);
			FontHelper.ApplyFont(_purpleStyle);
			_profitPositiveStyle = new GUIStyle(GUI.skin.label);
			_profitPositiveStyle.normal.textColor = new Color(0.3f, 0.9f, 0.3f);
			_profitPositiveStyle.fontStyle = (FontStyle)1;
			FontHelper.ApplyFont(_profitPositiveStyle);
			_profitNegativeStyle = new GUIStyle(GUI.skin.label);
			_profitNegativeStyle.normal.textColor = new Color(1f, 0.3f, 0.3f);
			_profitNegativeStyle.fontStyle = (FontStyle)1;
			FontHelper.ApplyFont(_profitNegativeStyle);
			_stylesReady = true;
		}

		private static Texture2D MakeTex(int w, int h, Color col)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[w * h];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(w, h);
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private static void DrawWindowContents(int id)
		{
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("  商店管理工具箱", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(30f),
				GUILayout.Height(25f)
			}))
			{
				ToggleWindow();
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("货架管理", (_tab == 0) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				_tab = 0;
			}
			if (GUILayout.Button("价格管理", (_tab == 1) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				_tab = 1;
			}
			if (GUILayout.Button("资源修改", (_tab == 2) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				_tab = 2;
			}
			if (GUILayout.Button("增强功能", (_tab == 3) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				_tab = 3;
			}
			if (GUILayout.Button("经营分析", (_tab == 4) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				_tab = 4;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			if (_tab == 0)
			{
				DrawShelfTab();
			}
			else if (_tab == 1)
			{
				DrawPriceTab();
			}
			else if (_tab == 2)
			{
				DrawCheatTab();
			}
			else if (_tab == 3)
			{
				DrawEnhancementTab();
			}
			else if (_tab == 4)
			{
				DrawAnalyticsTab();
			}
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
		}

		private static void DrawShelfTab()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)NPC_Manager.Instance == (Object)null)
			{
				GUILayout.Label("未在游戏中。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			bool flag = ShelfManager.CanManageShelves();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (flag)
			{
				if (GUILayout.Button("一键分配(每个格子不同产品)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }))
				{
					ShelfManager.AutoAssignAllEmpty();
				}
			}
			else
			{
				GUILayout.Label("仅查看(需要补货权限)", _hostOnlyStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			}
			if (GUILayout.Button("刷新", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
			{
				ShelfManager.RefreshShelfList();
				_expandedShelfIndex = -1;
				_pickingSlot = -2;
			}
			GUILayout.FlexibleSpace();
			GUILayout.Label($"{_cachedShelves.Count} 个货架", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			GUILayout.EndHorizontal();
			GUILayout.Space(2f);
			_shelfScrollPos = GUILayout.BeginScrollView(_shelfScrollPos, Array.Empty<GUILayoutOption>());
			for (int i = 0; i < _cachedShelves.Count; i++)
			{
				DrawShelfEntry(i, flag);
			}
			GUILayout.EndScrollView();
		}

		private static void DrawShelfEntry(int index, bool canManage)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			ShelfManager.ShelfInfo shelf = _cachedShelves[index];
			bool flag = _expandedShelfIndex == index;
			GUILayout.BeginHorizontal(flag ? _expandedBg : GUIStyle.none, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(flag ? "v" : ">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }))
			{
				_expandedShelfIndex = (flag ? (-1) : index);
				_pickingSlot = -2;
				_productScrollPos = Vector2.zero;
			}
			GUILayout.Label(shelf.Name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			GUILayout.Label($"类型{shelf.ContainerClass}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			GUILayout.Label($"{shelf.FilledSlots}/{shelf.TotalSlots}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			if (shelf.FilledSlots == 0)
			{
				GUILayout.Label("(空)", _emptyStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			}
			else if (shelf.IsMixed)
			{
				int num = shelf.DistinctProducts - 1;
				GUILayout.Label(ShelfManager.GetProductName(shelf.PrimaryProductId) + $" +{num}种", _mixedStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			}
			else
			{
				GUILayout.Label(ShelfManager.GetProductName(shelf.PrimaryProductId), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			}
			if (canManage)
			{
				if (shelf.FilledSlots > 0 && shelf.FilledSlots < shelf.TotalSlots && !shelf.IsMixed && GUILayout.Button("填充", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }))
				{
					FillShelfDirect(shelf.Container, shelf.PrimaryProductId);
					ShelfManager.RefreshShelfList();
				}
				if (shelf.FilledSlots > 0 && GUILayout.Button("清除", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }))
				{
					ClearShelfDirect(shelf.Container);
					_pickingSlot = -2;
					ShelfManager.RefreshShelfList();
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			if (flag)
			{
				DrawExpandedSlots(shelf, canManage);
			}
		}

		private static void DrawExpandedSlots(ShelfManager.ShelfInfo shelf, bool canManage)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)shelf.Container == (Object)null)
			{
				return;
			}
			int[] productInfoArray = shelf.Container.productInfoArray;
			if (productInfoArray == null)
			{
				return;
			}
			int num = productInfoArray.Length / 2;
			GUILayout.BeginVertical(_expandedBg, Array.Empty<GUILayoutOption>());
			for (int i = 0; i < num; i++)
			{
				int num2 = productInfoArray[i * 2];
				bool flag = num2 < 0;
				bool flag2 = _pickingSlot == i;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(25f);
				GUILayout.Label($"槽位{i + 1}:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
				if (flag)
				{
					GUILayout.Label("(空)", _slotEmptyStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
					if (canManage)
					{
						if (flag2)
						{
							if (GUILayout.Button("取消", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
							{
								_pickingSlot = -2;
							}
						}
						else if (GUILayout.Button("分配", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
						{
							_pickingSlot = i;
							_productScrollPos = Vector2.zero;
						}
					}
				}
				else
				{
					GUILayout.Label(ShelfManager.GetProductName(num2), _slotStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
					if (canManage && GUILayout.Button("清除", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
					{
						ClearSlotDirect(shelf.Container, i);
						ShelfManager.RefreshShelfList();
					}
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			if (canManage && shelf.FilledSlots < num)
			{
				GUILayout.Space(2f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(25f);
				if (_pickingSlot == -1)
				{
					if (GUILayout.Button("取消", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
					{
						_pickingSlot = -2;
					}
				}
				else if (GUILayout.Button("为所有空槽位选择产品...", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
				{
					_pickingSlot = -1;
					_productScrollPos = Vector2.zero;
				}
				GUILayout.EndHorizontal();
			}
			if (canManage && _pickingSlot >= -1)
			{
				DrawInlineProductPicker(shelf);
			}
			GUILayout.EndVertical();
		}

		private static void DrawInlineProductPicker(ShelfManager.ShelfInfo shelf)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)shelf.Container == (Object)null)
			{
				return;
			}
			List<ShelfManager.ProductInfo> compatibleProducts = ShelfManager.GetCompatibleProducts(shelf.ContainerClass);
			if (compatibleProducts.Count == 0)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(25f);
				GUILayout.Label("没有已解锁的兼容产品。", _emptyStyle, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				return;
			}
			string obj = ((_pickingSlot >= 0) ? $"为槽位 {_pickingSlot + 1} 选择产品:" : "为所有空槽位选择产品:");
			GUILayout.Space(3f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Space(25f);
			GUILayout.Label(obj, _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			_productScrollPos = GUILayout.BeginScrollView(_productScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(110f) });
			for (int i = 0; i < compatibleProducts.Count; i++)
			{
				int id = compatibleProducts[i].Id;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(30f);
				GUILayout.Label(ShelfManager.GetProductName(id), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
				GUILayout.Label(compatibleProducts[i].Brand, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				GUILayout.Label($"T{compatibleProducts[i].Tier}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(25f) });
				if (_pickingSlot >= 0)
				{
					if (GUILayout.Button("设槽位", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) }))
					{
						AssignSlotDirect(shelf.Container, _pickingSlot, id);
						_pickingSlot = -2;
						ShelfManager.RefreshShelfList();
					}
					if (GUILayout.Button("设全部", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) }))
					{
						AssignProductToShelfDirect(shelf.Container, id);
						_pickingSlot = -2;
						ShelfManager.RefreshShelfList();
					}
				}
				else if (GUILayout.Button("设全部", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) }))
				{
					AssignProductToShelfDirect(shelf.Container, id);
					_pickingSlot = -2;
					ShelfManager.RefreshShelfList();
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}

		private static void DrawEnhancementTab()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if ((Object)NPC_Manager.Instance == (Object)null)
			{
				GUILayout.Label("未在游戏中。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("补货提醒", (_enhanceSubTab == 0) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				_enhanceSubTab = 0;
			}
			if (GUILayout.Button("快速雇佣", (_enhanceSubTab == 1) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				_enhanceSubTab = 1;
			}
			if (GUILayout.Button("快速传送", (_enhanceSubTab == 2) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				_enhanceSubTab = 2;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			if (_enhanceSubTab == 0)
			{
				DrawRestockAlert();
			}
			else if (_enhanceSubTab == 1)
			{
				DrawQuickHire();
			}
			else if (_enhanceSubTab == 2)
			{
				DrawQuickTeleport();
			}
		}

		private static void DrawRestockAlert()
		{
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ShelfManager.CanManageShelves();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("扫描货架库存", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				EnhancementManager.ScanShelfStock();
			}
			if (flag && GUILayout.Button("全部采购", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }) && EnhancementManager.RestockAllLow() > 0)
			{
				EnhancementManager.ScanShelfStock();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			List<EnhancementManager.ShelfStockInfo> shelfStocks = EnhancementManager.GetShelfStocks();
			if (shelfStocks.Count == 0)
			{
				GUILayout.Label("点击[扫描货架库存]查看补货状态。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			int num = 0;
			foreach (EnhancementManager.ShelfStockInfo item in shelfStocks)
			{
				if (item.IsLow)
				{
					num++;
				}
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"共 {shelfStocks.Count} 种商品", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			if (num > 0)
			{
				GUILayout.Label($"{num} 种需补货", _redStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			}
			else
			{
				GUILayout.Label("库存充足", _greenStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(2f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("商品", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
			GUILayout.Label("槽位容量", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			GUILayout.Label("槽位余量", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			GUILayout.Label("未上架", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			GUILayout.Label("状态", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			if (flag)
			{
				GUILayout.Label("操作", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			}
			GUILayout.EndHorizontal();
			_enhanceScrollPos = GUILayout.BeginScrollView(_enhanceScrollPos, Array.Empty<GUILayoutOption>());
			foreach (EnhancementManager.ShelfStockInfo item2 in shelfStocks)
			{
				string text;
				GUIStyle val;
				if (item2.LowestSlotQty <= 0)
				{
					text = "缺货";
					val = _redStyle;
				}
				else if (item2.LowestSlotQty < 5)
				{
					text = "不足";
					val = _orangeStyle;
				}
				else
				{
					text = "充足";
					val = _greenStyle;
				}
				GUIStyle val2 = ((item2.LowestSlotQty <= 0) ? _redStyle : ((item2.LowestSlotQty < 5) ? _orangeStyle : _labelStyle));
				string text2 = ((item2.NotOnShelfCount > 0) ? $"{item2.NotOnShelfCount}" : "-");
				GUIStyle val3 = ((item2.NotOnShelfCount > 0) ? _redStyle : _labelStyle);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(item2.ProductName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
				GUILayout.Label($"{item2.MaxPerSlot}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
				GUILayout.Label($"{item2.LowestSlotQty}", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
				GUILayout.Label(text2, val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
				GUILayout.Label(text, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
				if (flag)
				{
					if (item2.LowestSlotQty < 5)
					{
						if (GUILayout.Button("+1箱", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) }))
						{
							EnhancementManager.RestockProduct(item2);
						}
					}
					else
					{
						GUILayout.Label("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
					}
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}

		private static int GetSkillValue(EnhancementManager.EmployeeInfo emp, int index)
		{
			return index switch
			{
				0 => emp.CashierValue, 
				1 => emp.RestockerValue, 
				2 => emp.StorageValue, 
				3 => emp.SecurityValue, 
				4 => emp.TechnicianValue, 
				5 => emp.OrderingValue, 
				6 => emp.ManufacturingValue, 
				_ => 0, 
			};
		}

		private static void DrawQuickHire()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0106: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			if (!ShelfManager.CanModifyResources())
			{
				GUILayout.Label("需要管理权限才能雇佣员工。", _hostOnlyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("刷新可雇佣列表", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }))
			{
				EnhancementManager.RefreshAvailableEmployees();
			}
			if (GUILayout.Button("全部雇佣", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				EnhancementManager.HireAllAvailable();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			if ((Object)NPC_Manager.Instance != (Object)null)
			{
				GUILayout.Label($"已雇佣: {NPC_Manager.Instance.numberOfHiredEmployees}/{NPC_Manager.Instance.maxEmployees}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			}
			GUILayout.Space(2f);
			List<EnhancementManager.EmployeeInfo> availableEmployees = EnhancementManager.GetAvailableEmployees();
			if (availableEmployees.Count == 0)
			{
				GUILayout.Label("点击[刷新可雇佣列表]查看今日可雇佣员工。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			_employeeScrollPos = GUILayout.BeginScrollView(_employeeScrollPos, Array.Empty<GUILayoutOption>());
			foreach (EnhancementManager.EmployeeInfo item in availableEmployees)
			{
				GUILayout.BeginVertical(_expandedBg, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(item.Name, _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
				GUILayout.Label($"薪资: ${item.Salary}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
				GUIStyle val = ((item.BestValue >= 7) ? _greenStyle : ((item.BestValue >= 4) ? _yellowStyle : _orangeStyle));
				GUILayout.Label($"最强: {_skillNames[item.BestSkill]}({item.BestValue})", val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
				if (GUILayout.Button("雇佣", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
				{
					EnhancementManager.HireEmployee(item.Index, item.Name);
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(10f);
				for (int i = 0; i < _skillNames.Length; i++)
				{
					int skillValue = GetSkillValue(item, i);
					GUIStyle val2 = ((skillValue >= 7) ? _greenStyle : ((skillValue >= 4) ? _yellowStyle : _labelStyle));
					GUILayout.Label($"{_skillNames[i]}:{skillValue}", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
				GUILayout.Space(2f);
			}
			GUILayout.EndScrollView();
		}

		private static void DrawQuickTeleport()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (!ShelfManager.CanManageShelves())
			{
				GUILayout.Label("需要补货或管理权限才能传送。", _hostOnlyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			EnhancementManager.InitPresetLocations();
			List<EnhancementManager.TeleportLocation> presetLocations = EnhancementManager.GetPresetLocations();
			GUILayout.Label("预设位置:", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			_teleportScrollPos = GUILayout.BeginScrollView(_teleportScrollPos, Array.Empty<GUILayoutOption>());
			for (int i = 0; i < presetLocations.Count; i++)
			{
				EnhancementManager.TeleportLocation teleportLocation = presetLocations[i];
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUIStyle val = ((i >= 6) ? _yellowStyle : _labelStyle);
				GUILayout.Label(teleportLocation.Name, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
				if (GUILayout.Button("传送", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
				{
					EnhancementManager.TeleportTo(teleportLocation.Position, teleportLocation.Rotation);
				}
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
			GUILayout.Space(8f);
			GUILayout.Label("保存当前位置:", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			_customLocationName = GUILayout.TextField(_customLocationName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			if (GUILayout.Button("保存", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }) && !string.IsNullOrEmpty(_customLocationName))
			{
				EnhancementManager.SaveCurrentPosition(_customLocationName);
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		private static void DrawAnalyticsTab()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if ((Object)GameData.Instance == (Object)null)
			{
				GUILayout.Label("未在游戏中。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("利润统计", (_analyticsSubTab == 0) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				_analyticsSubTab = 0;
			}
			if (GUILayout.Button("销售热力图", (_analyticsSubTab == 1) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				_analyticsSubTab = 1;
			}
			if (GUILayout.Button("每日收支", (_analyticsSubTab == 2) ? _tabActiveStyle : _tabInactiveStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				_analyticsSubTab = 2;
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			if (_analyticsSubTab == 0)
			{
				DrawProfitPanel();
			}
			else if (_analyticsSubTab == 1)
			{
				DrawSalesHeatmap();
			}
			else if (_analyticsSubTab == 2)
			{
				DrawDailyFinance();
			}
		}

		private static void DrawProfitPanel()
		{
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("计算利润", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
			{
				AnalyticsManager.CalculateProfits();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			List<AnalyticsManager.ProductProfitInfo> productProfits = AnalyticsManager.GetProductProfits();
			if (productProfits.Count == 0)
			{
				GUILayout.Label("点击[计算利润]查看各商品利润率。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			int num = 0;
			foreach (AnalyticsManager.ProductProfitInfo item in productProfits)
			{
				if (item.ProfitPerUnit < 0f)
				{
					num++;
				}
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"共 {productProfits.Count} 种商品", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			if (num > 0)
			{
				GUILayout.Label($"{num} 种亏本!", _redStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(2f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("商品", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
			GUILayout.Label("成本", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
			GUILayout.Label("售价", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
			GUILayout.Label("利润/件", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			GUILayout.Label("利润率", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
			GUILayout.Label("等级", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.EndHorizontal();
			_profitScrollPos = GUILayout.BeginScrollView(_profitScrollPos, Array.Empty<GUILayoutOption>());
			foreach (AnalyticsManager.ProductProfitInfo item2 in productProfits)
			{
				GUIStyle val = ((item2.ProfitPerUnit >= 0f) ? _profitPositiveStyle : _profitNegativeStyle);
				GUILayout.BeginHorizontal((item2.ProfitPerUnit < 0f) ? _redRowStyle : GUIStyle.none, Array.Empty<GUILayoutOption>());
				GUILayout.Label(item2.ProductName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
				GUILayout.Label($"${item2.InflatedCostPerUnit:F2}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
				GUILayout.Label($"${item2.SellingPrice:F2}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
				GUILayout.Label($"${item2.ProfitPerUnit:F2}", val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				GUILayout.Label($"{item2.ProfitMargin:F1}%", val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(65f) });
				GUILayout.Label($"T{item2.Tier}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}

		private static GUIStyle GetHeatLabelStyle(int heatLevel)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			if (!_heatStylesReady)
			{
				GUIStyle val = new GUIStyle(_labelStyle);
				val.normal.textColor = new Color(0.3f, 0.85f, 0.3f);
				_heatGreenStyle = val;
				GUIStyle val2 = new GUIStyle(_labelStyle);
				val2.normal.textColor = new Color(1f, 0.85f, 0.2f);
				_heatYellowStyle = val2;
				GUIStyle val3 = new GUIStyle(_labelStyle);
				val3.normal.textColor = new Color(1f, 0.6f, 0.2f);
				_heatOrangeStyle = val3;
				GUIStyle val4 = new GUIStyle(_labelStyle);
				val4.normal.textColor = new Color(1f, 0.3f, 0.3f);
				_heatRedStyle = val4;
				GUIStyle val5 = new GUIStyle(_labelStyle);
				val5.normal.textColor = new Color(0.8f, 0.2f, 0.8f);
				_heatPurpleStyle = val5;
				FontHelper.ApplyFont(_heatGreenStyle);
				FontHelper.ApplyFont(_heatYellowStyle);
				FontHelper.ApplyFont(_heatOrangeStyle);
				FontHelper.ApplyFont(_heatRedStyle);
				FontHelper.ApplyFont(_heatPurpleStyle);
				_heatStylesReady = true;
			}
			return (GUIStyle)(heatLevel switch
			{
				0 => _heatGreenStyle, 
				1 => _heatYellowStyle, 
				2 => _heatOrangeStyle, 
				3 => _heatRedStyle, 
				4 => _heatPurpleStyle, 
				_ => _labelStyle, 
			});
		}

		private static void DrawSalesHeatmap()
		{
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("刷新销售数据", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				AnalyticsManager.RefreshSalesHeat();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			List<AnalyticsManager.SalesHeatInfo> salesHeat = AnalyticsManager.GetSalesHeat();
			if (salesHeat.Count == 0)
			{
				GUILayout.Label("点击[刷新销售数据]查看商品销售状态。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("图例:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			GUILayout.Label("畅销", _greenStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) });
			GUILayout.Label("太贵", _yellowStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) });
			GUILayout.Label("库存低", _orangeStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			GUILayout.Label("缺货", _redStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) });
			GUILayout.Label("找不到", _purpleStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
			GUILayout.EndHorizontal();
			GUILayout.Space(2f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("商品", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			GUILayout.Label("货架库存", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			GUILayout.Label("状态", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			GUILayout.Label("标记", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.EndHorizontal();
			_heatScrollPos = GUILayout.BeginScrollView(_heatScrollPos, Array.Empty<GUILayoutOption>());
			foreach (AnalyticsManager.SalesHeatInfo item in salesHeat)
			{
				GUIStyle heatLabelStyle = GetHeatLabelStyle(item.HeatLevel);
				string text = "";
				if (item.IsTooExpensive)
				{
					text += "太贵 ";
				}
				if (item.IsNotFound)
				{
					text += "找不到 ";
				}
				if (item.OnShelfQty <= 0)
				{
					text += "缺货 ";
				}
				else if (item.OnShelfQty <= 5)
				{
					text += "库存低 ";
				}
				if (string.IsNullOrEmpty(text))
				{
					text = "正常";
				}
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(item.ProductName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
				GUILayout.Label($"{item.OnShelfQty}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				GUILayout.Label(AnalyticsManager.GetHeatLabel(item.HeatLevel), heatLabelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				GUILayout.Label(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}

		private static void DrawDailyFinance()
		{
			AnalyticsManager.DailyFinanceInfo dailyFinance = AnalyticsManager.GetDailyFinance();
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"第 {dailyFinance.GameDay} 天财务概览", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (GUILayout.Button("刷新", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
			{
				AnalyticsManager.RefreshDailyFinance();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.Label("-- 收入 --", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("日收益:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUIStyle val = ((dailyFinance.DayBenefits >= 0f) ? _profitPositiveStyle : _profitNegativeStyle);
			GUILayout.Label($"${dailyFinance.DayBenefits:F2}", val, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.Label("-- 支出 --", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("商品采购:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"-${dailyFinance.MoneySpentOnProducts:F2}", _redStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("员工薪资:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"-${dailyFinance.EmployeesCost:F2}", _redStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("租金:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"-${dailyFinance.RentCost:F2}", _redStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("电费:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"-${dailyFinance.LightCost:F2}", _redStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("其他费用:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"-${dailyFinance.OtherCosts:F2}", _redStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUIStyle val2 = ((dailyFinance.NetProfit >= 0f) ? _profitPositiveStyle : _profitNegativeStyle);
			GUILayout.BeginHorizontal(_expandedBg, Array.Empty<GUILayoutOption>());
			GUILayout.Label("净利润:", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"${dailyFinance.NetProfit:F2}", val2, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.Space(12f);
			GUILayout.Label("-- 其他统计 --", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("今日顾客:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"{dailyFinance.DailyCustomers}", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("被抢劫:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"{dailyFinance.TimesRobbed}次 (损失${dailyFinance.MoneyLostRobbing:F2})", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("卫生投诉:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			GUILayout.Label($"{dailyFinance.FilthComplaints}次", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
		}

		private static void DrawPriceTab()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			ProductListing instance = ProductListing.Instance;
			if ((Object)instance == (Object)null)
			{
				GUILayout.Label("ProductListing 不可用,请确认是否在游戏中。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("自动定价全部", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }))
			{
				PriceManager.AutoPriceAll(instance);
			}
			if (GUILayout.Button("-10%", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
			{
				Plugin.PriceMarkupPercent.Value = Mathf.Max(0f, Plugin.PriceMarkupPercent.Value - 10f);
			}
			GUILayout.Label($"加价: {Plugin.PriceMarkupPercent.Value:F0}%", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			if (GUILayout.Button("+10%", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
			{
				ConfigEntry<float> priceMarkupPercent = Plugin.PriceMarkupPercent;
				priceMarkupPercent.Value += 10f;
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(2f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("名称", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
			GUILayout.Label("品牌", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			GUILayout.Label("等级", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.Label("基础价", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
			GUILayout.Label("当前价", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			GUILayout.Label("新价格", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(75f) });
			GUILayout.Label("", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.Label("自动价", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
			GUILayout.EndHorizontal();
			_priceScrollPos = GUILayout.BeginScrollView(_priceScrollPos, Array.Empty<GUILayoutOption>());
			List<int> availableProducts = instance.availableProducts;
			if (availableProducts != null)
			{
				HashSet<int> hashSet = null;
				try
				{
					List<int> list = GameData.Instance?.lastDayTooExpensiveList;
					if (list != null && list.Count > 0)
					{
						hashSet = new HashSet<int>(list);
					}
				}
				catch
				{
				}
				for (int i = 0; i < availableProducts.Count; i++)
				{
					int num = availableProducts[i];
					DrawProductRow(instance, num, hashSet?.Contains(num) ?? false);
				}
			}
			GUILayout.EndScrollView();
		}

		private static void DrawProductRow(ProductListing pl, int productId, bool isExpensive)
		{
			if (productId < 0 || productId >= pl.productsData.Length)
			{
				return;
			}
			ProductData val = pl.productsData[productId];
			if (val != null)
			{
				GUILayout.BeginHorizontal(isExpensive ? _redRowStyle : GUIStyle.none, Array.Empty<GUILayoutOption>());
				GUILayout.Label(ShelfManager.GetProductName(productId), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) });
				GUILayout.Label(val.productBrand.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
				GUILayout.Label(val.productTier.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
				GUILayout.Label(val.basePricePerUnit.ToString("F2", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
				float num = 0f;
				if (pl.productPlayerPricing != null && productId < pl.productPlayerPricing.Length)
				{
					num = pl.productPlayerPricing[productId];
				}
				GUILayout.Label(num.ToString("F2", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
				if (!_priceInputs.ContainsKey(productId))
				{
					_priceInputs[productId] = num.ToString("F2", CultureInfo.InvariantCulture);
				}
				_priceInputs[productId] = GUILayout.TextField(_priceInputs[productId], (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(75f) });
				if (GUILayout.Button("设", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) }) && _priceInputs.ContainsKey(productId) && float.TryParse(_priceInputs[productId], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
				{
					result = Mathf.Max(0f, (float)Math.Round(result, 2));
					pl.CmdUpdateProductPrice(productId, result);
					_priceInputs[productId] = result.ToString("F2", CultureInfo.InvariantCulture);
				}
				GUILayout.Label(PriceManager.CalcAutoPrice(val, pl).ToString("F2", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
				GUILayout.EndHorizontal();
			}
		}

		private static void DrawCheatTab()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GameData instance = GameData.Instance;
			bool num = (Object)instance != (Object)null;
			bool flag = ShelfManager.CanModifyResources();
			if (!num)
			{
				GUILayout.Label("未在游戏中。", _emptyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			if (!flag)
			{
				GUILayout.Label("需要管理权限才能修改资源。", _hostOnlyStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("当前金钱:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			GUILayout.Label($"${instance.gameFunds:F2}", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("增加金额:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			_moneyInput = GUILayout.TextField(_moneyInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			if (GUILayout.Button("+增加", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }) && float.TryParse(_moneyInput, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				instance.CmdAlterFundsWithoutExperience(result);
				Plugin.Logger.LogInfo((object)$"已增加金钱: +${result:F2}");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("+$1,000", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.CmdAlterFundsWithoutExperience(1000f);
				Plugin.Logger.LogInfo((object)"已增加金钱: +$1,000");
			}
			if (GUILayout.Button("+$5,000", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.CmdAlterFundsWithoutExperience(5000f);
				Plugin.Logger.LogInfo((object)"已增加金钱: +$5,000");
			}
			if (GUILayout.Button("+$10,000", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.CmdAlterFundsWithoutExperience(10000f);
				Plugin.Logger.LogInfo((object)"已增加金钱: +$10,000");
			}
			if (GUILayout.Button("+$50,000", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.CmdAlterFundsWithoutExperience(50000f);
				Plugin.Logger.LogInfo((object)"已增加金钱: +$50,000");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(16f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("当前特权点:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			GUILayout.Label($"{instance.gameFranchisePoints}", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("增加点数:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			_franchiseInput = GUILayout.TextField(_franchiseInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			if (GUILayout.Button("+增加", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }) && int.TryParse(_franchiseInput, out var result2))
			{
				instance.NetworkgameFranchisePoints = instance.gameFranchisePoints + result2;
				Plugin.Logger.LogInfo((object)$"已增加特权点: +{result2}");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("+5", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.NetworkgameFranchisePoints = instance.gameFranchisePoints + 5;
				Plugin.Logger.LogInfo((object)"已增加特权点: +5");
			}
			if (GUILayout.Button("+10", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.NetworkgameFranchisePoints = instance.gameFranchisePoints + 10;
				Plugin.Logger.LogInfo((object)"已增加特权点: +10");
			}
			if (GUILayout.Button("+50", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.NetworkgameFranchisePoints = instance.gameFranchisePoints + 50;
				Plugin.Logger.LogInfo((object)"已增加特权点: +50");
			}
			if (GUILayout.Button("+100", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				instance.NetworkgameFranchisePoints = instance.gameFranchisePoints + 100;
				Plugin.Logger.LogInfo((object)"已增加特权点: +100");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(12f);
			if (GUILayout.Button("刷新当前数值", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				ReadCurrentValues();
			}
			GUILayout.Space(16f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("建筑碎块:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			if (GUILayout.Button("一键清理所有碎块", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				ClearAllDebris();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("空箱子:", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			if (GUILayout.Button("一键回收所有空箱", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				int num2 = EnhancementManager.SellEmptyBoxes();
				if (num2 > 0)
				{
					Plugin.Logger.LogInfo((object)$"已出售 {num2} 个空箱");
				}
			}
			GUILayout.EndHorizontal();
		}

		private static int GetInitQty(int productId)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ProductListing instance = ProductListing.Instance;
			if ((