Decompiled source of CaliforniaBoombox v1.0.0

CaliforniaGurlsBoombox.dll

Decompiled 10 months ago
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 CaliforniaGurls.Patches;
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("CaliforniaGurlsBoombox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CaliforniaGurlsBoombox")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1be27bca-f108-4e05-844d-a03c5ec109a6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CaliforniaGurls
{
	[BepInPlugin("RoroMods.CaliforniaGurlsBoombox", "CaliforniaBoomBox", "1.0.0")]
	public class CaliforniaGurlsBase : BaseUnityPlugin
	{
		private const string modGUID = "RoroMods.CaliforniaGurlsBoombox";

		private const string modName = "CaliforniaBoomBox";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("RoroMods.CaliforniaGurlsBoombox");

		private static CaliforniaGurlsBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle1;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("RoroMods.CaliforniaGurlsBoombox");
			mls.LogInfo((object)"CAL E FORNIA GURLS");
			harmony.PatchAll(typeof(CaliforniaGurlsBase));
			harmony.PatchAll(typeof(BoomboxItemPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("CaliforniaGurlsBoombox.dll".ToCharArray());
			Bundle1 = AssetBundle.LoadFromFile(location + "californiagurls");
			if ((Object)(object)Bundle1 != (Object)null)
			{
				SoundFX = Bundle1.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load california gurls's sound. Please retry downloading!");
			}
		}
	}
}
namespace CaliforniaGurls.Patches
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxItemPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(BoomboxItem __instance)
		{
			AudioClip[] musicAudios = CaliforniaGurlsBase.SoundFX.ToArray();
			__instance.musicAudios = musicAudios;
		}
	}
}