Decompiled source of MoreMapPins v1.2.0

files/plugins/MoreMapPins.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Arielle")]
[assembly: AssemblyProduct("MoreMapPins")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("MoreMapPins")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyConfiguration("")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreMapPins
{
	internal class AssetLoader
	{
		public static AssetBundle LoadAssetsAndIcons(string filename)
		{
			string filename2 = filename;
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename2));
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}
	}
	internal class ClientPatches
	{
		[HarmonyPatch(typeof(Minimap), "Start")]
		private static class Minimap_Start_Patch
		{
			public static void Postfix(Minimap __instance)
			{
				EnsureVisibleArrayCapacity(__instance);
				GenerateAdditionalWindow(__instance);
			}

			private static void EnsureVisibleArrayCapacity(Minimap map)
			{
				int num = Math.Max(EndPinExclusive, map.m_visibleIconTypes.Length);
				if (map.m_visibleIconTypes.Length < num)
				{
					bool[] visibleIconTypes = map.m_visibleIconTypes;
					Array.Resize(ref map.m_visibleIconTypes, num);
					Array.Copy(visibleIconTypes, map.m_visibleIconTypes, visibleIconTypes.Length);
					for (int i = visibleIconTypes.Length; i < num; i++)
					{
						map.m_visibleIconTypes[i] = true;
					}
				}
			}

			private static void GenerateAdditionalWindow(Minimap map)
			{
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				Minimap map2 = map;
				if (_extraIcons.Count == 0 || (Object)(object)map2?.m_mapLarge == (Object)null)
				{
					return;
				}
				CurrentWindow = PanelHelper.BuildPanel(map2);
				Transform val = ((Transform)CurrentWindow).Find("Scroll View/Viewport/Content");
				Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.Find("IconButtonTemplate") : null);
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
				{
					Debug.LogError((object)"[MoreMapPins] Panel build error: missing Content/IconButtonTemplate");
					return;
				}
				GameObject gameObject = ((Component)val2).gameObject;
				foreach (KeyValuePair<int, Sprite> item in _extraIcons.OrderBy<KeyValuePair<int, Sprite>, int>((KeyValuePair<int, Sprite> k) => k.Key))
				{
					int key = item.Key;
					Sprite value = item.Value;
					PinType val3 = (PinType)key;
					GameObject obj = Object.Instantiate<GameObject>(gameObject, val);
					((Object)obj).name = $"IconButton_{key}";
					obj.SetActive(true);
					Image component = obj.GetComponent<Image>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.sprite = value;
					}
					Transform val4 = obj.transform.Find("Selected");
					Image val5 = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).GetComponent<Image>() : null);
					if (Object.op_Implicit((Object)(object)val5))
					{
						((Behaviour)val5).enabled = false;
					}
					map2.m_icons.Add(new SpriteData
					{
						m_icon = value,
						m_name = val3
					});
					if (Object.op_Implicit((Object)(object)val5))
					{
						map2.m_selectedIcons[val3] = val5;
					}
					UIInputHandler component2 = obj.GetComponent<UIInputHandler>();
					if ((Object)(object)component2 != (Object)null)
					{
						PinType local = val3;
						component2.m_onLeftClick = (Action<UIInputHandler>)Delegate.Combine(component2.m_onLeftClick, (Action<UIInputHandler>)delegate
						{
							//IL_000c: Unknown result type (might be due to invalid IL or missing references)
							map2.SelectIcon(local);
						});
						component2.m_onRightClick = (Action<UIInputHandler>)Delegate.Combine(component2.m_onRightClick, (Action<UIInputHandler>)delegate
						{
							//IL_000c: Unknown result type (might be due to invalid IL or missing references)
							map2.ToggleIconFilter(local);
						});
					}
				}
			}
		}

		[HarmonyPatch(typeof(Minimap), "UpdateMap")]
		private static class Minimap_UpdateMap_Patch
		{
			private static void GuardPanel(ref float mult)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)CurrentWindow) && RectTransformUtility.RectangleContainsScreenPoint(CurrentWindow, Vector2.op_Implicit(Input.mousePosition)))
				{
					mult = 0f;
				}
			}

			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator ilg)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Expected O, but got Unknown
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Expected O, but got Unknown
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Expected O, but got Unknown
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Expected O, but got Unknown
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Expected O, but got Unknown
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Expected O, but got Unknown
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Expected O, but got Unknown
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0214: Expected O, but got Unknown
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Expected O, but got Unknown
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Expected O, but got Unknown
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, ilg).MatchForward(true, (CodeMatch[])(object)new CodeMatch[5]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Mul), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Add), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode.Name.StartsWith("stloc")), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Call), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Brtrue || i.opcode == OpCodes.Brtrue_S), (string)null)
				});
				if (val.IsInvalid)
				{
					return val.Instructions();
				}
				CodeInstruction instruction = val.Instruction;
				OpCode opcode = instruction.opcode;
				CodeInstruction val2 = ((opcode == OpCodes.Stloc_0) ? new CodeInstruction(OpCodes.Ldloca_S, (object)(byte)0) : ((opcode == OpCodes.Stloc_1) ? new CodeInstruction(OpCodes.Ldloca_S, (object)(byte)1) : ((opcode == OpCodes.Stloc_2) ? new CodeInstruction(OpCodes.Ldloca_S, (object)(byte)2) : ((opcode == OpCodes.Stloc_3) ? new CodeInstruction(OpCodes.Ldloca_S, (object)(byte)3) : ((opcode == OpCodes.Stloc_S) ? new CodeInstruction(OpCodes.Ldloca_S, instruction.operand) : ((!(opcode == OpCodes.Stloc)) ? ((CodeInstruction)null) : new CodeInstruction(OpCodes.Ldloca_S, instruction.operand)))))));
				CodeInstruction val3 = val2;
				if (val3 == null)
				{
					return val.Instructions();
				}
				val.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[1] { val3 }).Insert((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Minimap_UpdateMap_Patch), "GuardPanel", (Type[])null, (Type[])null))
				});
				return val.Instructions();
			}
		}

		[HarmonyPatch(typeof(ZInput), "GetMouseScrollWheel")]
		internal static class ZInput_GetMouseScrollWheel_Patch
		{
			private static void Postfix(ref float __result)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Invalid comparison between Unknown and I4
				if (UIInputBlocker.IsPointerOverPanel && (Object)(object)Minimap.instance != (Object)null && (int)Minimap.instance.m_mode == 2)
				{
					__result = 0f;
				}
			}
		}

		private static int StartPin = 750;

		private static int EndPinExclusive = 1000;

		private static string IconsFolderName = "MoreMapPins";

		private static readonly Dictionary<int, Sprite> _extraIcons = new Dictionary<int, Sprite>();

		internal static RectTransform CurrentWindow;

		public static void ApplyPatches()
		{
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(Paths.ConfigPath, IconsFolderName);
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			MonoBehaviour.print((object)("[MoreMapPins] Loading icons from " + text));
			int result;
			foreach (var item in from p in Directory.GetFiles(text, "*.png", SearchOption.TopDirectoryOnly)
				select new
				{
					Path = p,
					Name = Path.GetFileNameWithoutExtension(p)
				} into x
				where int.TryParse(x.Name, out result)
				orderby int.Parse(x.Name)
				select x)
			{
				int num = int.Parse(item.Name);
				int num2 = StartPin + (num - 1);
				if (num2 < StartPin || num2 >= EndPinExclusive)
				{
					Debug.LogWarning((object)$"[MoreMapPins] Skipping '{item.Path}': computed PinType {num2} out of range [{StartPin},{EndPinExclusive}).");
					continue;
				}
				if (_extraIcons.ContainsKey(num2))
				{
					Debug.LogWarning((object)$"[MoreMapPins] Duplicate PinType {num2} from '{item.Path}', ignoring.");
					continue;
				}
				try
				{
					byte[] array = File.ReadAllBytes(item.Path);
					Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
					ImageConversion.LoadImage(val, array);
					Sprite value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
					_extraIcons[num2] = value;
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("[MoreMapPins] Failed to load '" + item.Path + "': " + ex.Message));
				}
			}
		}

		public static void Teardown()
		{
			if (Object.op_Implicit((Object)(object)CurrentWindow))
			{
				Object.Destroy((Object)(object)((Component)CurrentWindow).gameObject);
			}
			CurrentWindow = null;
			foreach (Sprite value in _extraIcons.Values)
			{
				try
				{
					if (Object.op_Implicit((Object)(object)value) && Object.op_Implicit((Object)(object)value.texture))
					{
						Object.Destroy((Object)(object)value.texture);
					}
				}
				catch
				{
				}
			}
			_extraIcons.Clear();
		}
	}
	[BepInPlugin("Arielle.MoreMapPins", "MoreMapPins", "1.2.0")]
	public class MoreMapPinsPlugin : BaseUnityPlugin
	{
		internal const string ModName = "MoreMapPins";

		internal const string ModVersion = "1.2.0";

		internal const string Author = "Arielle";

		private const string ModGUID = "Arielle.MoreMapPins";

		internal static ConfigEntry<float> PanelOffsetX;

		internal static ConfigEntry<float> PanelOffsetY;

		internal static ConfigEntry<float> PanelScrollSpeed;

		internal static Vector2 PanelOffset => new Vector2(PanelOffsetX?.Value ?? (-83f), PanelOffsetY?.Value ?? 60f);

		public static Harmony HarmonyInstance { get; private set; }

		public void Awake()
		{
			PanelOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("UI.Panel", "OffsetX", -83f, "X offset from the big map's bottom-right corner (negative = left)");
			PanelOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("UI.Panel", "OffsetY", 60f, "Y offset from the big map's bottom-right corner (positive = up)");
			PanelScrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("UI.Panel", "ScrollSpeed", 10f, "Mouse wheel scroll sensitivity for the panel. higher = faster, lower = slower");
			PanelOffsetX.SettingChanged += delegate
			{
				TryApplyPanelOffset();
			};
			PanelOffsetY.SettingChanged += delegate
			{
				TryApplyPanelOffset();
			};
			ClientPatches.ApplyPatches();
			HarmonyInstance = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Arielle.MoreMapPins");
		}

		private void TryApplyPanelOffset()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ClientPatches.CurrentWindow != (Object)null)
			{
				ClientPatches.CurrentWindow.anchoredPosition = PanelOffset;
			}
		}

		private void OnDestroy()
		{
			try
			{
				Harmony harmonyInstance = HarmonyInstance;
				if (harmonyInstance != null)
				{
					harmonyInstance.UnpatchSelf();
				}
			}
			catch
			{
			}
			ClientPatches.Teardown();
		}
	}
	internal class PanelHelper
	{
		private const int GridColumns = 5;

		private static readonly Vector2 Cell = new Vector2(40f, 40f);

		private static readonly Vector2 Gap = new Vector2(6f, 6f);

		private static readonly Vector2 Padding = new Vector2(8f, 8f);

		private static readonly Vector2 PanelSize = new Vector2(260f, 220f);

		public static RectTransform BuildPanel(Minimap map)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_012d: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: 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_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: 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_0302: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MoreMapPinsPanel", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val.AddComponent<UIInputBlocker>();
			RectTransform component = val.GetComponent<RectTransform>();
			val.AddComponent<CanvasGroup>().blocksRaycasts = true;
			((Transform)component).SetParent(map.m_mapLarge.transform, false);
			component.anchorMin = new Vector2(1f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.pivot = new Vector2(1f, 0f);
			component.sizeDelta = PanelSize;
			component.anchoredPosition = MoreMapPinsPlugin.PanelOffset;
			((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.65f);
			GameObject val2 = new GameObject("Scroll View", new Type[5]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image),
				typeof(Mask),
				typeof(ScrollRect)
			});
			RectTransform component2 = val2.GetComponent<RectTransform>();
			((Transform)component2).SetParent((Transform)(object)component, false);
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.offsetMin = new Vector2(Padding.x, Padding.y);
			component2.offsetMax = new Vector2(0f - Padding.x, 0f - Padding.y);
			((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.3f);
			val2.GetComponent<Mask>().showMaskGraphic = false;
			RectTransform component3 = new GameObject("Viewport", new Type[2]
			{
				typeof(RectTransform),
				typeof(RectMask2D)
			}).GetComponent<RectTransform>();
			((Transform)component3).SetParent((Transform)(object)component2, false);
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.offsetMin = Vector2.zero;
			component3.offsetMax = Vector2.zero;
			GameObject val3 = new GameObject("Content", new Type[3]
			{
				typeof(RectTransform),
				typeof(GridLayoutGroup),
				typeof(ContentSizeFitter)
			});
			RectTransform component4 = val3.GetComponent<RectTransform>();
			((Transform)component4).SetParent((Transform)(object)component3, false);
			component4.anchorMin = new Vector2(0f, 1f);
			component4.anchorMax = new Vector2(0f, 1f);
			component4.pivot = new Vector2(0f, 1f);
			component4.anchoredPosition = Vector2.zero;
			component4.sizeDelta = Vector2.zero;
			GridLayoutGroup component5 = val3.GetComponent<GridLayoutGroup>();
			component5.cellSize = Cell;
			component5.spacing = Gap;
			component5.constraint = (Constraint)1;
			component5.constraintCount = 5;
			component5.startAxis = (Axis)0;
			component5.startCorner = (Corner)0;
			ContentSizeFitter component6 = val3.GetComponent<ContentSizeFitter>();
			component6.horizontalFit = (FitMode)2;
			component6.verticalFit = (FitMode)2;
			ScrollRect component7 = val2.GetComponent<ScrollRect>();
			component7.viewport = component3;
			component7.content = component4;
			component7.horizontal = false;
			component7.vertical = true;
			component7.movementType = (MovementType)2;
			component7.inertia = true;
			component7.scrollSensitivity = MoreMapPinsPlugin.PanelScrollSpeed.Value;
			CreateIconButtonTemplate(component4);
			return component;
		}

		public static void CreateIconButtonTemplate(RectTransform parent)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0055: 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_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)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("IconButtonTemplate", new Type[4]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image),
				typeof(UIInputHandler)
			});
			RectTransform component = val.GetComponent<RectTransform>();
			((Transform)component).SetParent((Transform)(object)parent, false);
			component.sizeDelta = Cell;
			((Graphic)val.GetComponent<Image>()).color = Color.white;
			GameObject val2 = new GameObject("Selected", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			RectTransform component2 = val2.GetComponent<RectTransform>();
			((Transform)component2).SetParent((Transform)(object)component, false);
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = Vector2.zero;
			Image component3 = val2.GetComponent<Image>();
			((Graphic)component3).color = new Color(1f, 1f, 1f, 0.25f);
			((Behaviour)component3).enabled = false;
			val.SetActive(false);
		}
	}
	public class UIInputBlocker : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IScrollHandler
	{
		public static bool IsPointerOverPanel { get; private set; }

		public void OnPointerEnter(PointerEventData e)
		{
			IsPointerOverPanel = true;
		}

		public void OnPointerExit(PointerEventData e)
		{
			IsPointerOverPanel = false;
		}

		public void OnScroll(PointerEventData e)
		{
		}

		private void OnDisable()
		{
			if (IsPointerOverPanel)
			{
				IsPointerOverPanel = false;
			}
		}
	}
}