using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using exit_F10.paches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("exit_F10")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("exit_F10")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c0d9e1f6-1add-4e54-a9e4-1f0b9258c8e2")]
[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")]
[BepInPlugin("exit_f10", "exit F10", "1.0.0")]
public class BackToMenuMod : BaseUnityPlugin
{
private const string modGUID = "exit_f10";
private const string modName = "exit F10";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("exit_f10");
private static BackToMenuMod Instance;
public static ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("exit_f10");
mls.LogInfo((object)"exit F10 loaded");
harmony.PatchAll(typeof(BackToMenuMod));
harmony.PatchAll(typeof(exitLogger));
}
}
namespace exit_F10.paches;
[HarmonyPatch(typeof(PlayerControllerB))]
internal class exitLogger
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void infinite()
{
if (((ButtonControl)Keyboard.current.f10Key).wasPressedThisFrame)
{
BackToMenuMod.mls.LogInfo((object)"F10 pressed");
if ((Object)(object)GameNetworkManager.Instance != (Object)null)
{
GameNetworkManager.Instance.Disconnect();
}
SceneManager.LoadScene("MainMenu");
}
}
}