Decompiled source of IntroShipSpeech v1.0.2

ShipIntroSpeech by seyirs.off.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 HarmonyLib;
using ShipIntroSpeech_by_seyirs.off.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("ShipIntroSpeech by seyirs.off")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipIntroSpeech by seyirs.off")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fd608e15-fd63-461d-b110-ae383fd69876")]
[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 ShipIntroSpeech_by_seyirs.off
{
	[BepInPlugin("SZ.ShipIntroSpeech", "Ship Intro Speech by seyirs.off", "1.0.0.0")]
	public class SZPluginBase : BaseUnityPlugin
	{
		private const string modGUID = "SZ.ShipIntroSpeech";

		private const string modName = "Ship Intro Speech by seyirs.off";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("SZ.ShipIntroSpeech");

		private static SZPluginBase 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("SZ.ShipIntroSpeech");
			mls.LogInfo((object)"SZPluginCore loaded successfully. Proceeding to load ShipIntroSpeech Plugin");
			harmony.PatchAll(typeof(SZPluginBase));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("ShipIntroSpeech by seyirs.off.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "sound");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded ShipIntroSpeech plugin Asset");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load ShipIntroSpeech plugin Asset");
			}
		}
	}
}
namespace ShipIntroSpeech_by_seyirs.off.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = SZPluginBase.SoundFX[0];
		}
	}
}