Decompiled source of Minimap v1.1.0

HTFMinimap.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("HTFMinimap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HTFMinimap")]
[assembly: AssemblyTitle("HTFMinimap")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HTFMinimap
{
	public class Dial : MonoBehaviour
	{
		private static readonly Color Rule = new Color(1f, 1f, 1f, 0.92f);

		private static readonly Color Ink = Color.white;

		private static readonly Color Quiet = new Color(1f, 1f, 1f, 0.62f);

		private static readonly Color BoatMark = new Color(0.95f, 0.8f, 0.35f, 1f);

		private static readonly Color CrewMark = new Color(0.55f, 0.78f, 0.95f, 1f);

		private const float Rim = 0.9f;

		private float _next;

		private float _sayRangeUntil;

		private static float _saidFor = float.NaN;

		private static bool _noRounding;

		private static bool _lookedForChart;

		private static FieldInfo _chart;

		private static PropertyInfo _chartOpen;

		private void Update()
		{
			//IL_0005: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Input.GetKeyDown(MinimapPlugin.ToggleKey.Value))
				{
					MinimapPlugin.ShowIt.Value = !MinimapPlugin.ShowIt.Value;
				}
				if (Wanted())
				{
					if (Input.GetKeyDown(MinimapPlugin.CloserKey.Value))
					{
						Zoom(0.7692308f);
					}
					if (Input.GetKeyDown(MinimapPlugin.WiderKey.Value))
					{
						Zoom(1.3f);
					}
					Tick();
				}
			}
			catch
			{
			}
		}

		private void Zoom(float by)
		{
			if (MinimapPlugin.AutoScale.Value)
			{
				MinimapPlugin.Fit.Value = Mathf.Clamp(MinimapPlugin.Fit.Value * by, 0.5f, 4f);
			}
			else
			{
				MinimapPlugin.Range.Value = Mathf.Clamp(MinimapPlugin.Range.Value * by, 25f, 400f);
			}
			_sayRangeUntil = Time.unscaledTime + 2f;
		}

		private void Tick()
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime < _next)
			{
				return;
			}
			_next = unscaledTime + 1f / (float)Mathf.Clamp(MinimapPlugin.Refresh.Value, 5, 60);
			Player localPlayer = Player.LocalPlayer;
			if ((Object)(object)localPlayer == (Object)null || (Object)(object)localPlayer.Transform == (Object)null)
			{
				return;
			}
			float yaw = 0f;
			if (MinimapPlugin.HeadingUp.Value)
			{
				Transform val = (((Object)(object)localPlayer.Camera != (Object)null) ? localPlayer.Camera.CamTransform : null);
				if ((Object)(object)val != (Object)null)
				{
					yaw = val.eulerAngles.y;
				}
			}
			Lens.Look(localPlayer.Transform.position, yaw, Reach(), MinimapPlugin.Detail.Value);
		}

		private static float Reach()
		{
			if (!MinimapPlugin.AutoScale.Value)
			{
				return MinimapPlugin.Range.Value;
			}
			float num = 0f;
			try
			{
				num = Island.IslandSize;
			}
			catch
			{
			}
			if (num < 5f || num > 2000f)
			{
				Said(num, MinimapPlugin.Range.Value, refused: true);
				return MinimapPlugin.Range.Value;
			}
			float num2 = Mathf.Clamp(num * MinimapPlugin.Fit.Value, 25f, 400f);
			Said(num, num2, refused: false);
			return num2;
		}

		private static void Said(float island, float reach, bool refused)
		{
			if (island != _saidFor)
			{
				_saidFor = island;
				if (refused)
				{
					MinimapPlugin.Log.LogWarning((object)("This island gives its size as " + island.ToString("0.#") + ", which is not a believable radius, so the minimap is using the fixed range of " + reach.ToString("0") + "m instead."));
				}
				else
				{
					MinimapPlugin.Log.LogInfo((object)("This island gives its size as " + island.ToString("0.#") + "m, so the minimap reaches " + reach.ToString("0") + "m."));
				}
			}
		}

		private void OnGUI()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0090: 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_00bc: 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_00d1: 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_0131: 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)
			try
			{
				if (Wanted() && Lens.Ready && !((Object)(object)Lens.Image == (Object)null))
				{
					Skin.Ready();
					float num = Mathf.Clamp(MinimapPlugin.Size.Value, 110, 460);
					float num2 = Mathf.Clamp(MinimapPlugin.Margin.Value, 0, 200);
					Rect face = default(Rect);
					((Rect)(ref face))..ctor((float)Screen.width - num - num2, num2, num, num);
					Vector2 center = ((Rect)(ref face)).center;
					float num3 = ((Rect)(ref face)).width * 0.5f;
					Round(face, num3);
					Skin.Ring(center, num3, A(Rule));
					if (MinimapPlugin.ShowCompass.Value)
					{
						DrawNorth(center, num3);
					}
					if (MinimapPlugin.MarkPlayers.Value)
					{
						DrawCrew(center, num3);
					}
					if (MinimapPlugin.MarkBoat.Value)
					{
						DrawBoat(center, num3);
					}
					DrawMe(center, num3);
					if (Time.unscaledTime < _sayRangeUntil)
					{
						Skin.Label(new Rect(((Rect)(ref face)).x, ((Rect)(ref face)).yMax - 30f, ((Rect)(ref face)).width, 18f), Mathf.RoundToInt(Reach()) + "m", A(Ink), (TextAnchor)4);
					}
				}
			}
			catch
			{
			}
		}

		private void Round(Rect face, float r)
		{
			//IL_0060: 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_006b: 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)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			((Color)(ref val))..ctor(1f, 1f, 1f, Alpha());
			if (!_noRounding)
			{
				try
				{
					GUI.DrawTexture(face, Lens.Image, (ScaleMode)0, true, 0f, val, 0f, r);
					return;
				}
				catch (Exception ex)
				{
					_noRounding = true;
					MinimapPlugin.Log.LogWarning((object)("This Unity will not round the minimap's corners, so it will be square: " + ex.Message));
				}
			}
			Color color = GUI.color;
			GUI.color = val;
			GUI.DrawTexture(face, Lens.Image, (ScaleMode)0, false);
			GUI.color = color;
		}

		private void DrawMe(Vector2 mid, float r)
		{
			//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_0035: 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_006f: 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_0074: 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_009c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00d1: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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)
			Player localPlayer = Player.LocalPlayer;
			if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)localPlayer.Transform == (Object)null) && Lens.ToDial(localPlayer.Transform.position, out var uv))
			{
				Vector2 at = Place(mid, r, uv);
				Transform val = (((Object)(object)localPlayer.Camera != (Object)null) ? localPlayer.Camera.CamTransform : null);
				Vector3 val2 = (((Object)(object)val != (Object)null) ? val.forward : localPlayer.Transform.forward);
				val2.y = 0f;
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = Vector3.forward;
				}
				Vector2 dir = Screenwise(Lens.Facing(((Vector3)(ref val2)).normalized));
				Skin.Disc(at, 9f, A(new Color(0f, 0f, 0f, 0.6f)));
				Skin.Pointer(at, dir, 9f, A(Ink), solid: false);
			}
		}

		private void DrawBoat(Vector2 mid, float r)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_006a: 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_005c: 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)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_009f: 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_00c3: 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_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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_0130: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			Boat val = null;
			try
			{
				val = (((Object)(object)BoatManager.Instance != (Object)null) ? BoatManager.Boat : null);
			}
			catch
			{
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Vector3 val2 = (((Object)(object)val.VisualBoat != (Object)null) ? val.VisualBoat.position : ((!((Object)(object)val.HiddenPhysicsRig != (Object)null)) ? ((Component)val).transform.position : val.HiddenPhysicsRig.position));
			if (Lens.ToDial(val2, out var uv) && !(((Vector2)(ref uv)).magnitude <= 0.9f))
			{
				Vector2 val3 = Screenwise(((Vector2)(ref uv)).normalized);
				Vector2 at = mid + val3 * r * 0.9f;
				Skin.Disc(at, 7f, A(new Color(0f, 0f, 0f, 0.55f)));
				Skin.Pointer(at, val3, 7f, A(BoatMark), solid: true);
				Player localPlayer = Player.LocalPlayer;
				if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)localPlayer.Transform == (Object)null))
				{
					float num = Vector3.Distance(new Vector3(localPlayer.Transform.position.x, 0f, localPlayer.Transform.position.z), new Vector3(val2.x, 0f, val2.z));
					Vector2 val4 = mid + val3 * r * 0.7f;
					Skin.Label(new Rect(val4.x - 34f, val4.y - 8f, 68f, 16f), Mathf.RoundToInt(num) + "m", A(BoatMark), (TextAnchor)4);
				}
			}
		}

		private void DrawCrew(Vector2 mid, float r)
		{
			//IL_0043: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//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_00e9: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_0064: 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_006a: 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_0089: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = null;
			try
			{
				list = PlayerManager.OtherPlayers;
			}
			catch
			{
			}
			if (list == null)
			{
				return;
			}
			for (int i = 0; i < list.Count; i++)
			{
				Player val = list[i];
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.Transform == (Object)null) && Lens.ToDial(val.Transform.position, out var uv))
				{
					if (((Vector2)(ref uv)).magnitude <= 0.9f)
					{
						Vector2 at = Place(mid, r, uv);
						Skin.Disc(at, 5f, A(new Color(0f, 0f, 0f, 0.55f)));
						Skin.Disc(at, 3.5f, A(CrewMark));
					}
					else
					{
						Vector2 val2 = Screenwise(((Vector2)(ref uv)).normalized);
						Vector2 at2 = mid + val2 * r * 0.9f;
						Skin.Disc(at2, 6f, A(new Color(0f, 0f, 0f, 0.55f)));
						Skin.Pointer(at2, val2, 6f, A(CrewMark), solid: true);
					}
				}
			}
		}

		private void DrawNorth(Vector2 mid, float r)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0032: 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)
			//IL_0047: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_005b: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Screenwise(Lens.North());
			Vector2 b = mid + val * (r - 3f);
			Skin.Line(mid + val * (r - 11f), b, A(Quiet), 2f);
			Vector2 val2 = mid + val * (r - 22f);
			Skin.Label(new Rect(val2.x - 14f, val2.y - 9f, 28f, 18f), "N", A(Quiet), (TextAnchor)4);
		}

		private static Vector2 Screenwise(Vector2 dial)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2(dial.x, 0f - dial.y);
		}

		private static Vector2 Place(Vector2 mid, float r, Vector2 uv)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_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)
			return mid + Screenwise(uv) * r;
		}

		private static float Alpha()
		{
			return Mathf.Clamp01(MinimapPlugin.Opacity.Value);
		}

		private static Color A(Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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)
			return new Color(c.r, c.g, c.b, c.a * Alpha());
		}

		private static bool Wanted()
		{
			if (!MinimapPlugin.ShowIt.Value)
			{
				return false;
			}
			try
			{
				if (MainMenuManager.IsInMenu)
				{
					return false;
				}
				if (PauseManager.IsPaused)
				{
					return false;
				}
				if (LoadingManager.IsLoadingIn)
				{
					return false;
				}
				if (IslandManager.IsLoading)
				{
					return false;
				}
				if (!Player.LocalPlayerEnabled)
				{
					return false;
				}
				Player localPlayer = Player.LocalPlayer;
				if ((Object)(object)localPlayer == (Object)null || (Object)(object)localPlayer.Transform == (Object)null)
				{
					return false;
				}
			}
			catch
			{
				return false;
			}
			return !ChartIsOpen();
		}

		private static bool ChartIsOpen()
		{
			if (!_lookedForChart)
			{
				_lookedForChart = true;
				try
				{
					Type type = AccessTools.TypeByName("ExtraIslands.WorldMap");
					if (type != null)
					{
						_chart = AccessTools.Field(type, "Instance");
						_chartOpen = AccessTools.Property(type, "IsOpen");
						if (_chart != null && _chartOpen != null)
						{
							MinimapPlugin.Log.LogInfo((object)"The Custom Islands Loader is here, so the minimap will step aside while its chart is open.");
						}
					}
				}
				catch
				{
				}
			}
			if (_chart == null || _chartOpen == null)
			{
				return false;
			}
			try
			{
				object? value = _chart.GetValue(null);
				Object val = (Object)((value is Object) ? value : null);
				if (val == (Object)null)
				{
					return false;
				}
				return (bool)_chartOpen.GetValue(val, null);
			}
			catch
			{
				return false;
			}
		}
	}
	public static class Lens
	{
		private const float Above = 60f;

		private const float Below = 160f;

		private static Camera _cam;

		private static RenderTexture _rt;

		private static int _madeAt;

		public static Texture Image => (Texture)(object)_rt;

		public static bool Ready { get; private set; }

		public static bool Look(Vector3 centre, float yaw, float range, int detail)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!Ensure(detail))
			{
				return false;
			}
			((Component)_cam).transform.position = new Vector3(centre.x, centre.y + 60f, centre.z);
			((Component)_cam).transform.rotation = Quaternion.Euler(90f, yaw, 0f);
			_cam.orthographicSize = Mathf.Max(1f, range);
			_cam.nearClipPlane = 0.3f;
			_cam.farClipPlane = 220f;
			bool fog = RenderSettings.fog;
			try
			{
				RenderSettings.fog = false;
				_cam.Render();
				Ready = true;
				return true;
			}
			catch (Exception ex)
			{
				MinimapPlugin.Log.LogWarning((object)("The minimap could not render: " + ex.Message));
				Ready = false;
				return false;
			}
			finally
			{
				RenderSettings.fog = fog;
			}
		}

		public static bool ToDial(Vector3 world, out Vector2 uv)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0031: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			uv = Vector2.zero;
			if ((Object)(object)_cam == (Object)null || !Ready)
			{
				return false;
			}
			Vector3 val = ((Component)_cam).transform.InverseTransformPoint(world);
			float num = Mathf.Max(0.001f, _cam.orthographicSize);
			uv = new Vector2(val.x / num, val.y / num);
			return true;
		}

		public static Vector2 Facing(Vector3 worldDir)
		{
			//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_0023: 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_002c: 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_004d: 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)
			if ((Object)(object)_cam == (Object)null)
			{
				return Vector2.up;
			}
			Vector3 val = ((Component)_cam).transform.InverseTransformDirection(worldDir);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(val.x, val.y);
			if (!(((Vector2)(ref val2)).sqrMagnitude < 0.0001f))
			{
				return ((Vector2)(ref val2)).normalized;
			}
			return Vector2.up;
		}

		public static Vector2 North()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Facing(Vector3.forward);
		}

		private static bool Ensure(int detail)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00e5: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			detail = Mathf.Clamp(detail, 128, 512);
			if ((Object)(object)_rt != (Object)null && _madeAt != detail)
			{
				if ((Object)(object)_cam != (Object)null)
				{
					_cam.targetTexture = null;
				}
				_rt.Release();
				Object.Destroy((Object)(object)_rt);
				_rt = null;
				Ready = false;
			}
			if ((Object)(object)_rt == (Object)null)
			{
				_rt = new RenderTexture(detail, detail, 16, (RenderTextureFormat)0)
				{
					name = "HTFMinimapView",
					hideFlags = (HideFlags)61,
					antiAliasing = 2,
					wrapMode = (TextureWrapMode)1,
					filterMode = (FilterMode)1
				};
				_rt.Create();
				_madeAt = detail;
				if ((Object)(object)_cam != (Object)null)
				{
					_cam.targetTexture = _rt;
				}
			}
			if ((Object)(object)_cam != (Object)null)
			{
				return true;
			}
			try
			{
				GameObject val = new GameObject("HTFMinimapCamera")
				{
					hideFlags = (HideFlags)61
				};
				Object.DontDestroyOnLoad((Object)val);
				_cam = val.AddComponent<Camera>();
				((Behaviour)_cam).enabled = false;
				_cam.orthographic = true;
				_cam.clearFlags = (CameraClearFlags)2;
				_cam.backgroundColor = new Color(0.05f, 0.13f, 0.18f, 1f);
				_cam.cullingMask = -1;
				Camera cam = _cam;
				cam.cullingMask &= -33;
				Camera cam2 = _cam;
				cam2.cullingMask &= -9;
				_cam.allowHDR = false;
				_cam.allowMSAA = true;
				_cam.useOcclusionCulling = false;
				_cam.depth = -100f;
				_cam.targetTexture = _rt;
				NoSky(val);
				return true;
			}
			catch (Exception ex)
			{
				MinimapPlugin.Log.LogError((object)("The minimap could not make its camera: " + ex.Message));
				return false;
			}
		}

		private static void NoSky(GameObject go)
		{
			try
			{
				Type type = AccessTools.TypeByName("UnityEngine.Rendering.Universal.UniversalAdditionalCameraData");
				if (!(type == null))
				{
					Component obj = go.GetComponent(type) ?? go.AddComponent(type);
					PropertyInfo property = type.GetProperty("backgroundType");
					if (property != null && property.CanWrite)
					{
						property.SetValue(obj, Enum.ToObject(property.PropertyType, 1), null);
					}
					PropertyInfo property2 = type.GetProperty("renderPostProcessing");
					if (property2 != null && property2.CanWrite)
					{
						property2.SetValue(obj, false, null);
					}
					PropertyInfo property3 = type.GetProperty("renderShadows");
					if (property3 != null && property3.CanWrite)
					{
						property3.SetValue(obj, false, null);
					}
				}
			}
			catch (Exception ex)
			{
				MinimapPlugin.Log.LogWarning((object)("Could not tell the minimap camera to leave the sky out: " + ex.Message));
			}
		}
	}
	[BepInPlugin("yoxiui.htf.minimap", "HTF Minimap", "1.0.0")]
	[BepInProcess("How to Fish.exe")]
	public class MinimapPlugin : BaseUnityPlugin
	{
		public const string Id = "yoxiui.htf.minimap";

		public static ManualLogSource Log;

		public static MinimapPlugin Self;

		public static ConfigEntry<bool> ShowIt;

		public static ConfigEntry<KeyCode> ToggleKey;

		public static ConfigEntry<int> Size;

		public static ConfigEntry<int> Margin;

		public static ConfigEntry<float> Opacity;

		public static ConfigEntry<bool> HeadingUp;

		public static ConfigEntry<bool> AutoScale;

		public static ConfigEntry<float> Fit;

		public static ConfigEntry<float> Range;

		public static ConfigEntry<KeyCode> CloserKey;

		public static ConfigEntry<KeyCode> WiderKey;

		public static ConfigEntry<bool> MarkBoat;

		public static ConfigEntry<bool> MarkPlayers;

		public static ConfigEntry<bool> ShowCompass;

		public static ConfigEntry<int> Refresh;

		public static ConfigEntry<int> Detail;

		public const float Closest = 25f;

		public const float Widest = 400f;

		private void Awake()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Expected O, but got Unknown
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: 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_02e9: Expected O, but got Unknown
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			Self = this;
			Log = ((BaseUnityPlugin)this).Logger;
			ShowIt = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show the minimap", true, "Whether the minimap is on screen. The toggle key changes this while you play, and what you leave it on is what you get next time.");
			ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Toggle key", (KeyCode)110, "Shows and hides the minimap.");
			Size = ((BaseUnityPlugin)this).Config.Bind<int>("Look", "Size", 200, new ConfigDescription("How big the minimap is on screen, in pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(110, 460), Array.Empty<object>()));
			Margin = ((BaseUnityPlugin)this).Config.Bind<int>("Look", "Margin", 16, new ConfigDescription("The gap between the minimap and the corner of the screen.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>()));
			Opacity = ((BaseUnityPlugin)this).Config.Bind<float>("Look", "Opacity", 1f, new ConfigDescription("How solid the minimap is. Lower it if it is in the way.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 1f), Array.Empty<object>()));
			HeadingUp = ((BaseUnityPlugin)this).Config.Bind<bool>("Look", "Turn with me", true, "On, the map turns as you do and the way you are facing is always up. Off, north is always up and your arrow turns instead.");
			AutoScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Zoom", "Scale to the island", true, "On, the minimap zooms itself to whatever island you are on, so a small island and a big one both fill it about the same amount. Off, it always shows the same number of metres whatever you are standing on.");
			Fit = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "How much island to show", 1.4f, new ConfigDescription("While scaling to the island, how far past its edge the minimap reaches. 1 stops at the shore, higher shows more of the sea around it. The zoom keys change this.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 4f), Array.Empty<object>()));
			Range = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "Range", 70f, new ConfigDescription("How many metres from you the edge of the minimap is, when it is NOT scaling itself to the island.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(25f, 400f), Array.Empty<object>()));
			CloserKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Zoom", "Zoom in key", (KeyCode)273, "Brings the minimap in closer.");
			WiderKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Zoom", "Zoom out key", (KeyCode)274, "Pulls the minimap back.");
			MarkBoat = ((BaseUnityPlugin)this).Config.Bind<bool>("Markers", "Show the boat", true, "Marks your boat, and pins the mark to the edge pointing the right way when the boat is further off than the minimap reaches.");
			MarkPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Markers", "Show other players", true, "Marks everybody else in your game.");
			ShowCompass = ((BaseUnityPlugin)this).Config.Bind<bool>("Markers", "Show north", true, "Puts a mark on the rim for north.");
			Refresh = ((BaseUnityPlugin)this).Config.Bind<int>("Performance", "Refreshes a second", 30, new ConfigDescription("How many times a second the view is re-rendered. This is the only thing here that costs anything, so it is the first thing to turn down if the game slows.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 60), Array.Empty<object>()));
			Detail = ((BaseUnityPlugin)this).Config.Bind<int>("Performance", "Detail", 256, new ConfigDescription("How many pixels across the view is rendered at. Higher is sharper and costs more.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(128, 512), Array.Empty<object>()));
			GameObject val = new GameObject("HTFMinimap")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<Dial>();
			Log.LogInfo((object)("Minimap ready. " + ((object)ToggleKey.Value/*cast due to .constrained prefix*/).ToString() + " shows and hides it, " + ((object)CloserKey.Value/*cast due to .constrained prefix*/).ToString() + " and " + ((object)WiderKey.Value/*cast due to .constrained prefix*/).ToString() + " zoom."));
		}
	}
	public static class Skin
	{
		private static Texture2D _pix;

		private static Texture2D _disc;

		private static Texture2D _ring;

		private static GUIStyle _label;

		private static Font _font;

		private static bool _lookedForFont;

		private static readonly Vector2[] Around = (Vector2[])(object)new Vector2[4]
		{
			new Vector2(-1.3f, -1.3f),
			new Vector2(1.3f, -1.3f),
			new Vector2(-1.3f, 1.3f),
			new Vector2(1.3f, 1.3f)
		};

		private static Font TheGamesFont()
		{
			if (_lookedForFont)
			{
				return _font;
			}
			_lookedForFont = true;
			string[] array = new string[3] { "Underdog", "Liberation", "Noto" };
			try
			{
				Font[] array2 = Resources.FindObjectsOfTypeAll<Font>();
				string[] array3 = array;
				foreach (string value in array3)
				{
					Font[] array4 = array2;
					foreach (Font val in array4)
					{
						if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((Object)val).name) && ((Object)val).name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0)
						{
							_font = val;
							MinimapPlugin.Log.LogInfo((object)("The minimap is set in the game's own font, " + ((Object)val).name + "."));
							return _font;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		public static void Ready()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			if ((Object)(object)_pix == (Object)null)
			{
				_pix = new Texture2D(1, 1, (TextureFormat)4, false)
				{
					hideFlags = (HideFlags)61
				};
				_pix.SetPixel(0, 0, Color.white);
				_pix.Apply();
			}
			if ((Object)(object)_disc == (Object)null)
			{
				_disc = Circle(64, hollow: false);
			}
			if ((Object)(object)_ring == (Object)null)
			{
				_ring = Circle(256, hollow: true);
			}
			if (_label == null)
			{
				_label = new GUIStyle(GUI.skin.label)
				{
					fontSize = 13,
					richText = false,
					wordWrap = false
				};
				Font val = TheGamesFont();
				if ((Object)(object)val != (Object)null)
				{
					_label.font = val;
				}
			}
		}

		private static Texture2D Circle(int size, bool hollow)
		{
			//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_0011: 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_0020: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61,
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			float num = (float)size * 0.5f;
			Color32[] array = (Color32[])(object)new Color32[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num));
					float num3 = (hollow ? (Mathf.Clamp01(num2 - (num - 4f) + 0.5f) * Mathf.Clamp01(num - num2 + 0.5f)) : Mathf.Clamp01(num - num2));
					array[i * size + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255f));
				}
			}
			val.SetPixels32(array);
			val.Apply(false);
			return val;
		}

		public static void Fill(Rect r, Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color = GUI.color;
			GUI.color = c;
			GUI.DrawTexture(r, (Texture)(object)_pix);
			GUI.color = color;
		}

		public static void Tinted(Rect r, Texture tex, Color c)
		{
			//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: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tex == (Object)null))
			{
				Color color = GUI.color;
				GUI.color = c;
				GUI.DrawTexture(r, tex, (ScaleMode)0, true);
				GUI.color = color;
			}
		}

		public static void Ring(Vector2 at, float radius, Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			Tinted(new Rect(at.x - radius, at.y - radius, radius * 2f, radius * 2f), (Texture)(object)_ring, c);
		}

		public static void Disc(Vector2 at, float radius, Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			Tinted(new Rect(at.x - radius, at.y - radius, radius * 2f, radius * 2f), (Texture)(object)_disc, c);
		}

		public static void Line(Vector2 a, Vector2 b, Color c, float w)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_0019: 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)
			//IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = b - a;
			float magnitude = ((Vector2)(ref val)).magnitude;
			if (!(magnitude < 0.01f))
			{
				Matrix4x4 matrix = GUI.matrix;
				GUIUtility.RotateAroundPivot(Mathf.Atan2(val.y, val.x) * 57.29578f, a);
				Fill(new Rect(a.x, a.y - w * 0.5f, magnitude, w), c);
				GUI.matrix = matrix;
			}
		}

		public static void Pointer(Vector2 at, Vector2 dir, float size, Color c, bool solid)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_009c: 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_00a8: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_00c5: 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_00c8: 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_00d7: 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)
			if (((Vector2)(ref dir)).sqrMagnitude < 0.0001f)
			{
				dir = Vector2.up;
			}
			dir = ((Vector2)(ref dir)).normalized;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f - dir.y, dir.x);
			Vector2 a = at + dir * size;
			Vector2 val2 = at - dir * size * 0.55f + val * size * 0.62f;
			Vector2 b = at - dir * size * 0.55f - val * size * 0.62f;
			Line(a, val2, c, 2f);
			Line(a, b, c, 2f);
			Line(val2, b, c, 2f);
			if (solid)
			{
				Disc(at + dir * size * 0.1f, size * 0.45f, c);
			}
		}

		public static void Label(Rect r, string s, Color c, TextAnchor anchor)
		{
			//IL_000d: 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_002a: Expected O, but got Unknown
			//IL_0043: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			if (_label != null)
			{
				_label.alignment = anchor;
				float num = _label.CalcHeight(new GUIContent(s), ((Rect)(ref r)).width) + 2f;
				if (num > ((Rect)(ref r)).height)
				{
					((Rect)(ref r)).height = num;
				}
				Color color = GUI.color;
				GUI.color = new Color(0f, 0f, 0f, 0.85f * c.a);
				Vector2[] around = Around;
				foreach (Vector2 val in around)
				{
					GUI.Label(new Rect(((Rect)(ref r)).x + val.x, ((Rect)(ref r)).y + val.y, ((Rect)(ref r)).width, ((Rect)(ref r)).height), s, _label);
				}
				GUI.color = c;
				GUI.Label(r, s, _label);
				GUI.color = color;
			}
		}
	}
}