using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using LobbyCompatibility.Attributes; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("WeeWee Proximity Minimap")] [assembly: AssemblyDescription("Circular proximity minimap for Lethal Company")] [assembly: AssemblyCompany("LilWeeWee")] [assembly: AssemblyProduct("WeeWee Proximity Minimap")] [assembly: ComVisible(false)] [assembly: Guid("c99d05a6-a637-468a-97b8-6895050a8a27")] [assembly: AssemblyFileVersion("0.1.2.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.1.2.0")] namespace WeeWeeProximityMinimap; [BepInPlugin("LilWeeWee.LethalCompany.ProximityMinimap", "WeeWee Proximity Minimap", "0.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "LilWeeWee.LethalCompany.ProximityMinimap"; public const string Name = "WeeWee Proximity Minimap"; public const string Version = "0.1.2"; internal ConfigEntry Enabled; internal ConfigEntry RotateWithPlayer; internal ConfigEntry ShowPlayers; internal ConfigEntry ShowItems; internal ConfigEntry ShowMonsters; internal ConfigEntry ShowExitArrow; internal ConfigEntry NearbyMarkerRange; internal ConfigEntry MapZoom; internal ConfigEntry MapSize; internal ConfigEntry PositionX; internal ConfigEntry PositionY; internal ConfigEntry PlayerArrowSize; internal ConfigEntry ExitArrowSize; internal ConfigEntry ToggleKey; private Harmony harmony; internal static Plugin Instance { get; private set; } internal void LogError(string message) { ((BaseUnityPlugin)this).Logger.LogError((object)message); } private void Awake() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Show the minimap while landed on a moon."); ToggleKey = ((BaseUnityPlugin)this).Config.Bind("General", "ToggleKey", new KeyboardShortcut((KeyCode)283, Array.Empty()), "Key used to show or hide the minimap."); RotateWithPlayer = ((BaseUnityPlugin)this).Config.Bind("General", "RotateWithPlayer", true, "Rotate the map so the direction you face is always at the top."); ShowPlayers = ((BaseUnityPlugin)this).Config.Bind("Markers", "ShowPlayers", true, "Show other living players regardless of their distance."); ShowItems = ((BaseUnityPlugin)this).Config.Bind("Markers", "ShowItems", true, "Show grabbable items only when they are within NearbyMarkerRange."); ShowMonsters = ((BaseUnityPlugin)this).Config.Bind("Markers", "ShowMonsters", true, "Show monsters only when they are within NearbyMarkerRange."); ShowExitArrow = ((BaseUnityPlugin)this).Config.Bind("Markers", "ShowExitArrow", true, "Show an edge arrow toward the main entrance while inside and toward the ship while outside."); NearbyMarkerRange = ((BaseUnityPlugin)this).Config.Bind("Markers", "NearbyMarkerRange", 5f, "Maximum distance in metres for item and monster markers."); MapZoom = ((BaseUnityPlugin)this).Config.Bind("Display", "MapZoom", 18f, "Orthographic map zoom. Lower values show a smaller area."); MapSize = ((BaseUnityPlugin)this).Config.Bind("Display", "MapSize", 180, "Circular minimap diameter in pixels."); PositionX = ((BaseUnityPlugin)this).Config.Bind("Display", "PositionX", -20f, "Horizontal offset from the top-right corner."); PositionY = ((BaseUnityPlugin)this).Config.Bind("Display", "PositionY", -20f, "Vertical offset from the top-right corner."); PlayerArrowSize = ((BaseUnityPlugin)this).Config.Bind("Display", "PlayerArrowSize", 10f, "Size in pixels of the centre arrow showing your facing direction."); ExitArrowSize = ((BaseUnityPlugin)this).Config.Bind("Display", "ExitArrowSize", 12f, "Size in pixels of the entrance/ship direction arrow."); harmony = new Harmony("LilWeeWee.LethalCompany.ProximityMinimap"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"WeeWee Proximity Minimap v0.1.2 loaded."); } private void OnDestroy() { MinimapController.DisposeCurrent(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] internal static class PlayerConnectPatch { private static void Postfix(PlayerControllerB __instance) { if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)__instance) { MinimapController.CreateOrReplace(__instance); } } } internal sealed class MinimapController : MonoBehaviour { private struct MarkerState { internal GameObject Marker; internal bool WasActive; } private static MinimapController current; private readonly List changedMarkers = new List(); private readonly List enemyMarkers = new List(); private readonly List hazardMarkers = new List(); private PlayerControllerB localPlayer; private GameObject root; private RawImage mapImage; private Image exitArrow; private Image selfArrow; private Camera mapCamera; private RenderTexture mapTexture; private float nextMarkerRefresh; private EntranceTeleport[] entrances = (EntranceTeleport[])(object)new EntranceTeleport[0]; internal static void CreateOrReplace(PlayerControllerB player) { //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_0015: Expected O, but got Unknown DisposeCurrent(); GameObject val = new GameObject("WeeWeeProximityMinimap_Controller"); Object.DontDestroyOnLoad((Object)val); current = val.AddComponent(); current.Initialise(player); } internal static void DisposeCurrent() { if ((Object)(object)current != (Object)null) { Object.Destroy((Object)(object)((Component)current).gameObject); } current = null; } private void Initialise(PlayerControllerB player) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown localPlayer = player; CreateUI(); CreateCamera(); Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(BeforeCameraRender)); Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(AfterCameraRender)); } private void CreateUI() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_0203: 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_0266: 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) Transform transform = ((Component)HUDManager.Instance.playerScreenTexture).transform; int num = Mathf.Clamp(Plugin.Instance.MapSize.Value, 80, 600); root = new GameObject("WeeWeeProximityMinimap_UI", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Mask) }); root.transform.SetParent(transform, false); RectTransform component = root.GetComponent(); component.anchorMin = Vector2.one; component.anchorMax = Vector2.one; component.pivot = Vector2.one; component.sizeDelta = new Vector2((float)num, (float)num); component.anchoredPosition = new Vector2(Plugin.Instance.PositionX.Value, Plugin.Instance.PositionY.Value); Image component2 = root.GetComponent(); component2.sprite = RuntimeSprites.CreateCircle(256, Color.white); ((Graphic)component2).color = new Color(0.03f, 0.08f, 0.08f, 0.92f); root.GetComponent().showMaskGraphic = true; GameObject val = new GameObject("Map", new Type[2] { typeof(RectTransform), typeof(RawImage) }); val.transform.SetParent(root.transform, false); mapImage = val.GetComponent(); ((Graphic)mapImage).raycastTarget = false; Stretch(((Graphic)mapImage).rectTransform); GameObject val2 = new GameObject("Border", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(root.transform, false); Stretch(val2.GetComponent()); Image component3 = val2.GetComponent(); component3.sprite = RuntimeSprites.CreateRing(256, 7, new Color(0.12f, 0.85f, 0.9f, 0.95f)); ((Graphic)component3).raycastTarget = false; selfArrow = CreateArrow(root.transform, "PlayerHeading", new Color(0.2f, 1f, 1f, 1f), Plugin.Instance.PlayerArrowSize.Value); ((Graphic)selfArrow).rectTransform.anchoredPosition = Vector2.zero; exitArrow = CreateArrow(root.transform, "ExitDirection", new Color(1f, 0.78f, 0.15f, 1f), Plugin.Instance.ExitArrowSize.Value); } private void CreateCamera() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_00ca: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown Camera val = (((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.mapScreen != (Object)null) ? StartOfRound.Instance.mapScreen.cam : null); if ((Object)(object)val == (Object)null) { Plugin.Instance.LogError("Could not locate the ship radar camera."); return; } GameObject val2 = new GameObject("WeeWeeProximityMinimap_Camera"); val2.transform.SetParent(((Component)this).transform, false); mapCamera = val2.AddComponent(); mapCamera.CopyFrom(val); ((Behaviour)mapCamera).enabled = false; mapCamera.depth = val.depth - 1f; int num = Mathf.Clamp(Plugin.Instance.MapSize.Value * 2, 256, 1024); mapTexture = new RenderTexture(num, num, 16, (RenderTextureFormat)0) { name = "WeeWeeProximityMinimap_Texture", filterMode = (FilterMode)1 }; mapTexture.Create(); mapCamera.targetTexture = mapTexture; mapImage.texture = (Texture)(object)mapTexture; } private void Update() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)localPlayer == (Object)null || (Object)(object)Plugin.Instance == (Object)null) { return; } KeyboardShortcut value = Plugin.Instance.ToggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Plugin.Instance.Enabled.Value = !Plugin.Instance.Enabled.Value; ((BaseUnityPlugin)Plugin.Instance).Config.Save(); HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip("Proximity Minimap", Plugin.Instance.Enabled.Value ? "Enabled" : "Disabled", false, false, "LC_Tip1"); } } bool flag = (Object)(object)StartOfRound.Instance != (Object)null && !StartOfRound.Instance.inShipPhase; bool flag2 = Plugin.Instance.Enabled.Value && flag; if ((Object)(object)root != (Object)null && root.activeSelf != flag2) { root.SetActive(flag2); } if (!flag2) { return; } if ((Object)(object)mapCamera == (Object)null) { CreateCamera(); if ((Object)(object)mapCamera == (Object)null) { return; } } UpdateCamera(); UpdateArrowSizes(); UpdateExitArrow(); if (Time.unscaledTime >= nextMarkerRefresh) { nextMarkerRefresh = Time.unscaledTime + 0.35f; RefreshMarkerCache(); } mapCamera.Render(); } private void UpdateCamera() { //IL_0014: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)StartOfRound.Instance.mapScreen.cam).transform.position; Vector3 position2 = ((Component)localPlayer).transform.position; ((Component)mapCamera).transform.position = new Vector3(position2.x, position.y, position2.z); float num = (Plugin.Instance.RotateWithPlayer.Value ? ((Component)localPlayer).transform.eulerAngles.y : 0f); ((Component)mapCamera).transform.rotation = Quaternion.Euler(90f, num, 0f); mapCamera.orthographicSize = Mathf.Clamp(Plugin.Instance.MapZoom.Value, 4f, 80f); ((Transform)((Graphic)selfArrow).rectTransform).localEulerAngles = (Vector3)(Plugin.Instance.RotateWithPlayer.Value ? Vector3.zero : new Vector3(0f, 0f, 0f - ((Component)localPlayer).transform.eulerAngles.y)); } private void UpdateArrowSizes() { //IL_004b: 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) float num = Mathf.Clamp(Plugin.Instance.PlayerArrowSize.Value, 4f, 40f); float num2 = Mathf.Clamp(Plugin.Instance.ExitArrowSize.Value, 4f, 40f); ((Graphic)selfArrow).rectTransform.sizeDelta = new Vector2(num, num); ((Graphic)exitArrow).rectTransform.sizeDelta = new Vector2(num2, num2); } private void UpdateExitArrow() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) bool value = Plugin.Instance.ShowExitArrow.Value; if (((Component)exitArrow).gameObject.activeSelf != value) { ((Component)exitArrow).gameObject.SetActive(value); } if (!value) { return; } Vector3 position; if (localPlayer.isInsideFactory) { EntranceTeleport val = FindNearestMainEntrance(); if ((Object)(object)val == (Object)null) { ((Component)exitArrow).gameObject.SetActive(false); return; } position = ((Component)val).transform.position; } else { if (!((Object)(object)StartOfRound.Instance != (Object)null) || !((Object)(object)StartOfRound.Instance.elevatorTransform != (Object)null)) { ((Component)exitArrow).gameObject.SetActive(false); return; } position = StartOfRound.Instance.elevatorTransform.position; } Vector3 val2 = position - ((Component)localPlayer).transform.position; float num = Mathf.Atan2(val2.x, val2.z) * 57.29578f - (Plugin.Instance.RotateWithPlayer.Value ? ((Component)localPlayer).transform.eulerAngles.y : 0f); float num2 = num * ((float)Math.PI / 180f); float num3 = (float)Mathf.Clamp(Plugin.Instance.MapSize.Value, 80, 600) * 0.39f; ((Graphic)exitArrow).rectTransform.anchoredPosition = new Vector2(Mathf.Sin(num2), Mathf.Cos(num2)) * num3; ((Transform)((Graphic)exitArrow).rectTransform).localEulerAngles = new Vector3(0f, 0f, 0f - num); } private EntranceTeleport FindNearestMainEntrance() { //IL_004e: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (entrances == null || entrances.Length == 0) { entrances = Object.FindObjectsOfType(); } EntranceTeleport result = null; float num = float.MaxValue; EntranceTeleport[] array = entrances; foreach (EntranceTeleport val in array) { if (!((Object)(object)val == (Object)null) && val.entranceId == 0) { Vector3 val2 = ((Component)val).transform.position - ((Component)localPlayer).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private void RefreshMarkerCache() { enemyMarkers.Clear(); EnemyAI[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { GameObject val = FindNamedChild(((Component)array[i]).transform, "MapDot"); if ((Object)(object)val != (Object)null) { enemyMarkers.Add(val); } } hazardMarkers.Clear(); Turret[] array2 = Object.FindObjectsOfType(); for (int i = 0; i < array2.Length; i++) { GameObject val2 = FindNamedChild(((Component)array2[i]).transform, "MapDot"); if ((Object)(object)val2 != (Object)null) { hazardMarkers.Add(val2); } } Landmine[] array3 = Object.FindObjectsOfType(); for (int i = 0; i < array3.Length; i++) { GameObject val3 = FindNamedChild(((Component)array3[i]).transform, "MapDot"); if ((Object)(object)val3 != (Object)null) { hazardMarkers.Add(val3); } } entrances = Object.FindObjectsOfType(); } private void BeforeCameraRender(Camera camera) { //IL_010c: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camera != (Object)(object)mapCamera || (Object)(object)localPlayer == (Object)null) { return; } changedMarkers.Clear(); float num = Mathf.Max(0f, Plugin.Instance.NearbyMarkerRange.Value); float num2 = num * num; if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.allPlayerScripts != null) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.mapRadarDotAnimator == (Object)null)) { bool flag = (Object)(object)val != (Object)(object)localPlayer && val.isPlayerControlled && !val.isPlayerDead; SetForThisRender(((Component)val.mapRadarDotAnimator).gameObject, Plugin.Instance.ShowPlayers.Value && flag); } } } GrabbableObject[] array = Object.FindObjectsOfType(); Vector3 val3; foreach (GrabbableObject val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.radarIcon == (Object)null)) { val3 = ((Component)val2).transform.position - ((Component)localPlayer).transform.position; bool flag2 = ((Vector3)(ref val3)).sqrMagnitude <= num2; SetForThisRender(((Component)val2.radarIcon).gameObject, Plugin.Instance.ShowItems.Value && flag2); } } foreach (GameObject enemyMarker in enemyMarkers) { if (!((Object)(object)enemyMarker == (Object)null)) { val3 = enemyMarker.transform.position - ((Component)localPlayer).transform.position; bool flag3 = ((Vector3)(ref val3)).sqrMagnitude <= num2; SetForThisRender(enemyMarker, Plugin.Instance.ShowMonsters.Value && flag3); } } foreach (GameObject hazardMarker in hazardMarkers) { SetForThisRender(hazardMarker, active: false); } TerminalAccessibleObject[] array2 = Object.FindObjectsOfType(); foreach (TerminalAccessibleObject val5 in array2) { if ((Object)(object)val5 != (Object)null && (Object)(object)val5.mapRadarObject != (Object)null) { SetForThisRender(val5.mapRadarObject, active: false); } } } private void AfterCameraRender(Camera camera) { if (!((Object)(object)camera != (Object)(object)mapCamera)) { RestoreMarkers(); } } private void SetForThisRender(GameObject marker, bool active) { if (!((Object)(object)marker == (Object)null) && marker.activeSelf != active) { changedMarkers.Add(new MarkerState { Marker = marker, WasActive = marker.activeSelf }); marker.SetActive(active); } } private void RestoreMarkers() { for (int num = changedMarkers.Count - 1; num >= 0; num--) { MarkerState markerState = changedMarkers[num]; if ((Object)(object)markerState.Marker != (Object)null) { markerState.Marker.SetActive(markerState.WasActive); } } changedMarkers.Clear(); } private static GameObject FindNamedChild(Transform rootTransform, string prefix) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown foreach (Transform item in rootTransform) { Transform val = item; if (((Object)val).name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) { return ((Component)val).gameObject; } GameObject val2 = FindNamedChild(val, prefix); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } private static Image CreateArrow(Transform parent, string name, Color color, float size) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0077: 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_00a3: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); Image component = val.GetComponent(); component.sprite = RuntimeSprites.CreateTriangle(64, color); ((Graphic)component).raycastTarget = false; ((Graphic)component).rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ((Graphic)component).rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ((Graphic)component).rectTransform.pivot = new Vector2(0.5f, 0.5f); ((Graphic)component).rectTransform.sizeDelta = new Vector2(size, size); return component; } private static void Stretch(RectTransform rect) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.offsetMin = Vector2.zero; rect.offsetMax = Vector2.zero; } private void OnDestroy() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(BeforeCameraRender)); Camera.onPostRender = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(AfterCameraRender)); RestoreMarkers(); if ((Object)(object)mapTexture != (Object)null) { mapTexture.Release(); Object.Destroy((Object)(object)mapTexture); } if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)root); } if ((Object)(object)current == (Object)(object)this) { current = null; } } } internal static class RuntimeSprites { internal static Sprite CreateCircle(int size, Color color) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = NewTexture(size); Color[] array = (Color[])(object)new Color[size * size]; float num = (float)(size - 1) * 0.5f; float num2 = num - 1f; float num3 = num2 * num2; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num4 = (float)j - num; float num5 = (float)i - num; array[i * size + j] = ((num4 * num4 + num5 * num5 <= num3) ? color : Color.clear); } } return Finish(texture, array); } internal static Sprite CreateRing(int size, int thickness, Color color) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = NewTexture(size); Color[] array = (Color[])(object)new Color[size * size]; float num = (float)(size - 1) * 0.5f; float num2 = num - 1f; float num3 = num2 - (float)thickness; float num4 = num2 * num2; float num5 = num3 * num3; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num6 = (float)j - num; float num7 = (float)i - num; float num8 = num6 * num6 + num7 * num7; array[i * size + j] = ((num8 <= num4 && num8 >= num5) ? color : Color.clear); } } return Finish(texture, array); } internal static Sprite CreateTriangle(int size, Color color) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) Texture2D texture = NewTexture(size); Color[] array = (Color[])(object)new Color[size * size]; float num = (float)(size - 1) * 0.5f; for (int i = 0; i < size; i++) { float num2 = (1f - (float)i / (float)(size - 1)) * num; for (int j = 0; j < size; j++) { array[i * size + j] = ((Mathf.Abs((float)j - num) <= num2) ? color : Color.clear); } } return Finish(texture, array); } private static Texture2D NewTexture(int size) { //IL_0004: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown return new Texture2D(size, size, (TextureFormat)4, false) { name = "WeeWeeProximityMinimap_RuntimeSprite", wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; } private static Sprite Finish(Texture2D texture, Color[] pixels) { //IL_0028: 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) texture.SetPixels(pixels); texture.Apply(false, true); return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f), 100f); } }