Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MoreMapPins v1.3.0
files/plugins/MoreMapPins.dll
Decompiled 8 months agousing 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.Events; using UnityEngine.UI; [assembly: AssemblyFileVersion("1.3.0")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyProduct("MoreMapPins")] [assembly: AssemblyCompany("Arielle")] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyTitle("MoreMapPins")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.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; } } [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 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(); } internal static void SetAllIconFilters(Minimap map, bool visible) { if ((Object)(object)map == (Object)null) { return; } 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; } } for (int j = 0; j < map.m_visibleIconTypes.Length; j++) { if (map.m_visibleIconTypes[j] != visible) { map.ToggleIconFilter((PinType)j); } } } } [BepInPlugin("Arielle.MoreMapPins", "MoreMapPins", "1.3.0")] public class MoreMapPinsPlugin : BaseUnityPlugin { internal const string ModName = "MoreMapPins"; internal const string ModVersion = "1.3.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); private const float ToolbarHeight = 28f; 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0310: 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); CreateToolbar(component, map); 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 - 28f); ((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; } private static RectTransform CreateToolbar(RectTransform parent, Minimap map) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown Minimap map2 = map; GameObject val = new GameObject("Toolbar", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform barRT = val.GetComponent<RectTransform>(); ((Transform)barRT).SetParent((Transform)(object)parent, false); barRT.anchorMin = new Vector2(0f, 1f); barRT.anchorMax = new Vector2(1f, 1f); barRT.pivot = new Vector2(0.5f, 1f); barRT.sizeDelta = new Vector2(0f, 28f); barRT.anchoredPosition = new Vector2(0f, 0f - Padding.y); ((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.35f); HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)obj).padding = new RectOffset((int)Padding.x, (int)Padding.x, 0, 0); ((HorizontalOrVerticalLayoutGroup)obj).spacing = Gap.x; ((LayoutGroup)obj).childAlignment = (TextAnchor)3; MakeButton("AllOffButton", "All Off", delegate { ClientPatches.SetAllIconFilters(map2, visible: false); }); MakeButton("AllOnButton", "All On", delegate { ClientPatches.SetAllIconFilters(map2, visible: true); }); return barRT; RectTransform MakeButton(string name, string label, Action onClick) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) Action onClick2 = onClick; GameObject val2 = new GameObject(name, new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button) }); RectTransform component = val2.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)barRT, false); component.sizeDelta = new Vector2(80f, 22f); ((Graphic)val2.GetComponent<Image>()).color = new Color(1f, 1f, 1f, 0.15f); ((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { onClick2?.Invoke(); }); GameObject val3 = new GameObject("Text", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); RectTransform component2 = val3.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; Text component3 = val3.GetComponent<Text>(); component3.text = label; component3.alignment = (TextAnchor)4; component3.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); component3.fontSize = 14; ((Graphic)component3).color = Color.white; 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; } } } }