Decompiled source of Minimap v1.6.3
MinimapRuntime.dll
Decompiled 8 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using HarmonyLib; using MelonLoader; using Microsoft.CodeAnalysis; using MimesisPatches; using Mimic.Actors; using Pathfinding; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: MelonInfo(typeof(MelonEntry), "Minimap", "1.6.3", "medovanx", "https://github.com/medovanx/mimesis-patches")] [assembly: MelonGame("ReLUGames", "MIMESIS")] [assembly: HarmonyDontPatchAll] [assembly: AssemblyCompany("Mohamed Darwesh")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Mohamed Darwesh (github.com/medovanx)")] [assembly: AssemblyFileVersion("1.6.3.0")] [assembly: AssemblyInformationalVersion("1.6.3+c0c5849b6d1e86d27fb44104da693c963cf161f6")] [assembly: AssemblyProduct("MinimapRuntime")] [assembly: AssemblyTitle("MinimapRuntime")] [assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (code, refactoring and documentation).")] [assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic (Claude)")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.3.0")] [module: UnverifiableCode] [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 MimesisPatches { internal sealed class PatchMenu : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Comparison<Dictionary<string, object>> <>9__8_1; public static UnityAction <>9__25_0; internal int <Register>b__8_1(Dictionary<string, object> a, Dictionary<string, object> b) { return string.CompareOrdinal((string)a["name"], (string)b["name"]); } internal void <BuildWindow>b__25_0() { Application.OpenURL("https://github.com/medovanx/mimesis-patches"); } } public const string Repo = "medovanx/mimesis-patches"; public const string RepoUrl = "https://github.com/medovanx/mimesis-patches"; private const string SizeKey = "medovanx.patches.window"; private static readonly Vector2 MinSize = new Vector2(900f, 560f); private const string RegistryKey = "medovanx.patches.registry"; private const string OwnerKey = "medovanx.patches.owner"; private static readonly Color ChipColor = new Color(0f, 0f, 0f, 0.55f); private static readonly Color UpdateColor = new Color(0.85f, 0.45f, 0.05f, 0.85f); private RectTransform _row; private TMP_Text _chipText; private Image _chipBg; private TMP_FontAsset _font; private GameObject _window; private RectTransform _sidebar; private RectTransform _content; private string _selected; private static int _hovered; private static IntPtr _hand; private const int IDC_HAND = 32649; private static List<Dictionary<string, object>> Entries => (AppDomain.CurrentDomain.GetData("medovanx.patches.registry") as List<Dictionary<string, object>>) ?? new List<Dictionary<string, object>>(); public static void Register(string name, Version version, Func<string> status = null, Action<RectTransform, TMP_FontAsset> build = null) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown List<Dictionary<string, object>> list = AppDomain.CurrentDomain.GetData("medovanx.patches.registry") as List<Dictionary<string, object>>; if (list == null) { AppDomain.CurrentDomain.SetData("medovanx.patches.registry", list = new List<Dictionary<string, object>>()); } list.RemoveAll((Dictionary<string, object> e) => (string)e["name"] == name); list.Add(new Dictionary<string, object> { ["name"] = name, ["version"] = new Version(version.Major, version.Minor, Math.Max(version.Build, 0)), ["status"] = status, ["build"] = ((build == null) ? null : ((Action<RectTransform, TMP_FontAsset>)delegate(RectTransform rt, TMP_FontAsset font) { PatchUi.Refreshers.Clear(); build(rt, font); PatchUi.RefreshAll(); })) }); list.Sort((Dictionary<string, object> a, Dictionary<string, object> b) => string.CompareOrdinal((string)a["name"], (string)b["name"])); if (AppDomain.CurrentDomain.GetData("medovanx.patches.owner") == null) { AppDomain.CurrentDomain.SetData("medovanx.patches.owner", name); GameObject val = new GameObject("MedovanxPatchMenu"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<PatchMenu>(); } } private static Version Latest(Dictionary<string, object> e) { if (!e.TryGetValue("latest", out var value)) { return null; } return value as Version; } private static bool HasUpdate(Dictionary<string, object> e) { if (Latest(e) != null) { return Latest(e) > (Version)e["version"]; } return false; } private IEnumerator Start() { WaitForSeconds wait = new WaitForSeconds(0.5f); while (true) { GameObject val = GameObject.Find("UIPrefab_MainMenu(Clone)") ?? GameObject.Find("UIPrefab_MainMenu"); object obj; if (!((Object)(object)val != (Object)null)) { obj = null; } else { Transform obj2 = val.transform.Find("VersionTextRect/versionText"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<TMP_Text>() : null); } TMP_Text val2 = (TMP_Text)obj; if ((Object)(object)val2 == (Object)null) { if ((Object)(object)_row != (Object)null) { ((Component)_row).gameObject.SetActive(false); } _hovered = 0; } else if ((Object)(object)((Graphic)val2).canvas != (Object)null) { _font = val2.font; if ((Object)(object)_row == (Object)null) { BuildChip(((Component)((Graphic)val2).canvas.rootCanvas).transform, val2); } List<Dictionary<string, object>> entries = Entries; int num = entries.Count(HasUpdate); _chipText.text = $"Patches ({entries.Count})" + ((num > 0) ? $", {num} update{((num > 1) ? "s" : "")}" : ""); ((Graphic)_chipBg).color = ((num > 0) ? UpdateColor : ChipColor); bool flag = val.activeInHierarchy && ((Object)(object)Hub.s == (Object)null || Hub.s.pdata == null || (Object)(object)Hub.s.pdata.main == (Object)null); ((Component)_row).gameObject.SetActive(flag); if (!flag) { _hovered = 0; Close(); } } yield return wait; } } private void BuildChip(Transform canvas, TMP_Text version) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0066: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) _row = new GameObject("PatchChips", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)_row).SetParent(canvas, false); ((Transform)_row).SetAsLastSibling(); RectTransform row = _row; RectTransform row2 = _row; Vector2 val = (_row.pivot = Vector2.zero); Vector2 anchorMin = (row2.anchorMax = val); row.anchorMin = anchorMin; _row.anchoredPosition = new Vector2(24f, 20f); _row.sizeDelta = new Vector2(600f, 30f); HorizontalLayoutGroup obj = ((Component)_row).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)obj).childAlignment = (TextAnchor)6; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childControlWidth; GameObject val3 = new GameObject("Chip_Patches", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Button) }); val3.transform.SetParent((Transform)(object)_row, false); _chipBg = val3.GetComponent<Image>(); Button component = val3.GetComponent<Button>(); ((Selectable)component).targetGraphic = (Graphic)(object)_chipBg; ColorBlock colors = ((Selectable)component).colors; ((ColorBlock)(ref colors)).highlightedColor = new Color(1.6f, 1.6f, 1.6f, 1f); ((Selectable)component).colors = colors; ((UnityEvent)component.onClick).AddListener(new UnityAction(Open)); Hover(val3); HorizontalLayoutGroup obj2 = val3.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)obj2).padding = new RectOffset(12, 12, 4, 4); childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = childControlWidth; _chipText = (TMP_Text)(object)new GameObject("Text", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>(); _chipText.transform.SetParent(val3.transform, false); _chipText.font = version.font; _chipText.fontSize = version.fontSize * 0.85f; ((Graphic)_chipText).color = PatchUi.Text; ((Graphic)_chipText).raycastTarget = false; Debug.Log((object)"[Patches] Main menu chip added"); } private void Open() { if ((Object)(object)_window == (Object)null) { BuildWindow(); } _window.SetActive(true); List<Dictionary<string, object>> entries = Entries; if (_selected == null || entries.All((Dictionary<string, object> e) => (string)e["name"] != _selected)) { _selected = entries.FirstOrDefault()?["name"] as string; } BuildSidebar(); Select(_selected); } private void Close() { if ((Object)(object)_window != (Object)null) { _window.SetActive(false); } } private void BuildWindow() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00ef: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0278: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: 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) //IL_02ed: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0361: 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_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Expected O, but got Unknown //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Expected O, but got Unknown Canvas component = new GameObject("PatchesWindow", new Type[3] { typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }).GetComponent<Canvas>(); ((Component)component).transform.SetParent(((Component)this).transform, false); component.renderMode = (RenderMode)0; component.sortingOrder = 200; CanvasScaler component2 = ((Component)component).GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 1f; _window = ((Component)component).gameObject; RectTransform obj = PatchUi.Box(((Component)component).transform, "Dim", new Color(0f, 0f, 0f, 0.55f)); PatchUi.Stretch(obj); Button obj2 = ((Component)obj).gameObject.AddComponent<Button>(); ((Selectable)obj2).transition = (Transition)0; ((UnityEvent)obj2.onClick).AddListener(new UnityAction(Close)); RectTransform val = PatchUi.Box(((Component)component).transform, "Panel", new Color(0.06f, 0.06f, 0.06f, 0.96f)); val.sizeDelta = new Vector2(Mathf.Clamp(PlayerPrefs.GetFloat("medovanx.patches.window.w", 1100f), MinSize.x, 1900f), Mathf.Clamp(PlayerPrefs.GetFloat("medovanx.patches.window.h", 760f), MinSize.y, 1060f)); val.anchoredPosition = new Vector2(PlayerPrefs.GetFloat("medovanx.patches.window.x", 0f), PlayerPrefs.GetFloat("medovanx.patches.window.y", 0f)); WindowFrame.AddMove(val); TMP_Text obj3 = PatchUi.Label((Transform)(object)val, _font, "Patches", 30f); Object.Destroy((Object)(object)((Component)obj3).GetComponent<LayoutElement>()); obj3.rectTransform.anchorMin = new Vector2(0f, 1f); obj3.rectTransform.anchorMax = new Vector2(1f, 1f); obj3.rectTransform.pivot = new Vector2(0f, 1f); obj3.rectTransform.offsetMin = new Vector2(28f, -64f); obj3.rectTransform.offsetMax = new Vector2(-80f, -16f); RectTransform val2 = PatchUi.Box((Transform)(object)val, "Close", PatchUi.Off); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 1f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; val2.anchoredPosition = new Vector2(-16f, -16f); val2.sizeDelta = new Vector2(44f, 44f); ((Graphic)((Component)val2).GetComponent<Image>()).color = PatchUi.Off; Button obj4 = ((Component)val2).gameObject.AddComponent<Button>(); ((Selectable)obj4).targetGraphic = (Graphic)(object)((Component)val2).GetComponent<Image>(); ((UnityEvent)obj4.onClick).AddListener(new UnityAction(Close)); Hover(((Component)val2).gameObject); float[] array = new float[2] { 45f, -45f }; foreach (float num in array) { RectTransform obj5 = PatchUi.Box((Transform)(object)val2, "Bar", PatchUi.Text); obj5.sizeDelta = new Vector2(22f, 3f); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); obj5.pivot = val3; anchorMin = (obj5.anchorMax = val3); obj5.anchorMin = anchorMin; obj5.anchoredPosition = Vector2.zero; ((Transform)obj5).localRotation = Quaternion.Euler(0f, 0f, num); ((Graphic)((Component)obj5).GetComponent<Image>()).raycastTarget = false; } TMP_Text obj6 = PatchUi.Label((Transform)(object)val, _font, "Made by <b>Mohamed Darwesh</b> (@medovanx) | <u>github.com/medovanx/mimesis-patches</u>", 18f, PatchUi.Dim); Object.Destroy((Object)(object)((Component)obj6).GetComponent<LayoutElement>()); obj6.alignment = (TextAlignmentOptions)514; ((Graphic)obj6).raycastTarget = true; RectTransform rectTransform = obj6.rectTransform; rectTransform.anchorMin = new Vector2(0f, 0f); rectTransform.anchorMax = new Vector2(1f, 0f); rectTransform.pivot = new Vector2(0.5f, 0f); rectTransform.offsetMin = new Vector2(16f, 12f); rectTransform.offsetMax = new Vector2(-16f, 44f); ButtonClickedEvent onClick = ((Component)obj6).gameObject.AddComponent<Button>().onClick; object obj7 = <>c.<>9__25_0; if (obj7 == null) { UnityAction val6 = delegate { Application.OpenURL("https://github.com/medovanx/mimesis-patches"); }; <>c.<>9__25_0 = val6; obj7 = (object)val6; } ((UnityEvent)onClick).AddListener((UnityAction)obj7); Hover(((Component)obj6).gameObject); _sidebar = PatchUi.Box((Transform)(object)val, "Sidebar", new Color(1f, 1f, 1f, 0.04f)); _sidebar.anchorMin = new Vector2(0f, 0f); _sidebar.anchorMax = new Vector2(0f, 1f); _sidebar.pivot = new Vector2(0f, 0.5f); _sidebar.offsetMin = new Vector2(16f, 56f); _sidebar.offsetMax = new Vector2(296f, -80f); VerticalLayoutGroup obj8 = ((Component)_sidebar).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)obj8).padding = new RectOffset(8, 8, 8, 8); ((HorizontalOrVerticalLayoutGroup)obj8).spacing = 6f; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj8).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj8).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj8).childForceExpandHeight = false; _content = new GameObject("Content", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)_content).SetParent((Transform)(object)val, false); _content.anchorMin = Vector2.zero; _content.anchorMax = Vector2.one; _content.offsetMin = new Vector2(320f, 56f); _content.offsetMax = new Vector2(-24f, -80f); VerticalLayoutGroup obj9 = ((Component)_content).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj9).spacing = 14f; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj9).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj9).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj9).childForceExpandHeight = false; WindowFrame.AddResize(val); } private void BuildSidebar() { //IL_0014: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in (Transform)_sidebar) { Object.Destroy((Object)(object)((Component)item).gameObject); } foreach (Dictionary<string, object> entry in Entries) { string name = (string)entry["name"]; string label = name + " <size=70%><color=#A6AAA0>v" + ((Version)entry["version"]).ToString(3) + "</color></size>" + (HasUpdate(entry) ? " <color=#E08A1E>●</color>" : ""); Button obj = PatchUi.Button((Transform)(object)_sidebar, _font, label, delegate { _selected = name; Select(name); }, 260f, 48f); TMP_Text componentInChildren = ((Component)obj).GetComponentInChildren<TMP_Text>(); componentInChildren.alignment = (TextAlignmentOptions)4097; componentInChildren.margin = new Vector4(14f, 0f, 8f, 0f); ((Graphic)((Component)obj).GetComponent<Image>()).color = ((name == _selected) ? PatchUi.On : PatchUi.Off); } } private void Select(string name) { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown BuildSidebar(); foreach (Transform item in (Transform)_content) { Object.Destroy((Object)(object)((Component)item).gameObject); } Dictionary<string, object> dictionary = Entries.FirstOrDefault((Dictionary<string, object> x) => (string)x["name"] == name); if (dictionary == null) { return; } PatchUi.Label((Transform)(object)_content, _font, name + " <size=70%><color=#A6AAA0>v" + ((Version)dictionary["version"]).ToString(3) + "</color></size>", 30f, null, 40f); if (dictionary["status"] is Func<string> func) { string text = null; try { text = func(); } catch { } if (!string.IsNullOrEmpty(text)) { PatchUi.Label((Transform)(object)_content, _font, text, 18f, PatchUi.Dim, 26f); } } if (!(dictionary["build"] is Action<RectTransform, TMP_FontAsset> action)) { return; } RectTransform val = ScrollArea((Transform)(object)_content); VerticalLayoutGroup obj2 = ((Component)val).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 14f; ((LayoutGroup)obj2).padding = new RectOffset(0, 24, 8, 16); bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; ((Component)val).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; try { action(val, _font); } catch (Exception value) { Debug.LogError((object)$"[{name}] Options page failed: {value}"); } } private RectTransform ScrollArea(Transform parent) { //IL_0018: 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_009d: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0118: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("Scroll", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); ((Component)component).gameObject.AddComponent<LayoutElement>().flexibleHeight = 1f; RectTransform component2 = new GameObject("Viewport", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }).GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component, false); PatchUi.Stretch(component2); ((Graphic)((Component)component2).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); RectTransform component3 = new GameObject("Options", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component3).SetParent((Transform)(object)component2, false); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(0.5f, 1f); Vector2 offsetMin = (component3.offsetMax = Vector2.zero); component3.offsetMin = offsetMin; RectTransform val = PatchUi.Box((Transform)(object)component, "Scrollbar", new Color(1f, 1f, 1f, 0.05f)); val.anchorMin = new Vector2(1f, 0f); val.anchorMax = Vector2.one; val.pivot = new Vector2(1f, 0.5f); val.sizeDelta = new Vector2(8f, 0f); RectTransform component4 = new GameObject("Handle Area", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component4).SetParent((Transform)(object)val, false); PatchUi.Stretch(component4); RectTransform val2 = PatchUi.Box((Transform)(object)component4, "Handle", new Color(1f, 1f, 1f, 0.3f)); offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; Scrollbar val3 = ((Component)val).gameObject.AddComponent<Scrollbar>(); val3.handleRect = val2; ((Selectable)val3).targetGraphic = (Graphic)(object)((Component)val2).GetComponent<Image>(); val3.direction = (Direction)2; ScrollRect obj = ((Component)component).gameObject.AddComponent<ScrollRect>(); obj.viewport = component2; obj.content = component3; obj.horizontal = false; obj.movementType = (MovementType)2; obj.scrollSensitivity = 30f; obj.verticalScrollbar = val3; obj.verticalScrollbarVisibility = (ScrollbarVisibility)1; return component3; } [DllImport("user32.dll")] private static extern IntPtr LoadCursor(IntPtr instance, int name); [DllImport("user32.dll")] private static extern IntPtr SetCursor(IntPtr cursor); private static void Hover(GameObject target) { EventTrigger hover = target.AddComponent<EventTrigger>(); On((EventTriggerType)0, 1); On((EventTriggerType)1, -1); void On(EventTriggerType type, int delta) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001a: Expected O, but got Unknown Entry val = new Entry { eventID = type }; ((UnityEvent<BaseEventData>)(object)val.callback).AddListener((UnityAction<BaseEventData>)delegate { _hovered = Mathf.Max(0, _hovered + delta); }); hover.triggers.Add(val); } } private void LateUpdate() { if (_hovered > 0) { if (_hand == IntPtr.Zero) { _hand = LoadCursor(IntPtr.Zero, 32649); } SetCursor(_hand); } } } internal sealed class WindowFrame : MonoBehaviour, IDragHandler, IEventSystemHandler, IEndDragHandler, IBeginDragHandler, IPointerEnterHandler, IPointerExitHandler { private const float MinW = 900f; private const float MinH = 560f; private const float Edge = 8f; private const float Corner = 22f; private const float TitleBar = 72f; private const int IDC_SIZENWSE = 32642; private const int IDC_SIZENESW = 32643; private const int IDC_SIZEWE = 32644; private const int IDC_SIZENS = 32645; private const int IDC_SIZEALL = 32646; private RectTransform _panel; private Vector2Int _dir; private int _cursor; private bool _hover; private bool _dragging; private IntPtr _handle; [DllImport("user32.dll")] private static extern IntPtr LoadCursor(IntPtr instance, int name); [DllImport("user32.dll")] private static extern IntPtr SetCursor(IntPtr cursor); private static WindowFrame Make(RectTransform panel, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax, Vector2Int dir, int cursor) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = PatchUi.Box((Transform)(object)panel, name, new Color(1f, 1f, 1f, 0.001f)); obj.anchorMin = anchorMin; obj.anchorMax = anchorMax; obj.offsetMin = offsetMin; obj.offsetMax = offsetMax; WindowFrame windowFrame = ((Component)obj).gameObject.AddComponent<WindowFrame>(); windowFrame._panel = panel; windowFrame._dir = dir; windowFrame._cursor = cursor; return windowFrame; } public static void AddMove(RectTransform panel) { //IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Make(panel, "TitleBar", new Vector2(0f, 1f), Vector2.one, new Vector2(8f, -72f), new Vector2(-8f, -8f), Vector2Int.zero, 32646); } public static void AddResize(RectTransform panel) { //IL_0006: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: 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_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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) Make(panel, "Left", Vector2.zero, new Vector2(0f, 1f), new Vector2(0f, 22f), new Vector2(8f, -22f), new Vector2Int(-1, 0), 32644); Make(panel, "Right", new Vector2(1f, 0f), Vector2.one, new Vector2(-8f, 22f), new Vector2(0f, -22f), new Vector2Int(1, 0), 32644); Make(panel, "Top", new Vector2(0f, 1f), Vector2.one, new Vector2(22f, -8f), new Vector2(-22f, 0f), new Vector2Int(0, -1), 32645); Make(panel, "Bottom", Vector2.zero, new Vector2(1f, 0f), new Vector2(22f, 0f), new Vector2(-22f, 8f), new Vector2Int(0, 1), 32645); Make(panel, "TopLeft", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, -22f), new Vector2(22f, 0f), new Vector2Int(-1, -1), 32642); Make(panel, "TopRight", Vector2.one, Vector2.one, new Vector2(-22f, -22f), Vector2.zero, new Vector2Int(1, -1), 32643); Make(panel, "BottomLeft", Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(22f, 22f), new Vector2Int(-1, 1), 32643); WindowFrame windowFrame = Make(panel, "BottomRight", new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-22f, 0f), new Vector2(0f, 22f), new Vector2Int(1, 1), 32642); Vector2 val = default(Vector2); for (int i = 0; i < 3; i++) { RectTransform obj = PatchUi.Box(((Component)windowFrame).transform, "Line", new Color(1f, 1f, 1f, 0.35f)); float num = 5f + 5f * (float)i; ((Vector2)(ref val))..ctor(1f, 0f); obj.anchorMax = val; obj.anchorMin = val; obj.sizeDelta = new Vector2(num * 1.414f, 2f); obj.anchoredPosition = new Vector2(-4f - num / 2f, 4f + num / 2f); ((Transform)obj).localRotation = Quaternion.Euler(0f, 0f, 45f); ((Graphic)((Component)obj).GetComponent<Image>()).raycastTarget = false; } } public void OnPointerEnter(PointerEventData e) { _hover = true; } public void OnPointerExit(PointerEventData e) { _hover = false; } public void OnBeginDrag(PointerEventData e) { _dragging = true; } private void LateUpdate() { if (_hover || _dragging) { if (_handle == IntPtr.Zero) { _handle = LoadCursor(IntPtr.Zero, _cursor); } SetCursor(_handle); } } public void OnDrag(PointerEventData e) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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_00b8: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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) Canvas componentInParent = ((Component)_panel).GetComponentInParent<Canvas>(); Vector2 val = e.delta / (((Object)(object)componentInParent != (Object)null) ? componentInParent.scaleFactor : 1f); if (_dir == Vector2Int.zero) { RectTransform panel = _panel; panel.anchoredPosition += val; } else { Vector2 sizeDelta = _panel.sizeDelta; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((((Vector2Int)(ref _dir)).x == 0) ? sizeDelta.x : Mathf.Clamp(sizeDelta.x + (float)((Vector2Int)(ref _dir)).x * val.x, 900f, 1900f), (((Vector2Int)(ref _dir)).y == 0) ? sizeDelta.y : Mathf.Clamp(sizeDelta.y - (float)((Vector2Int)(ref _dir)).y * val.y, 560f, 1060f)); Vector2 val3 = val2 - sizeDelta; _panel.sizeDelta = val2; RectTransform panel2 = _panel; panel2.anchoredPosition += new Vector2((float)((Vector2Int)(ref _dir)).x * val3.x / 2f, (float)(-((Vector2Int)(ref _dir)).y) * val3.y / 2f); } Rect rect = ((RectTransform)((Component)componentInParent).transform).rect; Vector2 val4 = ((Rect)(ref rect)).size / 2f; Vector2 anchoredPosition = _panel.anchoredPosition; _panel.anchoredPosition = new Vector2(Mathf.Clamp(anchoredPosition.x, 0f - val4.x, val4.x), Mathf.Clamp(anchoredPosition.y, 0f - val4.y - _panel.sizeDelta.y / 2f + 80f, val4.y - _panel.sizeDelta.y / 2f)); } public void OnEndDrag(PointerEventData e) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) _dragging = false; PlayerPrefs.SetFloat("medovanx.patches.window.w", _panel.sizeDelta.x); PlayerPrefs.SetFloat("medovanx.patches.window.h", _panel.sizeDelta.y); PlayerPrefs.SetFloat("medovanx.patches.window.x", _panel.anchoredPosition.x); PlayerPrefs.SetFloat("medovanx.patches.window.y", _panel.anchoredPosition.y); PlayerPrefs.Save(); } } internal static class PatchUi { public static readonly Color Text = new Color(0.9f, 0.92f, 0.88f, 1f); public static readonly Color Dim = new Color(0.65f, 0.67f, 0.63f, 1f); public static readonly Color Off = new Color(1f, 1f, 1f, 0.08f); public static readonly Color On = new Color(0.85f, 0.55f, 0.1f, 0.95f); public static readonly Color Accent = new Color(0.85f, 0.45f, 0.05f, 1f); public static readonly List<Action> Refreshers = new List<Action>(); public static void RefreshAll() { foreach (Action refresher in Refreshers) { refresher(); } } public static TMP_Text Label(Transform parent, TMP_FontAsset font, string text, float size = 22f, Color? color = null, float height = 0f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = new GameObject("Label", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>(); ((TMP_Text)val).transform.SetParent(parent, false); if ((Object)(object)font != (Object)null) { ((TMP_Text)val).font = font; } ((TMP_Text)val).fontSize = size; ((Graphic)val).color = (Color)(((??)color) ?? Text); ((TMP_Text)val).text = text; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).enableWordWrapping = true; LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>(); if (height > 0f) { val2.preferredHeight = height; } return (TMP_Text)(object)val; } public static RectTransform Box(Transform parent, string name, Color color) { //IL_0021: 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) RectTransform component = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); ((Graphic)((Component)component).GetComponent<Image>()).color = color; return component; } public static void Stretch(RectTransform rt) { //IL_0001: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; Vector2 offsetMin = (rt.offsetMax = Vector2.zero); rt.offsetMin = offsetMin; } public static Button Button(Transform parent, TMP_FontAsset font, string label, Action onClick, float width = 160f, float height = 44f) { //IL_000f: 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_0062: Expected O, but got Unknown RectTransform val = Box(parent, label, Off); LayoutElement obj = ((Component)val).gameObject.AddComponent<LayoutElement>(); obj.preferredWidth = width; obj.preferredHeight = height; Button obj2 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)((Component)val).GetComponent<Image>(); ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { onClick(); RefreshAll(); }); TMP_Text obj3 = Label((Transform)(object)val, font, label, 20f); obj3.alignment = (TextAlignmentOptions)514; Stretch(obj3.rectTransform); Object.Destroy((Object)(object)((Component)obj3).GetComponent<LayoutElement>()); return obj2; } public static RectTransform Row(Transform parent, float height = 48f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("Row", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); HorizontalLayoutGroup obj = ((Component)component).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f; ((LayoutGroup)obj).childAlignment = (TextAnchor)3; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childControlWidth; ((Component)component).gameObject.AddComponent<LayoutElement>().preferredHeight = height; return component; } public static void Options(Transform parent, TMP_FontAsset font, string title, params (string label, Func<bool> selected, Action select)[] options) { Options(parent, font, title, 160f, options); } public static void Options(Transform parent, TMP_FontAsset font, string title, float width, params (string label, Func<bool> selected, Action select)[] options) { RectTransform parent2 = Row(parent); ((Component)Label((Transform)(object)parent2, font, title)).GetComponent<LayoutElement>().preferredWidth = 190f; for (int i = 0; i < options.Length; i++) { (string, Func<bool>, Action) tuple = options[i]; string item = tuple.Item1; Func<bool> selected = tuple.Item2; Action item2 = tuple.Item3; Image img = ((Component)Button((Transform)(object)parent2, font, item, item2, width)).GetComponent<Image>(); Refreshers.Add(delegate { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) ((Graphic)img).color = (selected() ? On : Off); }); } } public static void OnOff(Transform parent, TMP_FontAsset font, string title, Func<bool> get, Action<bool> set) { Options(parent, font, title, ("On", get, delegate { set(obj: true); }), ("Off", () => !get(), delegate { set(obj: false); })); } public static void Number(Transform parent, TMP_FontAsset font, string title, Func<int> get, Action<int> set, int fallback) { //IL_006c: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) RectTransform parent2 = Row(parent); ((Component)Label((Transform)(object)parent2, font, title)).GetComponent<LayoutElement>().preferredWidth = 190f; RectTransform val = Box((Transform)(object)parent2, "Field", new Color(1f, 1f, 1f, 0.08f)); LayoutElement obj = ((Component)val).gameObject.AddComponent<LayoutElement>(); obj.preferredWidth = 200f; obj.preferredHeight = 44f; RectTransform component = new GameObject("Text Area", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)val, false); Stretch(component); component.offsetMin = new Vector2(12f, 4f); component.offsetMax = new Vector2(-12f, -4f); TextMeshProUGUI val2 = new GameObject("Text", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>(); ((TMP_Text)val2).transform.SetParent((Transform)(object)component, false); Stretch(((TMP_Text)val2).rectTransform); if ((Object)(object)font != (Object)null) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).fontSize = 22f; ((Graphic)val2).color = Text; ((TMP_Text)val2).alignment = (TextAlignmentOptions)4097; TMP_InputField input = ((Component)val).gameObject.AddComponent<TMP_InputField>(); input.textViewport = component; input.textComponent = (TMP_Text)(object)val2; input.contentType = (ContentType)2; input.characterLimit = 7; input.SetTextWithoutNotify(get().ToString()); ((UnityEvent<string>)(object)input.onEndEdit).AddListener((UnityAction<string>)delegate(string s) { set((int.TryParse(s, out var result) && result >= 0) ? result : fallback); RefreshAll(); }); Refreshers.Add(delegate { if (!input.isFocused) { input.SetTextWithoutNotify(get().ToString()); } }); } public static void Section(Transform parent, TMP_FontAsset font, string title) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("Section", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); VerticalLayoutGroup obj = ((Component)component).gameObject.AddComponent<VerticalLayoutGroup>(); bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f; ((LayoutGroup)obj).padding = new RectOffset(0, 0, 10, 2); Label((Transform)(object)component, font, title.ToUpperInvariant(), 17f, Accent, 24f).characterSpacing = 6f; ((Component)Box((Transform)(object)component, "Line", new Color(1f, 1f, 1f, 0.12f))).gameObject.AddComponent<LayoutElement>().preferredHeight = 1f; } public static Slider Slider(Transform parent, TMP_FontAsset font, string title, int min, int max, Func<int> get, Action<int> set, string suffix = "", string description = null) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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_0192: 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) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_02ab: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Row(parent, (description == null) ? 48f : 58f); if (description == null) { ((Component)Label((Transform)(object)val, font, title)).GetComponent<LayoutElement>().preferredWidth = 190f; } else { RectTransform component = new GameObject("Title", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)val, false); VerticalLayoutGroup obj = ((Component)component).gameObject.AddComponent<VerticalLayoutGroup>(); bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((LayoutGroup)obj).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj).spacing = 0f; ((Component)component).gameObject.AddComponent<LayoutElement>().preferredWidth = 190f; Label((Transform)(object)component, font, title, 22f, null, 28f); Label((Transform)(object)component, font, description, 15f, Dim, 20f); } RectTransform component2 = new GameObject("Slider", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)val, false); LayoutElement obj2 = ((Component)component2).gameObject.AddComponent<LayoutElement>(); obj2.preferredWidth = 360f; obj2.preferredHeight = 28f; RectTransform obj3 = Box((Transform)(object)component2, "Track", Off); obj3.anchorMin = new Vector2(0f, 0.5f); obj3.anchorMax = new Vector2(1f, 0.5f); obj3.sizeDelta = new Vector2(0f, 8f); RectTransform component3 = new GameObject("Fill Area", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component3).SetParent((Transform)(object)component2, false); component3.anchorMin = new Vector2(0f, 0.5f); component3.anchorMax = new Vector2(1f, 0.5f); component3.sizeDelta = new Vector2(0f, 8f); RectTransform val2 = Box((Transform)(object)component3, "Fill", On); val2.sizeDelta = Vector2.zero; RectTransform component4 = new GameObject("Handle Area", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component4).SetParent((Transform)(object)component2, false); Stretch(component4); component4.offsetMin = new Vector2(8f, 0f); component4.offsetMax = new Vector2(-8f, 0f); RectTransform val3 = Box((Transform)(object)component4, "Handle", Text); val3.sizeDelta = new Vector2(16f, 0f); Slider slider = ((Component)component2).gameObject.AddComponent<Slider>(); slider.fillRect = val2; slider.handleRect = val3; ((Selectable)slider).targetGraphic = (Graphic)(object)((Component)val3).GetComponent<Image>(); slider.direction = (Direction)0; slider.minValue = min; slider.maxValue = max; slider.wholeNumbers = true; slider.SetValueWithoutNotify((float)get()); TMP_Text value = Label((Transform)(object)val, font, get() + suffix); ((Component)value).GetComponent<LayoutElement>().preferredWidth = 80f; ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float v) { set((int)v); RefreshAll(); }); Refreshers.Add(delegate { slider.SetValueWithoutNotify((float)get()); value.text = get() + suffix; }); return slider; } } public sealed class MelonEntry : MelonMod { private static Action _init; public override void OnInitializeMelon() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown MethodInfo methodInfo = typeof(MelonEntry).Assembly.GetType(((MelonBase)this).Info.Name + ".Plugin")?.GetMethod("Init", Type.EmptyTypes); if (methodInfo == null) { ((MelonBase)this).LoggerInstance.Error(((MelonBase)this).Info.Name + ".Plugin.Init not found"); return; } _init = (Action)Delegate.CreateDelegate(typeof(Action), methodInfo); ((MelonBase)this).HarmonyInstance.Patch((MethodBase)AccessTools.Method(typeof(Hub), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(typeof(MelonEntry), "HubAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((MelonBase)this).LoggerInstance.Msg(((MelonBase)this).Info.Name + " " + ((MelonBase)this).Info.Version + " loaded; starts with the game"); } private static void HubAwake() { _init?.Invoke(); } } } namespace Minimap { internal sealed class Minimap : MonoBehaviour { public enum Reveal { Explored, Full } public enum Style { Plain, Graphic } private const string RevealKey = "medovanx.Minimap.Mode"; private const string StyleKey = "medovanx.Minimap.Style"; private const int MaxTexSize = 512; private const float ViewMeters = 50f; private const float RevealRadius = 7f; private const float FloorTolerance = 3f; private const float SameFloor = 2f; private const float ScreenSize = 230f; private static readonly Color32 Empty = new Color32((byte)0, (byte)0, (byte)0, (byte)0); private static readonly Color32 Floor = new Color32((byte)200, (byte)200, (byte)190, (byte)220); private static readonly Color32 OtherFloor = new Color32((byte)200, (byte)200, (byte)190, (byte)45); private static readonly Color PlayerDot = new Color(0.3f, 0.65f, 1f, 1f); private static readonly Color MonsterDot = new Color(1f, 0.25f, 0.2f, 1f); private static readonly Color ItemDot = new Color(1f, 0.85f, 0.2f, 1f); private const float DotSize = 12f; private const float LegendHeight = 26f; private static readonly Color32 Unexplored = new Color32((byte)0, (byte)0, (byte)0, (byte)235); private const int GraphicSize = 400; private const float GraphicMargin = 1.6f; private const float GraphicInterval = 0.15f; private const float CameraAboveFeet = 2.2f; private float[] _h0; private float[] _h1; private bool[] _seen0; private bool[] _seen1; private int _w; private int _h; private float _metersPerPixel; private Vector2 _origin; private Texture2D _tex; private Color32[] _pixels; private object _builtFor; private float _nextBuildLog; private Canvas _canvas; private RawImage _map; private RawImage _graphic; private Camera _cam; private RenderTexture _rt; private float _nextRender; private float _nextActorScan; private Vector3 _renderedAt; private readonly List<(Transform t, Color color, bool shown)> _things = new List<(Transform, Color, bool)>(); private readonly List<Renderer> _hiddenRenderers = new List<Renderer>(); private readonly List<RawImage> _dots = new List<RawImage>(); private RectTransform _frame; private RectTransform _legend; private string _legendKey; private Texture2D _dotTex; private RectTransform _arrow; private bool _visible = true; private float _nextDraw; private object _diagnosed; private Light _light; public static Reveal CurrentReveal { get { return (Reveal)PlayerPrefs.GetInt("medovanx.Minimap.Mode", 0); } set { PlayerPrefs.SetInt("medovanx.Minimap.Mode", (int)value); PlayerPrefs.Save(); } } public static Style CurrentStyle { get { return (Style)PlayerPrefs.GetInt("medovanx.Minimap.Style", 0); } set { PlayerPrefs.SetInt("medovanx.Minimap.Style", (int)value); PlayerPrefs.Save(); } } public static bool ShowPlayers { get { return GetBool("Players"); } set { SetBool("Players", value); } } public static bool ShowMonsters { get { return GetBool("Monsters"); } set { SetBool("Monsters", value); } } public static bool ShowItems { get { return GetBool("Items"); } set { SetBool("Items", value); } } public static bool Visible { get { return PlayerPrefs.GetInt("medovanx.Minimap.Visible", 1) == 1; } set { PlayerPrefs.SetInt("medovanx.Minimap.Visible", value ? 1 : 0); PlayerPrefs.Save(); } } public static string Summary => ((CurrentReveal == Reveal.Full) ? "Full" : "Explored") + ", " + CurrentStyle; private static bool GetBool(string key) { return PlayerPrefs.GetInt("medovanx.Minimap.Show" + key, 0) == 1; } private static void SetBool(string key, bool on) { PlayerPrefs.SetInt("medovanx.Minimap.Show" + key, on ? 1 : 0); PlayerPrefs.Save(); } public static void Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown GameObject val = new GameObject("MedovanxMinimap"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<Minimap>(); } private void Awake() { BuildUi(); } private void Update() { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current != null && ((ButtonControl)current.mKey).wasPressedThisFrame) { _visible = !_visible; } GameMainBase val = (((Object)(object)Hub.s != (Object)null && Hub.s.pdata != null) ? Hub.s.pdata.main : null); ProtoActor val2 = (((Object)(object)val != (Object)null) ? val.GetMyAvatar() : null); bool flag = Visible && _visible && (Object)(object)val2 != (Object)null && !val2.dead && (!((Object)(object)Hub.s.uiman != (Object)null) || !Hub.s.uiman.isGameMenuOpen); if ((Object)(object)val == (Object)null) { _builtFor = null; } if (flag && _builtFor != val && !BuildMap(val)) { flag = false; } Diagnose(val, val2, flag); ((Behaviour)_canvas).enabled = flag; if (!flag) { return; } Vector3 position = ((Component)val2).transform.position; bool flag2 = CurrentStyle == Style.Graphic; if (CurrentReveal == Reveal.Explored) { RevealAround(position); } if (Time.unscaledTime >= _nextDraw) { _nextDraw = Time.unscaledTime + 0.2f; Draw(position.y, flag2); } if (Time.unscaledTime >= _nextActorScan) { Scan(val2); } Legend(); Dots(position); ((Behaviour)_graphic).enabled = flag2; ((Behaviour)_map).enabled = !flag2 || CurrentReveal == Reveal.Explored; if (flag2) { Vector2 zero = default(Vector2); ((Vector2)(ref zero))..ctor(position.x - _renderedAt.x, position.z - _renderedAt.z); float num = 15.000001f; if (Time.unscaledTime >= _nextRender || ((Vector2)(ref zero)).magnitude > num * 0.8f) { _nextRender = Time.unscaledTime + 0.15f; RenderGraphic(position); _renderedAt = position; zero = Vector2.zero; } float num2 = 80f; Vector2 val3 = Vector2.one / 1.6f; _graphic.uvRect = new Rect(new Vector2(0.5f, 0.5f) + zero / num2 - val3 / 2f, val3); } Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(50f / ((float)_w * _metersPerPixel), 50f / ((float)_h * _metersPerPixel)); Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor((position.x - _origin.x) / ((float)_w * _metersPerPixel), (position.z - _origin.y) / ((float)_h * _metersPerPixel)); _map.uvRect = new Rect(val5 - val4 / 2f, val4); ((Transform)_arrow).localEulerAngles = new Vector3(0f, 0f, 0f - ((Component)val2).transform.eulerAngles.y); } private void Diagnose(object scene, ProtoActor me, bool show) { if (show || _diagnosed == scene) { return; } string text = ((scene == null) ? "no game scene" : (((Object)(object)me == (Object)null) ? "no local player yet" : (me.dead ? "you are dead" : ((!_visible) ? "hidden with M" : (((Object)(object)Hub.s.uiman != (Object)null && Hub.s.uiman.isGameMenuOpen) ? "menu open" : ((_builtFor != scene) ? "no NavMesh in this scene yet" : null)))))); if (text == null) { return; } switch (text) { case "no game scene": case "no local player yet": if (Time.frameCount % 300 != 0) { return; } break; default: _diagnosed = scene; break; } Debug.Log((object)("[Minimap] Hidden in " + (scene?.GetType().Name ?? "-") + ": " + text)); } private bool BuildMap(object scene) { //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_0097: 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_009f: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cb: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_01e5: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown var (array, array2, value) = FloorTriangles(); if (array.Length == 0) { if (Time.unscaledTime >= _nextBuildLog) { _nextBuildLog = Time.unscaledTime + 5f; Debug.Log((object)("[Minimap] Can't build map in " + scene?.GetType().Name + ": no NavMesh or A* graph yet (retrying)")); } return false; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(float.MaxValue, float.MaxValue); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(float.MinValue, float.MinValue); Vector3[] array3 = array; foreach (Vector3 val3 in array3) { val = Vector2.Min(val, new Vector2(val3.x, val3.z)); val2 = Vector2.Max(val2, new Vector2(val3.x, val3.z)); } Vector2 val4 = val2 - val; _metersPerPixel = Mathf.Max(new float[3] { val4.x, val4.y, 1f }) / 512f; _w = Mathf.CeilToInt(val4.x / _metersPerPixel) + 2; _h = Mathf.CeilToInt(val4.y / _metersPerPixel) + 2; _origin = val - Vector2.one * _metersPerPixel; int num = _w * _h; _h0 = new float[num]; _h1 = new float[num]; for (int j = 0; j < num; j++) { _h0[j] = (_h1[j] = float.NaN); } _seen0 = new bool[num]; _seen1 = new bool[num]; for (int k = 0; k + 2 < array2.Length; k += 3) { Rasterize(array[array2[k]], array[array2[k + 1]], array[array2[k + 2]]); } if ((Object)(object)_tex != (Object)null) { Object.Destroy((Object)(object)_tex); } _tex = new Texture2D(_w, _h, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; _pixels = (Color32[])(object)new Color32[num]; _map.texture = (Texture)(object)_tex; _builtFor = scene; Debug.Log((object)$"[Minimap] Map built: {_w}x{_h} px, {_metersPerPixel:0.00} m/px, {array2.Length / 3} triangles from {value}"); return true; } private static (Vector3[] vertices, int[] indices, string source) FloorTriangles() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) NavMeshTriangulation val = NavMesh.CalculateTriangulation(); if (val.vertices != null && val.vertices.Length != 0) { return (vertices: val.vertices, indices: val.indices, source: "NavMesh"); } List<Vector3> verts = new List<Vector3>(); AstarData val2 = (((Object)(object)AstarPath.active != (Object)null) ? AstarPath.active.data : null); if (val2?.graphs != null) { NavGraph[] graphs = val2.graphs; foreach (NavGraph obj in graphs) { if (obj == null) { continue; } obj.GetNodes((Action<GraphNode>)delegate(GraphNode node) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) TriangleMeshNode val3 = (TriangleMeshNode)(object)((node is TriangleMeshNode) ? node : null); if (val3 != null && ((GraphNode)val3).Walkable) { for (int j = 0; j < 3; j++) { verts.Add((Vector3)((MeshNode)val3).GetVertex(j)); } } }); } } int[] array = new int[verts.Count]; for (int num = 0; num < array.Length; num++) { array[num] = num; } return (vertices: verts.ToArray(), indices: array, source: "A* graph"); } private void Rasterize(Vector3 a, Vector3 b, Vector3 c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_001f: 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_0048: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_016c: 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_0181: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) Vector2 val = P(a); Vector2 val2 = P(b); Vector2 val3 = P(c); int num = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val.x, Mathf.Min(val2.x, val3.x)))); int num2 = Mathf.Min(_w - 1, Mathf.CeilToInt(Mathf.Max(val.x, Mathf.Max(val2.x, val3.x)))); int num3 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val.y, Mathf.Min(val2.y, val3.y)))); int num4 = Mathf.Min(_h - 1, Mathf.CeilToInt(Mathf.Max(val.y, Mathf.Max(val2.y, val3.y)))); float num5 = (val2.x - val.x) * (val3.y - val.y) - (val3.x - val.x) * (val2.y - val.y); if (Mathf.Abs(num5) < 1E-06f) { return; } Vector2 val4 = default(Vector2); for (int i = num3; i <= num4; i++) { for (int j = num; j <= num2; j++) { ((Vector2)(ref val4))..ctor((float)j + 0.5f, (float)i + 0.5f); float num6 = ((val2.x - val4.x) * (val3.y - val4.y) - (val3.x - val4.x) * (val2.y - val4.y)) / num5; float num7 = ((val3.x - val4.x) * (val.y - val4.y) - (val.x - val4.x) * (val3.y - val4.y)) / num5; float num8 = 1f - num6 - num7; if (!(num6 < -0.35f) && !(num7 < -0.35f) && !(num8 < -0.35f)) { float num9 = num6 * a.y + num7 * b.y + num8 * c.y; int num10 = i * _w + j; if (float.IsNaN(_h0[num10]) || Mathf.Abs(_h0[num10] - num9) < 2f) { _h0[num10] = (float.IsNaN(_h0[num10]) ? num9 : Mathf.Min(_h0[num10], num9)); } else if (float.IsNaN(_h1[num10]) || Mathf.Abs(_h1[num10] - num9) < 2f) { _h1[num10] = (float.IsNaN(_h1[num10]) ? num9 : Mathf.Min(_h1[num10], num9)); } } } } Vector2 P(Vector3 v) { //IL_0000: 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_0032: Unknown result type (might be due to invalid IL or missing references) return new Vector2((v.x - _origin.x) / _metersPerPixel, (v.z - _origin.y) / _metersPerPixel); } } private void RevealAround(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_00be: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt((pos.x - _origin.x) / _metersPerPixel); int num2 = Mathf.RoundToInt((pos.z - _origin.y) / _metersPerPixel); int num3 = Mathf.CeilToInt(7f / _metersPerPixel); for (int i = Mathf.Max(0, num2 - num3); i <= Mathf.Min(_h - 1, num2 + num3); i++) { for (int j = Mathf.Max(0, num - num3); j <= Mathf.Min(_w - 1, num + num3); j++) { if ((j - num) * (j - num) + (i - num2) * (i - num2) <= num3 * num3) { int num4 = i * _w + j; if (Mathf.Abs(_h0[num4] - pos.y) < 3f) { _seen0[num4] = true; } if (Mathf.Abs(_h1[num4] - pos.y) < 3f) { _seen1[num4] = true; } } } } } private void Draw(float myY, bool graphic) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00d7: 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) bool flag = CurrentReveal == Reveal.Full; for (int i = 0; i < _pixels.Length; i++) { if (graphic) { _pixels[i] = ((_seen0[i] || _seen1[i]) ? Empty : Unexplored); continue; } bool flag2 = !float.IsNaN(_h0[i]) && (flag || _seen0[i]); bool flag3 = !float.IsNaN(_h1[i]) && (flag || _seen1[i]); if ((flag2 && Mathf.Abs(_h0[i] - myY) < 3f) || (flag3 && Mathf.Abs(_h1[i] - myY) < 3f)) { _pixels[i] = Floor; } else if (flag2 || flag3) { _pixels[i] = OtherFloor; } else { _pixels[i] = Empty; } } _tex.SetPixels32(_pixels); _tex.Apply(false); } private void BuildUi() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) //IL_00ff: 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_0101: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_019a: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025c: 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_0262: 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_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) _canvas = new GameObject("MinimapCanvas", new Type[2] { typeof(Canvas), typeof(CanvasScaler) }).GetComponent<Canvas>(); ((Component)_canvas).transform.SetParent(((Component)this).transform, false); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 50; CanvasScaler component = ((Component)_canvas).GetComponent<CanvasScaler>(); component.uiScaleMode = (ScaleMode)1; component.referenceResolution = new Vector2(1920f, 1080f); component.matchWidthOrHeight = 1f; RectTransform component2 = new GameObject("Frame", new Type[3] { typeof(RectTransform), typeof(Image), typeof(RectMask2D) }).GetComponent<RectTransform>(); ((Transform)component2).SetParent(((Component)_canvas).transform, false); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 0f); component2.pivot = val; Vector2 anchorMin = (component2.anchorMax = val); component2.anchorMin = anchorMin; component2.anchoredPosition = new Vector2(24f, 50f); component2.sizeDelta = new Vector2(230f, 230f); _frame = component2; _dotTex = DotTexture(); Image component3 = ((Component)component2).GetComponent<Image>(); ((Graphic)component3).color = new Color(0f, 0f, 0f, 0.55f); ((Graphic)component3).raycastTarget = false; _graphic = new GameObject("Graphic", new Type[2] { typeof(RectTransform), typeof(RawImage) }).GetComponent<RawImage>(); RectTransform rectTransform = ((Graphic)_graphic).rectTransform; ((Transform)rectTransform).SetParent((Transform)(object)component2, false); rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; anchorMin = (rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = anchorMin; ((Graphic)_graphic).raycastTarget = false; ((Behaviour)_graphic).enabled = false; _map = new GameObject("Map", new Type[2] { typeof(RectTransform), typeof(RawImage) }).GetComponent<RawImage>(); RectTransform rectTransform2 = ((Graphic)_map).rectTransform; ((Transform)rectTransform2).SetParent((Transform)(object)component2, false); rectTransform2.anchorMin = Vector2.zero; rectTransform2.anchorMax = Vector2.one; anchorMin = (rectTransform2.offsetMax = Vector2.zero); rectTransform2.offsetMin = anchorMin; ((Graphic)_map).raycastTarget = false; _arrow = new GameObject("You", new Type[2] { typeof(RectTransform), typeof(RawImage) }).GetComponent<RectTransform>(); ((Transform)_arrow).SetParent((Transform)(object)component2, false); _arrow.sizeDelta = new Vector2(18f, 18f); RawImage component4 = ((Component)_arrow).GetComponent<RawImage>(); component4.texture = (Texture)(object)ArrowTexture(); ((Graphic)component4).raycastTarget = false; ((Behaviour)_canvas).enabled = false; } private void RenderGraphic(Vector3 pos) { //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_025c: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_021e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cam == (Object)null) { _rt = new RenderTexture(400, 400, 16, (RenderTextureFormat)0); _cam = new GameObject("MinimapCamera").AddComponent<Camera>(); ((Component)_cam).transform.SetParent(((Component)this).transform, false); ((Behaviour)_cam).enabled = false; _cam.orthographic = true; _cam.nearClipPlane = 0.05f; _cam.farClipPlane = 40f; _cam.clearFlags = (CameraClearFlags)2; _cam.backgroundColor = new Color(0f, 0f, 0f, 0f); Camera cam = _cam; cam.cullingMask &= ~(1 << LayerMask.NameToLayer("UI")); _cam.targetTexture = _rt; UniversalAdditionalCameraData universalAdditionalCameraData = CameraExtensions.GetUniversalAdditionalCameraData(_cam); universalAdditionalCameraData.renderPostProcessing = false; universalAdditionalCameraData.renderShadows = false; _graphic.texture = (Texture)(object)_rt; } _cam.orthographicSize = 40f; ((Component)_cam).transform.SetPositionAndRotation(pos + Vector3.up * 2.2f, Quaternion.Euler(90f, 0f, 0f)); List<Renderer> list = new List<Renderer>(_hiddenRenderers.Count); foreach (Renderer hiddenRenderer in _hiddenRenderers) { if ((Object)(object)hiddenRenderer != (Object)null && !hiddenRenderer.forceRenderingOff) { hiddenRenderer.forceRenderingOff = true; list.Add(hiddenRenderer); } } if ((Object)(object)_light == (Object)null) { _light = new GameObject("MinimapLight").AddComponent<Light>(); ((Component)_light).transform.SetParent(((Component)this).transform, false); ((Component)_light).transform.rotation = Quaternion.Euler(90f, 0f, 0f); _light.type = (LightType)1; _light.intensity = 1.1f; _light.shadows = (LightShadows)0; ((Behaviour)_light).enabled = false; } AmbientMode ambientMode = RenderSettings.ambientMode; Color ambientLight = RenderSettings.ambientLight; bool fog = RenderSettings.fog; RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = new Color(0.55f, 0.55f, 0.55f); RenderSettings.fog = false; ((Behaviour)_light).enabled = true; try { _cam.Render(); } finally { ((Behaviour)_light).enabled = false; RenderSettings.ambientMode = ambientMode; RenderSettings.ambientLight = ambientLight; RenderSettings.fog = fog; foreach (Renderer item in list) { if ((Object)(object)item != (Object)null) { item.forceRenderingOff = false; } } } } private void Scan(ProtoActor me) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_00ee: 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_0094: Unknown result type (might be due to invalid IL or missing references) _nextActorScan = Time.unscaledTime + 1f; _things.Clear(); _hiddenRenderers.Clear(); ProtoActor[] array = Object.FindObjectsByType<ProtoActor>((FindObjectsSortMode)0); foreach (ProtoActor val in array) { if ((Object)(object)val == (Object)(object)me) { _hiddenRenderers.AddRange(((Component)val).GetComponentsInChildren<Renderer>(true)); continue; } bool flag = (int)val.ActorType == 1 && !val.IsMimic(); bool flag2 = (flag ? ShowPlayers : ShowMonsters); if (!val.dead) { _things.Add((((Component)val).transform, flag ? PlayerDot : MonsterDot, flag2)); } if (!flag2) { _hiddenRenderers.AddRange(((Component)val).GetComponentsInChildren<Renderer>(true)); } } LootingLevelObject[] array2 = Object.FindObjectsByType<LootingLevelObject>((FindObjectsSortMode)0); foreach (LootingLevelObject val2 in array2) { _things.Add((((Component)val2).transform, ItemDot, ShowItems)); if (!ShowItems) { _hiddenRenderers.AddRange(((Component)val2).GetComponentsInChildren<Renderer>(true)); } } } private void Dots(Vector3 me) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_01b6: 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_0166: Unknown result type (might be due to invalid IL or missing references) int num = 0; Rect rect = _frame.rect; float num2 = ((Rect)(ref rect)).width / 50f; foreach (var thing in _things) { var (val, color, _) = thing; if (!thing.shown || (Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } Vector3 val2 = val.position - me; if (Mathf.Abs(val2.y) > 3f) { continue; } Vector2 val3 = new Vector2(val2.x, val2.z) * num2; float num3 = Mathf.Abs(val3.x); rect = _frame.rect; if (num3 > ((Rect)(ref rect)).width / 2f) { continue; } float num4 = Mathf.Abs(val3.y); rect = _frame.rect; if (!(num4 > ((Rect)(ref rect)).height / 2f)) { if (num == _dots.Count) { RawImage component = new GameObject("Dot", new Type[2] { typeof(RectTransform), typeof(RawImage) }).GetComponent<RawImage>(); ((Transform)((Graphic)component).rectTransform).SetParent((Transform)(object)_frame, false); ((Graphic)component).rectTransform.sizeDelta = new Vector2(12f, 12f); component.texture = (Texture)(object)_dotTex; ((Graphic)comp