Decompiled source of Descriptionless Orbits v1.0.6

orbits.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("orbits")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e8c9dbe4446e10840924336d02ba225002f716e3")]
[assembly: AssemblyProduct("orbits")]
[assembly: AssemblyTitle("orbits")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace orbits
{
	[BepInPlugin("com.crafty.orbits", "Orbits Video Only", "1.0.6")]
	public class plugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.crafty.orbits";

		public const string PluginName = "Orbits Video Only";

		public const string PluginVersion = "1.0.6";

		internal static ManualLogSource Logger;

		internal static AssetBundle orbitsAssets;

		internal static Dictionary<int, string> LevelPatches = new Dictionary<int, string>
		{
			[0] = null,
			[1] = null,
			[2] = "MapView56Vow",
			[3] = "MapView71Gor",
			[4] = "MapView61Mar",
			[5] = "MapView20Ada",
			[6] = "MapView85Ren",
			[7] = "MapView7Din",
			[8] = "MapView21Off",
			[9] = "MapView8Tit",
			[10] = "MapView68Art",
			[12] = "MapView5Emb"
		};

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.crafty.orbits").PatchAll();
			orbitsAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "orbits"));
			if ((Object)(object)orbitsAssets == (Object)null)
			{
				Logger.LogError((object)"No assets for Orbits found. Not loading Orbits.");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				Logger.LogInfo((object)"Orbits Video Only is loaded.");
			}
		}
	}
	public class LevelPatchData
	{
		public string Description;

		public string ClipName;
	}
	[HarmonyPatch(typeof(RoundManager), "Start")]
	public class RoundManager_Start_Patch
	{
		private static Dictionary<string, VideoClip> _cachedVideoClips = new Dictionary<string, VideoClip>();

		private static void Postfix(RoundManager __instance)
		{
			SelectableLevel[] array = StartOfRound.Instance?.levels;
			foreach (SelectableLevel val in array)
			{
				if (!plugin.LevelPatches.TryGetValue(val.levelID, out var value) || string.IsNullOrEmpty(value))
				{
					continue;
				}
				if (!_cachedVideoClips.TryGetValue(value, out var value2))
				{
					value2 = plugin.orbitsAssets.LoadAsset<VideoClip>(value);
					if ((Object)(object)value2 != (Object)null)
					{
						_cachedVideoClips[value] = value2;
					}
				}
				val.videoReel = value2;
			}
			plugin.Logger.LogInfo((object)"Finished Orbits operations.");
		}
	}
}