Decompiled source of GermanTrashSounds v1.0.0

GermanTrashSounds.dll

Decompiled 2 years 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 GermanTrashSounds.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("GermanTrashSounds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GermanTrashSounds")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("50caf170-fbe1-4bb3-a349-ab0c5bc131e8")]
[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 GermanTrashSounds
{
	[BepInPlugin("Nerd100.GermanTrashSoundsBase", "German Trash Sounds", "1.0.0.0")]
	public class GermanTrashSoundsBase : BaseUnityPlugin
	{
		private const string modGUID = "Nerd100.GermanTrashSoundsBase";

		private const string modName = "German Trash Sounds";

		private const string modVerion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Nerd100.GermanTrashSoundsBase");

		private static GermanTrashSoundsBase 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("Nerd100.GermanTrashSoundsBase");
			mls.LogInfo((object)"Test Mod has awaken");
			harmony.PatchAll(typeof(StartOfRoundPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("GermanTrashSounds.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "hogwarts");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Success load asset bundle");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace GermanTrashSounds.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = GermanTrashSoundsBase.SoundFX[0];
		}
	}
}