using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("FS_CloseEAPopUp")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6ffeef70742983f46968769739efe1f484686843")]
[assembly: AssemblyProduct("FS_CloseEAPopUp")]
[assembly: AssemblyTitle("FS_CloseEAPopUp")]
[assembly: AssemblyVersion("1.0.0.0")]
internal static class ModLog
{
private static ManualLogSource _bepInExLogger;
public static string LogPrefix { get; set; }
public static void Init()
{
if (_bepInExLogger == null)
{
_bepInExLogger = Logger.CreateLogSource(LogPrefix ?? "");
}
}
internal static void Info(string message, string tag = "")
{
_bepInExLogger.LogInfo((object)FormatMessage(message, tag));
}
internal static void Log(string message, string tag = "")
{
_bepInExLogger.LogMessage((object)FormatMessage(message, tag));
}
internal static void Debug(string message, string tag = "")
{
}
internal static void Warn(string message, string tag = "")
{
_bepInExLogger.LogWarning((object)FormatMessage(message, tag));
}
internal static void Error(string message, string tag = "")
{
_bepInExLogger.LogError((object)FormatMessage(message, tag));
}
private static string FormatMessage(string message, string tag)
{
if (string.IsNullOrEmpty(tag))
{
return message;
}
return "[" + tag + "] " + message;
}
}
internal static class ModInfo
{
internal const string PLUGIN_GUID = "com.maxgerman.closeeapopup";
internal const string PLUGIN_NAME = "Close Early Access PopUp";
internal const string PLUGIN_VERSION = "1.0.1";
internal const string ASSEMBLY_VERSION = "1.0.1";
internal const string FILE_VERSION = "1.0.1";
internal const string INFORMATIONAL_VERSION = "1.0.1";
internal const string HARMONY_ID = "com.maxgerman.closeeapopup";
internal const string LOG_PREFIX = "Close EA PopUp";
internal const string DISPLAY_NAME_SHORT = "Close EA PopUp";
internal const string DISPLAY_NAME_LONG = "Close Early Access PopUp";
}
namespace Close_EA_popup;
[BepInPlugin("com.maxgerman.closeeapopup", "Close Early Access PopUp", "1.0.1")]
public class AutoClickerPlugin : BasePlugin
{
public override void Load()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
ModLog.LogPrefix = "Close EA PopUp";
ModLog.Init();
ModLog.Info("Close_EA_PopUp mod is loading...");
new Harmony("com.maxgerman.closeeapopup").PatchAll();
}
}
[HarmonyPatch(typeof(SceneManager), "Internal_SceneLoaded")]
public class SceneLoadedPatch
{
private static void Postfix(Scene scene)
{
if (((Scene)(ref scene)).name == "ForestMenu")
{
SearchAndClickAsync();
}
}
private static async Task SearchAndClickAsync()
{
int attempts = 0;
while (attempts < 50)
{
attempts++;
GameObject obj = GameObject.Find("Canvas/Hello Message/Window/ButtonLayout/Close");
Button val = ((obj != null) ? obj.GetComponent<Button>() : null);
if (val != null)
{
((UnityEvent)val.onClick).Invoke();
ModLog.Info("EA Popup closed successfully!");
return;
}
await Task.Delay(100);
}
ModLog.Info("EA Popup search stopped after 50 attempts.");
}
}