Decompiled source of Expanded Minimap v1.0.0

MinimapMod.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using MelonLoader;
using MinimapMod;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(MainMod), "MinimapMod", "1.0.0", "Hiccup", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace MinimapMod;

public class MainMod : MelonMod
{
	[CompilerGenerated]
	private sealed class <ContractPoICheckerWorld>d__54 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public MainMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ContractPoICheckerWorld>d__54(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Expected O, but got Unknown
			//IL_00b6: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			MainMod mainMod = <>4__this;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
			}
			else
			{
				<>1__state = -1;
			}
			GameObject val = GameObject.Find("Managers/@Quests/Contracts");
			List<Transform> list = new List<Transform>();
			if ((Object)(object)val != (Object)null)
			{
				Transform transform = val.transform;
				for (int i = 0; i < transform.childCount; i++)
				{
					mainMod.RecursiveFind(transform.GetChild(i), "ContractPoI(Clone)", list);
				}
				list.RemoveAll((Transform cp) => !((Component)cp).gameObject.activeInHierarchy);
				float num2 = 0.1f;
				Vector2 val2 = default(Vector2);
				foreach (Transform item in list)
				{
					Vector3 position = item.position;
					((Vector2)(ref val2))..ctor(position.x * mapScale, position.z * mapScale);
					val2.x -= 5f;
					bool flag = false;
					foreach (GameObject contractPoIMarker in mainMod.contractPoIMarkers)
					{
						if ((Object)(object)contractPoIMarker != (Object)null)
						{
							RectTransform component = contractPoIMarker.GetComponent<RectTransform>();
							if ((Object)(object)component != (Object)null && Vector2.Distance(component.anchoredPosition, val2) < num2)
							{
								flag = true;
								break;
							}
						}
					}
					if (!flag)
					{
						mainMod.AddContractPoIMarkerWorld(item);
					}
				}
				Vector2 val4 = default(Vector2);
				for (int num3 = mainMod.contractPoIMarkers.Count - 1; num3 >= 0; num3--)
				{
					GameObject val3 = mainMod.contractPoIMarkers[num3];
					if ((Object)(object)val3 == (Object)null)
					{
						mainMod.contractPoIMarkers.RemoveAt(num3);
					}
					else
					{
						RectTransform component2 = val3.GetComponent<RectTransform>();
						bool flag2 = false;
						if ((Object)(object)component2 != (Object)null)
						{
							Vector2 anchoredPosition = component2.anchoredPosition;
							foreach (Transform item2 in list)
							{
								((Vector2)(ref val4))..ctor(item2.position.x * mapScale, item2.position.z * mapScale);
								val4.x -= 5f;
								if (Vector2.Distance(anchoredPosition, val4) < num2)
								{
									flag2 = true;
									break;
								}
							}
						}
						if (!flag2)
						{
							Object.Destroy((Object)(object)val3);
							mainMod.contractPoIMarkers.RemoveAt(num3);
						}
					}
				}
			}
			else
			{
				mainMod.RemoveAllContractPoIMarkers();
			}
			<>2__current = (object)new WaitForSeconds(20f);
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <FindGameObjectsRoutine>d__39 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public MainMod <>4__this;

		private int <attempts>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FindGameObjectsRoutine>d__39(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			int num = <>1__state;
			MainMod mainMod = <>4__this;
			switch (num)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				MelonLogger.Msg("Looking for game objects...");
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<attempts>5__2 = 0;
				break;
			case 2:
				<>1__state = -1;
				break;
			}
			while (((Object)(object)mapAppObject == (Object)null || (Object)(object)playerObject == (Object)null) && <attempts>5__2 < 30)
			{
				<attempts>5__2++;
				try
				{
					if ((Object)(object)playerObject == (Object)null)
					{
						playerObject = GameObject.Find("Player_Local");
					}
					if ((Object)(object)mapAppObject == (Object)null)
					{
						GameObject val = GameObject.Find("GameplayMenu");
						if ((Object)(object)val != (Object)null)
						{
							Transform val2 = val.transform.Find("Phone");
							if ((Object)(object)val2 != (Object)null)
							{
								Transform val3 = val2.Find("phone");
								if ((Object)(object)val3 != (Object)null)
								{
									Transform val4 = val3.Find("AppsCanvas");
									if ((Object)(object)val4 != (Object)null)
									{
										Transform val5 = val4.Find("MapApp");
										if ((Object)(object)val5 != (Object)null)
										{
											mapAppObject = ((Component)val5).gameObject;
										}
									}
								}
							}
						}
					}
					if ((Object)(object)mapAppObject != (Object)null && (Object)(object)viewportObject == (Object)null)
					{
						Transform val6 = mapAppObject.transform.Find("Container");
						if ((Object)(object)val6 != (Object)null)
						{
							Transform val7 = val6.Find("Scroll View");
							if ((Object)(object)val7 != (Object)null)
							{
								Transform val8 = val7.Find("Viewport");
								if ((Object)(object)val8 != (Object)null)
								{
									viewportObject = ((Component)val8).gameObject;
								}
							}
						}
					}
				}
				catch (Exception ex)
				{
					MelonLogger.Error("Error finding game objects: " + ex.Message);
				}
				if ((Object)(object)mapAppObject == (Object)null || (Object)(object)playerObject == (Object)null)
				{
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				}
			}
			if ((Object)(object)viewportObject != (Object)null)
			{
				try
				{
					if (viewportObject.transform.childCount > 0)
					{
						Transform child = viewportObject.transform.GetChild(0);
						Image component = ((Component)child).GetComponent<Image>();
						if ((Object)(object)component != (Object)null && (Object)(object)component.sprite != (Object)null)
						{
							if ((Object)(object)mapContentObject != (Object)null)
							{
								Image val9 = mapContentObject.GetComponent<Image>();
								if ((Object)(object)val9 == (Object)null)
								{
									val9 = mapContentObject.AddComponent<Image>();
								}
								val9.sprite = component.sprite;
								val9.type = (Type)0;
								val9.preserveAspect = true;
								((Behaviour)val9).enabled = false;
								((Behaviour)val9).enabled = true;
								if ((Object)(object)gridContainer != (Object)null)
								{
									((Component)gridContainer).gameObject.SetActive(false);
								}
							}
						}
						else
						{
							int childCount = child.childCount;
							for (int i = 0; i < childCount; i++)
							{
								Image component2 = ((Component)child.GetChild(i)).GetComponent<Image>();
								if ((Object)(object)component2 != (Object)null && (Object)(object)component2.sprite != (Object)null && (Object)(object)mapContentObject != (Object)null)
								{
									Image val10 = mapContentObject.GetComponent<Image>();
									if ((Object)(object)val10 == (Object)null)
									{
										val10 = mapContentObject.AddComponent<Image>();
									}
									val10.sprite = component2.sprite;
									val10.type = (Type)0;
									val10.preserveAspect = true;
									((Behaviour)val10).enabled = false;
									((Behaviour)val10).enabled = true;
									if ((Object)(object)gridContainer != (Object)null)
									{
										((Component)gridContainer).gameObject.SetActive(false);
									}
									break;
								}
							}
						}
					}
				}
				catch (Exception ex2)
				{
					MelonLogger.Error("Error accessing map content: " + ex2.Message);
				}
			}
			mainMod.CreateVisualGrid();
			if ((Object)(object)mainMod.cachedPlayerMarker != (Object)null)
			{
				Image component3 = mainMod.cachedPlayerMarker.GetComponent<Image>();
				if ((Object)(object)component3 != (Object)null)
				{
					Color color = ((Graphic)component3).color;
					if (((Color)(ref color)).Equals(new Color(0.2f, 0.6f, 1f, 1f)))
					{
						if ((Object)(object)mainMod.cachedMapContent == (Object)null)
						{
							mainMod.cachedMapContent = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content");
						}
						if ((Object)(object)mainMod.cachedMapContent != (Object)null)
						{
							Transform val11 = mainMod.cachedMapContent.transform.Find("PlayerPoI(Clone)");
							if ((Object)(object)val11 != (Object)null)
							{
								Transform val12 = val11.Find("IconContainer");
								if ((Object)(object)val12 != (Object)null)
								{
									GameObject val13 = Object.Instantiate<GameObject>(((Component)val12).gameObject);
									((Object)val13).name = "PlayerMarker";
									val13.transform.SetParent(mainMod.cachedPlayerMarker.transform.parent, false);
									RectTransform component4 = val13.GetComponent<RectTransform>();
									if ((Object)(object)component4 != (Object)null)
									{
										component4.anchoredPosition = Vector2.zero;
										((Transform)component4).localScale = new Vector3(1f, 1f, 1f);
									}
									Transform val14 = val13.transform.Find("Image");
									if ((Object)(object)val14 != (Object)null)
									{
										Object.Destroy((Object)(object)((Component)val14).gameObject);
									}
									Object.Destroy((Object)(object)mainMod.cachedPlayerMarker);
									mainMod.cachedPlayerMarker = val13;
								}
							}
						}
					}
				}
			}
			if ((Object)(object)mainMod.cachedMapContent == (Object)null)
			{
				mainMod.cachedMapContent = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content");
			}
			if ((Object)(object)mainMod.cachedMapContent != (Object)null)
			{
				if ((Object)(object)mainMod.cachedPropertyPoI == (Object)null)
				{
					mainMod.cachedPropertyPoI = mainMod.cachedMapContent.transform.Find("PropertyPoI(Clone)");
				}
				if ((Object)(object)mainMod.cachedPropertyPoI != (Object)null && (Object)(object)mainMod.cachedPropertyPoI.Find("IconContainer") != (Object)null)
				{
					mainMod.AddDefaultMarkers();
				}
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <UpdateMinimapTimeCoroutine>d__46 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public MainMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <UpdateMinimapTimeCoroutine>d__46(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			int num = <>1__state;
			MainMod mainMod = <>4__this;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
			}
			else
			{
				<>1__state = -1;
			}
			mainMod.UpdateMinimapTime();
			<>2__current = (object)new WaitForSeconds(1f);
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private bool guiVisible;

	private bool minimapEnabled = true;

	private bool timeBarEnabled = true;

	private const float markerXAdjustment = 5f;

	private Rect minimapToggleRect = new Rect((float)(Screen.width - 170), 260f, 150f, 25f);

	private Rect timeToggleRect = new Rect((float)(Screen.width - 170), 250f, 150f, 25f);

	private Rect guiBackgroundRect = new Rect((float)(Screen.width - 175), 290f, 160f, 100f);

	private GameObject minimapDisplayObject;

	private RectTransform minimapTimeContainer;

	private bool doubleSizeEnabled;

	private RectTransform minimapFrameRect;

	private static float mapScale = 1.2487098f;

	private float mapZoomLevel = 0.4f;

	private static GameObject minimapObject;

	private static bool isInitializing = false;

	private static bool isEnabled = true;

	private RectTransform cachedDirectionIndicator;

	private GameObject cachedPlayerMarker;

	private Text cachedGameTimeText;

	private GameObject cachedMapContent;

	private Transform cachedPropertyPoI;

	private Text minimapTimeText;

	private GameObject contractPoIIconPrefab;

	private static GameObject mapAppObject;

	private static GameObject viewportObject;

	private static GameObject playerObject;

	private static GameObject mapContentObject;

	private static RectTransform gridContainer;

	private List<GameObject> contractPoIMarkers = new List<GameObject>();

	private static int gridSize = 20;

	private static Color gridColor = new Color(0.3f, 0.3f, 0.3f, 1f);

	private static Color bgColor = new Color(0.1f, 0.1f, 0.1f, 1f);

	private static float smoothingFactor = 10f;

	private Vector2 RotateVector(Vector2 v, float degrees)
	{
		//IL_0014: 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_0025: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		float num = degrees * ((float)Math.PI / 180f);
		float num2 = Mathf.Cos(num);
		float num3 = Mathf.Sin(num);
		return new Vector2(v.x * num2 - v.y * num3, v.x * num3 + v.y * num2);
	}

	public override void OnGUI()
	{
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: 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_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		if (!guiVisible)
		{
			return;
		}
		Rect val = default(Rect);
		Rect position = default(Rect);
		Rect position2 = default(Rect);
		Rect position3 = default(Rect);
		if (!doubleSizeEnabled)
		{
			((Rect)(ref val))..ctor((float)(Screen.width - 175), 220f, 160f, 100f);
			((Rect)(ref position))..ctor((float)(Screen.width - 170), 230f, 150f, 25f);
			((Rect)(ref position2))..ctor((float)(Screen.width - 170), 260f, 150f, 25f);
			((Rect)(ref position3))..ctor((float)(Screen.width - 170), 290f, 150f, 25f);
		}
		else
		{
			((Rect)(ref val))..ctor((float)(Screen.width - 250), 380f, 160f, 100f);
			((Rect)(ref position))..ctor((float)(Screen.width - 255), 390f, 300f, 25f);
			((Rect)(ref position2))..ctor((float)(Screen.width - 255), 420f, 300f, 25f);
			((Rect)(ref position3))..ctor((float)(Screen.width - 255), 450f, 300f, 25f);
		}
		GUI.color = Color.gray;
		GUI.Box(val, "");
		DrawToggle(position, "Minimap", ref minimapEnabled, delegate
		{
			//IL_0097: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)minimapDisplayObject != (Object)null)
			{
				minimapDisplayObject.SetActive(minimapEnabled);
			}
			if ((Object)(object)minimapTimeContainer != (Object)null)
			{
				if (minimapEnabled)
				{
					minimapTimeContainer.anchorMin = new Vector2(0.5f, 0f);
					minimapTimeContainer.anchorMax = new Vector2(0.5f, 0f);
					minimapTimeContainer.pivot = new Vector2(0.5f, 1f);
				}
				else
				{
					minimapTimeContainer.anchorMin = new Vector2(1f, 1f);
					minimapTimeContainer.anchorMax = new Vector2(1f, 1f);
					minimapTimeContainer.pivot = new Vector2(1f, 1f);
					minimapTimeContainer.anchoredPosition = Vector2.zero;
				}
			}
		});
		DrawToggle(position2, "Time", ref timeBarEnabled, delegate
		{
			if ((Object)(object)minimapTimeContainer != (Object)null)
			{
				((Component)minimapTimeContainer).gameObject.SetActive(timeBarEnabled);
			}
		});
		DrawToggle(position3, "2x Size", ref doubleSizeEnabled, delegate
		{
			UpdateMinimapSize();
		});
	}

	private void DrawToggle(Rect position, string label, ref bool state, Action onToggle)
	{
		//IL_0000: 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_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Expected O, but got Unknown
		GUI.color = Color.white;
		GUI.Label(new Rect(((Rect)(ref position)).x + 50f, ((Rect)(ref position)).y, ((Rect)(ref position)).width - 50f, ((Rect)(ref position)).height), label);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((Rect)(ref position)).x + 5f, ((Rect)(ref position)).y + 3f, 40f, 18f);
		GUI.color = (state ? Color.green : Color.gray);
		GUI.Box(val, "");
		Rect val2 = new Rect(state ? (((Rect)(ref val)).x + 22f) : (((Rect)(ref val)).x + 2f), ((Rect)(ref val)).y + 2f, 14f, 14f);
		GUI.color = Color.white;
		GUI.Box(val2, "");
		if (GUI.Button(position, new GUIContent(""), GUIStyle.none))
		{
			state = !state;
			onToggle();
		}
	}

	private void CreateMinimapTimeDisplay(Transform parent)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_002a: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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_0086: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		//IL_0100: 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_0120: 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_0162: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("MinimapTimeContainer");
		val.transform.SetParent(parent, false);
		RectTransform val2 = val.AddComponent<RectTransform>();
		val2.sizeDelta = new Vector2(100f, 50f);
		val2.anchorMin = new Vector2(0.5f, 0f);
		val2.anchorMax = new Vector2(0.5f, 0f);
		val2.pivot = new Vector2(0.5f, 1f);
		if (doubleSizeEnabled)
		{
			val2.anchoredPosition = new Vector2(0f, 40f);
		}
		else
		{
			val2.anchoredPosition = new Vector2(0f, 10f);
		}
		minimapTimeContainer = val2;
		((Graphic)val.AddComponent<Image>()).color = new Color(0.2f, 0.2f, 0.2f, 0.5f);
		GameObject val3 = new GameObject("MinimapTime");
		val3.transform.SetParent(val.transform, false);
		RectTransform obj = val3.AddComponent<RectTransform>();
		obj.anchorMin = new Vector2(0f, 0f);
		obj.anchorMax = new Vector2(1f, 1f);
		obj.offsetMin = Vector2.zero;
		obj.offsetMax = Vector2.zero;
		minimapTimeText = val3.AddComponent<Text>();
		minimapTimeText.text = "Time";
		minimapTimeText.alignment = (TextAnchor)4;
		((Graphic)minimapTimeText).color = Color.white;
		minimapTimeText.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		minimapTimeText.horizontalOverflow = (HorizontalWrapMode)0;
		minimapTimeText.verticalOverflow = (VerticalWrapMode)0;
	}

	private void UpdateMinimapTime()
	{
		if ((Object)(object)cachedGameTimeText == (Object)null)
		{
			GameObject val = GameObject.Find("GameplayMenu/Phone/phone/HomeScreen/InfoBar/Time");
			if ((Object)(object)val != (Object)null)
			{
				cachedGameTimeText = val.GetComponent<Text>();
			}
		}
		if ((Object)(object)cachedGameTimeText != (Object)null && (Object)(object)minimapTimeText != (Object)null)
		{
			string text = cachedGameTimeText.text;
			string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			if (array.Length >= 3)
			{
				string text2 = array[0] + " " + array[1];
				string text3 = array[^1];
				minimapTimeText.text = text3 + "\n" + text2;
			}
			else
			{
				minimapTimeText.text = text;
			}
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		try
		{
			if (sceneName == "Main" && !isInitializing)
			{
				isInitializing = true;
				MelonLogger.Msg("Detected Main scene, initializing Minimap...");
				if ((Object)(object)minimapObject != (Object)null)
				{
					Object.Destroy((Object)(object)minimapObject);
					minimapObject = null;
				}
				CreateMinimapUI();
				MelonCoroutines.Start(FindGameObjectsRoutine());
				isInitializing = false;
				CacheContractPoIIcon();
				MelonCoroutines.Start(UpdateMinimapTimeCoroutine());
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Failed to initialize MinimapMod: " + ex.Message + "\nStack trace: " + ex.StackTrace);
			isInitializing = false;
		}
	}

	[IteratorStateMachine(typeof(<FindGameObjectsRoutine>d__39))]
	private IEnumerator FindGameObjectsRoutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <FindGameObjectsRoutine>d__39(0)
		{
			<>4__this = this
		};
	}

	private void UpdateMinimapFramePosition()
	{
		//IL_0033: 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)
		if (doubleSizeEnabled)
		{
			minimapFrameRect.anchoredPosition = new Vector2(-20f, -60f);
		}
		else
		{
			minimapFrameRect.anchoredPosition = new Vector2(-20f, -20f);
		}
	}

	private void UpdateMinimapSize()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		float num = (doubleSizeEnabled ? 2f : 1f);
		if ((Object)(object)minimapFrameRect != (Object)null)
		{
			minimapFrameRect.sizeDelta = new Vector2(150f, 150f) * num;
		}
		if ((Object)(object)minimapDisplayObject != (Object)null)
		{
			RectTransform component = minimapDisplayObject.GetComponent<RectTransform>();
			if ((Object)(object)component != (Object)null)
			{
				component.offsetMin = new Vector2(0f, 50f * num);
			}
		}
		Transform val = minimapDisplayObject.transform.Find("MinimapMask");
		if ((Object)(object)val != (Object)null)
		{
			RectTransform component2 = ((Component)val).GetComponent<RectTransform>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.sizeDelta = new Vector2(140f, 140f) * num;
			}
		}
		Transform val2 = minimapDisplayObject.transform.Find("MinimapBorder");
		if ((Object)(object)val2 != (Object)null)
		{
			RectTransform component3 = ((Component)val2).GetComponent<RectTransform>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.sizeDelta = new Vector2(150f, 150f) * num;
			}
		}
		ResetMapContentPosition();
		UpdateMinimapFramePosition();
		UpdateTimeDisplayPosition();
	}

	private void ResetMapContentPosition()
	{
		//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_003e: 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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)playerObject == (Object)null) && !((Object)(object)mapContentObject == (Object)null) && !((Object)(object)minimapDisplayObject == (Object)null))
		{
			Vector3 position = playerObject.transform.position;
			float num = (0f - position.x) * mapScale;
			float num2 = (0f - position.z) * mapScale;
			Vector2 val = new Vector2(9f, -1f) * mapZoomLevel;
			Vector2 anchoredPosition = new Vector2(num, num2) * mapZoomLevel + val;
			RectTransform component = mapContentObject.GetComponent<RectTransform>();
			if ((Object)(object)component != (Object)null)
			{
				component.anchoredPosition = anchoredPosition;
			}
		}
	}

	private void CreateMinimapUI()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: 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_0134: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Expected O, but got Unknown
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: 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_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: 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_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: 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_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: 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_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: 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_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Expected O, but got Unknown
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0457: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_051f: Unknown result type (might be due to invalid IL or missing references)
		//IL_053a: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			minimapObject = new GameObject("MinimapContainer");
			Object.DontDestroyOnLoad((Object)(object)minimapObject);
			GameObject val = new GameObject("MinimapCanvas");
			val.transform.SetParent(minimapObject.transform, false);
			Canvas obj = val.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 9999;
			CanvasScaler obj2 = val.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			val.AddComponent<GraphicRaycaster>();
			GameObject val2 = new GameObject("MinimapFrame");
			val2.transform.SetParent(val.transform, false);
			minimapFrameRect = val2.AddComponent<RectTransform>();
			minimapFrameRect.sizeDelta = new Vector2(150f, 150f);
			minimapFrameRect.anchorMin = new Vector2(1f, 1f);
			minimapFrameRect.anchorMax = new Vector2(1f, 1f);
			minimapFrameRect.pivot = new Vector2(1f, 1f);
			minimapFrameRect.anchoredPosition = new Vector2(-20f, -20f);
			minimapDisplayObject = new GameObject("MinimapDisplay");
			minimapDisplayObject.transform.SetParent(val2.transform, false);
			RectTransform obj3 = minimapDisplayObject.AddComponent<RectTransform>();
			obj3.anchorMin = new Vector2(0f, 0f);
			obj3.anchorMax = new Vector2(1f, 1f);
			obj3.offsetMin = new Vector2(0f, 50f);
			obj3.offsetMax = Vector2.zero;
			GameObject val3 = new GameObject("MinimapMask");
			val3.transform.SetParent(minimapDisplayObject.transform, false);
			RectTransform obj4 = val3.AddComponent<RectTransform>();
			obj4.sizeDelta = new Vector2(140f, 140f);
			obj4.anchorMin = new Vector2(0.5f, 0.5f);
			obj4.anchorMax = new Vector2(0.5f, 0.5f);
			obj4.pivot = new Vector2(0.5f, 0.5f);
			obj4.anchoredPosition = Vector2.zero;
			val3.AddComponent<Mask>().showMaskGraphic = false;
			Image obj5 = val3.AddComponent<Image>();
			Sprite sprite = CreateCircleSprite(140, Color.white);
			obj5.sprite = sprite;
			obj5.type = (Type)1;
			((Graphic)obj5).color = Color.white;
			GameObject val4 = new GameObject("MinimapBorder");
			val4.transform.SetParent(minimapDisplayObject.transform, false);
			RectTransform obj6 = val4.AddComponent<RectTransform>();
			obj6.sizeDelta = new Vector2(150f, 150f);
			obj6.anchorMin = new Vector2(0.5f, 0.5f);
			obj6.anchorMax = new Vector2(0.5f, 0.5f);
			obj6.pivot = new Vector2(0.5f, 0.5f);
			obj6.anchoredPosition = Vector2.zero;
			val4.transform.SetSiblingIndex(0);
			Image obj7 = val4.AddComponent<Image>();
			Sprite sprite2 = CreateCircleSprite(150, Color.black);
			obj7.sprite = sprite2;
			obj7.type = (Type)1;
			((Graphic)obj7).color = Color.black;
			mapContentObject = new GameObject("MapContent");
			mapContentObject.transform.SetParent(val3.transform, false);
			RectTransform obj8 = mapContentObject.AddComponent<RectTransform>();
			obj8.sizeDelta = new Vector2(500f, 500f);
			obj8.anchorMin = new Vector2(0.5f, 0.5f);
			obj8.anchorMax = new Vector2(0.5f, 0.5f);
			obj8.pivot = new Vector2(0.5f, 0.5f);
			obj8.anchoredPosition = Vector2.zero;
			mapContentObject.transform.localScale = new Vector3(mapZoomLevel, mapZoomLevel, 1f);
			GameObject val5 = new GameObject("GridContainer");
			val5.transform.SetParent(mapContentObject.transform, false);
			gridContainer = val5.AddComponent<RectTransform>();
			gridContainer.sizeDelta = new Vector2(500f, 500f);
			gridContainer.anchorMin = new Vector2(0.5f, 0.5f);
			gridContainer.anchorMax = new Vector2(0.5f, 0.5f);
			gridContainer.pivot = new Vector2(0.5f, 0.5f);
			gridContainer.anchoredPosition = Vector2.zero;
			CreateMinimapTimeDisplay((Transform)(object)minimapFrameRect);
			GameObject val6 = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content");
			if ((Object)(object)val6 != (Object)null)
			{
				Transform val7 = val6.transform.Find("PlayerPoI(Clone)");
				if ((Object)(object)val7 != (Object)null)
				{
					Transform val8 = val7.Find("IconContainer");
					if ((Object)(object)val8 != (Object)null)
					{
						cachedPlayerMarker = Object.Instantiate<GameObject>(((Component)val8).gameObject);
						((Object)cachedPlayerMarker).name = "PlayerMarker";
						cachedPlayerMarker.transform.SetParent(val3.transform, false);
						RectTransform component = cachedPlayerMarker.GetComponent<RectTransform>();
						if ((Object)(object)component != (Object)null)
						{
							component.anchoredPosition = Vector2.zero;
							((Transform)component).localScale = new Vector3(0.5f, 0.5f, 0.5f);
						}
					}
					else
					{
						CreateFallbackPlayerMarker(val3);
					}
				}
				else
				{
					CreateFallbackPlayerMarker(val3);
				}
			}
			else
			{
				CreateFallbackPlayerMarker(val3);
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Error creating minimap UI: " + ex.Message);
		}
	}

	private void CreateVisualGrid()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: 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_007c: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: 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_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if ((Object)(object)gridContainer != (Object)null)
			{
				int num = 10;
				for (int i = 0; i <= num; i++)
				{
					GameObject val = new GameObject($"HLine_{i}");
					val.transform.SetParent((Transform)(object)gridContainer, false);
					RectTransform obj = val.AddComponent<RectTransform>();
					obj.sizeDelta = new Vector2((float)(num * gridSize), 1f);
					obj.anchorMin = new Vector2(0.5f, 0.5f);
					obj.anchorMax = new Vector2(0.5f, 0.5f);
					obj.pivot = new Vector2(0.5f, 0.5f);
					float num2 = ((float)i - (float)num / 2f) * (float)gridSize;
					obj.anchoredPosition = new Vector2(0f, num2);
					((Graphic)val.AddComponent<Image>()).color = gridColor;
				}
				for (int j = 0; j <= num; j++)
				{
					GameObject val2 = new GameObject($"VLine_{j}");
					val2.transform.SetParent((Transform)(object)gridContainer, false);
					RectTransform obj2 = val2.AddComponent<RectTransform>();
					obj2.sizeDelta = new Vector2(1f, (float)(num * gridSize));
					obj2.anchorMin = new Vector2(0.5f, 0.5f);
					obj2.anchorMax = new Vector2(0.5f, 0.5f);
					obj2.pivot = new Vector2(0.5f, 0.5f);
					float num3 = ((float)j - (float)num / 2f) * (float)gridSize;
					obj2.anchoredPosition = new Vector2(num3, 0f);
					((Graphic)val2.AddComponent<Image>()).color = gridColor;
				}
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Error creating visual grid: " + ex.Message);
		}
	}

	public override void OnUpdate()
	{
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (Input.GetKeyDown((KeyCode)283))
			{
				guiVisible = !guiVisible;
			}
			if (isEnabled && !((Object)(object)playerObject == (Object)null) && !((Object)(object)mapContentObject == (Object)null) && !((Object)(object)minimapDisplayObject == (Object)null))
			{
				Vector3 position = playerObject.transform.position;
				float num = (0f - position.x) * mapScale;
				float num2 = (0f - position.z) * mapScale;
				Vector2 val = new Vector2(9f, -1f) * mapZoomLevel;
				Vector2 val2 = new Vector2(num, num2) * mapZoomLevel + val;
				RectTransform component = mapContentObject.GetComponent<RectTransform>();
				if ((Object)(object)component != (Object)null)
				{
					component.anchoredPosition = Vector2.Lerp(component.anchoredPosition, val2, Time.deltaTime * smoothingFactor);
					UpdatePlayerDirectionIndicator();
				}
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Error in OnUpdate: " + ex.Message);
		}
	}

	[IteratorStateMachine(typeof(<UpdateMinimapTimeCoroutine>d__46))]
	private IEnumerator UpdateMinimapTimeCoroutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <UpdateMinimapTimeCoroutine>d__46(0)
		{
			<>4__this = this
		};
	}

	private void UpdatePlayerDirectionIndicator()
	{
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)cachedPlayerMarker == (Object)null || (Object)(object)playerObject == (Object)null)
		{
			return;
		}
		if ((Object)(object)cachedDirectionIndicator == (Object)null)
		{
			Transform val = cachedPlayerMarker.transform.Find("DirectionIndicator");
			if ((Object)(object)val != (Object)null)
			{
				cachedDirectionIndicator = (RectTransform)(object)((val is RectTransform) ? val : null);
			}
			else
			{
				GameObject val2 = new GameObject("DirectionIndicator");
				val2.transform.SetParent(cachedPlayerMarker.transform, false);
				cachedDirectionIndicator = val2.AddComponent<RectTransform>();
				cachedDirectionIndicator.sizeDelta = new Vector2(6f, 6f);
				((Graphic)val2.AddComponent<Image>()).color = Color.white;
			}
		}
		cachedDirectionIndicator.pivot = new Vector2(0.5f, 0.5f);
		float num = 25f;
		Quaternion rotation = playerObject.transform.rotation;
		float y = ((Quaternion)(ref rotation)).eulerAngles.y;
		float num2 = (90f - y) * ((float)Math.PI / 180f);
		Vector2 anchoredPosition = default(Vector2);
		((Vector2)(ref anchoredPosition))..ctor(num * Mathf.Cos(num2), num * Mathf.Sin(num2));
		cachedDirectionIndicator.anchoredPosition = anchoredPosition;
	}

	private Sprite CreateCircleSprite(int diameter, Color color)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_0034: 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_00c3: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(diameter, diameter, (TextureFormat)5, false);
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
		for (int i = 0; i < diameter; i++)
		{
			for (int j = 0; j < diameter; j++)
			{
				val.SetPixel(j, i, val2);
			}
		}
		int num = diameter / 2;
		Vector2 val3 = default(Vector2);
		((Vector2)(ref val3))..ctor((float)num, (float)num);
		for (int k = 0; k < diameter; k++)
		{
			for (int l = 0; l < diameter; l++)
			{
				if (Vector2.Distance(new Vector2((float)l, (float)k), val3) <= (float)num)
				{
					val.SetPixel(l, k, color);
				}
			}
		}
		val.Apply();
		return Sprite.Create(val, new Rect(0f, 0f, (float)diameter, (float)diameter), new Vector2(0.5f, 0.5f));
	}

	private void AddWhiteStaticMarker(Vector3 worldPos)
	{
		//IL_00dc: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)mapContentObject == (Object)null)
		{
			return;
		}
		if ((Object)(object)cachedMapContent == (Object)null)
		{
			cachedMapContent = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content");
		}
		if (!((Object)(object)cachedMapContent != (Object)null))
		{
			return;
		}
		if ((Object)(object)cachedPropertyPoI == (Object)null)
		{
			cachedPropertyPoI = cachedMapContent.transform.Find("PropertyPoI(Clone)");
		}
		if (!((Object)(object)cachedPropertyPoI != (Object)null))
		{
			return;
		}
		Transform val = cachedPropertyPoI.Find("IconContainer");
		if ((Object)(object)val != (Object)null)
		{
			GameObject obj = Object.Instantiate<GameObject>(((Component)val).gameObject);
			((Object)obj).name = "StaticMarker_White";
			obj.transform.SetParent(mapContentObject.transform, false);
			RectTransform component = obj.GetComponent<RectTransform>();
			if ((Object)(object)component != (Object)null)
			{
				((Transform)component).localScale = new Vector3(2f, 2f, 2f);
				float num = worldPos.x * mapScale;
				float num2 = worldPos.z * mapScale;
				component.anchoredPosition = new Vector2(num, num2);
			}
		}
	}

	private void AddRedStaticMarker(Vector3 worldPos)
	{
		//IL_0013: 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_002e: 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_0049: 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_0065: 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)
		if (!((Object)(object)mapContentObject == (Object)null))
		{
			GameObject val = new GameObject("StaticMarker_Red");
			val.transform.SetParent(mapContentObject.transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.sizeDelta = new Vector2(5f, 5f);
			float num = worldPos.x * mapScale;
			float num2 = worldPos.z * mapScale;
			obj.anchoredPosition = new Vector2(num, num2);
			((Graphic)val.AddComponent<Image>()).color = Color.red;
		}
	}

	private void AddDefaultMarkers()
	{
		//IL_0010: 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)
		AddWhiteStaticMarker(new Vector3(-67.17f, -3.03f, 138.31f));
		AddWhiteStaticMarker(new Vector3(-79.88f, -2.26f, 85.13f));
		AddWhiteStaticMarker(new Vector3(-179.99f, -3.03f, 113.69f));
	}

	private void UpdateTimeDisplayPosition()
	{
		//IL_0041: 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)
		if ((Object)(object)minimapTimeContainer != (Object)null)
		{
			if (doubleSizeEnabled)
			{
				minimapTimeContainer.anchoredPosition = new Vector2(0f, 40f);
			}
			else
			{
				minimapTimeContainer.anchoredPosition = new Vector2(0f, 10f);
			}
		}
	}

	private void RecursiveFind(Transform current, string targetName, List<Transform> result)
	{
		if (((Object)current).name == targetName)
		{
			result.Add(current);
		}
		for (int i = 0; i < current.childCount; i++)
		{
			RecursiveFind(current.GetChild(i), targetName, result);
		}
	}

	[IteratorStateMachine(typeof(<ContractPoICheckerWorld>d__54))]
	private IEnumerator ContractPoICheckerWorld()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ContractPoICheckerWorld>d__54(0)
		{
			<>4__this = this
		};
	}

	private void RemoveAllContractPoIMarkers()
	{
		foreach (GameObject contractPoIMarker in contractPoIMarkers)
		{
			if ((Object)(object)contractPoIMarker != (Object)null)
			{
				Object.Destroy((Object)(object)contractPoIMarker);
			}
		}
		contractPoIMarkers.Clear();
	}

	private void AddContractPoIMarkerWorld(Transform cpTransform)
	{
		//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_0013: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)cpTransform == (Object)null)
		{
			return;
		}
		Vector3 position = cpTransform.position;
		Vector2 anchoredPosition = default(Vector2);
		((Vector2)(ref anchoredPosition))..ctor(position.x * mapScale, position.z * mapScale);
		anchoredPosition.x -= 5f;
		if ((Object)(object)contractPoIIconPrefab == (Object)null)
		{
			CacheContractPoIIcon();
			if ((Object)(object)contractPoIIconPrefab == (Object)null)
			{
				return;
			}
		}
		GameObject val = Object.Instantiate<GameObject>(contractPoIIconPrefab);
		((Object)val).name = "ContractPoIMarker_" + ((Object)cpTransform).GetInstanceID();
		if ((Object)(object)mapContentObject != (Object)null)
		{
			val.transform.SetParent(mapContentObject.transform, false);
			RectTransform component = val.GetComponent<RectTransform>();
			if ((Object)(object)component != (Object)null)
			{
				component.anchoredPosition = anchoredPosition;
				((Transform)component).localScale = new Vector3(0.5f, 0.5f, 0.5f);
			}
			contractPoIMarkers.Add(val);
		}
	}

	private void CacheContractPoIIcon()
	{
		if ((Object)(object)contractPoIIconPrefab == (Object)null)
		{
			GameObject val = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content/ContractPoI(Clone)/IconContainer");
			if ((Object)(object)val != (Object)null)
			{
				contractPoIIconPrefab = val;
			}
		}
	}

	private void CreateFallbackPlayerMarker(GameObject parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		cachedPlayerMarker = new GameObject("PlayerMarker");
		cachedPlayerMarker.transform.SetParent(parent.transform, false);
		RectTransform obj = cachedPlayerMarker.AddComponent<RectTransform>();
		obj.sizeDelta = new Vector2(5f, 5f);
		obj.anchorMin = new Vector2(0.5f, 0.5f);
		obj.anchorMax = new Vector2(0.5f, 0.5f);
		obj.pivot = new Vector2(0.5f, 0.5f);
		obj.anchoredPosition = Vector2.zero;
		((Graphic)cachedPlayerMarker.AddComponent<Image>()).color = new Color(0.2f, 0.6f, 1f, 1f);
	}
}