using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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("AssortedMusicChanges")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AssortedMusicChanges")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bdfe8a55-ab74-4ede-9146-bb1decaf6828")]
[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 AssortedMusicChanges
{
[BepInPlugin("Semario.AssortedMusicChanges", "Assorted Music Changes", "1.0.0.0")]
public class MusicModBase : BaseUnityPlugin
{
private const string modGUID = "Semario.AssortedMusicChanges";
private const string modName = "Assorted Music Changes";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Semario.AssortedMusicChanges");
private static MusicModBase Instance;
internal ManualLogSource mls;
internal static List<AudioClip> Music;
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Semario.AssortedMusicChanges");
mls.LogInfo((object)"Music mod has awaken");
harmony.PatchAll();
mls = ((BaseUnityPlugin)this).Logger;
Music = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("AssortedMusicChanges.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "music");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Sucessfully loaded asset bundle");
Music = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Failed to load asset bundle");
}
}
}
}
namespace AssortedMusicChanges.Patches
{
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(StartOfRound __instance)
{
__instance.companyVisitMusic = MusicModBase.Music[2];
__instance.alarmSFX = MusicModBase.Music[1];
__instance.shipIntroSpeechSFX = MusicModBase.Music[0];
}
}
}