Decompiled source of OrbitMapSelector v0.2.3

BepInEx/plugins/HJM.InteriorSelector.dll

Decompiled 22 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using DunGen.Graph;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 HJM.InteriorSelector
{
	[Serializable]
	public sealed class BlockSettings
	{
		public int version = 2;

		public List<string> blocked = new List<string>();
	}
	[BepInPlugin("hjm.interiorselector", "HJM Map Blocker / 地图屏蔽", "0.2.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Id = "hjm.interiorselector";

		internal static Plugin Instance;

		internal HashSet<string> Blocked = new HashSet<string>(StringComparer.Ordinal);

		private ConfigEntry<string> settings;

		private Harmony harmony;

		private bool visible;

		private QuickMenuManager quickMenu;

		private GameObject blocker;

		private List<ExtendedDungeonFlow> rows = new List<ExtendedDungeonFlow>();

		private HashSet<string> draft = new HashSet<string>(StringComparer.Ordinal);

		private bool dirty;

		private string status = "";

		private string search = "";

		private Vector2 scroll;

		private Rect window = new Rect(50f, 30f, 1180f, 760f);

		private Font font;

		private GUIStyle normalStyle;

		private GUIStyle headerStyle;

		private GUIStyle buttonStyle;

		private GUIStyle inputStyle;

		private GUIStyle toggleStyle;

		internal static bool IsHost
		{
			get
			{
				if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer)
				{
					return NetworkManager.Singleton.IsListening;
				}
				return false;
			}
		}

		internal static bool InOrbit
		{
			get
			{
				StartOfRound instance = StartOfRound.Instance;
				if ((Object)(object)instance != (Object)null && instance.inShipPhase && !instance.shipHasLanded && !instance.shipIsLeaving)
				{
					return !instance.travellingToNewLevel;
				}
				return false;
			}
		}

		internal static bool CanEdit
		{
			get
			{
				if (IsHost)
				{
					return InOrbit;
				}
				return false;
			}
		}

		private void Awake()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			Instance = this;
			settings = ((BaseUnityPlugin)this).Config.Bind<string>("Storage", "BlockedInteriors", "", "Managed by the in-game map blocking menu.");
			LethalConfigManager.SkipAutoGenFor((ConfigEntryBase)(object)settings);
			LoadSaved();
			LethalConfigManager.SetModDescription("房主在轨道中勾选要屏蔽的室内地图,保存后在所有星球生效。下一次落地按未屏蔽地图的原有几率生成。");
			LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem("Maps / 地图", "Block Interiors / 屏蔽室内地图", "轨道中由房主操作。勾选表示屏蔽,保存后下一次落地生效。", "Open / 打开菜单", new GenericButtonHandler(Open)));
			harmony = new Harmony("hjm.interiorselector");
			harmony.Patch((MethodBase)AccessTools.Method(typeof(DungeonManager), "GetValidExtendedDungeonFlows", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Hooks), "Pool", (Type[])null)
			{
				priority = 0
			}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"0.2.2 ready: opaque dark menu with independent canvas; existing host-only LLL blocklist.");
		}

		private void OnDestroy()
		{
			Close();
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		internal static string Key(ExtendedContent content)
		{
			if ((Object)(object)content == (Object)null)
			{
				return "";
			}
			if (!string.IsNullOrEmpty(content.UniqueIdentificationName))
			{
				return content.UniqueIdentificationName;
			}
			return content.ModName + "/" + ((Object)content).name;
		}

		internal static bool IsVanilla(ExtendedDungeonFlow flow)
		{
			if ((Object)(object)flow == (Object)null || (Object)(object)flow.DungeonFlow == (Object)null)
			{
				return false;
			}
			string name = ((Object)flow.DungeonFlow).name;
			if (!(name == "Level1Flow") && !(name == "Level2Flow"))
			{
				return name == "Level3Flow";
			}
			return true;
		}

		internal static string Name(ExtendedDungeonFlow flow)
		{
			switch (((Object)flow.DungeonFlow).name)
			{
			case "Level1Flow":
				return "工厂 / Facility";
			case "Level2Flow":
				return "豪宅 / Mansion";
			case "Level3Flow":
				return "矿井 / Mineshaft";
			default:
				if (!string.IsNullOrEmpty(flow.DungeonName))
				{
					return flow.DungeonName;
				}
				return ((Object)flow.DungeonFlow).name;
			}
		}

		internal static List<ExtendedDungeonFlow> Catalog()
		{
			List<ExtendedDungeonFlow> list = new List<ExtendedDungeonFlow>();
			RoundManager instance = RoundManager.Instance;
			if ((Object)(object)instance == (Object)null || instance.dungeonFlowTypes == null)
			{
				return list;
			}
			HashSet<DungeonFlow> hashSet = new HashSet<DungeonFlow>(from f in instance.dungeonFlowTypes
				where f != null
				select f.dungeonFlow);
			foreach (ExtendedDungeonFlow flow in PatchedContent.ExtendedDungeonFlows)
			{
				if ((Object)(object)flow != (Object)null && (Object)(object)flow.DungeonFlow != (Object)null && hashSet.Contains(flow.DungeonFlow) && !list.Any((ExtendedDungeonFlow f) => Key((ExtendedContent)(object)f) == Key((ExtendedContent)(object)flow)))
				{
					list.Add(flow);
				}
			}
			return list.OrderBy((ExtendedDungeonFlow f) => f.DungeonID).ToList();
		}

		internal void LoadSaved()
		{
			if (string.IsNullOrWhiteSpace(settings.Value))
			{
				return;
			}
			try
			{
				BlockSettings blockSettings = JsonConvert.DeserializeObject<BlockSettings>(settings.Value);
				if (blockSettings == null || blockSettings.version != 2 || blockSettings.blocked == null || blockSettings.blocked.Any(string.IsNullOrWhiteSpace))
				{
					throw new FormatException("Invalid map blocklist");
				}
				Blocked = new HashSet<string>(blockSettings.blocked, StringComparer.Ordinal);
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not read saved blocklist; keeping current settings. " + ex.Message));
			}
		}

		internal bool SaveBlocks(IEnumerable<string> ids, out string message)
		{
			message = "";
			if (!CanEdit)
			{
				message = "只有轨道中的房主可以保存。";
				return false;
			}
			List<ExtendedDungeonFlow> source = Catalog();
			List<ExtendedDungeonFlow> list = source.Where(IsVanilla).ToList();
			if (list.Count == 0)
			{
				message = "地图尚未完成加载,请稍后再试。";
				return false;
			}
			HashSet<string> replacement = new HashSet<string>(ids.Where((string id) => !string.IsNullOrWhiteSpace(id)), StringComparer.Ordinal);
			if (list.All((ExtendedDungeonFlow flow) => replacement.Contains(Key((ExtendedContent)(object)flow))))
			{
				message = "请至少保留一种原版室内地图,供地图池为空时使用。";
				return false;
			}
			string value = settings.Value;
			bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet;
			try
			{
				((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
				settings.Value = JsonConvert.SerializeObject((object)new BlockSettings
				{
					blocked = replacement.OrderBy<string, string>((string id) => id, StringComparer.Ordinal).ToList()
				});
				((BaseUnityPlugin)this).Config.Save();
				Blocked = replacement;
			}
			catch (Exception ex)
			{
				settings.Value = value;
				((BaseUnityPlugin)this).Logger.LogError((object)ex);
				message = "保存失败,原屏蔽设置已保留。";
				return false;
			}
			finally
			{
				((BaseUnityPlugin)this).Config.SaveOnConfigSet = saveOnConfigSet;
			}
			message = "已保存。勾选的地图已在所有星球屏蔽,下一次落地生效。";
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Saved global blocklist; registered interiors blocked=" + source.Count((ExtendedDungeonFlow f) => Blocked.Contains(Key((ExtendedContent)(object)f)))));
			return true;
		}

		internal List<ExtendedDungeonFlowWithRarity> FilterPool(List<ExtendedDungeonFlowWithRarity> original)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			if (Blocked.Count == 0)
			{
				return original;
			}
			List<ExtendedDungeonFlowWithRarity> list = original.Where((ExtendedDungeonFlowWithRarity item) => item != null && (Object)(object)item.extendedDungeonFlow != (Object)null && !Blocked.Contains(Key((ExtendedContent)(object)item.extendedDungeonFlow))).ToList();
			if (list.Count > 0)
			{
				return list;
			}
			ExtendedDungeonFlow val = ((IEnumerable<ExtendedDungeonFlow>)Catalog()).FirstOrDefault((Func<ExtendedDungeonFlow, bool>)((ExtendedDungeonFlow flow) => IsVanilla(flow) && !Blocked.Contains(Key((ExtendedContent)(object)flow))));
			if ((Object)(object)val != (Object)null)
			{
				return new List<ExtendedDungeonFlowWithRarity>
				{
					new ExtendedDungeonFlowWithRarity(val, 300)
				};
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)"No unblocked vanilla fallback is registered. Leaving the original pool unchanged.");
			return original;
		}

		private void Update()
		{
			if (visible && (!CanEdit || (Object)(object)quickMenu == (Object)null || !quickMenu.isMenuOpen))
			{
				Close();
			}
		}

		internal void Open()
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			if (visible)
			{
				return;
			}
			if (!CanEdit)
			{
				if ((Object)(object)HUDManager.Instance != (Object)null)
				{
					HUDManager.Instance.DisplayTip("地图屏蔽", IsHost ? "请在飞船进入轨道、航行结束后使用。" : "地图屏蔽由房主设置。", false, false, "LC_Tip1");
				}
				return;
			}
			quickMenu = Object.FindObjectOfType<QuickMenuManager>();
			if ((Object)(object)quickMenu == (Object)null || !quickMenu.isMenuOpen)
			{
				return;
			}
			rows = Catalog();
			if (rows.Count == 0)
			{
				if ((Object)(object)HUDManager.Instance != (Object)null)
				{
					HUDManager.Instance.DisplayTip("地图屏蔽", "地图尚未完成加载,请稍后再试。", false, false, "LC_Tip1");
				}
				return;
			}
			draft = new HashSet<string>(Blocked, StringComparer.Ordinal);
			dirty = false;
			search = "";
			scroll = Vector2.zero;
			status = "勾选要屏蔽的室内地图,再点保存。设置会在重启后保留。";
			blocker = new GameObject("HJM-MapMenu-InputBlocker", new Type[3]
			{
				typeof(RectTransform),
				typeof(Canvas),
				typeof(GraphicRaycaster)
			});
			((Object)blocker).hideFlags = (HideFlags)52;
			Canvas component = blocker.GetComponent<Canvas>();
			component.renderMode = (RenderMode)0;
			component.overrideSorting = true;
			component.sortingOrder = 32760;
			GameObject val = new GameObject("BlockBehindMapMenu", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(blocker.transform, false);
			RectTransform component2 = val.GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			Vector2 offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			Image component3 = val.GetComponent<Image>();
			((Graphic)component3).color = new Color(0f, 0f, 0f, 0.9f);
			((Graphic)component3).raycastTarget = true;
			visible = true;
		}

		internal void Close()
		{
			visible = false;
			if ((Object)(object)blocker != (Object)null)
			{
				Object.Destroy((Object)(object)blocker);
			}
			blocker = null;
		}

		internal bool SetDraft(string id, bool blocked)
		{
			if (!CanEdit)
			{
				return false;
			}
			if (blocked && rows.Where(IsVanilla).All((ExtendedDungeonFlow f) => Key((ExtendedContent)(object)f) == id || draft.Contains(Key((ExtendedContent)(object)f))))
			{
				status = "请至少保留一种原版室内地图,供地图池为空时使用。";
				return false;
			}
			if (blocked)
			{
				draft.Add(id);
			}
			else
			{
				draft.Remove(id);
			}
			dirty = !draft.SetEquals(Blocked);
			return true;
		}

		internal void SaveDraft()
		{
			if (SaveBlocks(draft, out status))
			{
				dirty = false;
			}
		}

		private void Styles()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00ee: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_012d: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			if (normalStyle == null)
			{
				font = Font.CreateDynamicFontFromOSFont(new string[3] { "Microsoft YaHei", "SimHei", "Arial" }, 20);
				normalStyle = new GUIStyle(GUI.skin.label)
				{
					font = font,
					fontSize = 20,
					alignment = (TextAnchor)3,
					wordWrap = true
				};
				normalStyle.normal.textColor = new Color(0.89f, 0.93f, 0.96f);
				headerStyle = new GUIStyle(normalStyle)
				{
					fontSize = 27,
					fontStyle = (FontStyle)1
				};
				buttonStyle = new GUIStyle(GUI.skin.button)
				{
					font = font,
					fontSize = 20,
					alignment = (TextAnchor)4,
					padding = new RectOffset(8, 8, 6, 6)
				};
				inputStyle = new GUIStyle(GUI.skin.textField)
				{
					font = font,
					fontSize = 20,
					alignment = (TextAnchor)3,
					padding = new RectOffset(8, 8, 4, 4)
				};
				toggleStyle = new GUIStyle(GUI.skin.toggle)
				{
					font = font,
					fontSize = 21,
					alignment = (TextAnchor)3
				};
				GUIStyleState normal = toggleStyle.normal;
				GUIStyleState onNormal = toggleStyle.onNormal;
				Color textColor = default(Color);
				((Color)(ref textColor))..ctor(0.89f, 0.93f, 0.96f);
				onNormal.textColor = textColor;
				normal.textColor = textColor;
			}
		}

		private void OnGUI()
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00a6: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (!visible)
			{
				return;
			}
			Styles();
			Matrix4x4 matrix = GUI.matrix;
			int depth = GUI.depth;
			bool enabled = GUI.enabled;
			try
			{
				GUI.depth = -1000;
				float num = Math.Min((float)Screen.width / 1280f, (float)Screen.height / 830f);
				GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num, num, 1f));
				window = GUI.Window(87291, window, new WindowFunction(DrawMenu), "", new GUIStyle(GUI.skin.window)
				{
					font = font
				});
			}
			finally
			{
				GUI.matrix = matrix;
				GUI.depth = depth;
				GUI.enabled = enabled;
			}
		}

		private static void Fill(Rect rect, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			try
			{
				GUI.color = color;
				GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture);
			}
			finally
			{
				GUI.color = color2;
			}
		}

		private void DrawMenu(int id)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			Fill(new Rect(0f, 0f, ((Rect)(ref window)).width, ((Rect)(ref window)).height), new Color(0.055f, 0.07f, 0.09f, 1f));
			GUI.Label(new Rect(24f, 12f, 900f, 48f), "地图屏蔽", headerStyle);
			if (GUI.Button(new Rect(1028f, 20f, 126f, 38f), "关闭", buttonStyle))
			{
				Close();
				return;
			}
			GUI.Label(new Rect(24f, 66f, 1120f, 36f), "勾选 = 屏蔽    ·    房主设置    ·    所有星球生效    ·    保存后下一次落地生效", normalStyle);
			GUI.Label(new Rect(24f, 114f, 110f, 36f), "搜索地图", normalStyle);
			search = GUI.TextField(new Rect(140f, 116f, 540f, 36f), search, 80, inputStyle);
			GUI.Label(new Rect(740f, 114f, 400f, 36f), "已勾选屏蔽:" + rows.Count((ExtendedDungeonFlow f) => draft.Contains(Key((ExtendedContent)(object)f))) + " / " + rows.Count, normalStyle);
			List<ExtendedDungeonFlow> list = rows.Where((ExtendedDungeonFlow f) => string.IsNullOrWhiteSpace(search) || Name(f).IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
			scroll = GUI.BeginScrollView(new Rect(24f, 172f, 1132f, 408f), scroll, new Rect(0f, 0f, 1104f, (float)Math.Max(408, list.Count * 58)));
			for (int num = 0; num < list.Count; num++)
			{
				ExtendedDungeonFlow val = list[num];
				string text = Key((ExtendedContent)(object)val);
				float num2 = num * 58;
				Fill(new Rect(0f, num2, 1100f, 54f), (num % 2 == 0) ? new Color(0.1f, 0.125f, 0.16f, 1f) : new Color(0.13f, 0.155f, 0.19f, 1f));
				GUI.Label(new Rect(14f, num2 + 4f, 660f, 46f), Name(val), normalStyle);
				GUI.Label(new Rect(710f, num2 + 4f, 150f, 46f), IsVanilla(val) ? "原版" : "模组", normalStyle);
				bool flag = draft.Contains(text);
				GUI.enabled = CanEdit;
				bool flag2 = GUI.Toggle(new Rect(918f, num2 + 10f, 160f, 36f), flag, flag ? " 屏蔽" : " 允许", toggleStyle);
				if (flag2 != flag)
				{
					SetDraft(text, flag2);
				}
				GUI.enabled = true;
			}
			GUI.EndScrollView();
			GUI.Label(new Rect(24f, 592f, 1128f, 48f), "至少保留一种原版室内图。某星球的地图池被全部屏蔽时,将使用未屏蔽的原版图。", normalStyle);
			GUI.enabled = CanEdit && dirty;
			if (GUI.Button(new Rect(24f, 650f, 246f, 44f), "保存屏蔽设置", buttonStyle))
			{
				SaveDraft();
			}
			GUI.enabled = CanEdit;
			if (GUI.Button(new Rect(292f, 650f, 246f, 44f), "全部允许", buttonStyle))
			{
				draft.Clear();
				dirty = !draft.SetEquals(Blocked);
				status = "已取消全部勾选,点保存后生效。";
			}
			GUI.enabled = true;
			GUI.Label(new Rect(568f, 650f, 572f, 44f), dirty ? "有未保存的修改;关闭会丢弃修改。" : "设置已保存。", normalStyle);
			GUI.Label(new Rect(24f, 702f, 1128f, 40f), status, normalStyle);
		}
	}
	internal static class Hooks
	{
		internal static void Pool(ref List<ExtendedDungeonFlowWithRarity> __result)
		{
			Plugin instance = Plugin.Instance;
			if (!((Object)(object)instance == (Object)null) && Plugin.IsHost && __result != null)
			{
				__result = instance.FilterPool(__result);
			}
		}
	}
}