Decompiled source of LevelLoader v1.0.0

Mods/LoadLevels.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using BoneLib.Notifications;
using LevelLoader;
using LoadLevels;
using MelonLoader;
using MelonLoader.Preferences;
using SLZ.Marrow.SceneStreaming;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LevelLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("LevelLoader")]
[assembly: AssemblyCopyright("Created by Son of Forehead")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(LoadLevelsMain), "LevelLoader", "1.0.0", "Son of Forehead", null)]
[assembly: MelonGame(null, null)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LevelLoader
{
	public static class BuildInfo
	{
		public const string Name = "LevelLoader";

		public const string Author = "Son of Forehead";

		public const string Version = "1.0.0";

		public const string Company = null;

		public const string DownloadLink = null;
	}
	public class LoadLevelsMain : MelonMod
	{
		public static MelonPreferences_Category mainPrefCategory;

		public static MelonPreferences_Entry<string> level1;

		public static MelonPreferences_Entry<string> level2;

		public static MelonPreferences_Entry<string> level3;

		public static MelonPreferences_Entry<string> level4;

		public static MelonPreferences_Entry<string> level5;

		public static string barcode1;

		public static string barcode2;

		public static string barcode3;

		public static string barcode4;

		public static string barcode5;

		public override void OnInitializeMelon()
		{
			CreateMelonPrefs();
			LoaderBonemenu.CreateBonemenu();
			barcode1 = level1.Value;
			barcode2 = level2.Value;
			barcode3 = level3.Value;
			barcode4 = level4.Value;
			barcode5 = level5.Value;
		}

		public static void CreateMelonPrefs()
		{
			mainPrefCategory = MelonPreferences.CreateCategory("LevelLoader");
			level1 = mainPrefCategory.CreateEntry<string>("LVL_1:", "default", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			level2 = mainPrefCategory.CreateEntry<string>("LVL_2:", "default", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			level3 = mainPrefCategory.CreateEntry<string>("LVL_3:", "default", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			level4 = mainPrefCategory.CreateEntry<string>("LVL_4:", "default", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			level5 = mainPrefCategory.CreateEntry<string>("LVL_5:", "default", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		}

		public static void LoadLevel1()
		{
			if (barcode1.Contains(".Level."))
			{
				MelonLogger.Msg("Valid Level Barcode!");
				SceneStreamer.Load(barcode1, "");
				MelonLogger.Msg("Loading: " + barcode1 + "...");
			}
			else
			{
				LoaderBonemenu.InvalidBarcode();
			}
		}

		public static void LoadLevel2()
		{
			if (barcode2.Contains(".Level."))
			{
				MelonLogger.Msg("Valid Level Barcode!");
				SceneStreamer.Load(barcode2, "");
				MelonLogger.Msg("Loading: " + barcode2 + "...");
			}
			else
			{
				LoaderBonemenu.InvalidBarcode();
			}
		}

		public static void LoadLevel3()
		{
			if (barcode3.Contains(".Level."))
			{
				MelonLogger.Msg("Valid Level Barcode!");
				SceneStreamer.Load(barcode3, "");
				MelonLogger.Msg("Loading: " + barcode3 + "...");
			}
			else
			{
				LoaderBonemenu.InvalidBarcode();
			}
		}

		public static void LoadLevel4()
		{
			if (barcode4.Contains(".Level."))
			{
				MelonLogger.Msg("Valid Level Barcode!");
				SceneStreamer.Load(barcode4, "");
				MelonLogger.Msg("Loading: " + barcode4 + "...");
			}
			else
			{
				LoaderBonemenu.InvalidBarcode();
			}
		}

		public static void LoadLevel5()
		{
			if (barcode5.Contains(".Level."))
			{
				MelonLogger.Msg("Valid Level Barcode!");
				SceneStreamer.Load(barcode5, "");
				MelonLogger.Msg("Loading: " + barcode5 + "...");
			}
			else
			{
				LoaderBonemenu.InvalidBarcode();
			}
		}
	}
}
namespace LoadLevels
{
	public static class LoaderBonemenu
	{
		public static MenuCategory mainCategory;

		public static Notification invalidNotification;

		public static void CreateBonemenu()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			mainCategory = MenuManager.CreateCategory("LevelLoader", Color.blue);
			mainCategory.CreateFunctionElement("`Default` will load Void G114.", Color.red, (Action)delegate
			{
			});
			mainCategory.CreateFunctionElement("Reload Preferences", Color.yellow, (Action)ReloadPrefs);
			mainCategory.CreateFunctionElement(LoadLevelsMain.level1.Value, Color.gray, (Action)LoadLevelsMain.LoadLevel1, "Are you sure?");
			mainCategory.CreateFunctionElement(LoadLevelsMain.level2.Value, Color.gray, (Action)LoadLevelsMain.LoadLevel2, "Are you sure?");
			mainCategory.CreateFunctionElement(LoadLevelsMain.level3.Value, Color.gray, (Action)LoadLevelsMain.LoadLevel3, "Are you sure?");
			mainCategory.CreateFunctionElement(LoadLevelsMain.level4.Value, Color.gray, (Action)LoadLevelsMain.LoadLevel4, "Are you sure?");
			mainCategory.CreateFunctionElement(LoadLevelsMain.level5.Value, Color.gray, (Action)LoadLevelsMain.LoadLevel5, "Are you sure?");
		}

		public static void ReloadPrefs()
		{
			mainCategory.Elements.Clear();
			LoadLevelsMain.barcode1 = LoadLevelsMain.level1.Value;
			LoadLevelsMain.barcode2 = LoadLevelsMain.level2.Value;
			LoadLevelsMain.barcode3 = LoadLevelsMain.level3.Value;
			LoadLevelsMain.barcode4 = LoadLevelsMain.level4.Value;
			LoadLevelsMain.barcode5 = LoadLevelsMain.level5.Value;
			CreateBonemenu();
		}

		public static void InvalidBarcode()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			MelonLogger.Warning("Invalid Barcode!");
			invalidNotification = new Notification();
			invalidNotification.Title = NotificationText.op_Implicit("Level Loader");
			invalidNotification.Message = NotificationText.op_Implicit("Invalid Barcode!");
			invalidNotification.Type = (NotificationType)2;
			invalidNotification.PopupLength = 3f;
			Notifier.Send(invalidNotification);
		}
	}
}