Decompiled source of LoadIntoLevel v0.1.1

com.validaq.loadintolevel.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("com.validaq.loadintolevel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+7e8f91ba1044d1fa0b2a3bba309c90030e547a7b")]
[assembly: AssemblyProduct("LoadIntoLevel")]
[assembly: AssemblyTitle("com.validaq.loadintolevel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 LoadIntoLevel
{
	[BepInPlugin("com.validaq.loadintolevel", "LoadIntoLevel", "0.1.0")]
	public class LoadIntoLevel : BaseUnityPlugin
	{
		private const string pluginGuid = "com.validaq.loadintolevel";

		private ConfigEntry<string> sceneToReplace;

		private ConfigEntry<string> sceneToLoad;

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			sceneToReplace = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SceneToReplace", "Intro", "Game scene to be replaced. Use 'Intro' to instantly load into the given scene upon game launch, or 'Training-Level' to load into it when starting the tutorial. It's advised to avoid using 'Main-Menu', as it will make you unable to return to main menu from the scene, leaving Alt-F4 as the only way to exit.");
			sceneToLoad = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SceneToLoad", "Playground", "The name of the scene to load instead of the specified scene. This should be the name of the scene you want to load into, such as 'Playground'.");
			SceneManager.sceneLoaded += OnSceneLoad;
			Logger.LogInfo((object)"Plugin com.validaq.loadintolevel is loaded!");
		}

		private void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name == sceneToReplace.Value)
			{
				SceneManager.LoadScene(sceneToLoad.Value);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.validaq.loadintolevel";

		public const string PLUGIN_NAME = "LoadIntoLevel";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}