Decompiled source of OMP HideNearbyButton v1.2.1

BepInEx\plugins\OMP_HideNearbyButton.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("OMP_HideNearbyButton")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OMP_HideNearbyButton")]
[assembly: AssemblyTitle("OMP_HideNearbyButton")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 OMP_HideNearbyButton
{
	[BepInPlugin("diegopho13.omp.hidenearbybutton", "OMP Hide Nearby Button", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		private GameObject target;

		private float nextScan;

		private void Update()
		{
			if ((Object)(object)target != (Object)null || Time.unscaledTime < nextScan)
			{
				return;
			}
			nextScan = Time.unscaledTime + 2f;
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			foreach (GameObject val in array)
			{
				if (!((Object)(object)val == (Object)null) && !(((Object)val).name != "OMP_NearbyUse"))
				{
					target = val;
					CanvasGroup val2 = target.GetComponent<CanvasGroup>();
					if ((Object)(object)val2 == (Object)null)
					{
						val2 = target.AddComponent<CanvasGroup>();
					}
					val2.alpha = 0f;
					val2.interactable = false;
					val2.blocksRaycasts = false;
					break;
				}
			}
		}
	}
}