Decompiled source of FunnySounds v1.0.3

FunnySounds.dll

Decompiled 7 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 FunnySounds.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("FunnySounds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FunnySounds")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b785dba3-1ce5-4cd3-8d24-9a7d2e6e94a0")]
[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 FunnySounds
{
	[BepInPlugin("daus.FunnySounds", "FunnySounds", "1.0.2")]
	public class FunnySoundsBase : BaseUnityPlugin
	{
		private const string modGUID = "daus.FunnySounds";

		private const string modName = "FunnySounds";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("daus.FunnySounds");

		private static FunnySoundsBase instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> soundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("daus.FunnySounds");
			mls.LogInfo((object)"FunnySounds awoke");
			harmony.PatchAll(typeof(ShipTeleporterPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			soundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)instance).Info.Location;
			location = location.TrimEnd("FunnySounds.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "newBeamUp");
			if ((Object)(object)Bundle != (Object)null)
			{
				soundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
				mls.LogInfo((object)"Successfully loaded AssetBundle");
			}
			else
			{
				mls.LogError((object)"Failed to load AssetBundle");
			}
		}
	}
}
namespace FunnySounds.Patches
{
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class ShipTeleporterPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void patchBeamUpSound(ShipTeleporter __instance)
		{
			__instance.beamUpPlayerBodySFX = FunnySoundsBase.soundFX[0];
		}
	}
}