Decompiled source of Truck Compass v1.0.0

TruckCompass.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TruckCompass")]
[assembly: AssemblyTitle("TruckCompass")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TruckCompass
{
	[BepInPlugin("com.empress.truckcompass", "EMPRESS UI COMPASS", "3.0.0")]
	public class EmpressCompassPlugin : BaseUnityPlugin
	{
		private float compassWidth = 400f;

		private float compassHeight = 40f;

		private float fieldOfView = 90f;

		private GUIStyle markerStyle;

		private GUIStyle centerTickStyle;

		private Texture2D backgroundTexture;

		private void OnGUI()
		{
			//IL_012a: 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_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_013d: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: 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)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00c5: 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_00eb: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.RunIsLevel() && Object.op_Implicit((Object)(object)PlayerController.instance))
			{
				if (markerStyle == null)
				{
					markerStyle = new GUIStyle(GUI.skin.label);
					markerStyle.alignment = (TextAnchor)1;
					markerStyle.fontSize = 16;
					markerStyle.fontStyle = (FontStyle)1;
					markerStyle.normal.textColor = new Color(0.8f, 0f, 1f);
					centerTickStyle = new GUIStyle(GUI.skin.label);
					centerTickStyle.alignment = (TextAnchor)4;
					centerTickStyle.normal.textColor = Color.white;
					centerTickStyle.fontSize = 20;
					backgroundTexture = new Texture2D(1, 1);
					backgroundTexture.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.5f));
					backgroundTexture.Apply();
				}
				Transform transform = ((Component)PlayerController.instance).transform;
				Vector3 zero = Vector3.zero;
				float num = Vector3.Distance(transform.position, zero);
				Vector3 val = zero - transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				Vector3 forward = transform.forward;
				forward.y = 0f;
				Vector3 val2 = normalized;
				val2.y = 0f;
				float num2 = Vector3.SignedAngle(forward, val2, Vector3.up);
				float num3 = (float)Screen.width / 2f;
				float num4 = 30f;
				GUI.DrawTexture(new Rect(num3 - compassWidth / 2f, num4, compassWidth, compassHeight), (Texture)(object)backgroundTexture);
				GUI.Label(new Rect(num3 - 10f, num4, 20f, compassHeight), "|", centerTickStyle);
				if (Mathf.Abs(num2) < fieldOfView / 2f)
				{
					float num5 = compassWidth / fieldOfView;
					float num6 = num2 * num5;
					Rect val3 = default(Rect);
					((Rect)(ref val3))..ctor(num3 + num6 - 50f, num4 + 5f, 100f, 50f);
					GUI.Label(val3, $"♛\n{Mathf.RoundToInt(num)}m", markerStyle);
				}
			}
		}
	}
}