Decompiled source of Hoshi Speaker v1.1.2

BepinEx/plugin/CustomSound/Hoshi_Intro_Speech/HoshiSpeech.dll

Decompiled 9 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 HoshiSpeechBase.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("HoshiSpeech")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HoshiSpeech")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f4e60018-c2db-4d12-b33e-175d408666fb")]
[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 HoshiSpeechBase
{
	[BepInPlugin("Meepis.HoshiSpeechBase", "Hoshi Speech", "1.1.0")]
	public class HoshiSpeechBase : BaseUnityPlugin
	{
		private const string modGUID = "Meepis.HoshiSpeechBase";

		private const string modName = "Hoshi Speech";

		private const string modVersion = "1.1.0";

		private readonly Harmony harmony = new Harmony("Meepis.HoshiSpeechBase");

		private static HoshiSpeechBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFx;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			if ((Object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Meepis.HoshiSpeechBase");
			mls.LogInfo((object)"Hoshi intro speech loaded");
			SoundFx = new List<AudioClip>();
			harmony.PatchAll(typeof(HoshiSpeechBase));
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("HoshiSpeech.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "HoshiSpeech");
			if ((Object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Hoshi intro speech Asset Bundle loaded!");
				SoundFx = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogInfo((object)"Hoshi intro speech Asset Bundle failed to load!");
			}
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}
	}
}
namespace HoshiSpeechBase.Patches
{
	internal class PlayerControllerBPatche
	{
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPrefix(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = HoshiSpeechBase.SoundFx[0];
		}
	}
}