Decompiled source of RemoveHud v0.0.1

remove_hud.dll

Decompiled 3 months 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 BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Entities.Player;
using Il2CppSystem.Collections.Generic;
using Managers;
using Mirror;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("remove_hud")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("remove_hud")]
[assembly: AssemblyTitle("remove_hud")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace remove_hud;

public class RemoveHud_Component : MonoBehaviour
{
	private void Update()
	{
		if (!Input.GetKeyDown((KeyCode)110) || RemoveHud.storedVolumeProfileComponents == null)
		{
			return;
		}
		Fate currentFate = PlayerManager.LocalPlayerObject.GetComponent<PlayerFate>().CurrentFate;
		if (RemoveHud.shouldRemoveHud)
		{
			Enumerator<VolumeComponent> enumerator = RemoveHud.storedVolumeProfileComponents.GetEnumerator();
			while (enumerator.MoveNext())
			{
				VolumeComponent current = enumerator.Current;
				currentFate.volumeProfile.components.Add(current);
			}
		}
		else
		{
			currentFate.volumeProfile.components.Clear();
		}
		RemoveHud.shouldRemoveHud = !RemoveHud.shouldRemoveHud;
	}
}
[BepInPlugin("remove_hud", "Remove Hud", "0.0.1")]
public class RemoveHud : BasePlugin
{
	internal static ManualLogSource Log;

	internal static bool shouldRemoveHud = true;

	internal static List<VolumeComponent> storedVolumeProfileComponents = null;

	public override void Load()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		Log = ((BasePlugin)this).Log;
		((BasePlugin)this).AddComponent<RemoveHud_Component>();
		FateManager.OnClientPlayerFateChanged += FateEvent.op_Implicit((Action<PlayerFate, Fate, Fate>)ClearFateVolumeOnFateChanged);
		ManualLogSource log = Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 0, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin remove_hud loaded successfully.");
		}
		log.LogInfo(val);
	}

	public void ClearFateVolumeOnFateChanged(PlayerFate playerFate, Fate previousFate, Fate nextFate)
	{
		if (((NetworkBehaviour)playerFate).isLocalPlayer && ((NetworkBehaviour)playerFate).isClient && nextFate != null)
		{
			storedVolumeProfileComponents = new List<VolumeComponent>();
			Enumerator<VolumeComponent> enumerator = nextFate.volumeProfile.components.GetEnumerator();
			while (enumerator.MoveNext())
			{
				VolumeComponent current = enumerator.Current;
				storedVolumeProfileComponents.Add(current);
			}
			if (shouldRemoveHud)
			{
				nextFate.volumeProfile.components.Clear();
			}
		}
	}
}