Decompiled source of ShipIntroSFX v1.0.0

ShipIntro.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using ShipIntro.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("ShipIntro")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipIntro")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d77940fb-db2a-4cde-9206-4a61c29703a8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShipIntro
{
	[BepInPlugin("Ex.ShipIntroMod", "Ex Ship Intro Replacer Mod", "1.0.0")]
	public class ShipIntroBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.ShipIntroMod";

		private const string modName = "Ex Ship Intro Replacer Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Ex.ShipIntroMod");

		private static ShipIntroBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip newShipIntroSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.ShipIntroMod");
			mls.LogInfo((object)"Ship Intro SFX mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "ShipIntro.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "ShipIntroSFX";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newShipIntroSFX = val.LoadAsset<AudioClip>("Assets/endtheme.mp3");
			harmony.PatchAll(typeof(ShipIntroBase));
			harmony.PatchAll(typeof(ShipIntroPatch));
			mls.LogInfo((object)"Thumper SFX mod has loaded.");
		}
	}
}
namespace ShipIntro.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class ShipIntroPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void ShipIntroSFXPatch(ref AudioClip ___shipIntroSpeechSFX)
		{
			___shipIntroSpeechSFX = ShipIntroBase.newShipIntroSFX;
		}
	}
}