Decompiled source of NoEAPopUp v1.0.0

NoEAPopUp.dll

Decompiled 21 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Mod for MineMogul game")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Max German")]
[assembly: AssemblyProduct("No Early Access PopUp")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("15c541e3-490d-462e-9992-466b53469609")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoEAPopUp;

internal static class ModInfo
{
	public const string PLUGIN_GUID = "com.maxgerman.noeapopup";

	public const string PLUGIN_NAME = "No Early Access PopUp";

	public const string PLUGIN_VERSION = "1.0.0";

	public const string ASSEMBLY_VERSION = "1.0.0";

	public const string FILE_VERSION = "1.0.0";

	public const string INFORMATIONAL_VERSION = "1.0.0";

	public const string HARMONY_ID = "com.maxgerman.noeapopup";

	public const string LOG_PREFIX = "[NoEAPopUp]";

	public const string DISPLAY_NAME_SHORT = "No EA PopUp";

	public const string DISPLAY_NAME_LONG = "No Early Access PopUp";

	internal const string Guid = "com.maxgerman.noeapopup";

	internal const string Name = "No Early Access PopUp";

	internal const string Version = "1.0.0";
}
[BepInPlugin("com.maxgerman.noeapopup", "No Early Access PopUp", "1.0.0")]
public class SkipEarlyAccessPlugin : BaseUnityPlugin
{
	private bool _popupWasActive;

	private bool _missingWarningShown;

	private float _mainMenuFoundTime = -1f;

	private const string MainMenuPath = "UI/MainMenu";

	private const string PopupPath = "UI/MainMenu/EarlyAccessPopup";

	private const string ButtonPath = "UI/MainMenu/EarlyAccessPopup/ClosePopupButton";

	private void Update()
	{
		if ((Object)(object)GameObject.Find("UI/MainMenu") == (Object)null)
		{
			_mainMenuFoundTime = -1f;
			_popupWasActive = false;
			return;
		}
		if (_mainMenuFoundTime < 0f)
		{
			_mainMenuFoundTime = Time.time;
		}
		GameObject val = GameObject.Find("UI/MainMenu/EarlyAccessPopup");
		if ((Object)(object)val != (Object)null)
		{
			_missingWarningShown = false;
			bool activeInHierarchy = val.activeInHierarchy;
			if (activeInHierarchy && !_popupWasActive)
			{
				ClosePopup();
			}
			_popupWasActive = activeInHierarchy;
		}
		else
		{
			_popupWasActive = false;
			if (Time.time - _mainMenuFoundTime >= 15f && !_missingWarningShown)
			{
				Debug.LogWarning((object)"[NoEAPopUp] EarlyAccessPopup not found. If the game has been updated and the Early Access popup has been removed, this mod may no longer be needed.");
				_missingWarningShown = true;
			}
		}
	}

	private void ClosePopup()
	{
		GameObject val = GameObject.Find("UI/MainMenu/EarlyAccessPopup/ClosePopupButton");
		if ((Object)(object)val == (Object)null)
		{
			Debug.LogWarning((object)"[NoEAPopUp] EarlyAccessPopup found, but ClosePopupButton was not found.");
			return;
		}
		Button component = val.GetComponent<Button>();
		if ((Object)(object)component == (Object)null)
		{
			Debug.LogWarning((object)"[NoEAPopUp] ClosePopupButton does not have a UnityEngine.UI.Button component.");
			return;
		}
		Debug.Log((object)"[NoEAPopUp] Automatically closing Early Access.");
		((UnityEvent)component.onClick).Invoke();
	}
}