Decompiled source of AddItem v4.0.0

BepInEx/plugins/Additems/cs.HoLMod.AddItem.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using YuanAPI;
using cs.HoLMod.AddItem.Views;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("cs.HoLMod.AddItem")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+afc8ba5c886680161fa3bd6fae2540bcd81776aa")]
[assembly: AssemblyProduct("cs.HoLMod.AddItem")]
[assembly: AssemblyTitle("cs.HoLMod.AddItem")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 cs.HoLMod.AddItem
{
	[BepInPlugin("cs.HoLMod.AddItem.AnZhi20", "HoLMod.AddItem", "4.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AddItem : BaseUnityPlugin
	{
		public const string MODGUID = "cs.HoLMod.AddItem.AnZhi20";

		public const string MODNAME = "HoLMod.AddItem";

		public const string VERSION = "4.0.0";

		internal static ManualLogSource Logger;

		internal static string LocaleNamespace = "AddItem";

		private static IAddItemModel _model;

		private static IAddItemView _view;

		private static AddItemController _controller;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			CheckConfigVersion();
			LoadLocalizations();
		}

		private void Start()
		{
			Localization.OnLanguageChanged += ItemData.RefreshText;
			ItemData.RefreshText(Localization.GetLocale(Mainload.SetData[4]));
			ItemData.RefreshProp();
			InitializeMVC();
			Logger.LogInfo((object)"物品添加器初始化完毕");
		}

		private void CheckConfigVersion()
		{
			//IL_0011: 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_0030: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			ConfigEntry<string> val = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("内部配置", "已加载版本"), "4.0.0", new ConfigDescription("用于跟踪插件版本,请勿手动修改", (AcceptableValueBase)null, Array.Empty<object>()));
			if (!(val.Value == "4.0.0"))
			{
				Logger.LogInfo((object)"检测到插件版本更新至 4.0.0,配置更新");
				val.Value = "4.0.0";
			}
		}

		private static void LoadLocalizations()
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string directoryName = Path.GetDirectoryName(executingAssembly.Location);
			Localization.LoadFromPath(directoryName);
		}

		private static void InitializeMVC()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			_model = new AddItemModule();
			GameObject val = new GameObject("AddItemUI");
			val.AddComponent<IMGUIAddItemView>();
			val.AddComponent<IFloatingView>();
			Object.DontDestroyOnLoad((Object)(object)val);
			_view = val.GetComponent<IMGUIAddItemView>();
			_view.Initialize(_model);
			_controller = new AddItemController(_model, _view);
		}
	}
	public class AddItemController
	{
		private IAddItemModel _model;

		private IAddItemView _view;

		private LocalizationInstance _i18N;

		private List<string> _mapArea = new List<string>(4) { "4", "9", "16", "25" };

		internal AddItemController(IAddItemModel model, IAddItemView view)
		{
			_model = model;
			_view = view;
			_i18N = Localization.CreateInstance("zh-CN", AddItem.LocaleNamespace, true);
			BindView();
		}

		private void BindView()
		{
			_view.OnFilterChanged += FilteredProps;
			_view.OnCountInputChanged += CheckCountInput;
			_view.OnAddButton += CallAddButton;
		}

		private void FilteredProps()
		{
			int propClass = (int)((!_view.SelectedPropClass.HasValue) ? ((PropClass)(-1)) : _view.SelectedPropClass.Value);
			_model.FilterItems(propClass, _view.SearchText);
		}

		private void CheckCountInput()
		{
			if (!int.TryParse(_view.CountInput, out var result))
			{
				_view.CountInput = "1";
				return;
			}
			switch (_view.PanelTab)
			{
			case MenuTab.Currency:
			{
				CurrencyClass selectedCurrency = _view.SelectedCurrency;
				if (1 == 0)
				{
				}
				int num2 = selectedCurrency switch
				{
					CurrencyClass.Coins => Mathf.Clamp(result, 1, 1000000000), 
					CurrencyClass.Gold => Mathf.Clamp(result, 1, 1000000), 
					_ => throw new ArgumentOutOfRangeException(), 
				};
				if (1 == 0)
				{
				}
				result = num2;
				_view.CountInput = result.ToString();
				break;
			}
			case MenuTab.Items:
			{
				int num = int.Parse(Mainload.FamilyData[5]);
				num = ((num < 1) ? 1 : num);
				_view.CountInput = Mathf.Clamp(result, 1, num).ToString();
				break;
			}
			case MenuTab.Stories:
				_view.CountInput = "1";
				break;
			case MenuTab.Map:
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}

		private void CallAddButton()
		{
			switch (_view.PanelTab)
			{
			case MenuTab.Currency:
				CheckCountInput();
				WhenAddCurrency();
				break;
			case MenuTab.Items:
				CheckCountInput();
				WhenAddItem();
				break;
			case MenuTab.Stories:
				CheckCountInput();
				WhenAddStories();
				break;
			case MenuTab.Horses:
				WhenAddHorses();
				break;
			case MenuTab.Map:
				WhenAddMaps();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}

		private void WhenAddCurrency()
		{
			switch (_view.SelectedCurrency)
			{
			case CurrencyClass.Coins:
				_model.AddCoins(int.Parse(_view.CountInput));
				break;
			case CurrencyClass.Gold:
				_model.AddGold(int.Parse(_view.CountInput));
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}

		private void WhenAddItem()
		{
			if (!_view.SelectedPropId.HasValue)
			{
				MsgTool.TipMsg(_i18N.t("Tip.SelectedNone"), (TipLv)0);
			}
			else
			{
				_model.AddProp(_view.SelectedPropId.Value, int.Parse(_view.CountInput));
			}
		}

		private void WhenAddStories()
		{
			if (!_view.SelectedBookId.HasValue)
			{
				MsgTool.TipMsg(_i18N.t("Tip.SelectedNone"), (TipLv)0);
			}
			else
			{
				_model.AddStoriesBook(_view.SelectedBookId.Value);
			}
		}

		private void WhenAddHorses()
		{
			if (!_view.SelectedHorseId.HasValue)
			{
				MsgTool.TipMsg(_i18N.t("Tip.SelectedNone"), (TipLv)0);
			}
			else
			{
				_model.AddHorse(_view.SelectedHorseId.Value);
			}
		}

		private void WhenAddMaps()
		{
			int selectedJunId = _view.SelectedJunId;
			int selectedXianId = _view.SelectedXianId;
			string selectedArea = _view.SelectedArea;
			switch (_view.SelectedMap)
			{
			case MapTab.Mansion:
				_model.AddMansion(selectedJunId, selectedXianId, GetName());
				break;
			case MapTab.Farm:
				if (!CheckArea(selectedArea))
				{
					MsgTool.TipMsg("无效面积", (TipLv)0);
				}
				else
				{
					_model.AddFarm(selectedJunId, selectedXianId, selectedArea, GetName());
				}
				break;
			case MapTab.Fief:
				_model.AddFief(selectedJunId);
				break;
			case MapTab.Clan:
				_model.AddClan(selectedJunId, selectedXianId);
				break;
			case MapTab.Cemetery:
				if (!CheckArea(selectedArea))
				{
					MsgTool.TipMsg("无效面积", (TipLv)0);
				}
				else
				{
					_model.AddCemetery(selectedJunId, selectedXianId, selectedArea, GetName());
				}
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}

		private bool CheckArea(string area)
		{
			return _mapArea.Contains(area);
		}

		private string GetName()
		{
			string nameInput = _view.NameInput;
			if (!string.IsNullOrWhiteSpace(nameInput))
			{
				return nameInput;
			}
			switch (_view.SelectedMap)
			{
			case MapTab.Mansion:
				nameInput = RandName.GetFudiName();
				break;
			case MapTab.Farm:
				nameInput = RandName.GetNongZName();
				break;
			case MapTab.Fief:
			case MapTab.Clan:
			case MapTab.Cemetery:
				nameInput = RandName.GetMudiName();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			return nameInput;
		}
	}
	public class AddItemModule : IAddItemModel
	{
		private Random Random = new Random();

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private List<int> <FilteredProps>k__BackingField;

		private LocalizationInstance _i18N;

		private LocalizationInstance _vStr;

		public List<int> FilteredProps
		{
			[CompilerGenerated]
			get
			{
				return <FilteredProps>k__BackingField;
			}
			private set
			{
				<FilteredProps>k__BackingField = value;
				this.OnFilteredPropsChanged?.Invoke();
			}
		}

		public event Action OnFilteredPropsChanged;

		internal AddItemModule()
		{
			_i18N = Localization.CreateInstance("zh-CN", AddItem.LocaleNamespace, true);
			_vStr = Localization.CreateInstance("zh-CN", "Vanilla", true);
			FilteredProps = ItemData.AllProps;
		}

		public void FilterItems(int propClass = -1, string search = "")
		{
			List<int> list = ((propClass == -1) ? ItemData.AllProps : ItemData.ClassifiedProps[propClass]);
			if (string.IsNullOrEmpty(search))
			{
				FilteredProps = list;
				return;
			}
			search = search.ToLower();
			FilteredProps = list.Where((int index) => _vStr.t($"Text_AllProp.{index}").ToLower().Contains(search)).ToList();
		}

		public void AddCoins(int count)
		{
			FormulaData.ChangeCoins(count);
			ShowInfo(_i18N.t("Tip.AddCoins.Succeed", new object[1] { count }));
		}

		public void AddGold(int count)
		{
			int num = int.Parse(Mainload.CGNum[1]);
			Mainload.CGNum[1] = (num + count).ToString();
			ShowInfo(_i18N.t("Tip.AddGold.Succeed", new object[1] { count }));
		}

		public void AddProp(int propId, int propCount)
		{
			if (PropTool.AddProp(propId, propCount, true, false))
			{
				ShowInfo(_i18N.t("Tip.AddItem.Succeed", new object[2]
				{
					_vStr.t($"Text_AllProp.{propId}"),
					propCount
				}));
			}
			else
			{
				ShowWarning(_i18N.t("Tip.AddItem.Failed", new object[2]
				{
					_vStr.t($"Text_AllProp.{propId}"),
					propCount
				}));
			}
		}

		public void AddStoriesBook(int bookId)
		{
			if (bookId < 0 || bookId >= ItemData.StoriesList.Count)
			{
				ShowWarning(_i18N.t("Tip.AddStories.None", new object[1] { bookId }));
			}
			else if (!CheckIfBookExists(bookId))
			{
				Mainload.XiQuHave_Now.Add(new List<string>(3)
				{
					bookId.ToString(),
					"",
					"100"
				});
				ShowInfo(_i18N.t("Tip.AddStories.Succeed", new object[1] { ItemData.StoriesList[bookId] }));
			}
			else
			{
				ShowWarning(_i18N.t("Tip.AddStories.Failed", new object[1] { ItemData.StoriesList[bookId] }));
			}
		}

		private static bool CheckIfBookExists(int bookId)
		{
			if (Mainload.XiQuHave_Now == null || Mainload.XiQuHave_Now.Count == 0)
			{
				return false;
			}
			string bookIdStr = bookId.ToString();
			return Mainload.XiQuHave_Now.Any((List<string> book) => book[0] == bookIdStr);
		}

		public void AddHorse(int UIId)
		{
			if (int.Parse(Mainload.FamilyData[6]) > 0)
			{
				Mainload.Horse_Have.Add(new List<string>
				{
					$"{UIId}",
					"1",
					Random.Next(10, 20).ToString(),
					"100",
					"100",
					"100",
					null
				});
				Mainload.FamilyData[6] = (int.Parse(Mainload.FamilyData[6]) - 1).ToString();
				ShowInfo(_i18N.t("Tip.AddHorse.Succeed"));
			}
			else
			{
				ShowWarning(_i18N.t("Tip.AddHorse.Failed"));
			}
		}

		public void AddMansion(int junId, int xianId, string name)
		{
			if (!ValidateJunUnlocked(junId) || CheckLocationOccupied(junId, xianId))
			{
				return;
			}
			List<string> item = new List<string>
			{
				$"{junId}|{xianId}",
				name,
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"1",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"0",
				"25",
				"0",
				"0"
			};
			try
			{
				Mainload.Fudi_now.Add(item);
				Mainload.NewCreateShijia.Add($"{junId}|{xianId}|-1");
				ShowInfo("已在(" + GetLocationName(junId, xianId) + ")添加府邸");
				Mainload.SceneID = "M|" + (Mainload.Fudi_now.Count - 1);
			}
			catch (Exception ex)
			{
				throw new Exception("Fail to add Mansion: " + ex.Message, ex);
			}
		}

		public void AddFarm(int junId, int xianId, string area, string name)
		{
			if (!ValidateJunUnlocked(junId) || CheckLocationOccupied(junId, xianId))
			{
				return;
			}
			string text = $"{junId}|{xianId}";
			List<string> list = new List<string>
			{
				"-1",
				"null",
				GetFertilityString(),
				"1",
				text,
				area,
				name,
				"0",
				"0",
				"null",
				(TrueRandom.GetRanom(80) + 20).ToString(),
				"0",
				"0",
				"0",
				"null",
				"null",
				"null",
				Mainload.Time_now[0].ToString(),
				"null",
				"null",
				"null",
				"null",
				"null",
				"null",
				"0|0|0",
				(Mainload.Time_now[0] - 1).ToString(),
				"5|3|2"
			};
			int num = -1;
			for (int i = 0; i < Mainload.NongZ_now[0].Count; i++)
			{
				if (!(Mainload.NongZ_now[0][i][0] == "-1") && !(Mainload.NongZ_now[0][i][4] != text))
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				Mainload.NongZ_now[0].Add(list);
				num = Mainload.NongZ_now[0].Count - 1;
			}
			else
			{
				Mainload.NongZ_now[0][num] = list;
			}
			try
			{
				Mainload.NongZ_now[0].Add(list);
				SaveData.SaveBuild("Z", "0", num.ToString(), true);
				Mainload.ZhuangTou_now[0].Add(new List<List<string>>());
				Mainload.NongzHaveData.Add("0|" + num);
				ShowInfo(_i18N.t("Tip.Farm.AddSucceed", GetLocationName(junId, xianId)));
				Mainload.SceneID = "Z|0|" + num;
			}
			catch (Exception ex)
			{
				throw new Exception("Fail to add Farm: " + ex.Message, ex);
			}
			string GetFertilityString()
			{
				int num2 = int.Parse(area);
				List<string> list2 = new List<string>();
				for (int j = 0; j < 25; j++)
				{
					list2.Add((j < num2) ? "1" : "0");
				}
				return string.Join("|", list2);
			}
		}

		public void AddFief(int junId)
		{
			if (ValidateJunUnlocked(junId))
			{
				if (Mainload.Fengdi_now[++junId][0] == "1")
				{
					ShowInfo(_i18N.t("Tip.Fief.AlreadyUnlocked", ItemData.JunList[junId]));
					return;
				}
				Mainload.Fengdi_now[junId][0] = "1";
				ShowInfo(_i18N.t("Tip.Fief.UnlockSucceed", ItemData.JunList[junId]));
			}
		}

		public void AddClan(int junId, int xianId)
		{
			ShowWarning("添加世家功能正在开发中");
		}

		public void AddCemetery(int junId, int xianId, string area, string name)
		{
			AddFarm(junId, xianId, area, name);
			if (name != "null")
			{
				int num = int.Parse(Mainload.SceneID.Split(new char[1] { '|' })[1]);
				int num2 = int.Parse(Mainload.SceneID.Split(new char[1] { '|' })[2]);
				if (num2 < Mainload.Mudi_now[num].Count)
				{
					Mainload.Mudi_now[num][num2] = new List<string>
					{
						Mainload.NongZ_now[num][num2][4],
						name,
						Mainload.NongZ_now[num][num2][5],
						"0",
						Mainload.Time_now[0] + "|" + Mainload.Time_now[1],
						"0",
						"0",
						"0",
						"0",
						"0"
					};
				}
				else
				{
					int num3 = 0;
					while (num2 >= Mainload.Mudi_now[num].Count)
					{
						Mainload.Mudi_now[num].Add(new List<string>());
						num3++;
					}
					Mainload.Mudi_now[num][num2] = new List<string>
					{
						Mainload.NongZ_now[num][num2][4],
						name,
						Mainload.NongZ_now[num][num2][5],
						"0",
						Mainload.Time_now[0] + "|" + Mainload.Time_now[1],
						"0",
						"0",
						"0",
						"0",
						"0"
					};
				}
				Mainload.NongZ_now[num][num2][0] = "-2";
				Mainload.NongZ_now[num][num2][8] = "2";
				if (num == 0)
				{
					Mainload.NewCreateMudi.Add(Mainload.Mudi_now[num][num2][0] + "|" + num2);
				}
				for (int i = 0; i < Mainload.NongzHaveData.Count; i++)
				{
					if (Mainload.NongzHaveData[i] == num + "|" + num2)
					{
						Mainload.NongzHaveData.RemoveAt(i);
						break;
					}
				}
				Mainload.SceneID = "L|@|$".Replace("@", num.ToString()).Replace("$", num2.ToString());
				Mainload.isFNongZPanelOpen = false;
				Mainload.isKuaiToSceneInit = true;
			}
			else
			{
				Mainload.Tip_Show.Add(new List<string>
				{
					"1",
					AllText.Text_TipShow[66][Mainload.SetData[4]]
				});
				ShowInfo(_i18N.t("Tip.FarmToCemetery", GetLocationName(junId, xianId)));
			}
		}

		private static bool ValidateJunUnlocked(int junId)
		{
			string text = Mainload.CityData_now[junId][0][0].Split(new char[1] { '|' })[0];
			if (text == "-1")
			{
				return true;
			}
			ShowWarning(ItemData.JunList[junId] + "未解锁或郡城叛军未清剿,无法添加");
			return false;
		}

		private static bool CheckLocationOccupied(int junId, int xianId)
		{
			string locationKey = $"{junId}|{xianId}";
			if (Mainload.Fudi_now.Any((List<string> mansion) => mansion[0] == locationKey) || Mainload.NongZ_now[0].Any((List<string> farm) => farm[0] == "-1" && farm[4] == locationKey))
			{
				ShowWarning(GetLocationName(junId, xianId) + "已有其他建筑,添加失败");
				return true;
			}
			return false;
		}

		private static string GetLocationName(int junId, int xianId)
		{
			return ItemData.JunList[junId] + "-" + ItemData.XianList[junId][xianId];
		}

		private static void ShowWarning(string message)
		{
			MsgTool.TipMsg(message, (TipLv)1);
			AddItem.Logger.LogWarning((object)message);
		}

		private static void ShowInfo(string message)
		{
			MsgTool.TipMsg(message, (TipLv)0);
			AddItem.Logger.LogInfo((object)message);
		}
	}
	public enum CurrencyClass
	{
		Coins,
		Gold
	}
	public enum MapTab
	{
		Mansion,
		Farm,
		Fief,
		Clan,
		Cemetery
	}
	public enum MenuTab
	{
		Currency,
		Items,
		Stories,
		Horses,
		Map
	}
	public enum PropClass
	{
		Special = 0,
		Other = 1,
		Snack = 3,
		Textile = 4,
		Mineral = 5,
		Rouge = 6,
		Jewelry = 7,
		Book = 9,
		Ink = 10,
		Art = 11,
		Antique = 12,
		Weapon = 13,
		TeaSet = 14,
		Incense = 15,
		Vase = 16,
		Wine = 17,
		Music = 18,
		Pelt = 19,
		Spell = 20,
		Poison = 21,
		Produce = 22,
		Medicine = 23
	}
	public interface IAddItemModel
	{
		List<int> FilteredProps { get; }

		event Action OnFilteredPropsChanged;

		void FilterItems(int propClass = -1, string search = "");

		void AddCoins(int count);

		void AddGold(int count);

		void AddProp(int propId, int propCount);

		void AddStoriesBook(int bookId);

		void AddMansion(int junId, int xianId, string name);

		void AddFarm(int junId, int xianId, string area, string name);

		void AddFief(int junId);

		void AddClan(int junId, int xianId);

		void AddCemetery(int junId, int xianId, string area, string name);

		void AddHorse(int UIId);
	}
	public static class ItemData
	{
		internal static List<int> AllProps;

		internal static List<List<int>> ClassifiedProps;

		internal static List<string> StoriesList;

		internal static List<string> HorsesList;

		internal static List<string> JunList;

		internal static List<List<string>> XianList;

		internal static void RefreshText(string local)
		{
			LocalizationInstance val = Localization.CreateInstance(local, "Vanilla", false);
			StoriesList = new List<string>();
			int count = AllText.Text_AllXiQu.Count;
			for (int i = 0; i < count; i++)
			{
				string item = val.t($"Text_AllXiQu.{i}").Split(new char[1] { '|' })[0];
				StoriesList.Add(item);
			}
			HorsesList = new List<string>();
			int num = 10;
			for (int j = 0; j < num; j++)
			{
				string item2 = $"{j}";
				HorsesList.Add(item2);
			}
			JunList = new List<string>();
			XianList = new List<List<string>>();
			int count2 = AllText.Text_City.Count;
			for (int k = 0; k < count2; k++)
			{
				string[] array = val.t($"Text_City.{k}").Split(new char[1] { '~' });
				JunList.Add(array[0]);
				array = array[1].Split(new char[1] { '|' });
				XianList.Add(array.ToList());
			}
		}

		internal static void RefreshProp()
		{
			AllProps = new List<int>();
			ClassifiedProps = new List<List<int>>();
			int max = Enum.GetValues(typeof(PropClass)).Cast<int>().Max();
			for (int i = 0; i <= max; i++)
			{
				ClassifiedProps.Add(new List<int>());
			}
			EnumerableExtension.ForEach<List<string>>((IEnumerable<List<string>>)Mainload.AllPropdata, (Action<List<string>, int>)delegate(List<string> propData, int index)
			{
				int num = int.Parse(propData[1]);
				num = ((num > 2) ? num : 0);
				num = ((num == 8) ? 7 : num);
				num = ((num > max) ? 1 : num);
				ClassifiedProps[num].Add(index);
				AllProps.Add(index);
			});
		}
	}
	public interface IAddItemView
	{
		bool ShowMenu { get; set; }

		MenuTab PanelTab { get; set; }

		CurrencyClass SelectedCurrency { get; set; }

		string SearchText { get; set; }

		PropClass? SelectedPropClass { get; set; }

		int? SelectedPropId { get; set; }

		int? SelectedBookId { get; set; }

		int? SelectedHorseId { get; set; }

		MapTab SelectedMap { get; set; }

		int SelectedJunId { get; set; }

		int SelectedXianId { get; set; }

		string SelectedArea { get; set; }

		string CountInput { get; set; }

		string NameInput { get; set; }

		event Action OnFilterChanged;

		event Action OnCountInputChanged;

		event Action OnNameInputChanged;

		event Action OnAddButton;

		void Initialize(IAddItemModel model);
	}
	public class IMGUIAddItemView : MonoBehaviour, IAddItemView
	{
		[Flags]
		private enum MapPartFlag
		{
			None = 1,
			Jun = 2,
			Xian = 4,
			Area = 8,
			Name = 0x10
		}

		private Rect _windowRect;

		private Vector2 _scrollPosition;

		private float _scaleFactor = 1f;

		private Texture2D _backgroundTexture;

		private Texture2D _instructionTexture;

		private Texture2D _biaoQianATexture;

		private Texture2D _biaoQianBTexture;

		private Texture2D _btfTexture;

		private Texture2D _btgTexture;

		private Font _mediumFont;

		private Font _boldFont;

		private Texture2D _startBTATexture;

		private float topY;

		private float bottomY;

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private string <CountInput>k__BackingField = "1";

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private string <NameInput>k__BackingField = "";

		private LocalizationInstance _i18N;

		private LocalizationInstance _vStr;

		private IAddItemModel _model;

		private static float _defaultWidth = 800f;

		private static float _defaultHeight = 1000f;

		private Dictionary<MapTab, MapPartFlag> _mapPartFlags = new Dictionary<MapTab, MapPartFlag>
		{
			{
				MapTab.Mansion,
				MapPartFlag.Jun | MapPartFlag.Xian | MapPartFlag.Name
			},
			{
				MapTab.Farm,
				MapPartFlag.Jun | MapPartFlag.Xian | MapPartFlag.Area | MapPartFlag.Name
			},
			{
				MapTab.Fief,
				MapPartFlag.Jun
			},
			{
				MapTab.Clan,
				MapPartFlag.Jun | MapPartFlag.Xian
			},
			{
				MapTab.Cemetery,
				MapPartFlag.Jun | MapPartFlag.Xian | MapPartFlag.Area | MapPartFlag.Name
			}
		};

		private List<string> _mapArea = new List<string>(4) { "4", "9", "16", "25" };

		private static (string label, int value)[] _kQuickAdds = new(string, int)[5]
		{
			("1", 1),
			("1K", 1000),
			("1M", 1000000),
			("1B", 1000000000),
			("Max", int.MaxValue)
		};

		public bool ShowMenu { get; set; }

		public MenuTab PanelTab { get; set; } = MenuTab.Items;


		public CurrencyClass SelectedCurrency { get; set; } = CurrencyClass.Coins;


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


		public PropClass? SelectedPropClass { get; set; }

		public int? SelectedPropId { get; set; }

		public int? HoveredPropId { get; set; }

		public int? SelectedBookId { get; set; }

		public int? HoveredStoryId { get; set; }

		public int? SelectedHorseId { get; set; }

		public MapTab SelectedMap { get; set; } = MapTab.Mansion;


		public int SelectedJunId { get; set; }

		public int SelectedXianId { get; set; }

		public string SelectedArea { get; set; } = "16";


		public string CountInput
		{
			[CompilerGenerated]
			get
			{
				return <CountInput>k__BackingField;
			}
			set
			{
				if (!(<CountInput>k__BackingField == value))
				{
					<CountInput>k__BackingField = value;
					this.OnCountInputChanged?.Invoke();
				}
			}
		}

		public string NameInput
		{
			[CompilerGenerated]
			get
			{
				return <NameInput>k__BackingField;
			}
			set
			{
				if (!(<NameInput>k__BackingField == value))
				{
					<NameInput>k__BackingField = value;
					this.OnNameInputChanged?.Invoke();
				}
			}
		}

		public event Action OnFilterChanged;

		public event Action OnCountInputChanged;

		public event Action OnNameInputChanged;

		public event Action OnAddButton;

		private bool ContainsChinese(string text)
		{
			return Regex.IsMatch(text, "[\\u4e00-\\u9fa5]");
		}

		public void Initialize(IAddItemModel model)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			_i18N = Localization.CreateInstance("zh-CN", AddItem.LocaleNamespace, true);
			_vStr = Localization.CreateInstance("zh-CN", "Vanilla", true);
			_model = model;
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			string path = Path.Combine(directoryName, "Sprites", "PanelC.png");
			if (File.Exists(path))
			{
				_backgroundTexture = new Texture2D(2, 2);
				byte[] array = File.ReadAllBytes(path);
				ImageConversion.LoadImage(_backgroundTexture, array);
			}
			string path2 = Path.Combine(directoryName, "Sprites", "StartBTA.png");
			if (File.Exists(path2))
			{
				_startBTATexture = new Texture2D(2, 2);
				byte[] array2 = File.ReadAllBytes(path2);
				ImageConversion.LoadImage(_startBTATexture, array2);
			}
			LoadButtonTexture(ref _biaoQianATexture, directoryName, "BiaoQianA.png");
			LoadButtonTexture(ref _biaoQianBTexture, directoryName, "BiaoQianB.png");
			LoadButtonTexture(ref _btfTexture, directoryName, "BTF.png");
			LoadButtonTexture(ref _btgTexture, directoryName, "BTG.png");
			LoadFont(ref _mediumFont, directoryName, Path.Combine("Fonts", "SourceHanSansSC-Medium-2.otf"));
			LoadFont(ref _boldFont, directoryName, Path.Combine("Fonts", "SourceHanSansSC-Bold-2.otf"));
			UpdateResolutionSettings();
		}

		private void LoadButtonTexture(ref Texture2D texture, string dllDirectory, string textureName)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			string path = Path.Combine(dllDirectory, "Sprites", textureName);
			if (File.Exists(path))
			{
				texture = new Texture2D(2, 2);
				byte[] array = File.ReadAllBytes(path);
				ImageConversion.LoadImage(texture, array);
			}
		}

		private void LoadFont(ref Font font, string dllDirectory, string fontPath)
		{
			string text = Path.Combine(dllDirectory, fontPath);
			if (File.Exists(text))
			{
				font = Font.CreateDynamicFontFromOSFont(text, 20);
				if ((Object)(object)font.material != (Object)null)
				{
					font.material.shader = Shader.Find("GUI/Text Shader");
				}
			}
		}

		private void Update()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)283))
			{
				ShowMenu = !ShowMenu;
				if (ShowMenu)
				{
					UpdateResolutionSettings();
					Mainload.isMapPanelOpen = false;
				}
				else
				{
					HoveredPropId = null;
					HoveredStoryId = null;
				}
				AddItem.Logger.LogInfo((object)("物品添加器窗口已" + (ShowMenu ? "打开" : "关闭")));
			}
			if (ShowMenu && (Input.mouseScrollDelta.y != 0f || Input.GetMouseButton(0) || Input.GetMouseButton(1) || (Input.GetMouseButton(2) && Input.anyKeyDown && !Input.GetKeyDown((KeyCode)283))))
			{
				Input.ResetInputAxes();
			}
		}

		private void DrawItemButton(int propId)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00cb: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			string text = _vStr.t($"Text_AllProp.{propId}");
			GUIStyle val = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_btgTexture != (Object)null)
			{
				val.normal.background = _btgTexture;
			}
			val.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			val.alignment = (TextAnchor)4;
			Rect rect = GUILayoutUtility.GetRect(new GUIContent(text), val);
			if (GUI.Button(rect, text, val))
			{
				SelectedPropId = propId;
				HoveredPropId = null;
			}
			Event current = Event.current;
			if (current == null || ((int)current.type != 2 && (int)current.type != 7))
			{
				return;
			}
			if ((float)Screen.width == 1280f && (float)Screen.height == 720f)
			{
				if (Mainload.SetData[4] == 0)
				{
					if (((Rect)(ref rect)).Contains(current.mousePosition) && IFloatingView._mousePosition.y >= 235f && IFloatingView._mousePosition.y <= 520f)
					{
						HoveredPropId = propId;
					}
				}
				else if (((Rect)(ref rect)).Contains(current.mousePosition) && IFloatingView._mousePosition.y >= 245f && IFloatingView._mousePosition.y <= 530f)
				{
					HoveredPropId = propId;
				}
			}
			else if ((float)Screen.width == 1920f && (float)Screen.height == 1080f)
			{
				if (Mainload.SetData[4] == 0)
				{
					if (((Rect)(ref rect)).Contains(current.mousePosition) && IFloatingView._mousePosition.y >= 350f && IFloatingView._mousePosition.y <= 780f)
					{
						HoveredPropId = propId;
					}
				}
				else if (((Rect)(ref rect)).Contains(current.mousePosition) && IFloatingView._mousePosition.y >= 330f && IFloatingView._mousePosition.y <= 800f)
				{
					HoveredPropId = propId;
				}
			}
			else if ((float)Screen.width == 2560f && (float)Screen.height == 1440f)
			{
				if (Mainload.SetData[4] == 0)
				{
					if (((Rect)(ref rect)).Contains(current.mousePosition) && IFloatingView._mousePosition.y >= 470f && IFloatingView._mousePosition.y <= 1050f)
					{
						HoveredPropId = propId;
					}
				}
				else if (((Rect)(ref rect)).Contains(current.mousePosition) && IFloatingView._mousePosition.y >= 450f && IFloatingView._mousePosition.y <= 1060f)
				{
					HoveredPropId = propId;
				}
			}
			else if (((Rect)(ref rect)).Contains(current.mousePosition))
			{
				HoveredPropId = propId;
			}
		}

		private void UpdateResolutionSettings()
		{
			//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)
			float num = Screen.width;
			float num2 = Screen.height;
			_scaleFactor = Mathf.Min(num / 1920f, num2 / 1080f);
			_windowRect = new Rect(150f, 50f, _defaultWidth, _defaultHeight);
			AddItem.Logger.LogInfo((object)$"当前分辨率: {num}x{num2},缩放因子: {_scaleFactor}");
		}

		private void OnGUI()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_004a: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: 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)
			if (ShowMenu)
			{
				if ((int)Event.current.type == 7)
				{
					HoveredPropId = null;
					HoveredStoryId = null;
				}
				Color backgroundColor = GUI.backgroundColor;
				GUIStyle window = GUI.skin.window;
				GUIStyle val = new GUIStyle(GUI.skin.window);
				val.normal.background = null;
				val.border = new RectOffset(0, 0, 0, 0);
				val.padding = new RectOffset(0, 0, 0, 0);
				GUI.skin.window = val;
				GUI.backgroundColor = Color.clear;
				GUI.BeginGroup(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height));
				GUI.color = new Color(0f, 0f, 0f, 0.1f);
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = Color.white;
				GUI.EndGroup();
				Matrix4x4 matrix = GUI.matrix;
				GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(_scaleFactor, _scaleFactor, 1f));
				if ((Object)(object)_backgroundTexture != (Object)null)
				{
					Rect val2 = default(Rect);
					((Rect)(ref val2))..ctor(((Rect)(ref _windowRect)).x - 50f, ((Rect)(ref _windowRect)).y - 40f, ((Rect)(ref _windowRect)).width + 100f, ((Rect)(ref _windowRect)).height + 80f);
					GUI.DrawTexture(val2, (Texture)(object)_backgroundTexture, (ScaleMode)0);
				}
				else
				{
					GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f, 0.95f);
				}
				_windowRect = GUI.Window(0, _windowRect, new WindowFunction(DrawWindow), "");
				GUI.matrix = matrix;
				GUI.backgroundColor = backgroundColor;
				GUI.skin.window = window;
			}
		}

		private void DrawWindow(int windowID)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Expected O, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Expected O, but got Unknown
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Expected O, but got Unknown
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Expected O, but got Unknown
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Expected O, but got Unknown
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label);
			if ((Object)(object)_boldFont != (Object)null)
			{
				val.font = _boldFont;
				string text = _i18N.t("Info.Category");
				val.fontSize = (ContainsChinese(text) ? 18 : 16);
			}
			else
			{
				val.fontSize = 18;
			}
			GUIStyle val2 = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_boldFont != (Object)null)
			{
				val2.font = _boldFont;
				string text2 = _i18N.t("Button.Clear");
				val2.fontSize = (ContainsChinese(text2) ? 18 : 16);
			}
			else
			{
				val2.fontSize = 18;
			}
			val2.alignment = (TextAnchor)4;
			GUI.skin.label = val;
			GUI.skin.button = val2;
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.FlexibleSpace();
			GUIStyle val3 = new GUIStyle(GUI.skin.label);
			string text3 = _i18N.t("Mod.Name") ?? "";
			string text4 = _i18N.t("Mod.VersionText") + "4.0.0   " + _i18N.t("Mod.AuthorText") + _i18N.t("Mod.Author");
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val3.font = _mediumFont;
				val3.fontSize = (ContainsChinese(text3) ? 30 : 28);
				val3.alignment = (TextAnchor)4;
				val3.normal.textColor = new Color(0.6314f, 0.3137f, 0.3137f, 1f);
			}
			else
			{
				val3.fontSize = 30;
				val3.alignment = (TextAnchor)4;
				val3.normal.textColor = new Color(0.6314f, 0.3137f, 0.3137f, 1f);
			}
			GUILayout.Label(text3, val3, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.FlexibleSpace();
			GUIStyle val4 = new GUIStyle(val3);
			val4.fontSize = (ContainsChinese(text4) ? 24 : 22);
			val4.normal.textColor = new Color(0.6314f, 0.3137f, 0.3137f, 1f);
			val4.alignment = (TextAnchor)4;
			val4.wordWrap = false;
			GUILayout.Label(text4, val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			EnumerableExtension.ForEach<string>((IEnumerable<string>)Enum.GetNames(typeof(MenuTab)), (Action<string, int>)delegate(string key, int index)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				GUIStyle val7 = new GUIStyle(GUI.skin.button);
				val7.normal.background = (((Object)(object)_biaoQianBTexture != (Object)null) ? _biaoQianBTexture : null);
				if (index == (int)PanelTab && (Object)(object)_biaoQianATexture != (Object)null)
				{
					val7.normal.background = _biaoQianATexture;
				}
				val7.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				val7.alignment = (TextAnchor)4;
				if (GUILayout.Button(_i18N.t("MenuTab." + key) ?? "", val7, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					PanelTab = (MenuTab)index;
				}
			});
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			switch (PanelTab)
			{
			case MenuTab.Currency:
				DrawAddCurrency();
				break;
			case MenuTab.Items:
				DrawAddItem();
				break;
			case MenuTab.Stories:
				DrawAddStories();
				break;
			case MenuTab.Horses:
				DrawAddHorses();
				break;
			case MenuTab.Map:
				DrawAddMaps();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.Space(10f);
			DrawAddButton();
			GUILayout.Space(10f);
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUIStyle val5 = new GUIStyle();
			if ((Object)(object)_startBTATexture != (Object)null)
			{
				val5.normal.background = _startBTATexture;
			}
			val5.border = new RectOffset(0, 0, 0, 0);
			val5.margin = new RectOffset(0, 0, 0, 0);
			val5.padding = new RectOffset(10, 10, 10, 10);
			val5.alignment = (TextAnchor)3;
			val5.font = _mediumFont;
			string text5 = _i18N.t("Info.Description");
			val5.fontSize = (ContainsChinese(text5) ? 24 : 20);
			GUIStyle val6 = new GUIStyle();
			val6.normal.textColor = new Color(0.6314f, 0.3137f, 0.3137f, 1f);
			val6.font = _mediumFont;
			val6.fontSize = 20;
			val5.normal.textColor = new Color(0.6314f, 0.3137f, 0.3137f, 1f);
			GUILayout.Label(_i18N.t("Info.Description"), val5, Array.Empty<GUILayoutOption>());
			for (int i = 1; i <= 6; i++)
			{
				string text6 = _i18N.t($"Description.{i}");
				val6.fontSize = (ContainsChinese(text6) ? 20 : 18);
				GUILayout.Label(text6, val6, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
			GUILayout.EndVertical();
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height));
		}

		private void DrawAddCurrency()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle();
			val.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val.font = _mediumFont;
				string text = _i18N.t("Info.Category");
				val.fontSize = (ContainsChinese(text) ? 18 : 16);
			}
			GUILayout.Label(_i18N.t("Info.Category"), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			GUIStyle val2 = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_btfTexture != (Object)null)
			{
				val2.normal.background = _btfTexture;
				val2.active.background = _btfTexture;
				val2.focused.background = _btfTexture;
				val2.hover.background = _btfTexture;
			}
			val2.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			val2.alignment = (TextAnchor)4;
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(_i18N.t("CurrencyClass.Coins"), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				SelectedCurrency = CurrencyClass.Coins;
			}
			if (GUILayout.Button(_i18N.t("CurrencyClass.Gold"), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				SelectedCurrency = CurrencyClass.Gold;
			}
			GUILayout.EndHorizontal();
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUILayout.Space(10f);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			GUIStyle val3 = new GUIStyle();
			val3.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val3.font = _mediumFont;
				string text2 = _i18N.t("Info.CurrencyNow.Coins");
				val3.fontSize = (ContainsChinese(text2) ? 18 : 16);
			}
			GUILayout.Label(_i18N.t("Info.CurrencyNow.Coins", new object[1] { FormulaData.GetCoinsNum() }), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Label(_i18N.t("Info.CurrencyNow.Gold", new object[1] { Mainload.CGNum[1] }), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.EndVertical();
		}

		private void DrawAddItem()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_002d: 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_0116: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUIStyle val = new GUIStyle();
			val.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val.font = _mediumFont;
				string text = _i18N.t("Info.Search");
				val.fontSize = (ContainsChinese(text) ? 18 : 16);
			}
			GUILayout.Label(_i18N.t("Info.Search"), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			string text2 = GUILayout.TextField(SearchText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (text2 != SearchText)
			{
				SearchText = text2;
				this.OnFilterChanged?.Invoke();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUIStyle val2 = new GUIStyle();
			val2.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val2.font = _mediumFont;
				string text3 = _i18N.t("Info.Category");
				val2.fontSize = (ContainsChinese(text3) ? 18 : 16);
			}
			GUILayout.Label(_i18N.t("Info.Category") + (SelectedPropClass.HasValue ? _i18N.t("PropClass." + SelectedPropClass.ToString()) : ""), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			GUIStyle val3 = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_btfTexture != (Object)null)
			{
				val3.normal.background = _btfTexture;
			}
			val3.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			val3.alignment = (TextAnchor)4;
			string text4 = _i18N.t("Button.Clear");
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val3.font = _mediumFont;
				val3.fontSize = (ContainsChinese(text4) ? 18 : 16);
			}
			if (GUILayout.Button(_i18N.t("Button.Clear"), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }))
			{
				SearchText = "";
				SelectedPropClass = null;
				this.OnFilterChanged?.Invoke();
			}
			GUILayout.EndHorizontal();
			EnumerableExtension.ForEach<string>((IEnumerable<string>)Enum.GetNames(typeof(PropClass)), (Action<string, int>)delegate(string cate, int index)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Expected O, but got Unknown
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				if (index == 0 || index % 5 == 2)
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				}
				GUIStyle val4 = new GUIStyle(GUI.skin.button);
				if ((Object)(object)_btfTexture != (Object)null)
				{
					val4.normal.background = _btfTexture;
				}
				val4.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				val4.alignment = (TextAnchor)4;
				if (GUILayout.Button(_i18N.t("PropClass." + cate), val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((index < 2) ? 285f : 140f) }))
				{
					SelectedPropClass = (PropClass)Enum.Parse(typeof(PropClass), cate);
					this.OnFilterChanged?.Invoke();
				}
				if (index % 5 == 1)
				{
					GUILayout.EndHorizontal();
				}
				if (index == 1)
				{
					GUILayout.Space(10f);
				}
			});
			GUILayout.Space(10f);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			if (_model.FilteredProps.Count > 0)
			{
				_model.FilteredProps.ForEach(delegate(int propId)
				{
					DrawItemButton(propId);
				});
			}
			else
			{
				GUILayout.Label(_i18N.t("Error.NoProp"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
		}

		private void DrawAddStories()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			GUIStyle btgButtonStyle = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_btgTexture != (Object)null)
			{
				btgButtonStyle.normal.background = _btgTexture;
				btgButtonStyle.hover.background = _btgTexture;
				btgButtonStyle.active.background = _btgTexture;
			}
			btgButtonStyle.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			btgButtonStyle.alignment = (TextAnchor)4;
			EnumerableExtension.ForEach<string>((IEnumerable<string>)ItemData.StoriesList, (Action<string, int>)delegate(string book, int index)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				//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_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Invalid comparison between Unknown and I4
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Invalid comparison between Unknown and I4
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				Rect rect = GUILayoutUtility.GetRect(new GUIContent(book), btgButtonStyle);
				if (GUI.Button(rect, book, btgButtonStyle))
				{
					SelectedBookId = index;
					HoveredStoryId = null;
				}
				Event current = Event.current;
				if (current != null && ((int)current.type == 2 || (int)current.type == 7) && ((Rect)(ref rect)).Contains(current.mousePosition))
				{
					HoveredStoryId = index;
				}
			});
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
		}

		private void DrawAddHorses()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			GUIStyle btgButtonStyle = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_btgTexture != (Object)null)
			{
				btgButtonStyle.normal.background = _btgTexture;
				btgButtonStyle.hover.background = _btgTexture;
				btgButtonStyle.active.background = _btgTexture;
			}
			btgButtonStyle.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			btgButtonStyle.alignment = (TextAnchor)4;
			EnumerableExtension.ForEach<string>((IEnumerable<string>)ItemData.HorsesList, (Action<string, int>)delegate(string horse, int index)
			{
				if (GUILayout.Button(horse, btgButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
				{
					SelectedHorseId = index;
				}
			});
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
		}

		private void DrawAddMaps()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Expected O, but got Unknown
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			EnumerableExtension.ForEach<string>((IEnumerable<string>)Enum.GetNames(typeof(MapTab)), (Action<string, int>)delegate(string key, int index)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				if (!(key == "Clan"))
				{
					GUIStyle val7 = new GUIStyle(GUI.skin.button);
					val7.normal.background = (((Object)(object)_biaoQianBTexture != (Object)null) ? _biaoQianBTexture : null);
					if (index == (int)SelectedMap && (Object)(object)_biaoQianATexture != (Object)null)
					{
						val7.normal.background = _biaoQianATexture;
					}
					val7.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
					val7.alignment = (TextAnchor)4;
					if (GUILayout.Button(_i18N.t("MapTab." + key), val7, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
					{
						SelectedMap = (MapTab)index;
					}
				}
			});
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			if ((_mapPartFlags[SelectedMap] & MapPartFlag.Jun) == MapPartFlag.Jun)
			{
				GUIStyle val = new GUIStyle();
				val.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				if ((Object)(object)_mediumFont != (Object)null)
				{
					val.font = _mediumFont;
					string text = _i18N.t("Info.Jun");
					val.fontSize = (ContainsChinese(text) ? 18 : 16);
				}
				GUILayout.Label(_i18N.t("Info.Jun"), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
				int perLineBtn2 = 5;
				int maxBtn2 = ItemData.JunList.Count;
				EnumerableExtension.ForEach<string>((IEnumerable<string>)ItemData.JunList, (Action<string, int>)delegate(string junName, int index)
				{
					//IL_0025: Unknown result type (might be due to invalid IL or missing references)
					//IL_002b: Expected O, but got Unknown
					//IL_0073: Unknown result type (might be due to invalid IL or missing references)
					if (index % perLineBtn2 == 0)
					{
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					}
					GUIStyle val6 = new GUIStyle(GUI.skin.button);
					if ((Object)(object)_btfTexture != (Object)null)
					{
						val6.normal.background = _btfTexture;
					}
					val6.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
					val6.alignment = (TextAnchor)4;
					if (GUILayout.Button(junName, val6, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }))
					{
						SelectedJunId = index;
					}
					if (++index % perLineBtn2 == 0 || index == maxBtn2)
					{
						GUILayout.EndHorizontal();
					}
				});
			}
			if ((_mapPartFlags[SelectedMap] & MapPartFlag.Xian) == MapPartFlag.Xian)
			{
				GUILayout.Space(10f);
				GUIStyle val2 = new GUIStyle();
				val2.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				if ((Object)(object)_mediumFont != (Object)null)
				{
					val2.font = _mediumFont;
					string text2 = _i18N.t("Info.Xian");
					val2.fontSize = (ContainsChinese(text2) ? 18 : 16);
				}
				GUILayout.Label(_i18N.t("Info.Xian"), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
				int perLineBtn = 5;
				int maxBtn = ItemData.XianList[SelectedJunId].Count;
				if (SelectedXianId >= maxBtn)
				{
					SelectedXianId = 0;
				}
				EnumerableExtension.ForEach<string>((IEnumerable<string>)ItemData.XianList[SelectedJunId], (Action<string, int>)delegate(string xianName, int index)
				{
					//IL_0025: Unknown result type (might be due to invalid IL or missing references)
					//IL_002b: Expected O, but got Unknown
					//IL_0073: Unknown result type (might be due to invalid IL or missing references)
					if (index % perLineBtn == 0)
					{
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					}
					GUIStyle val5 = new GUIStyle(GUI.skin.button);
					if ((Object)(object)_btfTexture != (Object)null)
					{
						val5.normal.background = _btfTexture;
					}
					val5.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
					val5.alignment = (TextAnchor)4;
					if (GUILayout.Button(xianName, val5, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }))
					{
						SelectedXianId = index;
					}
					if (++index % perLineBtn == 0 || index == maxBtn)
					{
						GUILayout.EndHorizontal();
					}
				});
			}
			if ((_mapPartFlags[SelectedMap] & MapPartFlag.Area) == MapPartFlag.Area)
			{
				GUILayout.Space(10f);
				GUIStyle val3 = new GUIStyle();
				val3.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				if ((Object)(object)_mediumFont != (Object)null)
				{
					val3.font = _mediumFont;
					string text3 = _i18N.t("Info.Area");
					val3.fontSize = (ContainsChinese(text3) ? 18 : 16);
				}
				GUILayout.Label(_i18N.t("Info.Area"), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				_mapArea.ForEach(delegate(string area)
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Expected O, but got Unknown
					//IL_004f: Unknown result type (might be due to invalid IL or missing references)
					GUIStyle val4 = new GUIStyle(GUI.skin.button);
					if ((Object)(object)_btfTexture != (Object)null)
					{
						val4.normal.background = _btfTexture;
					}
					val4.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
					val4.alignment = (TextAnchor)4;
					if (GUILayout.Button(area, val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
					{
						SelectedArea = area;
					}
				});
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
		}

		private string GetSelectMap()
		{
			string text = _i18N.t("MapTab." + Enum.GetName(typeof(MapTab), SelectedMap));
			if ((_mapPartFlags[SelectedMap] & MapPartFlag.Jun) == MapPartFlag.Jun)
			{
				text += " - ";
				text += ItemData.JunList[SelectedJunId];
			}
			if ((_mapPartFlags[SelectedMap] & MapPartFlag.Xian) == MapPartFlag.Xian)
			{
				text += " - ";
				text += ItemData.XianList[SelectedJunId][SelectedXianId];
			}
			if ((_mapPartFlags[SelectedMap] & MapPartFlag.Area) == MapPartFlag.Area)
			{
				text += " - ";
				text += SelectedArea;
			}
			return text;
		}

		private void DrawAddButton()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Expected O, but got Unknown
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Expected O, but got Unknown
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			MenuTab panelTab = PanelTab;
			if (1 == 0)
			{
			}
			string text = panelTab switch
			{
				MenuTab.Currency => _i18N.t("CurrencyClass." + SelectedCurrency), 
				MenuTab.Items => SelectedPropId.HasValue ? _vStr.t($"Text_AllProp.{SelectedPropId}") : "", 
				MenuTab.Stories => SelectedBookId.HasValue ? ItemData.StoriesList[SelectedBookId.Value] : "", 
				MenuTab.Horses => SelectedHorseId.HasValue ? ItemData.HorsesList[SelectedHorseId.Value] : "", 
				MenuTab.Map => GetSelectMap(), 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			string text2 = text;
			GUIStyle val = new GUIStyle();
			val.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val.font = _mediumFont;
				string text3 = _i18N.t("Info.Selected");
				val.fontSize = (ContainsChinese(text3) ? 18 : 16);
			}
			GUILayout.Label(_i18N.t("Info.Selected") + text2, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			switch (PanelTab)
			{
			case MenuTab.Currency:
			case MenuTab.Items:
			case MenuTab.Stories:
			{
				GUIStyle val3 = new GUIStyle();
				val3.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				if ((Object)(object)_mediumFont != (Object)null)
				{
					val3.font = _mediumFont;
					string text4 = _i18N.t("Info.Count");
					val3.fontSize = (ContainsChinese(text4) ? 18 : 16);
				}
				GUILayout.Label(_i18N.t("Info.Count"), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
				CountInput = GUILayout.TextField(CountInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				break;
			}
			case MenuTab.Horses:
			case MenuTab.Map:
			{
				GUIStyle val2 = new GUIStyle();
				val2.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				if ((_mapPartFlags[SelectedMap] & MapPartFlag.Name) == MapPartFlag.Name)
				{
					GUILayout.Label(_i18N.t("Info.Name"), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
					NameInput = GUILayout.TextField(NameInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				else
				{
					GUILayout.Label(_i18N.t("Info.Name"), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
					GUILayout.TextField(_i18N.t("Info.NoName"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				}
				break;
			}
			default:
				throw new ArgumentOutOfRangeException();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			DrawQuickAddRow();
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Space(15f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUIStyle val4 = new GUIStyle(GUI.skin.button);
			if ((Object)(object)_btfTexture != (Object)null)
			{
				val4.normal.background = _btfTexture;
			}
			val4.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
			val4.alignment = (TextAnchor)4;
			if ((Object)(object)_mediumFont != (Object)null)
			{
				val4.font = _mediumFont;
				val4.fontSize = 40;
			}
			if (GUILayout.Button(_i18N.t("Button.Add"), val4, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(180f),
				GUILayout.Height(80f)
			}))
			{
				this.OnAddButton?.Invoke();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void DrawQuickAddRow()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			(string, int)[] kQuickAdds = _kQuickAdds;
			for (int i = 0; i < kQuickAdds.Length; i++)
			{
				(string, int) tuple = kQuickAdds[i];
				string item = tuple.Item1;
				int item2 = tuple.Item2;
				GUIStyle val = new GUIStyle(GUI.skin.button);
				if ((Object)(object)_btfTexture != (Object)null)
				{
					val.normal.background = _btfTexture;
				}
				val.normal.textColor = new Color(0.32156864f, 0.23529412f, 10f / 51f, 1f);
				val.alignment = (TextAnchor)4;
				if (GUILayout.Button(item, val, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(80f),
					GUILayout.Height(36f)
				}))
				{
					CountInput = item2.ToString();
				}
				GUILayout.Space(6f);
			}
		}
	}
}
namespace cs.HoLMod.AddItem.Views
{
	public class IFloatingView : MonoBehaviour
	{
		private int? _selectedPropId;

		public static Vector2 _mousePosition;

		private bool _isVisible;

		private Rect _windowRect = new Rect(0f, 0f, 200f, 300f);

		private int? _selectedStoryId;

		private bool _isStoryVisible;

		private Rect _storyWindowRect = new Rect(0f, 0f, 300f, 200f);

		private bool _showStoryToggleButton = false;

		private Rect _storyToggleButtonRect = new Rect(10f, 10f, 30f, 30f);

		private LocalizationInstance _i18N;

		private LocalizationInstance _vStr;

		private bool _isInitialized;

		private Texture2D _backgroundTexture;

		private Texture2D _contentTexture;

		private Texture2D _lineTexture;

		private Texture2D _currencyTexture;

		private Font _boldFont;

		private Font _mediumFont;

		private GUIStyle _itemNameStyle;

		private GUIStyle _contentTextStyle;

		private bool ContainsChinese(string text)
		{
			return Regex.IsMatch(text, "[\\u4e00-\\u9fa5]");
		}

		private void Start()
		{
			Initialize();
		}

		private void Initialize()
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Expected O, but got Unknown
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			if (_isInitialized)
			{
				return;
			}
			_i18N = Localization.CreateInstance("zh-CN", AddItem.LocaleNamespace, true);
			_vStr = Localization.CreateInstance("zh-CN", "Vanilla", true);
			string location = Assembly.GetExecutingAssembly().Location;
			string directoryName = Path.GetDirectoryName(location);
			string text = Path.Combine(directoryName, "Fonts", "SourceHanSansSC-Bold-2.otf");
			string text2 = Path.Combine(directoryName, "Fonts", "SourceHanSansSC-Medium-2.otf");
			if (File.Exists(text))
			{
				Font boldFont = Font.CreateDynamicFontFromOSFont(text, 20);
				_boldFont = boldFont;
				if ((Object)(object)_boldFont.material != (Object)null)
				{
					_boldFont.material.shader = Shader.Find("GUI/Text Shader");
				}
			}
			if (File.Exists(text2))
			{
				Font mediumFont = Font.CreateDynamicFontFromOSFont(text2, 18);
				_mediumFont = mediumFont;
				if ((Object)(object)_mediumFont.material != (Object)null)
				{
					_mediumFont.material.shader = Shader.Find("GUI/Text Shader");
				}
			}
			_itemNameStyle = new GUIStyle();
			if ((Object)(object)_boldFont != (Object)null)
			{
				_itemNameStyle.font = _boldFont;
			}
			_itemNameStyle.normal.textColor = new Color(0.6313726f, 16f / 51f, 16f / 51f);
			_itemNameStyle.alignment = (TextAnchor)4;
			_contentTextStyle = new GUIStyle();
			if ((Object)(object)_mediumFont != (Object)null)
			{
				_contentTextStyle.font = _mediumFont;
			}
			_contentTextStyle.normal.textColor = new Color(32f / 85f, 22f / 85f, 19f / 85f);
			_contentTextStyle.alignment = (TextAnchor)3;
			string path = Path.Combine(directoryName, "Sprites", "PanelC.png");
			if (File.Exists(path))
			{
				_backgroundTexture = new Texture2D(2, 2);
				byte[] array = File.ReadAllBytes(path);
				ImageConversion.LoadImage(_backgroundTexture, array);
			}
			string path2 = Path.Combine(directoryName, "Sprites", "KuangC.png");
			if (File.Exists(path2))
			{
				byte[] array2 = File.ReadAllBytes(path2);
				_contentTexture = new Texture2D(2, 2);
				ImageConversion.LoadImage(_contentTexture, array2);
			}
			string path3 = Path.Combine(directoryName, "Sprites", "lineA.png");
			if (File.Exists(path3))
			{
				byte[] array3 = File.ReadAllBytes(path3);
				_lineTexture = new Texture2D(2, 2);
				ImageConversion.LoadImage(_lineTexture, array3);
			}
			string path4 = Path.Combine(directoryName, "Sprites", "TongQian.png");
			if (File.Exists(path4))
			{
				byte[] array4 = File.ReadAllBytes(path4);
				_currencyTexture = new Texture2D(2, 2);
				ImageConversion.LoadImage(_currencyTexture, array4);
			}
			_isInitialized = true;
		}

		private void Update()
		{
			UpdateFloatingView();
		}

		private void UpdateFloatingView()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			Initialize();
			IMGUIAddItemView iMGUIAddItemView = Object.FindObjectOfType<IMGUIAddItemView>();
			if ((Object)(object)iMGUIAddItemView == (Object)null || !iMGUIAddItemView.ShowMenu)
			{
				_isVisible = false;
				_isStoryVisible = false;
				_showStoryToggleButton = false;
			}
			else if (iMGUIAddItemView.PanelTab == MenuTab.Items)
			{
				_showStoryToggleButton = false;
				_selectedPropId = iMGUIAddItemView.HoveredPropId;
				_mousePosition = Vector2.op_Implicit(Input.mousePosition);
				_mousePosition.y = (float)Screen.height - _mousePosition.y;
				_isVisible = _selectedPropId.HasValue;
				_isStoryVisible = false;
				if (_isVisible)
				{
					((Rect)(ref _windowRect)).x = _mousePosition.x + 20f;
					((Rect)(ref _windowRect)).y = _mousePosition.y - 20f;
					((Rect)(ref _windowRect)).x = Mathf.Clamp(((Rect)(ref _windowRect)).x, 0f, (float)Screen.width - ((Rect)(ref _windowRect)).width);
					((Rect)(ref _windowRect)).y = Mathf.Clamp(((Rect)(ref _windowRect)).y, 0f, (float)Screen.height - ((Rect)(ref _windowRect)).height);
				}
			}
			else if (iMGUIAddItemView.PanelTab == MenuTab.Stories)
			{
				_isVisible = false;
				_showStoryToggleButton = true;
				_selectedStoryId = iMGUIAddItemView.HoveredStoryId;
				_mousePosition = Vector2.op_Implicit(Input.mousePosition);
				_mousePosition.y = (float)Screen.height - _mousePosition.y;
				if (_selectedStoryId.HasValue)
				{
					((Rect)(ref _storyWindowRect)).x = _mousePosition.x + 20f;
					((Rect)(ref _storyWindowRect)).y = _mousePosition.y - 20f;
					((Rect)(ref _storyWindowRect)).x = Mathf.Clamp(((Rect)(ref _storyWindowRect)).x, 0f, (float)Screen.width - ((Rect)(ref _storyWindowRect)).width);
					((Rect)(ref _storyWindowRect)).y = Mathf.Clamp(((Rect)(ref _storyWindowRect)).y, 0f, (float)Screen.height - ((Rect)(ref _storyWindowRect)).height);
					_isStoryVisible = true;
				}
			}
			else
			{
				_isVisible = false;
				_isStoryVisible = false;
				_showStoryToggleButton = false;
			}
		}

		private void OnGUI()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Expected O, but got Unknown
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			if (_isVisible && _selectedPropId.HasValue)
			{
				Color backgroundColor = GUI.backgroundColor;
				Color contentColor = GUI.contentColor;
				GUIStyle window = GUI.skin.window;
				GUIStyle val = new GUIStyle(GUI.skin.window);
				val.normal.background = null;
				val.border = new RectOffset(0, 0, 0, 0);
				val.padding = new RectOffset(0, 0, 0, 0);
				GUI.skin.window = val;
				GUI.backgroundColor = Color.clear;
				GUI.contentColor = Color.white;
				if ((Object)(object)_backgroundTexture != (Object)null)
				{
					GUI.DrawTexture(_windowRect, (Texture)(object)_backgroundTexture, (ScaleMode)0);
				}
				else
				{
					GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.8f);
					GUI.Box(_windowRect, "");
					GUI.backgroundColor = Color.clear;
				}
				_windowRect = GUI.Window(12345, _windowRect, new WindowFunction(DrawFloatingWindow), "");
				GUI.backgroundColor = backgroundColor;
				GUI.contentColor = contentColor;
				GUI.skin.window = window;
			}
			if (_isStoryVisible && _selectedStoryId.HasValue)
			{
				Color backgroundColor2 = GUI.backgroundColor;
				Color contentColor2 = GUI.contentColor;
				GUIStyle window2 = GUI.skin.window;
				GUIStyle val2 = new GUIStyle(GUI.skin.window);
				val2.normal.background = null;
				val2.border = new RectOffset(0, 0, 0, 0);
				val2.padding = new RectOffset(0, 0, 0, 0);
				GUI.skin.window = val2;
				GUI.backgroundColor = Color.clear;
				GUI.contentColor = Color.white;
				if ((Object)(object)_backgroundTexture != (Object)null)
				{
					GUI.DrawTexture(_storyWindowRect, (Texture)(object)_backgroundTexture, (ScaleMode)0);
				}
				else
				{
					GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.8f);
					GUI.Box(_storyWindowRect, "");
					GUI.backgroundColor = Color.clear;
				}
				_storyWindowRect = GUI.Window(12346, _storyWindowRect, new WindowFunction(DrawStoryFloatingWindow), "");
				GUI.backgroundColor = backgroundColor2;
				GUI.contentColor = contentColor2;
				GUI.skin.window = window2;
			}
		}

		private void DrawFloatingWindow(int windowID)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Expected O, but got Unknown
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Expected O, but got Unknown
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Expected O, but got Unknown
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Expected O, but got Unknown
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Expected O, but got Unknown
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Expected O, but got Unknown
			//IL_069a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Expected O, but got Unknown
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Expected O, but got Unknown
			//IL_0722: Unknown result type (might be due to invalid IL or missing references)
			//IL_0729: Expected O, but got Unknown
			if ((Object)(object)_contentTexture != (Object)null)
			{
				GUI.DrawTexture(new Rect(5f, 5f, ((Rect)(ref _windowRect)).width - 10f, ((Rect)(ref _windowRect)).height - 10f), (Texture)(object)_contentTexture, (ScaleMode)0);
			}
			GUILayout.BeginArea(new Rect(10f, 10f, ((Rect)(ref _windowRect)).width - 20f, ((Rect)(ref _windowRect)).height - 20f));
			if (!_selectedPropId.HasValue)
			{
				return;
			}
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.ExpandHeight(true)
			});
			GUILayout.Space(10f);
			string text = _vStr.t($"Text_AllProp.{_selectedPropId}");
			GUIStyle val = new GUIStyle(_itemNameStyle);
			val.fontSize = (ContainsChinese(text) ? 20 : 16);
			GUILayout.Label(text, val, Array.Empty<GUILayoutOption>());
			if ((Object)(object)_lineTexture != (Object)null)
			{
				GUILayout.Space(5f);
				GUIStyle val2 = new GUIStyle();
				val2.normal.background = null;
				val2.border = new RectOffset(0, 0, 0, 0);
				val2.margin = new RectOffset(0, 0, 0, 0);
				val2.padding = new RectOffset(0, 0, 0, 0);
				val2.alignment = (TextAnchor)4;
				GUI.color = new Color(0.8862745f, 47f / 85f, 0.47058824f);
				GUILayout.Box((Texture)(object)_lineTexture, val2, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(180f),
					GUILayout.Height(20f)
				});
				GUI.color = Color.white;
				GUILayout.Space(5f);
			}
			else
			{
				GUILayout.Space(10f);
			}
			if (Mainload.AllPropdata != null)
			{
				string[] array = Mainload.AllPropdata[_selectedPropId.Value][2].Split(new char[1] { '|' });
				if (int.Parse(array[0]) > 0)
				{
					string text2 = _vStr.t("Text_UIA.1123").Replace("@", array[0]);
					GUIStyle val3 = new GUIStyle(_contentTextStyle);
					val3.fontSize = (ContainsChinese(text2) ? 18 : 16);
					GUILayout.Label(text2, val3, Array.Empty<GUILayoutOption>());
				}
				if (int.Parse(array[1]) > 0)
				{
					string text3 = _vStr.t("Text_UIA.1124").Replace("@", array[1]);
					GUIStyle val4 = new GUIStyle(_contentTextStyle);
					val4.fontSize = (ContainsChinese(text3) ? 18 : 16);
					GUILayout.Label(text3, val4, Array.Empty<GUILayoutOption>());
				}
				if (int.Parse(array[2]) > 0)
				{
					string text4 = _vStr.t("Text_UIA.1125").Replace("@", array[2]);
					GUIStyle val5 = new GUIStyle(_contentTextStyle);
					val5.fontSize = (ContainsChinese(text4) ? 18 : 16);
					GUILayout.Label(text4, val5, Array.Empty<GUILayoutOption>());
				}
				if (int.Parse(array[3]) > 0)
				{
					string text5 = _vStr.t("Text_UIA.1126").Replace("@", array[3]);
					GUIStyle val6 = new GUIStyle(_contentTextStyle);
					val6.fontSize = (ContainsChinese(text5) ? 18 : 16);
					GUILayout.Label(text5, val6, Array.Empty<GUILayoutOption>());
				}
				DrawSignedProperty(array[4], _vStr.t("Text_UIA.1127"));
				DrawSignedProperty(array[5], _vStr.t("Text_UIA.1128"));
				DrawSignedProperty(array[6], _vStr.t("Text_UIA.1129"));
				DrawSignedProperty(array[7], _vStr.t("Text_UIA.1130"));
				if (int.Parse(array[8]) > 0)
				{
					string text6 = _vStr.t("Text_UIA.1131");
					GUIStyle val7 = new GUIStyle(_contentTextStyle);
					val7.fontSize = (ContainsChinese(text6) ? 18 : 16);
					GUILayout.Label(text6, val7, Array.Empty<GUILayoutOption>());
				}
				if (int.Parse(array[9]) > 0)
				{
					string text7 = _vStr.t("Text_UIA.1075").Replace("@", "+" + array[9]);
					GUIStyle val8 = new GUIStyle(_contentTextStyle);
					val8.fontSize = (ContainsChinese(text7) ? 18 : 16);
					GUILayout.Label(text7, val8, Array.Empty<GUILayoutOption>());
				}
				for (int i = 10; i <= 15; i++)
				{
					if (int.Parse(array[i]) > 0)
					{
						string text8 = _vStr.t($"Text_AllMemberSkill.{i - 9}") + ": +" + array[i];
						GUIStyle val9 = new GUIStyle(_contentTextStyle);
						val9.fontSize = (ContainsChinese(text8) ? 18 : 16);
						GUILayout.Label(text8, val9, Array.Empty<GUILayoutOption>());
					}
				}
				DrawSpecialItemDescription(_selectedPropId.Value);
				GUILayout.Space(20f);
				int num = int.Parse(Mainload.AllPropdata[_selectedPropId.Value][1]);
				string text9 = "(" + _vStr.t($"Text_AllPropClass.{num}") + ")";
				GUIStyle val10 = new GUIStyle(_contentTextStyle);
				val10.fontSize = (ContainsChinese(text9) ? 18 : 16);
				GUILayout.Label(text9, val10, Array.Empty<GUILayoutOption>());
				GUILayout.Space(20f);
				float num2 = float.Parse(Mainload.AllPropdata[_selectedPropId.Value][0]);
				string text10 = FormulaData.NumShow((long)Mathf.CeilToInt(num2));
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUIStyle val11 = new GUIStyle(_contentTextStyle);
				val11.fontSize = (ContainsChinese(_i18N.t("FloatingView.Price")) ? 18 : 16);
				GUIStyle val12 = new GUIStyle(val11);
				val12.margin.right = 0;
				GUILayout.Label(_i18N.t("FloatingView.Price") + ":", val12, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
				if ((Object)(object)_currencyTexture != (Object)null)
				{
					GUIStyle val13 = new GUIStyle();
					val13.margin.left = 0;
					GUILayout.Label((Texture)(object)_currencyTexture, val13, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(20f),
						GUILayout.Height(20f)
					});
				}
				GUILayout.Label(text10, val11, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
			}
			GUILayout.EndVertical();
			GUILayout.EndArea();
			GUI.DragWindow(new Rect(0f, 0f, float.MaxValue, 20f));
		}

		private void DrawStoryFloatingWindow(int windowID)
		{
			//IL_007f: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_contentTexture != (Object)null)
			{
				GUI.DrawTexture(new Rect(5f, 5f, ((Rect)(ref _storyWindowRect)).width - 10f, ((Rect)(ref _storyWindowRect)).height - 10f), (Texture)(object)_contentTexture, (ScaleMode)0);
			}
			GUILayout.BeginArea(new Rect(10f, 10f, ((Rect)(ref _storyWindowRect)).width - 20f, ((Rect)(ref _storyWindowRect)).height - 20f));
			if (_selectedStoryId.HasValue)
			{
				GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.ExpandWidth(true),
					GUILayout.ExpandHeight(true)
				});
				GUILayout.Space(10f);
				string storyName = GetStoryName(_selectedStoryId.Value);
				GUIStyle val = new GUIStyle(_itemNameStyle);
				val.fontSize = (ContainsChinese(storyName) ? 20 : 16);
				GUILayout.Label(storyName, val, Array.Empty<GUILayoutOption>());
				if ((Object)(object)_lineTexture != (Object)null)
				{
					GUILayout.Space(5f);
					GUIStyle val2 = new GUIStyle();
					val2.normal.background = null;
					val2.border = new RectOffset(0, 0, 0, 0);
					val2.margin = new RectOffset(0, 0, 0, 0);
					val2.padding = new RectOffset(0, 0, 0, 0);
					val2.alignment = (TextAnchor)4;
					GUI.color = new Color(0.8862745f, 47f / 85f, 0.47058824f);
					GUILayout.Box((Texture)(object)_lineTexture, val2, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(280f),
						GUILayout.Height(20f)
					});
					GUI.color = Color.white;
					GUILayout.Space(5f);
				}
				else
				{
					GUILayout.Space(10f);
				}
				string storyDescription = GetStoryDescription(_selectedStoryId.Value);
				GUIStyle val3 = new GUIStyle(_contentTextStyle);
				val3.fontSize = (ContainsChinese(storyDescription) ? 18 : 16);
				val3.wordWrap = true;
				GUILayout.Label(storyDescription, val3, Array.Empty<GUILayoutOption>());
				GUILayout.EndVertical();
				GUILayout.EndArea();
				GUI.DragWindow(new Rect(0f, 0f, float.MaxValue, 20f));
			}
		}

		private string GetStoryName(int storyId)
		{
			try
			{
				if (Mainload.XiQuID_Enter > storyId)
				{
					string[] array = AllText.Text_AllXiQu[Mainload.XiQuID_Enter][storyId].Split(new char[1] { '|' });
					if (array.Length != 0)
					{
						return array[0];
					}
				}
			}
			catch
			{
			}
			return _vStr.t($"Text_AllXiQu.{storyId}").Split(new char[1] { '|' })[0];
		}

		private string GetStoryDescription(int storyId)
		{
			try
			{
				if (Mainload.XiQuID_Enter > storyId)
				{
					string[] array = AllText.Text_AllXiQu[Mainload.XiQuID_Enter][storyId].Split(new char[1] { '|' });
					if (array.Length > 1)
					{
						return array[1];
					}
				}
			}
			catch
			{
			}
			return _vStr.t($"Text_AllXiQu.{storyId}").Split(new char[1] { '|' })[1];
		}

		private void DrawSignedProperty(string value, string label)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			int num = int.Parse(value);
			if (num != 0)
			{
				string text = ((num > 0) ? "+" : "");
				string text2 = label.Replace("@", text + value);
				GUIStyle val = new GUIStyle(_contentTextStyle);
				val.fontSize = (ContainsChinese(text2) ? 18 : 16);
				GUILayout.Label(text2, val, Array.Empty<GUILayoutOption>());
			}
		}

		private void DrawSpecialItemDescription(int propId)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			switch (propId.ToString())
			{
			case "75":
			{
				string text3 = _vStr.t("Text_UIA.1258");
				GUIStyle val3 = new GUIStyle(_contentTextStyle);
				val3.fontSize = (ContainsChinese(text3) ? 18 : 16);
				GUILayout.Label(text3, val3, Array.Empty<GUILayoutOption>());
				break;
			}
			case "282":
			{
				string text2 = _vStr.t("Text_UIA.1259");
				GUIStyle val2 = new GUIStyle(_contentTextStyle);
				val2.fontSize = (ContainsChinese(text2) ? 18 : 16);
				GUILayout.Label(text2, val2, Array.Empty<GUILayoutOption>());
				break;
			}
			case "283":
			{
				string text4 = _vStr.t("Text_UIA.1260");
				GUIStyle val4 = new GUIStyle(_contentTextStyle);
				val4.fontSize = (ContainsChinese(text4) ? 18 : 16);
				GUILayout.Label(text4, val4, Array.Empty<GUILayoutOption>());
				break;
			}
			case "285":
			{
				string text = _vStr.t("Text_UIA.1808");
				GUIStyle val = new GUIStyle(_contentTextStyle);
				val.fontSize = (ContainsChinese(text) ? 18 : 16);
				GUILayout.Label(text, val, Array.Empty<GUILayoutOption>());
				break;
			}
			}
		}

		public void SetVisible(bool visible)
		{
			_isVisible = visible;
		}

		public void SetSelectedPropId(int? propId)
		{
			_selectedPropId = propId;
		}
	}
}