Decompiled source of HUDToggler v1.0.1

HUDKey.dll

Decompiled a year ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
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 BepInEx.Unity.IL2CPP.Utils.Collections;
using GTFO.API;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("HUDKey")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HUDKey")]
[assembly: AssemblyTitle("HUDKey")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace HUDKey
{
	internal static class Patch
	{
		public class MonoHUDKey : MonoBehaviour
		{
			public static ManualLogSource Log;

			public static bool _HUD_hidden;

			public static float _previousHUD;

			public static bool _chat_show;

			public static bool _compass_show;

			public static bool _inv_show;

			public static bool _obj_show;

			public static float _crosshair_op;

			public static float _ghost_op;

			public static bool _hit_ind_show;

			public static float _hud_op;

			private void ReadUserSettings()
			{
				_chat_show = CellSettingsManager.GetBoolValue((eCellSettingID)391);
				_compass_show = CellSettingsManager.GetBoolValue((eCellSettingID)351);
				_inv_show = CellSettingsManager.GetBoolValue((eCellSettingID)361);
				_obj_show = CellSettingsManager.GetBoolValue((eCellSettingID)381);
				_crosshair_op = CellSettingsManager.GetFloatValue((eCellSettingID)305);
				_ghost_op = CellSettingsManager.GetFloatValue((eCellSettingID)309);
				_hit_ind_show = CellSettingsManager.GetBoolValue((eCellSettingID)308);
				_hud_op = CellSettingsManager.GetFloatValue((eCellSettingID)302);
			}

			public void Initialize()
			{
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(CheckKey()), (Action)null);
			}

			private void Update()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Invalid comparison between Unknown and I4
				if (Input.GetKeyDown((KeyCode)104) && (int)FocusStateManager.Current.m_currentState == 4)
				{
					Log.LogInfo((object)("HUD Toggler state: " + _HUD_hidden));
					_HUD_hidden = !_HUD_hidden;
					if (_HUD_hidden)
					{
						ReadUserSettings();
						CellSettingsManager.SetBoolValue((eCellSettingID)391, false);
						CellSettingsManager.SetBoolValue((eCellSettingID)351, false);
						CellSettingsManager.SetBoolValue((eCellSettingID)361, false);
						CellSettingsManager.SetBoolValue((eCellSettingID)381, false);
						CellSettingsManager.SetFloatValue((eCellSettingID)305, 0f, false);
						CellSettingsManager.SetFloatValue((eCellSettingID)309, 0f, false);
						CellSettingsManager.SetBoolValue((eCellSettingID)308, false);
						CellSettingsManager.SetFloatValue((eCellSettingID)302, 0f, false);
					}
					else
					{
						CellSettingsManager.SetBoolValue((eCellSettingID)391, _chat_show);
						CellSettingsManager.SetBoolValue((eCellSettingID)351, _compass_show);
						CellSettingsManager.SetBoolValue((eCellSettingID)361, _inv_show);
						CellSettingsManager.SetBoolValue((eCellSettingID)381, _obj_show);
						CellSettingsManager.SetFloatValue((eCellSettingID)305, _crosshair_op, false);
						CellSettingsManager.SetFloatValue((eCellSettingID)309, _ghost_op, false);
						CellSettingsManager.SetBoolValue((eCellSettingID)308, _hit_ind_show);
						CellSettingsManager.SetFloatValue((eCellSettingID)302, _hud_op, false);
					}
					CellSettingsManager.ApplyAndSave();
					FocusStateManager.ChangeState((eFocusState)4, true);
				}
			}

			private IEnumerator CheckKey()
			{
				while (true)
				{
					yield return (object)new WaitForSeconds(1f);
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("HUDToggler", "HUDToggler", "1.0.1")]
	public class Plugin : BasePlugin
	{
		public override void Load()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			Patch.MonoHUDKey.Log = ((BasePlugin)this).Log;
			EventAPI.OnExpeditionStarted += ((BasePlugin)this).AddComponent<Patch.MonoHUDKey>().Initialize;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin HUDToggler is now loaded.");
			}
			log.LogInfo(val);
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "HUDKey";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}