Decompiled source of Compass UI v1.0.0

Compass.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Compass;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Compass")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Compass")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("65BAF4AB-E942-4534-9823-A1A9C7026673")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class CompassMark : MonoBehaviour
{
	public Vector3 precomputedDirectionVector;

	public CanvasGroup canvasGroup;

	public RectTransform rectTransform;

	public TMP_Text tmpText;

	public RectTransform lineTransform;

	public Image lineImage;

	public RawImage iconImage;

	public RawImage arrowImage;

	public static Texture2D cachedCircle;

	public static Texture2D cachedDiamond;

	public static Texture2D cachedChevron;

	public static Texture2D cachedTriangle;

	public void Init(TMP_Text originalUISource, float markDegrees, bool isForPlayer = false, bool isForSuitcase = false)
	{
		//IL_001b: 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_0024: 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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Expected O, but got Unknown
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: 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_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Expected O, but got Unknown
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Expected O, but got Unknown
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0470: 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_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0508: Unknown result type (might be due to invalid IL or missing references)
		//IL_050f: Expected O, but got Unknown
		//IL_0549: Unknown result type (might be due to invalid IL or missing references)
		//IL_0572: Unknown result type (might be due to invalid IL or missing references)
		//IL_0589: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0671: Unknown result type (might be due to invalid IL or missing references)
		//IL_0688: Unknown result type (might be due to invalid IL or missing references)
		//IL_0696: Unknown result type (might be due to invalid IL or missing references)
		//IL_069b: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_070b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0712: Expected O, but got Unknown
		//IL_074c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: Unknown result type (might be due to invalid IL or missing references)
		//IL_078c: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0802: Unknown result type (might be due to invalid IL or missing references)
		float num = markDegrees * ((float)Math.PI / 180f);
		Vector3 val = new Vector3(Mathf.Sin(num), 0f, Mathf.Cos(num));
		precomputedDirectionVector = ((Vector3)(ref val)).normalized;
		rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
		canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>();
		GameObject val2 = new GameObject("tmp", new Type[1] { typeof(RectTransform) });
		val2.transform.SetParent((Transform)(object)rectTransform);
		tmpText = (TMP_Text)(object)val2.AddComponent<TextMeshProUGUI>();
		CopyTMPSettings(originalUISource, tmpText);
		tmpText.text = markDegrees.ToString();
		tmpText.horizontalAlignment = (HorizontalAlignmentOptions)2;
		tmpText.verticalAlignment = (VerticalAlignmentOptions)1024;
		tmpText.fontSize = 40f;
		if (markDegrees == 0f)
		{
			tmpText.text = "N";
		}
		else if (markDegrees == 90f)
		{
			tmpText.text = "E";
		}
		else if (markDegrees == 180f)
		{
			tmpText.text = "S";
		}
		else if (markDegrees == 270f)
		{
			tmpText.text = "W";
		}
		else
		{
			tmpText.fontSize = 18f;
		}
		((Object)((Component)this).gameObject).name = tmpText.text;
		RectTransform component = val2.GetComponent<RectTransform>();
		component.anchoredPosition = new Vector2(0f, 50f);
		rectTransform.pivot = new Vector2(0.5f, 0.5f);
		rectTransform.anchoredPosition = new Vector2(0f, 0f);
		rectTransform.sizeDelta = new Vector2(5f, 40f);
		GameObject val3 = new GameObject("lineTransform", new Type[1] { typeof(RectTransform) });
		val3.transform.SetParent((Transform)(object)rectTransform);
		lineTransform = val3.GetComponent<RectTransform>();
		lineImage = val3.AddComponent<Image>();
		float num2 = 0.4f;
		((Graphic)lineImage).color = new Color(num2, num2, num2, 0.8f);
		lineTransform.anchorMin = new Vector2(0f, 0f);
		lineTransform.anchorMax = new Vector2(1f, 1f);
		lineTransform.pivot = new Vector2(0.5f, 0.5f);
		lineTransform.offsetMin = Vector2.zero;
		lineTransform.offsetMax = Vector2.zero;
		if (isForPlayer)
		{
			GameObject val4 = new GameObject("circle", new Type[1] { typeof(RectTransform) });
			val4.transform.SetParent((Transform)(object)rectTransform);
			iconImage = val4.AddComponent<RawImage>();
			((Graphic)iconImage).color = new Color(1f, 0f, 0f, 1f);
			RectTransform component2 = ((Component)iconImage).gameObject.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0.5f, 0.5f);
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = Vector2.zero;
			component2.anchorMin = new Vector2(0.5f, 0.5f);
			component2.anchorMax = new Vector2(0.5f, 0.5f);
			component2.sizeDelta = new Vector2(30f, 30f);
			Texture2D texture = GenerateCircleTexture(512, 512, 0.45f);
			iconImage.texture = (Texture)(object)texture;
			((Object)((Component)this).gameObject).name = $"Player_{markDegrees}";
			tmpText.verticalAlignment = (VerticalAlignmentOptions)256;
			RectTransform component3 = ((Component)tmpText).GetComponent<RectTransform>();
			component3.anchoredPosition = new Vector2(0.5f, 2f);
			component3.pivot = new Vector2(0.5f, 1f);
			((Transform)component3).position = ((Transform)component3).position + Vector3.down * 25f;
			tmpText.fontSize = 24f;
			tmpText.text = "123m";
			((Behaviour)lineImage).enabled = false;
		}
		if (isForSuitcase)
		{
			GameObject val5 = new GameObject("square", new Type[1] { typeof(RectTransform) });
			val5.transform.SetParent((Transform)(object)rectTransform);
			iconImage = val5.AddComponent<RawImage>();
			((Graphic)iconImage).color = new Color(0.349f, 0.18f, 0.047f, 1f);
			RectTransform component4 = ((Component)iconImage).gameObject.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0f);
			component4.anchorMax = new Vector2(1f, 1f);
			component4.pivot = new Vector2(0.5f, 0.5f);
			component4.offsetMin = Vector2.zero;
			component4.offsetMax = Vector2.zero;
			component4.anchorMin = new Vector2(0.5f, 0.5f);
			component4.anchorMax = new Vector2(0.5f, 0.5f);
			component4.sizeDelta = new Vector2(30f, 30f);
			Texture2D texture2 = GenerateDiamondTextureWithFade(512, 512);
			iconImage.texture = (Texture)(object)texture2;
			((Object)((Component)this).gameObject).name = $"Suitcase_{markDegrees}";
			tmpText.verticalAlignment = (VerticalAlignmentOptions)256;
			RectTransform component5 = ((Component)tmpText).GetComponent<RectTransform>();
			component5.anchoredPosition = new Vector2(0.5f, 2f);
			component5.pivot = new Vector2(0.5f, 1f);
			((Transform)component5).position = ((Transform)component5).position + Vector3.down * 25f;
			tmpText.fontSize = 24f;
			tmpText.text = "123m";
			((Behaviour)lineImage).enabled = false;
		}
		if (isForPlayer || isForSuitcase)
		{
			GameObject val6 = new GameObject("arrow", new Type[1] { typeof(RectTransform) });
			val6.transform.SetParent((Transform)(object)rectTransform);
			arrowImage = val6.AddComponent<RawImage>();
			((Graphic)arrowImage).color = new Color(1f, 1f, 1f, 0.5f);
			RectTransform component6 = ((Component)arrowImage).gameObject.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0f, 0f);
			component6.anchorMax = new Vector2(1f, 1f);
			component6.pivot = new Vector2(0.5f, 0.5f);
			component6.offsetMin = Vector2.zero;
			component6.offsetMax = Vector2.zero;
			component6.anchorMin = new Vector2(0.5f, 0.5f);
			component6.anchorMax = new Vector2(0.5f, 0.5f);
			component6.sizeDelta = new Vector2(12f, 12f);
			Texture2D texture3 = GenerateUpwardTriangleTexture(256, 256);
			arrowImage.texture = (Texture)(object)texture3;
			((Behaviour)arrowImage).enabled = false;
		}
	}

	private void CopyTMPSettings(TMP_Text source, TMP_Text destination)
	{
		//IL_001d: 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_0044: 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)
		destination.font = source.font;
		destination.fontSharedMaterial = source.fontSharedMaterial;
		((Graphic)destination).color = ((Graphic)source).color;
		destination.alignment = source.alignment;
		destination.richText = source.richText;
		destination.fontStyle = source.fontStyle;
		float num = 0.3f;
		((Graphic)destination).color = new Color(num, num, num, 0.93f);
	}

	private Texture2D GenerateCircleTexture(int width, int height, float radiusFactor)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_00c6: 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_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: 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_0115: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cachedCircle))
		{
			return cachedCircle;
		}
		Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color32 val2 = default(Color32);
		((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
		Color32 val3 = default(Color32);
		((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
		int num = width / 2;
		int num2 = height / 2;
		float num3 = (float)Mathf.Min(width, height) * radiusFactor;
		float num4 = num3 - 2f;
		float num5 = num3;
		float num6 = num5 - num4;
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				int num7 = j - num;
				int num8 = i - num2;
				float num9 = Mathf.Sqrt((float)(num7 * num7 + num8 * num8));
				if (num9 <= num4)
				{
					val.SetPixel(j, i, Color32.op_Implicit(val3));
				}
				else if (num9 <= num5)
				{
					float num10 = (num5 - num9) / num6;
					byte b = (byte)(num10 * 255f);
					val.SetPixel(j, i, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b)));
				}
				else
				{
					val.SetPixel(j, i, Color32.op_Implicit(val2));
				}
			}
		}
		val.Apply();
		cachedCircle = val;
		return val;
	}

	private Texture2D GenerateDiamondTextureWithFade(int width, int height, int fadeWidth = 3)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//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_011f: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cachedDiamond))
		{
			return cachedDiamond;
		}
		Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color32 val2 = default(Color32);
		((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
		Color32 val3 = default(Color32);
		((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0);
		int num = width / 2;
		int num2 = height / 2;
		int num3 = num;
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				int num4 = Mathf.Abs(j - num);
				int num5 = Mathf.Abs(i - num2);
				int num6 = num4 + num5;
				if (num6 <= num3 - fadeWidth)
				{
					val.SetPixel(j, i, Color32.op_Implicit(val2));
				}
				else if (num6 <= num3)
				{
					float num7 = Mathf.InverseLerp((float)num3, (float)(num3 - fadeWidth), (float)num6);
					byte b = (byte)(num7 * 255f);
					val.SetPixel(j, i, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b)));
				}
				else
				{
					val.SetPixel(j, i, Color32.op_Implicit(val3));
				}
			}
		}
		val.Apply();
		cachedDiamond = val;
		return val;
	}

	private Texture2D GenerateUpwardChevronTexture(int width, int height, int thickness = 20, int fade = 3)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//IL_00a1: 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_00b1: 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_01ad: 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_012e: 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_0197: 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_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cachedChevron))
		{
			return cachedChevron;
		}
		Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color32 val2 = default(Color32);
		((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
		Color32 val3 = default(Color32);
		((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0);
		Vector2 val4 = default(Vector2);
		((Vector2)(ref val4))..ctor((float)width / 2f, (float)height * 0.6f);
		float num = (float)width * 0.3f;
		Vector2 val5 = default(Vector2);
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				((Vector2)(ref val5))..ctor((float)j, (float)i);
				float num2 = val5.y - val4.y;
				float num3 = val5.x - val4.x;
				float num4 = Mathf.Abs(num2 - (0f - num3));
				float num5 = Mathf.Abs(num2 - num3);
				float num6 = Mathf.Abs(num3);
				float num7 = 0f - num2;
				if (num7 >= 0f && num6 <= num)
				{
					float num8 = Mathf.Min(num4, num5);
					if (num8 <= (float)(thickness - fade))
					{
						val.SetPixel(j, i, Color32.op_Implicit(val2));
					}
					else if (num8 <= (float)thickness)
					{
						float num9 = Mathf.InverseLerp((float)thickness, (float)(thickness - fade), num8);
						byte b = (byte)(num9 * 255f);
						val.SetPixel(j, i, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b)));
					}
					else
					{
						val.SetPixel(j, i, Color32.op_Implicit(val3));
					}
				}
				else
				{
					val.SetPixel(j, i, Color32.op_Implicit(val3));
				}
			}
		}
		val.Apply();
		cachedChevron = val;
		return val;
	}

	private Texture2D GenerateUpwardTriangleTexture(int width, int height, int fade = 3)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		//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_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: 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_00b9: 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_00bc: 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_00f0: 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_00ff: 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)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: 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_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: 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)
		//IL_014e: 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_015d: 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_0170: 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_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: 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_01a2: 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_032d: 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_01fc: 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_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: 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_0220: 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_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: 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_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: 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_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: 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_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: 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_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cachedTriangle))
		{
			return cachedTriangle;
		}
		Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color32 val2 = default(Color32);
		((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
		Color32 val3 = default(Color32);
		((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0);
		Vector2 val4 = default(Vector2);
		((Vector2)(ref val4))..ctor((float)width / 2f, (float)height * 0.1f);
		Vector2 val5 = default(Vector2);
		((Vector2)(ref val5))..ctor((float)width * 0.15f, (float)height * 0.9f);
		Vector2 val6 = default(Vector2);
		((Vector2)(ref val6))..ctor((float)width * 0.85f, (float)height * 0.9f);
		Vector2 val7 = val5 - val4;
		Vector2 val8 = val6 - val5;
		Vector2 val9 = val4 - val6;
		Vector2 val10 = default(Vector2);
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				((Vector2)(ref val10))..ctor((float)j + 0.5f, (float)i + 0.5f);
				float num = (val10.x - val5.x) * (val4.y - val5.y) - (val10.y - val5.y) * (val4.x - val5.x);
				float num2 = (val10.x - val6.x) * (val5.y - val6.y) - (val10.y - val6.y) * (val5.x - val6.x);
				float num3 = (val10.x - val4.x) * (val6.y - val4.y) - (val10.y - val4.y) * (val6.x - val4.x);
				if ((num >= 0f && num2 >= 0f && num3 >= 0f) || (num <= 0f && num2 <= 0f && num3 <= 0f))
				{
					Vector2 val11 = val10 - val4;
					Vector2 normalized = ((Vector2)(ref val11)).normalized;
					val11 = Vector2.Perpendicular(val7);
					float num4 = Mathf.Abs(Vector2.Dot(normalized, ((Vector2)(ref val11)).normalized) * Vector2.Distance(val10, val4));
					val11 = val10 - val5;
					Vector2 normalized2 = ((Vector2)(ref val11)).normalized;
					val11 = Vector2.Perpendicular(val8);
					float num5 = Mathf.Abs(Vector2.Dot(normalized2, ((Vector2)(ref val11)).normalized) * Vector2.Distance(val10, val5));
					val11 = val10 - val6;
					Vector2 normalized3 = ((Vector2)(ref val11)).normalized;
					val11 = Vector2.Perpendicular(val9);
					float num6 = Mathf.Abs(Vector2.Dot(normalized3, ((Vector2)(ref val11)).normalized) * Vector2.Distance(val10, val6));
					float num7 = Mathf.Min(new float[3] { num4, num5, num6 });
					if (num7 <= (float)fade)
					{
						float num8 = Mathf.InverseLerp((float)fade, 0f, num7);
						byte b = (byte)(num8 * 255f);
						val.SetPixel(j, i, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b)));
					}
					else
					{
						val.SetPixel(j, i, Color32.op_Implicit(val2));
					}
				}
				else
				{
					val.SetPixel(j, i, Color32.op_Implicit(val3));
				}
			}
		}
		val.Apply();
		cachedTriangle = val;
		return val;
	}
}
[BepInPlugin("com.Playboi.Compass", "Compass", "1.0.0")]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch(typeof(GUIManager), "Start")]
	private static class PatchGUIManager
	{
		public static void Postfix(GUIManager __instance)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_004e: 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_0090: 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)
			Transform transform = ((Component)((Component)__instance).GetComponentInChildren<AscentUI>()).transform;
			RectTransform val = (RectTransform)Object.Instantiate<Transform>(transform, transform.parent);
			((Object)val).name = "Compass Tape UI";
			Object.Destroy((Object)(object)((Component)val).GetComponent<AscentUI>());
			CompassTapeUI compassTapeUI = ((Component)val).gameObject.AddComponent<CompassTapeUI>();
			val.anchorMin = new Vector2(0f, 1f);
			val.anchorMax = new Vector2(1f, 1f);
			val.pivot = new Vector2(0.5f, 1f);
			val.anchoredPosition = new Vector2(0f, 0f);
			val.sizeDelta = new Vector2(0f, 50f);
		}
	}

	public static readonly Harmony harmony = new Harmony("Playboi.Compass");

	public static ConfigEntry<bool> showPlayersOnCompass;

	public static ConfigEntry<bool> alwaysShowSuitcases;

	public static ConfigEntry<float> suitcaseDistance;

	public static ConfigEntry<KeyCode> suitcasePingKeybind;

	private void Awake()
	{
		harmony.PatchAll();
		showPlayersOnCompass = ((BaseUnityPlugin)this).Config.Bind<bool>("Compass", "showPlayersOnCompass", true, "Whether to show player dots on the compass UI");
		alwaysShowSuitcases = ((BaseUnityPlugin)this).Config.Bind<bool>("Compass", "alwaysShowSuitcases", false, "Whether to show suitcases all the time or not (otherwise will require ping)");
		suitcaseDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Compass", "pingDistance", 100f, "What distance will suitcases show up on the compass");
		suitcasePingKeybind = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Compass", "suitcasePingKeybind", (KeyCode)112, "What button does the suitcase ping");
	}

	private void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}

	private void Update()
	{
	}
}
namespace Compass;

public class CompassTapeUI : MonoBehaviour
{
	public RectTransform rectTransform;

	public TMP_Text tmpText;

	public RectTransform lineTransform;

	public RawImage lineImage;

	private const int INCREMENT_COUNT = 24;

	private CompassMark[] marks = new CompassMark[24];

	private CompassMark[] playerBuffer = new CompassMark[20];

	private CompassMark[] suitcaseBuffer = new CompassMark[150];

	private float showSuitcasesUntilTime;

	private const float UP_DOWN_THRESHOLD = 7.5f;

	public Transform referenceTransform;

	private void Start()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_007a: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		//IL_0109: 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_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		rectTransform = ((Component)this).GetComponent<RectTransform>();
		tmpText = ((Component)this).GetComponent<TMP_Text>();
		rectTransform.anchorMin = new Vector2(0.3f, 1f);
		rectTransform.anchorMax = new Vector2(0.7f, 1f);
		rectTransform.pivot = new Vector2(0.5f, 1f);
		rectTransform.anchoredPosition = new Vector2(0f, -75f);
		rectTransform.sizeDelta = new Vector2(0f, 25f);
		((Behaviour)tmpText).enabled = false;
		GameObject val = new GameObject("lineTransform", new Type[1] { typeof(RectTransform) });
		val.transform.SetParent((Transform)(object)rectTransform);
		lineTransform = val.GetComponent<RectTransform>();
		lineImage = val.AddComponent<RawImage>();
		float num = 0.4f;
		((Graphic)lineImage).color = new Color(num, num, num, 0.4f);
		Texture2D texture = GenerateHorizontalAlphaFadeTexture(2048, 10);
		lineImage.texture = (Texture)(object)texture;
		lineTransform.anchorMin = new Vector2(0f, 0.5f);
		lineTransform.anchorMax = new Vector2(1f, 0.5f);
		lineTransform.pivot = new Vector2(0.5f, 0.5f);
		lineTransform.offsetMin = new Vector2(0f, -2f);
		lineTransform.offsetMax = new Vector2(0f, 2f);
		((Transform)lineTransform).localScale = new Vector3(1.1f, 1f, 1f);
		for (int i = 0; i < marks.Length; i++)
		{
			marks[i] = SpawnCompassMark(i);
		}
		for (int j = 0; j < playerBuffer.Length; j++)
		{
			playerBuffer[j] = SpawnPlayerMarker(j);
		}
		for (int k = 0; k < suitcaseBuffer.Length; k++)
		{
			suitcaseBuffer[k] = SpawnSuitcaseMarker(k);
		}
	}

	private CompassMark SpawnCompassMark(int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		GameObject val = new GameObject();
		val.transform.SetParent((Transform)(object)rectTransform);
		CompassMark compassMark = val.AddComponent<CompassMark>();
		float markDegrees = (float)index / 24f * 360f;
		compassMark.Init(tmpText, markDegrees);
		return compassMark;
	}

	private CompassMark SpawnPlayerMarker(int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		GameObject val = new GameObject();
		val.transform.SetParent((Transform)(object)rectTransform);
		CompassMark compassMark = val.AddComponent<CompassMark>();
		compassMark.Init(tmpText, index, isForPlayer: true);
		return compassMark;
	}

	private CompassMark SpawnSuitcaseMarker(int index)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		GameObject val = new GameObject();
		val.transform.SetParent((Transform)(object)rectTransform);
		CompassMark compassMark = val.AddComponent<CompassMark>();
		compassMark.Init(tmpText, index, isForPlayer: false, isForSuitcase: true);
		return compassMark;
	}

	private void Update()
	{
		//IL_0006: 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_0052: 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_0061: 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_006b: 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_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_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_0091: 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_00bb: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(Main.suitcasePingKeybind.Value))
		{
			showSuitcasesUntilTime = Time.time + 6f;
		}
		referenceTransform = ((Component)Camera.main).transform;
		Vector3 val = new Vector3(referenceTransform.forward.x, 0f, referenceTransform.forward.z);
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		Vector3 rightVector = Vector3.Cross(Vector3.up, normalized);
		Vector3 position = ((Component)Camera.main).transform.position;
		for (int i = 0; i < marks.Length; i++)
		{
			UpdateMark(i, normalized, rightVector);
		}
		for (int j = 0; j < playerBuffer.Length; j++)
		{
			UpdatePlayerMark(j, normalized, rightVector, position);
		}
		for (int k = 0; k < suitcaseBuffer.Length; k++)
		{
			UpdateSuitcaseMark(k, normalized, rightVector, position);
		}
	}

	private void UpdateMark(int index, Vector3 headingVector, Vector3 rightVector)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: 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_003e: 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_0092: 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_00b4: 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)
		CompassMark compassMark = marks[index];
		Vector3 precomputedDirectionVector = compassMark.precomputedDirectionVector;
		float num = Vector3.Dot(precomputedDirectionVector, headingVector);
		if (num < 0f)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		float num2 = Vector3.Dot(precomputedDirectionVector, rightVector);
		bool flag = num2 > 0f;
		num = Mathf.Acos(num) / (float)Math.PI;
		num *= 2f;
		if (!flag)
		{
			num *= -1f;
		}
		RectTransform val = compassMark.rectTransform;
		Transform parent = ((Transform)val).parent;
		RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
		Rect rect = val2.rect;
		float num3 = ((Rect)(ref rect)).width * 0.5f;
		float num4 = num * num3;
		val.anchoredPosition = new Vector2(num4, val.anchoredPosition.y);
		float num5 = Mathf.Abs(num);
		float num6 = Mathf.InverseLerp(1f, 0.6f, num5);
		num6 = Mathf.Clamp01(num6);
		float alpha = num6;
		compassMark.canvasGroup.alpha = alpha;
	}

	private void UpdatePlayerMark(int index, Vector3 headingVector, Vector3 rightVector, Vector3 cameraPosition)
	{
		//IL_00b3: 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_00b8: 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_00ba: 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_00c1: 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_00cb: 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_00e1: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: 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_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: 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_02ae: Unknown result type (might be due to invalid IL or missing references)
		Character val = null;
		CompassMark compassMark = playerBuffer[index];
		if (!Main.showPlayersOnCompass.Value)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		if (Character.AllCharacters != null && index >= 0 && index < Character.AllCharacters.Count)
		{
			val = Character.AllCharacters[index];
		}
		if (!Object.op_Implicit((Object)(object)val) || val.IsLocal)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		Vector3 val2 = ((!val.data.dead) ? val.Center : ((Component)val.Ghost).transform.position);
		Vector3 val3 = val2 - cameraPosition;
		Vector3 normalized = ((Vector3)(ref val3)).normalized;
		val3 = new Vector3(normalized.x, 0f, normalized.z);
		Vector3 normalized2 = ((Vector3)(ref val3)).normalized;
		float num = Vector3.Dot(normalized2, headingVector);
		if (num < 0f)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		float num2 = Vector3.Dot(normalized2, rightVector);
		bool flag = num2 > 0f;
		num = Mathf.Acos(num) / (float)Math.PI;
		num *= 2f;
		if (!flag)
		{
			num *= -1f;
		}
		RectTransform val4 = compassMark.rectTransform;
		Transform parent = ((Transform)val4).parent;
		RectTransform val5 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
		Rect rect = val5.rect;
		float num3 = ((Rect)(ref rect)).width * 0.5f;
		float num4 = num * num3;
		val4.anchoredPosition = new Vector2(num4, val4.anchoredPosition.y);
		float num5 = Mathf.Abs(num);
		float num6 = Mathf.InverseLerp(1f, 0.6f, num5);
		num6 = Mathf.Clamp01(num6);
		float alpha = num6;
		compassMark.canvasGroup.alpha = alpha;
		float num7 = Vector3.Distance(val2, cameraPosition);
		((Graphic)compassMark.iconImage).color = val.refs.customization.PlayerColor;
		compassMark.tmpText.text = $"{num7:F0}m";
		float num8 = val2.y - cameraPosition.y;
		if (num8 >= 7.5f)
		{
			((Behaviour)compassMark.arrowImage).enabled = true;
			((Component)compassMark.arrowImage).transform.localEulerAngles = new Vector3(0f, 0f, 180f);
		}
		else if (num8 <= -7.5f)
		{
			((Behaviour)compassMark.arrowImage).enabled = true;
			((Component)compassMark.arrowImage).transform.localEulerAngles = Vector3.zero;
		}
		else
		{
			((Behaviour)compassMark.arrowImage).enabled = false;
		}
	}

	private void UpdateSuitcaseMark(int index, Vector3 headingVector, Vector3 rightVector, Vector3 cameraPosition)
	{
		//IL_00a3: 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_00d6: 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_010b: 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_010e: 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_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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: 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)
		//IL_013a: 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_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		Luggage val = null;
		CompassMark compassMark = suitcaseBuffer[index];
		if (Luggage.ALL_LUGGAGE != null && index >= 0 && index < Luggage.ALL_LUGGAGE.Count)
		{
			val = Luggage.ALL_LUGGAGE[index];
		}
		if ((Object)(object)val == (Object)null)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		if (!Main.alwaysShowSuitcases.Value && !(Time.time < showSuitcasesUntilTime))
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		Vector3 position = ((Component)val).transform.position;
		if (position.y <= 0f)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		float num = Vector3.Distance(position, cameraPosition);
		if (num > Main.suitcaseDistance.Value)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		Vector3 val2 = position - cameraPosition;
		Vector3 normalized = ((Vector3)(ref val2)).normalized;
		val2 = new Vector3(normalized.x, 0f, normalized.z);
		Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
		float num2 = Vector3.Dot(normalized2, headingVector);
		if (num2 < 0f)
		{
			compassMark.canvasGroup.alpha = 0f;
			return;
		}
		float num3 = Vector3.Dot(normalized2, rightVector);
		bool flag = num3 > 0f;
		num2 = Mathf.Acos(num2) / (float)Math.PI;
		num2 *= 2f;
		if (!flag)
		{
			num2 *= -1f;
		}
		RectTransform val3 = compassMark.rectTransform;
		Transform parent = ((Transform)val3).parent;
		RectTransform val4 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
		Rect rect = val4.rect;
		float num4 = ((Rect)(ref rect)).width * 0.5f;
		float num5 = num2 * num4;
		val3.anchoredPosition = new Vector2(num5, val3.anchoredPosition.y);
		float num6 = Mathf.Abs(num2);
		float num7 = Mathf.InverseLerp(1f, 0.6f, num6);
		num7 = Mathf.Clamp01(num7);
		float num8 = num7;
		if (!Main.alwaysShowSuitcases.Value)
		{
			float num9 = Mathf.InverseLerp(showSuitcasesUntilTime, showSuitcasesUntilTime - 0.5f, Time.time);
			num9 = Mathf.Clamp01(num9);
			num8 *= num9;
		}
		compassMark.canvasGroup.alpha = num8;
		compassMark.tmpText.text = $"{num:F0}m";
		float num10 = position.y - cameraPosition.y;
		if (num10 >= 7.5f)
		{
			((Behaviour)compassMark.arrowImage).enabled = true;
			((Component)compassMark.arrowImage).transform.localEulerAngles = new Vector3(0f, 0f, 180f);
		}
		else if (num10 <= -7.5f)
		{
			((Behaviour)compassMark.arrowImage).enabled = true;
			((Component)compassMark.arrowImage).transform.localEulerAngles = Vector3.zero;
		}
		else
		{
			((Behaviour)compassMark.arrowImage).enabled = false;
		}
	}

	private Texture2D GenerateHorizontalAlphaFadeTexture(int width, int height)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_00cd: 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)
		Texture2D val = new Texture2D(width, height, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color32 val2 = default(Color32);
		((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
		float num = 0f;
		float num2 = (float)width * 0.35f;
		float num3 = (float)width * 0.65f;
		float num4 = width;
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				byte b;
				if ((float)j < num2)
				{
					float num5 = Mathf.InverseLerp(num, num2, (float)j);
					b = (byte)(num5 * 255f);
				}
				else if ((float)j > num3)
				{
					float num6 = Mathf.InverseLerp(num4, num3, (float)j);
					b = (byte)(num6 * 255f);
				}
				else
				{
					b = byte.MaxValue;
				}
				val.SetPixel(j, i, Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b)));
			}
		}
		val.Apply();
		return val;
	}
}