Decompiled source of CompassUI v1.0.0

CompassUI.dll

Decompiled 5 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CompassUI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CompassUI")]
[assembly: AssemblyTitle("CompassUI")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CompassUI;

[BepInPlugin("com.nrein.peak.compassui", "Compass UI", "1.0.0")]
public class CompassUIPlugin : BaseUnityPlugin
{
	private Camera mainCamera;

	private void Start()
	{
		mainCamera = Camera.main;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Compass UI] Loaded successfully.");
	}

	private void OnGUI()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)mainCamera == (Object)null)
		{
			mainCamera = Camera.main;
			return;
		}
		Vector3 forward = ((Component)mainCamera).transform.forward;
		float num = Mathf.Atan2(forward.x, forward.z) * 57.29578f;
		if (num < 0f)
		{
			num += 360f;
		}
		GUIStyle val = new GUIStyle(GUI.skin.label)
		{
			fontSize = 24,
			alignment = (TextAnchor)4
		};
		val.normal.textColor = Color.white;
		GUIStyle val2 = val;
		GUI.Label(new Rect((float)(Screen.width / 2 - 150), 35f, 300f, 50f), $"{GetCardinal(num)}  ({num:0}°)", val2);
	}

	private string GetCardinal(float heading)
	{
		if (heading >= 315f || heading < 45f)
		{
			return "N";
		}
		if (heading < 135f)
		{
			return "E";
		}
		if (heading < 225f)
		{
			return "S";
		}
		return "W";
	}
}