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 OctoPlushBoombox.Patches;
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("OctoPlushBoombox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OctoPlushBoombox")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d5ad0dd3-65ae-4567-b65e-4bae2f085b94")]
[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 OctoPlushBoombox
{
[BepInPlugin("Semario.OctoplushBoombox", "Splatoon 3 Octoplush Boombox", "1.0.0.0")]
public class OctoplushBase : BaseUnityPlugin
{
private const string modGUID = "Semario.OctoplushBoombox";
private const string modName = "Splatoon 3 Octoplush Boombox";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Semario.OctoplushBoombox");
private static OctoplushBase 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.OctoplushBoombox");
mls.LogInfo((object)"Octoplush music mod has awaken");
harmony.PatchAll(typeof(BoomboxItemPatch));
mls = ((BaseUnityPlugin)this).Logger;
Music = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("OctoPlushBoombox.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "octoplush");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Sucessfully loaded octoplush asset bundle");
Music = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Failed to load octoplush asset bundle");
}
}
}
}
namespace OctoPlushBoombox.Patches
{
[HarmonyPatch(typeof(BoomboxItem))]
internal class BoomboxItemPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void OverrideAudio(BoomboxItem __instance)
{
AudioClip[] musicAudios = (AudioClip[])(object)new AudioClip[5]
{
OctoplushBase.Music[0],
OctoplushBase.Music[1],
OctoplushBase.Music[2],
OctoplushBase.Music[3],
OctoplushBase.Music[4]
};
__instance.musicAudios = musicAudios;
}
}
}