Decompiled source of SnowtimeStages v0.7.0

plugins/SnowtimeStagesAsmdef.dll

Decompiled 8 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG.Reflection;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using Snowtime.Content;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Snowtime
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("SnowySnowtime.SnowtimeStage", "SnowtimeStage", "0.7.0")]
	public class SnowtimeStage : BaseUnityPlugin
	{
		public const string Author = "SnowySnowtime";

		public const string Name = "SnowtimeStage";

		public const string Version = "0.7.0";

		public const string GUID = "SnowySnowtime.SnowtimeStage";

		public static SnowtimeStage instance;

		public static ConfigEntry<bool> ToggleBloodGulch { get; set; }

		public static ConfigEntry<bool> ToggleSidewinder { get; set; }

		public static ConfigEntry<bool> ToggleDeathIsland { get; set; }

		public static ConfigEntry<bool> ToggleIceFields { get; set; }

		public static ConfigEntry<bool> ToggleGephyrophobia { get; set; }

		public static ConfigEntry<bool> ToggleSandtrap { get; set; }

		public static ConfigEntry<bool> ToggleHalo { get; set; }

		public static ConfigEntry<bool> ToggleHalo2 { get; set; }

		public static ConfigEntry<bool> ToggleNMB { get; set; }

		public void Awake()
		{
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			ToggleBloodGulch = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 1 Toggles", "Blood Gulch", true, "If true, Blood Gulch is added to the loop, otherwise it shall not appear");
			ToggleSidewinder = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 1 Toggles", "Sidewinder", true, "If true, Sidewinder is added to the loop, otherwise it shall not appear");
			ToggleDeathIsland = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 2 Toggles", "Death Island", true, "If true, Death Island is added to the loop, otherwise it shall not appear");
			ToggleIceFields = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 2 Toggles", "Ice Fields", true, "If true, Ice Fields is added to the loop, otherwise it shall not appear");
			ToggleGephyrophobia = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 3 Toggles", "Gephyrophobia", true, "If true, Gephyrophobia is added to the loop, otherwise it shall not appear");
			ToggleSandtrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 4 Toggles", "Sandtrap", true, "If true, Sandtrap is added to the loop, otherwise it shall not appear");
			ToggleHalo = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 5 Toggles", "Halo", true, "If true, Halo is added to the loop, otherwise it shall not appear");
			ToggleHalo2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage 5 Toggles", "Halo(Alt)", true, "If true, Halo(Alt) is added to the loop, otherwise it shall not appear");
			ToggleNMB = ((BaseUnityPlugin)this).Config.Bind<bool>("Post Loop Stage Toggles", "New Mombasa Bridge", true, "If true, New Mombasa Bridge is added to the loop, otherwise it shall not appear");
			RegisterHooks();
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(GiveToRoR2OurContentPackProviders);
			Language.collectLanguageRootFolders += CollectLanguageRootFolders;
		}

		private void RegisterHooks()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			MusicController.StartIntroMusic += new hook_StartIntroMusic(MusicController_StartIntroMusic);
		}

		private void MusicController_StartIntroMusic(orig_StartIntroMusic orig, MusicController self)
		{
			orig.Invoke(self);
			AkSoundEngine.PostEvent("Play_Music_SystemST", ((Component)self).gameObject);
		}

		private void Destroy()
		{
			Language.collectLanguageRootFolders -= CollectLanguageRootFolders;
		}

		private void GiveToRoR2OurContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider());
		}

		public void CollectLanguageRootFolders(List<string> folders)
		{
			folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language"));
		}
	}
}
namespace Snowtime.Content
{
	public class ContentProvider : IContentPackProvider
	{
		private readonly ContentPack _contentPack = new ContentPack();

		public static string assetDirectory;

		public string identifier => "SnowySnowtime.SnowtimeStage.ContentProvider";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			_contentPack.identifier = identifier;
			string assetsFolderFullPath = (assetDirectory = Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "assetbundles"));
			SnowtimeContent.LoadSoundBanks(Path.Combine(Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location), "audio"));
			AssetBundle scenesAssetBundle = null;
			yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "snowtimestages"), args.progressReceiver, delegate(AssetBundle assetBundle)
			{
				scenesAssetBundle = assetBundle;
			});
			AssetBundle assetsAssetBundle = null;
			yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "snowtimeassets"), args.progressReceiver, delegate(AssetBundle assetBundle)
			{
				assetsAssetBundle = assetBundle;
			});
			yield return SnowtimeContent.LoadAssetBundlesAsync(scenesAssetBundle, assetsAssetBundle, args.progressReceiver, _contentPack);
		}

		private IEnumerator LoadAssetBundle(string assetBundleFullPath, IProgress<float> progress, Action<AssetBundle> onAssetBundleLoaded)
		{
			AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(assetBundleFullPath);
			while (!((AsyncOperation)assetBundleCreateRequest).isDone)
			{
				progress.Report(((AsyncOperation)assetBundleCreateRequest).progress);
				yield return null;
			}
			onAssetBundleLoaded(assetBundleCreateRequest.assetBundle);
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(_contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class SnowtimeContent
	{
		internal const string ScenesAssetBundleFileName = "snowtimestages";

		internal const string AssetsAssetBundleFileName = "snowtimeassets";

		internal const string MusicSoundBankFileName = "SnowtimeStagesMusic.bnk";

		internal const string SndSoundBankFileName = "SnowtimeStagesSounds.bnk";

		internal const string InitSoundBankFileName = "SnowtimeStagesInit.bnk";

		private static AssetBundle _scenesAssetBundle;

		private static AssetBundle _assetsAssetBundle;

		internal static UnlockableDef[] UnlockableDefs;

		internal static SceneDef[] SceneDefs;

		internal static ExpansionDef[] expansionDefs;

		internal static ExpansionDef ExpansionDefSTHalo;

		internal static SceneDef STSceneDef;

		internal static SceneDef STIFSceneDef;

		internal static SceneDef STBGSceneDef;

		internal static SceneDef STGPHSceneDef;

		internal static SceneDef STHSceneDef;

		internal static SceneDef STH2SceneDef;

		internal static SceneDef STShrineSceneDef;

		internal static SceneDef STSWSceneDef;

		internal static SceneDef STNMBSceneDef;

		internal static Sprite STSceneDefPreviewSprite;

		internal static Sprite STIFSceneDefPreviewSprite;

		internal static Sprite STBGSceneDefPreviewSprite;

		internal static Sprite STGPHSceneDefPreviewSprite;

		internal static Sprite STHSceneDefPreviewSprite;

		internal static Sprite STH2SceneDefPreviewSprite;

		internal static Sprite STShrineSceneDefPreviewSprite;

		internal static Sprite STSWSceneDefPreviewSprite;

		internal static Sprite STNMBSceneDefPreviewSprite;

		internal static Material STBazaarSeer;

		internal static Material STIFBazaarSeer;

		internal static Material STBGBazaarSeer;

		internal static Material STGPHBazaarSeer;

		internal static Material STHBazaarSeer;

		internal static Material STH2BazaarSeer;

		internal static Material STShrineBazaarSeer;

		internal static Material STSWBazaarSeer;

		internal static Material STNMBBazaarSeer;

		public static List<Material> SwappedMaterials = new List<Material>();

		public static Dictionary<string, string> ShaderLookup = new Dictionary<string, string>
		{
			{ "stubbedror2/base/shaders/hgstandard", "RoR2/Base/Shaders/HGStandard.shader" },
			{ "stubbedror2/base/shaders/hgsnowtopped", "RoR2/Base/Shaders/HGSnowTopped.shader" },
			{ "stubbedror2/base/shaders/hgtriplanarterrainblend", "RoR2/Base/Shaders/HGTriplanarTerrainBlend.shader" },
			{ "stubbedror2/base/shaders/hgintersectioncloudremap", "RoR2/Base/Shaders/HGIntersectionCloudRemap.shader" },
			{ "stubbedror2/base/shaders/hgcloudremap", "RoR2/Base/Shaders/HGCloudRemap.shader" },
			{ "stubbedror2/base/shaders/hgdistortion", "RoR2/Base/Shaders/HGDistortion.shader" },
			{ "stubbedror2/base/shaders/speedtreecustom", "RoR2/Base/Shaders/SpeedTreeCustom.shader" },
			{ "stubbedcalm water/calmwater - dx11 - doublesided", "Calm Water/CalmWater - DX11 - DoubleSided.shader" },
			{ "stubbedcalm water/calmwater - dx11", "Calm Water/CalmWater - DX11.shader" },
			{ "stubbednature/speedtree", "RoR2/Base/Shaders/SpeedTreeCustom.shader" }
		};

		internal static IEnumerator LoadAssetBundlesAsync(AssetBundle scenesAssetBundle, AssetBundle assetsAssetBundle, IProgress<float> progress, ContentPack contentPack)
		{
			_scenesAssetBundle = scenesAssetBundle;
			_assetsAssetBundle = assetsAssetBundle;
			Log.Debug("Snowtime Stages found. Loading asset bundles...");
			yield return LoadAllAssetsAsync<Material>(_assetsAssetBundle, progress, (Action<Material[]>)delegate(Material[] assets)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				if (assets != null)
				{
					Material[] array = assets;
					foreach (Material val in array)
					{
						if (((Object)val.shader).name.StartsWith("Stubbed"))
						{
							Shader val2 = Addressables.LoadAssetAsync<Shader>((object)ShaderLookup[((Object)val.shader).name.ToLower()]).WaitForCompletion();
							if (Object.op_Implicit((Object)(object)val2))
							{
								val.shader = val2;
								SwappedMaterials.Add(val);
							}
						}
					}
				}
			});
			yield return LoadAllAssetsAsync<UnlockableDef>(_assetsAssetBundle, progress, (Action<UnlockableDef[]>)delegate(UnlockableDef[] assets)
			{
				UnlockableDefs = assets;
				contentPack.unlockableDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<ExpansionDef>(_assetsAssetBundle, progress, (Action<ExpansionDef[]>)delegate(ExpansionDef[] assets)
			{
				expansionDefs = assets;
				ExpansionDefSTHalo = assets.First((ExpansionDef a) => ((Object)a).name == "snowtimestageshalo_expdef");
				Log.Debug("SnowtimeStages:Halo Expansion Definition Added");
				contentPack.expansionDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<Sprite>(_assetsAssetBundle, progress, (Action<Sprite[]>)delegate(Sprite[] assets)
			{
				STSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTScenePreview");
				STIFSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTIFScenePreview");
				STBGSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTBGScenePreview");
				STGPHSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTGPHScenePreview");
				STHSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTHaloScenePreview");
				STH2SceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTHaloScenePreview");
				STShrineSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTShrineScenePreview");
				STSWSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTSWScenePreview");
				STNMBSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texSTSWScenePreview");
			});
			yield return LoadAllAssetsAsync<SceneDef>(_assetsAssetBundle, progress, (Action<SceneDef[]>)delegate(SceneDef[] assets)
			{
				SceneDefs = assets;
				STSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_deathisland");
				STIFSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_icefields");
				STBGSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_bloodgulch");
				STGPHSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_gephyrophobia");
				STHSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_halo");
				STH2SceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_halo2");
				STShrineSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_sandtrap");
				STSWSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_sidewinder");
				STNMBSceneDef = SceneDefs.First((SceneDef sd) => sd.cachedName == "snowtime_newmombasabridge");
				Log.Debug(STSceneDef.nameToken);
				Log.Debug(STIFSceneDef.nameToken);
				Log.Debug(STBGSceneDef.nameToken);
				Log.Debug(STGPHSceneDef.nameToken);
				Log.Debug(STShrineSceneDef.nameToken);
				Log.Debug(STHSceneDef.nameToken);
				Log.Debug(STH2SceneDef.nameToken);
				Log.Debug(STSWSceneDef.nameToken);
				Log.Debug(STNMBSceneDef.nameToken);
				contentPack.sceneDefs.Add(assets);
			});
			yield return LoadAllAssetsAsync<MusicTrackDef>(_assetsAssetBundle, progress, (Action<MusicTrackDef[]>)delegate(MusicTrackDef[] assets)
			{
				contentPack.musicTrackDefs.Add(assets);
				Log.Debug("loaded musicDefs for SnowtimeStages");
			});
			STBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STSceneDefPreviewSprite.texture);
			STIFBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STIFSceneDefPreviewSprite.texture);
			STBGBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STBGSceneDefPreviewSprite.texture);
			STGPHBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STGPHSceneDefPreviewSprite.texture);
			STHBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STHSceneDefPreviewSprite.texture);
			STH2BazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STH2SceneDefPreviewSprite.texture);
			STShrineBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STShrineSceneDefPreviewSprite.texture);
			STSWBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STSWSceneDefPreviewSprite.texture);
			STNMBBazaarSeer = StageRegistration.MakeBazaarSeerMaterial(STSWSceneDefPreviewSprite.texture);
			STSceneDef.previewTexture = (Texture)(object)STSceneDefPreviewSprite.texture;
			STIFSceneDef.previewTexture = (Texture)(object)STIFSceneDefPreviewSprite.texture;
			STBGSceneDef.previewTexture = (Texture)(object)STBGSceneDefPreviewSprite.texture;
			STGPHSceneDef.previewTexture = (Texture)(object)STGPHSceneDefPreviewSprite.texture;
			STHSceneDef.previewTexture = (Texture)(object)STHSceneDefPreviewSprite.texture;
			STH2SceneDef.previewTexture = (Texture)(object)STH2SceneDefPreviewSprite.texture;
			STShrineSceneDef.previewTexture = (Texture)(object)STShrineSceneDefPreviewSprite.texture;
			STSWSceneDef.previewTexture = (Texture)(object)STSWSceneDefPreviewSprite.texture;
			STNMBSceneDef.previewTexture = (Texture)(object)STSWSceneDefPreviewSprite.texture;
			STSceneDef.portalMaterial = STBazaarSeer;
			STIFSceneDef.portalMaterial = STIFBazaarSeer;
			STBGSceneDef.portalMaterial = STBGBazaarSeer;
			STGPHSceneDef.portalMaterial = STGPHBazaarSeer;
			STHSceneDef.portalMaterial = STHBazaarSeer;
			STH2SceneDef.portalMaterial = STH2BazaarSeer;
			STShrineSceneDef.portalMaterial = STShrineBazaarSeer;
			STSWSceneDef.portalMaterial = STSWBazaarSeer;
			STNMBSceneDef.portalMaterial = STSWBazaarSeer;
			Log.Debug("Blood Gulch Config Status?");
			Log.Debug(SnowtimeStage.ToggleBloodGulch.Value);
			if (SnowtimeStage.ToggleBloodGulch.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STBGSceneDef);
				Log.Debug("Adding Blood Gulch to loop");
				Log.Debug(STBGSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleBloodGulch.Value)
			{
				Log.Debug("Skipped adding Blood Gulch to the loop");
			}
			Log.Debug("Sidewinder Config Status?");
			Log.Debug(SnowtimeStage.ToggleSidewinder.Value);
			if (SnowtimeStage.ToggleSidewinder.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STSWSceneDef);
				Log.Debug("Adding Sidewinder to the loop");
				Log.Debug(STSWSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleSidewinder.Value)
			{
				Log.Debug("Skipped adding Sidewinder to the loop");
			}
			Log.Debug("Death Island Config Status?");
			Log.Debug(SnowtimeStage.ToggleDeathIsland.Value);
			if (SnowtimeStage.ToggleDeathIsland.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STSceneDef);
				Log.Debug("Adding Death Island to the loop");
				Log.Debug(STSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleDeathIsland.Value)
			{
				Log.Debug("Skipped adding Death Island to the loop");
			}
			Log.Debug("Ice Fields Config Status?");
			Log.Debug(SnowtimeStage.ToggleIceFields.Value);
			if (SnowtimeStage.ToggleIceFields.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STIFSceneDef);
				Log.Debug("Adding Ice Fields to the loop");
				Log.Debug(STIFSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleIceFields.Value)
			{
				Log.Debug("Skipped adding Ice Fields to the loop");
			}
			Log.Debug("Gephyrophobia Config Status?");
			Log.Debug(SnowtimeStage.ToggleGephyrophobia.Value);
			if (SnowtimeStage.ToggleGephyrophobia.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STGPHSceneDef);
				Log.Debug("Adding Gephyrophobia to the loop");
				Log.Debug(STGPHSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleGephyrophobia.Value)
			{
				Log.Debug("Skipped adding Gephyrophobia to the loop");
			}
			Log.Debug("Sandtrap Config Status?");
			Log.Debug(SnowtimeStage.ToggleSandtrap.Value);
			if (SnowtimeStage.ToggleSandtrap.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STShrineSceneDef);
				Log.Debug("Adding Sandtrap to the loop");
				Log.Debug(STShrineSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleSandtrap.Value)
			{
				Log.Debug("Skipped adding Sandtrap to the loop");
			}
			Log.Debug("Halo Config Status?");
			Log.Debug(SnowtimeStage.ToggleHalo.Value);
			if (SnowtimeStage.ToggleHalo.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STHSceneDef);
				Log.Debug("Adding Halo to the loop");
				Log.Debug(STHSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleHalo.Value)
			{
				Log.Debug("Skipped adding Halo to the loop");
			}
			Log.Debug("Halo Config Status?");
			Log.Debug(SnowtimeStage.ToggleHalo2.Value);
			if (SnowtimeStage.ToggleHalo2.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STH2SceneDef);
				Log.Debug("Adding Halo(Alt) to the loop");
				Log.Debug(STH2SceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleHalo2.Value)
			{
				Log.Debug("Skipped adding Halo(Alt) to the loop");
			}
			Log.Debug("New Mombasa Bridge Config Status?");
			Log.Debug(SnowtimeStage.ToggleNMB.Value);
			if (SnowtimeStage.ToggleNMB.Value)
			{
				StageRegistration.RegisterSceneDefToLoop(STNMBSceneDef);
				Log.Debug("Adding New Mombasa Bridge to the loop");
				Log.Debug(STNMBSceneDef.destinationsGroup);
			}
			if (!SnowtimeStage.ToggleNMB.Value)
			{
				Log.Debug("Skipped adding New Mombasa Bridge to the loop");
			}
		}

		private static IEnumerator LoadAllAssetsAsync<T>(AssetBundle assetBundle, IProgress<float> progress, Action<T[]> onAssetsLoaded) where T : Object
		{
			AssetBundleRequest sceneDefsRequest = assetBundle.LoadAllAssetsAsync<T>();
			while (!((AsyncOperation)sceneDefsRequest).isDone)
			{
				progress.Report(((AsyncOperation)sceneDefsRequest).progress);
				yield return null;
			}
			onAssetsLoaded(sceneDefsRequest.allAssets.Cast<T>().ToArray());
		}

		internal static void LoadSoundBanks(string soundbanksFolderPath)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			AKRESULT val = AkSoundEngine.AddBasePath(soundbanksFolderPath);
			if ((int)val == 1)
			{
				Log.Info("Added bank base path : " + soundbanksFolderPath);
			}
			else
			{
				Log.Error("Error adding base path : " + soundbanksFolderPath + " " + $"Error code : {val}");
			}
			uint num = default(uint);
			val = AkSoundEngine.LoadBank("SnowtimeStagesInit.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : SnowtimeStagesInit.bnk");
			}
			else
			{
				Log.Error("Error loading bank : SnowtimeStagesInit.bnk " + $"Error code : {val}");
			}
			val = AkSoundEngine.LoadBank("SnowtimeStagesMusic.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : SnowtimeStagesMusic.bnk");
			}
			else
			{
				Log.Error("Error loading bank : SnowtimeStagesMusic.bnk " + $"Error code : {val}");
			}
			val = AkSoundEngine.LoadBank("SnowtimeStagesSounds.bnk", ref num);
			if ((int)val == 1)
			{
				Log.Info("Added bank : SnowtimeStagesSounds.bnk");
			}
			else
			{
				Log.Error("Error loading bank : SnowtimeStagesSounds.bnk " + $"Error code : {val}");
			}
		}
	}
}