Decompiled source of ShipIntroFORTHECOMPANY v1.0.0

ShipStartAudioReplacement.dll

Decompiled 8 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 HarmonyLib;
using ShipStartAudioReplacement.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("ShipStartAudioReplacement")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipStartAudioReplacement")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("457f7a83-7b28-442c-a6c5-13a04ab497fc")]
[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 ShipStartAudioReplacement
{
	[BepInPlugin("Elliot.ShipAudioReplacement", "Staryuceleste Ship Audio Replacement", "1.0.0")]
	public class ShipAudioModBase : BaseUnityPlugin
	{
		private const string modGUID = "Elliot.ShipAudioReplacement";

		private const string modName = "Staryuceleste Ship Audio Replacement";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Elliot.ShipAudioReplacement");

		private static ShipAudioModBase 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("Elliot.ShipAudioReplacement");
			mls.LogInfo((object)"ShipAudioModBase awake called");
			harmony.PatchAll(typeof(ShipAudioModBase));
			harmony.PatchAll(typeof(ShipStartAudioPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("ShipStartAudioReplacement.dll".ToCharArray());
			bundle = AssetBundle.LoadFromFile(location + "staryuceleste");
			if ((Object)(object)bundle != (Object)null)
			{
				mls.LogInfo((object)"Loaded asset bundle ShipAudioReplacement staryuceleste");
				SoundFX = bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle ShipAudioReplacement staryuceleste");
			}
		}
	}
}
namespace ShipStartAudioReplacement.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class ShipStartAudioPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = ShipAudioModBase.SoundFX[0];
		}
	}
}