Decompiled source of SkipToMultiplayerMenu v1.0.0

BepInEx/plugins/SkipToMultiplayerMenu.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SkipToMultiplayerMenu")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SkipToMultiplayerMenu")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("19daac4f-befb-4658-b237-679df1f71a19")]
[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 SkipToMultiplayerMenu
{
	[BepInPlugin("FlipMods.SkipToMultiplayerMenu", "SkipToMultiplayerMenu", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private static Plugin instance;

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			instance = this;
			_harmony = new Harmony("SkipToMultiplayerMenu");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SkipToMultiplayerMenu loaded");
		}

		public static void Log(string message)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo((object)message);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FlipMods.SkipToMultiplayerMenu";

		public const string PLUGIN_NAME = "SkipToMultiplayerMenu";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SkipToMultiplayerMenu.Patches
{
	[HarmonyPatch]
	internal class SkipToMultiplayerMenuPatcher
	{
		private static bool skippedPreInitScene;

		private static bool skippedInitScene;

		[HarmonyPatch(typeof(PreInitSceneScript), "Awake")]
		[HarmonyPrefix]
		public static bool InitializeGameManager()
		{
			if (skippedPreInitScene)
			{
				return true;
			}
			skippedPreInitScene = true;
			Plugin.Log("Loading GameManager in InitScene.");
			SceneManager.LoadScene("InitScene");
			return false;
		}

		[HarmonyPatch(typeof(InitializeGame), "Start")]
		[HarmonyPrefix]
		public static bool LoadMultiplayerMenuScene()
		{
			if (skippedInitScene)
			{
				return true;
			}
			skippedInitScene = true;
			Plugin.Log("Skipping to MainMenu scene.");
			SceneManager.LoadScene("MainMenu");
			return false;
		}
	}
}