Decompiled source of SpeedrunQOL v1.0.1

DuskSRQOL.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
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: AssemblyCompany("DuskSRQOL")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DuskSRQOL")]
[assembly: AssemblyTitle("DuskSRQOL")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.newblood.plugins.dusk.srqol", "DUSK Speedrunning QOL Mod", "1.0.0.0")]
public class DuskSRQOLPlugin : BaseUnityPlugin
{
	private float speedometerType;

	private float speedometerSpeed;

	private float SecondarySpeedometerSpeed;

	private string speedometerDisplay;

	private bool permStatus;

	private bool speedDisplayType;

	private bool textLingerFix;

	private float textLingerFixTimer;

	private void Awake()
	{
		speedometerType = 0f;
		speedDisplayType = true;
		textLingerFix = false;
		textLingerFixTimer = 0.01f;
	}

	private void Update()
	{
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: 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_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: 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_029f: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("Player");
		GameObject val2 = GameObject.Find("Canvas/SmallLevelName");
		GameObject val3 = GameObject.Find("Canvas/SmallDifficultyLabel");
		GameObject val4 = GameObject.Find("Canvas/LevelTime");
		GameObject val5 = GameObject.Find("Canvas/KillLabel");
		GameObject val6 = GameObject.Find("Canvas/SecretsLabel");
		CharacterController component = val.GetComponent<CharacterController>();
		TextMeshProUGUI component2 = val2.GetComponent<TextMeshProUGUI>();
		TextMeshProUGUI component3 = val3.GetComponent<TextMeshProUGUI>();
		TextMeshProUGUI component4 = val4.GetComponent<TextMeshProUGUI>();
		TextMeshProUGUI component5 = val5.GetComponent<TextMeshProUGUI>();
		TextMeshProUGUI component6 = val6.GetComponent<TextMeshProUGUI>();
		speedometerDisplay = speedometerSpeed.ToString();
		if (Input.GetKeyDown((KeyCode)290))
		{
			if (speedometerType < 4f)
			{
				speedometerType += 1f;
			}
			else
			{
				speedometerType = 0f;
			}
		}
		if (Input.GetKeyDown((KeyCode)291))
		{
			if (speedDisplayType)
			{
				speedDisplayType = false;
			}
			else
			{
				speedDisplayType = true;
			}
			textLingerFix = true;
			textLingerFixTimer = 0.01f;
		}
		if (Input.GetKeyDown((KeyCode)292))
		{
			if (permStatus)
			{
				permStatus = false;
			}
			else
			{
				permStatus = true;
			}
		}
		if (textLingerFix && textLingerFixTimer == 0f)
		{
			textLingerFix = false;
		}
		if (speedometerType == 1f)
		{
			Vector3 velocity = component.velocity;
			speedometerSpeed = Mathf.Round(((Vector3)(ref velocity)).magnitude * 1f);
			SpeedometerShow(speedometerDisplay + "u");
		}
		if (speedometerType == 2f)
		{
			speedometerSpeed = Mathf.Round(Mathf.Abs(component.velocity.x + component.velocity.z * 1f));
			SpeedometerShow(speedometerDisplay + "H/u");
		}
		if (speedometerType == 3f)
		{
			speedometerSpeed = Mathf.Round(Mathf.Abs(component.velocity.y * 1f));
			SpeedometerShow(speedometerDisplay + "V/u");
		}
		if (speedometerType == 4f)
		{
			speedometerSpeed = Mathf.Round(Mathf.Abs(component.velocity.x + component.velocity.z * 1f));
			SecondarySpeedometerSpeed = Mathf.Round(Mathf.Abs(component.velocity.y * 1f));
			SpeedometerShow(speedometerDisplay + "H/u " + SecondarySpeedometerSpeed + "V/u");
		}
		if (permStatus)
		{
			((TMP_Text)component3).alpha = 0.8f;
			((TMP_Text)component2).alpha = 0.8f;
			((TMP_Text)component4).alpha = 0.8f;
			((TMP_Text)component5).alpha = 0.8f;
			((TMP_Text)component6).alpha = 0.8f;
		}
		if (textLingerFixTimer > 0f)
		{
			textLingerFixTimer -= Time.deltaTime;
		}
	}

	private void SpeedometerShow(string message)
	{
		//IL_005e: 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_0137: 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_00c5: 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)
		GameObject val = GameObject.Find("TutorialMessageText");
		GameObject val2 = GameObject.Find("MessageText");
		TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
		TextMeshProUGUI component2 = val2.GetComponent<TextMeshProUGUI>();
		ClearMessageAfterTime component3 = val.GetComponent<ClearMessageAfterTime>();
		ClearMessageAfterTime component4 = val2.GetComponent<ClearMessageAfterTime>();
		if (speedometerType == 0f)
		{
			((Graphic)component).color = new Color(1f, 0.1324f, 0.1324f, 1f);
			((Graphic)component2).color = new Color(0.5735f, 0f, 0f, 1f);
		}
		if (speedDisplayType)
		{
			((TMP_Text)component).text = message;
			component3.timer = component3.defaulttime;
			if (speedometerType != 0f)
			{
				((Graphic)component).color = Color.white;
				((Graphic)component2).color = new Color(0.5735f, 0f, 0f, 1f);
			}
		}
		else
		{
			((TMP_Text)component2).text = message;
			component4.timer = component4.defaulttime;
			if (speedometerType != 0f)
			{
				((Graphic)component).color = new Color(1f, 0.1324f, 0.1324f, 1f);
				((Graphic)component2).color = Color.white;
			}
		}
		if (textLingerFix && speedometerType != 0f)
		{
			if (speedDisplayType)
			{
				component4.timer = 0f;
			}
			else
			{
				component3.timer = 0f;
			}
		}
	}
}