Decompiled source of BetterTimeControl v1.0.0

BepinEx/plugins/BetterTimeControl.dll

Decompiled a day 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("TABS Time Control")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TABS Time Control")]
[assembly: AssemblyTitle("TABS Time Control")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.tabs.timecontrol", "TABS Time Control", "1.0.0")]
public class TimeControl : BaseUnityPlugin
{
	private float gameSpeed = 1f;

	private const float MinSpeed = 0.1f;

	private const float MaxSpeed = 3f;

	private const float SpeedStep = 0.1f;

	private void Update()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		if (Input.mouseScrollDelta.y > 0f)
		{
			gameSpeed += 0.1f;
			gameSpeed = Mathf.Clamp(gameSpeed, 0.1f, 3f);
			ApplySpeed();
		}
		if (Input.mouseScrollDelta.y < 0f)
		{
			gameSpeed -= 0.1f;
			gameSpeed = Mathf.Clamp(gameSpeed, 0.1f, 3f);
			ApplySpeed();
		}
		if (Input.GetMouseButtonDown(2))
		{
			gameSpeed = 1f;
			ApplySpeed();
		}
	}

	private void ApplySpeed()
	{
		Time.timeScale = gameSpeed;
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Game speed: " + gameSpeed.ToString("0.0") + "x"));
	}

	private void OnDestroy()
	{
		Time.timeScale = 1f;
	}
}