Decompiled source of LTGIntroSpeech v1.0.0

LTGIntroSpeech.dll

Decompiled 5 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 LTGIntroSpeech.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("LTGIntroSpeech")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LTGIntroSpeech")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7b9a5f55-484c-4803-9873-82a11a65aceb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LTGIntroSpeech
{
	[BepInPlugin("Poseidon.LTGIntroSpeech", "LTGIntroSpeech", "1.0.0")]
	public class LTGIntroSpeechBase : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.LTGIntroSpeech";

		private const string modName = "LTGIntroSpeech";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Poseidon.LTGIntroSpeech");

		private static LTGIntroSpeechBase 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("Poseidon.LTGIntroSpeech");
			mls.LogInfo((object)"Loading LTGIntroSpeech");
			harmony.PatchAll(typeof(StartOfRoundPatch));
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("LTGIntroSpeech.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "ltg");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Succesfully loaded asset bundle.");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle.");
			}
		}
	}
}
namespace LTGIntroSpeech.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = LTGIntroSpeechBase.SoundFX[0];
		}
	}
}