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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnemiesReturns.Configuration;
using EnemiesReturns.Configuration.LynxTribe;
using EnemiesReturns.Enemies.LynxTribe.Scout;
using EnemiesReturns.Enemies.LynxTribe.Shaman;
using EnemiesReturns.Enemies.LynxTribe.Totem;
using EnemiesReturns.Enemies.Spitter;
using FSCStage.Content;
using HG.Reflection;
using MSU.Config;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using SS2;
using ShaderSwapper;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
[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 FSCStage
{
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);
}
}
public class IsStarstorm2
{
private static bool? _enabled;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm.MSU") && Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm");
}
return _enabled.Value;
}
}
}
public class IsEnemiesReturns
{
private static bool? _enabled;
public static bool enabled
{
get
{
if (!_enabled.HasValue)
{
_enabled = Chainloader.PluginInfos.ContainsKey("com.Viliger.EnemiesReturns");
}
return _enabled.Value;
}
}
}
public class EnemiesReturnsCompat
{
public static void AddEnemies()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Expected O, but got Unknown
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Expected O, but got Unknown
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Expected O, but got Unknown
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Expected O, but got Unknown
if (FSCStage.toggleLynxTotem.Value && LynxTotem.Enabled.Value && !LynxTotem.DefaultStageList.Value.Contains("foggyswampdownpour"))
{
DirectorCard card = new DirectorCard
{
spawnCard = (SpawnCard)SpawnCards.cscLynxTotemDefault,
spawnDistance = (MonsterSpawnDistance)0,
selectionWeight = LynxTotem.SelectionWeight.Value,
minimumStageCompletions = LynxTotem.MinimumStageCompletion.Value
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card,
MonsterCategory = (MonsterCategory)4
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Lynx Totem added to foggyswampdownpour's spawn pool.");
}
if (FSCStage.toggleLynxScout.Value && (LynxTotem.Enabled.Value || LynxShaman.Enabled.Value) && !LynxScout.DefaultStageList.Value.Contains("foggyswampdownpour"))
{
DirectorCard card2 = new DirectorCard
{
spawnCard = (SpawnCard)SpawnCards.cscLynxScoutDefault,
spawnDistance = (MonsterSpawnDistance)0,
selectionWeight = LynxScout.SelectionWeight.Value,
minimumStageCompletions = LynxScout.MinimumStageCompletion.Value
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card2,
MonsterCategory = (MonsterCategory)2
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Lynx Scout added to foggyswampdownpour's spawn pool.");
}
if (FSCStage.toggleLynxShaman.Value && LynxShaman.Enabled.Value && !LynxShaman.DefaultStageList.Value.Contains("foggyswampdownpour"))
{
DirectorCard card3 = new DirectorCard
{
spawnCard = (SpawnCard)SpawnCards.cscLynxShamanDefault,
spawnDistance = (MonsterSpawnDistance)0,
selectionWeight = LynxShaman.SelectionWeight.Value,
minimumStageCompletions = LynxShaman.MinimumStageCompletion.Value
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card3,
MonsterCategory = (MonsterCategory)2
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Lynx Shaman added to foggyswampdownpour's spawn pool.");
}
if (FSCStage.toggleSpitter.Value && Spitter.Enabled.Value && !Spitter.DefaultStageList.Value.Contains("foggyswampdownpour"))
{
DirectorCard card4 = new DirectorCard
{
spawnCard = (SpawnCard)SpawnCards.cscSpitterDefault,
spawnDistance = (MonsterSpawnDistance)0,
selectionWeight = Spitter.SelectionWeight.Value,
minimumStageCompletions = Spitter.MinimumStageCompletion.Value
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card4,
MonsterCategory = (MonsterCategory)3
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Spitter added to foggyswampdownpour's spawn pool.");
}
}
}
public class Starstorm2Compat
{
public static string FindEnemyConfig(string monsterName)
{
string text = "00 - Enemy Disabling.Disable Enemy: " + monsterName;
ConfigEntryBase[] configEntries = SS2Config.ConfigMonster.GetConfigEntries();
foreach (ConfigEntryBase val in configEntries)
{
if (((object)val.Definition).ToString() == text)
{
return val.GetSerializedValue();
}
}
return "false";
}
public static void AddEnemies()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
string text = FindEnemyConfig("Lamp Boss");
if (FSCStage.toggleWayfarer.Value && text == "false")
{
DirectorCard card = new DirectorCard
{
spawnCard = SS2Assets.LoadAsset<SpawnCard>("scLampBoss", (SS2Bundle)17),
spawnDistance = (MonsterSpawnDistance)0,
selectionWeight = 1
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card,
MonsterCategory = (MonsterCategory)4
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Wayfarer added to foggyswampdownpour's spawn pool.");
}
string text2 = FindEnemyConfig("Lamp");
if (FSCStage.toggleFollower.Value && text2 == "false")
{
DirectorCard card2 = new DirectorCard
{
spawnCard = SS2Assets.LoadAsset<SpawnCard>("scLamp", (SS2Bundle)17),
spawnDistance = (MonsterSpawnDistance)2,
selectionWeight = 2
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card2,
MonsterCategory = (MonsterCategory)2
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Follower added to foggyswampdownpour's spawn pool.");
}
if (((ConfiguredVariable<bool>)(object)SS2Config.enableBeta).value)
{
string text3 = FindEnemyConfig("Acid Bug");
if (FSCStage.toggleAcidBug.Value && text3 == "false")
{
DirectorCard card3 = new DirectorCard
{
spawnCard = SS2Assets.LoadAsset<SpawnCard>("cscAcidBug", (SS2Bundle)17),
spawnDistance = (MonsterSpawnDistance)0,
selectionWeight = 2,
minimumStageCompletions = 5
};
Helpers.AddNewMonsterToStage(new DirectorCardHolder
{
Card = card3,
MonsterCategory = (MonsterCategory)2
}, false, (Stage)1, "foggyswampdownpour");
Log.Info("Archer Wasp added to foggyswampdownpour's spawn pool.");
}
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("wormsworms.WetlandDownpour", "WetlandDownpour", "0.2.1")]
public class FSCStage : BaseUnityPlugin
{
public const string Author = "wormsworms";
public const string Name = "WetlandDownpour";
public const string Version = "0.2.1";
public const string GUID = "wormsworms.WetlandDownpour";
public static FSCStage instance;
public static ConfigEntry<bool> loopVariant;
public static ConfigEntry<bool> replaceFoggyswamp;
public static ConfigEntry<bool> toggleWayfarer;
public static ConfigEntry<bool> toggleFollower;
public static ConfigEntry<bool> toggleAcidBug;
public static ConfigEntry<bool> toggleLynxTotem;
public static ConfigEntry<bool> toggleLynxScout;
public static ConfigEntry<bool> toggleLynxShaman;
public static ConfigEntry<bool> toggleSpitter;
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
ConfigSetup();
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(GiveToRoR2OurContentPackProviders);
Language.collectLanguageRootFolders += CollectLanguageRootFolders;
Run.PickNextStageScene += new hook_PickNextStageScene(ReplaceWetlandAspect);
Run.onRunStartGlobal += InitializeBazaarSeerValues;
RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(AddModdedEnemies));
}
public static void AddModdedEnemies()
{
if (IsStarstorm2.enabled)
{
Starstorm2Compat.AddEnemies();
}
if (IsEnemiesReturns.enabled)
{
EnemiesReturnsCompat.AddEnemies();
}
}
public void InitializeBazaarSeerValues(Run run)
{
if (loopVariant.Value && !replaceFoggyswamp.Value)
{
SceneCatalog.GetSceneDefFromSceneName("foggyswamp").filterOutOfBazaar = false;
SceneCatalog.GetSceneDefFromSceneName("foggyswampdownpour").filterOutOfBazaar = true;
}
else if (replaceFoggyswamp.Value)
{
SceneCatalog.GetSceneDefFromSceneName("foggyswamp").filterOutOfBazaar = true;
SceneCatalog.GetSceneDefFromSceneName("foggyswampdownpour").filterOutOfBazaar = false;
}
}
public void ReplaceWetlandAspect(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices)
{
orig.Invoke(self, choices);
if (loopVariant.Value && !replaceFoggyswamp.Value)
{
if (Run.instance.stageClearCount > 3 && !SceneCatalog.GetSceneDefFromSceneName("foggyswamp").filterOutOfBazaar)
{
SceneCatalog.GetSceneDefFromSceneName("foggyswamp").filterOutOfBazaar = true;
SceneCatalog.GetSceneDefFromSceneName("foggyswampdownpour").filterOutOfBazaar = false;
SceneCatalog.GetSceneDefFromSceneName("foggyswamp").loopedSceneDef = SceneCatalog.GetSceneDefFromSceneName("foggyswampdownpour");
}
if (self.nextStageScene.baseSceneName != null && self.nextStageScene.baseSceneName == "foggyswamp" && Run.instance.stageClearCount > 3)
{
self.nextStageScene = SceneCatalog.GetSceneDefFromSceneName("foggyswampdownpour");
Log.Debug("Wetland Aspect annihilated by orbital missile; we did it, (read this in a cool voice)");
}
}
else if (replaceFoggyswamp.Value && self.nextStageScene.baseSceneName != null && self.nextStageScene.baseSceneName == "foggyswamp")
{
self.nextStageScene = SceneCatalog.GetSceneDefFromSceneName("foggyswampdownpour");
Log.Debug("Wetland Aspect annihilated by orbital missile; we did it, (read this in a cool voice)");
}
}
private void Destroy()
{
Language.collectLanguageRootFolders -= CollectLanguageRootFolders;
}
private static 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"));
}
private void ConfigSetup()
{
loopVariant = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Post-Loop Variant", true, "If true, Wetland Downpour behaves like a vanilla loop variant, entirely replacing Wetland Aspect after looping. If false, it does not replace Wetland Aspect and it can appear before or after looping, like a normal stage.");
replaceFoggyswamp = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Replace Wetland Aspect", false, "If true, Wetland Downpour will always replace Wetland Aspect, before and after looping, regardless of what value Loop Variant is set to.");
toggleWayfarer = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - Starstorm 2", "Wayfarer", true, "If true, Wayfarers can appear in Wetland Downpour.");
toggleFollower = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - Starstorm 2", "Follower", true, "If true, Followers can appear in Wetland Downpour.");
toggleAcidBug = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - Starstorm 2", "Archer Bug", true, "If true, Archer Bugs can appear in Wetland Downpour (after clearing 5 stages).");
toggleLynxTotem = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - EnemiesReturns", "Lynx Totem", true, "If true, Lynx Totems can appear in Wetland Downpour.");
toggleLynxScout = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - EnemiesReturns", "Lynx Scout", true, "If true, Lynx Scouts can appear in Wetland Downpour.");
toggleLynxShaman = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - EnemiesReturns", "Lynx Shaman", false, "If true, Lynx Shamans can appear in Wetland Downpour.");
toggleSpitter = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings - EnemiesReturns", "Spitter", true, "If true, Spitters can appear in Wetland Downpour.");
}
}
}
namespace FSCStage.Content
{
public class ContentProvider : IContentPackProvider
{
private readonly ContentPack _contentPack = new ContentPack();
public static string assetDirectory;
public string identifier => "wormsworms.WetlandDownpour.ContentProvider";
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
_contentPack.identifier = identifier;
string assetsFolderFullPath = (assetDirectory = Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location));
AssetBundle scenesAssetBundle = null;
yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "WetlandCoolScene"), args.progressReceiver, delegate(AssetBundle assetBundle)
{
scenesAssetBundle = assetBundle;
});
AssetBundle assetsAssetBundle = null;
yield return LoadAssetBundle(Path.Combine(assetsFolderFullPath, "WetlandCoolAssets"), args.progressReceiver, delegate(AssetBundle assetBundle)
{
assetsAssetBundle = assetBundle;
});
yield return FSCContent.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 FSCContent
{
internal const string ScenesAssetBundleFileName = "WetlandCoolScene";
internal const string AssetsAssetBundleFileName = "WetlandCoolAssets";
private static AssetBundle _scenesAssetBundle;
private static AssetBundle _assetsAssetBundle;
internal static UnlockableDef[] UnlockableDefs;
internal static SceneDef[] SceneDefs;
internal static SceneDef FSCSceneDef;
internal static Sprite FSCSceneDefPreviewSprite;
internal static Material FSCBazaarSeer;
public static List<Material> SwappedMaterials = new List<Material>();
internal static IEnumerator LoadAssetBundlesAsync(AssetBundle scenesAssetBundle, AssetBundle assetsAssetBundle, IProgress<float> progress, ContentPack contentPack)
{
_scenesAssetBundle = scenesAssetBundle;
_assetsAssetBundle = assetsAssetBundle;
IEnumerator upgradeStubbedShaders = ShaderSwapper.UpgradeStubbedShadersAsync(_assetsAssetBundle);
while (upgradeStubbedShaders.MoveNext())
{
yield return upgradeStubbedShaders.Current;
}
yield return LoadAllAssetsAsync<UnlockableDef>(assetsAssetBundle, progress, (Action<UnlockableDef[]>)delegate(UnlockableDef[] assets)
{
contentPack.unlockableDefs.Add(assets);
});
yield return LoadAllAssetsAsync<Sprite>(_assetsAssetBundle, progress, (Action<Sprite[]>)delegate(Sprite[] assets)
{
FSCSceneDefPreviewSprite = assets.First((Sprite a) => ((Object)a).name == "texFSCScenePreview");
});
yield return LoadAllAssetsAsync<SceneDef>(_assetsAssetBundle, progress, (Action<SceneDef[]>)delegate(SceneDef[] assets)
{
SceneDefs = assets;
FSCSceneDef = SceneDefs.First((SceneDef sd) => sd.baseSceneNameOverride == "foggyswampdownpour");
Log.Debug(FSCSceneDef.nameToken);
contentPack.sceneDefs.Add(assets);
});
FSCSceneDef.portalMaterial = StageRegistration.MakeBazaarSeerMaterial((Texture2D)FSCSceneDef.previewTexture);
AsyncOperationHandle<MusicTrackDef> mainTrackDefRequest = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/Base/Common/MusicTrackDefs/muFULLSong06.asset");
while (!mainTrackDefRequest.IsDone)
{
yield return null;
}
AsyncOperationHandle<MusicTrackDef> bossTrackDefRequest = Addressables.LoadAssetAsync<MusicTrackDef>((object)"RoR2/Base/Common/MusicTrackDefs/muSong22.asset");
while (!bossTrackDefRequest.IsDone)
{
yield return null;
}
FSCSceneDef.mainTrack = mainTrackDefRequest.Result;
FSCSceneDef.bossTrack = bossTrackDefRequest.Result;
if (FSCStage.loopVariant.Value)
{
StageRegistration.RegisterSceneDefToNormalProgression(FSCSceneDef, 0f, false, true);
}
else if (FSCStage.replaceFoggyswamp.Value)
{
StageRegistration.RegisterSceneDefToNormalProgression(FSCSceneDef, 0f, true, true);
}
else
{
StageRegistration.RegisterSceneDefToNormalProgression(FSCSceneDef, 1f, true, true);
}
}
internal static void Unload()
{
_assetsAssetBundle.Unload(true);
_scenesAssetBundle.Unload(true);
}
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());
}
}
}