Decompiled source of BarackObamaShipIntro v1.0.0

ObamaIntroMod.dll

Decompiled 6 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 ObamaIntroMod.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("ObamaIntroMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ObamaIntroMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a5cf649-5344-4b19-b0cf-cc40d908fde3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ObamaIntroMod
{
	[BepInPlugin("Tomato.ObamaIntroMod", "Obama Intro Mod", "1.0.0")]
	public class ObamaIntroMod : BaseUnityPlugin
	{
		private const string modGUID = "Tomato.ObamaIntroMod";

		private const string modName = "Obama Intro Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Tomato.ObamaIntroMod");

		private static ObamaIntroMod 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("Tomato.ObamaIntroMod");
			mls.LogInfo((object)"Obama Intro mod loaded");
			SoundFx = new List<AudioClip>();
			harmony.PatchAll(typeof(ObamaIntroMod));
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("ObamaIntroMod.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "obama");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Obama intro Asset Bundle loaded!");
				SoundFx = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogInfo((object)"Obama intro Asset Bundle failed to load!");
			}
			harmony.PatchAll(typeof(ShipIntroPatches));
		}
	}
}
namespace ObamaIntroMod.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class ShipIntroPatches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPrefix(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = ObamaIntroMod.SoundFx[0];
		}
	}
}