Decompiled source of PaperDoll v1.0.0

PaperDoll.dll

Decompiled an hour ago
using System;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PaperDoll")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PaperDoll")]
[assembly: AssemblyTitle("PaperDoll")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PaperDoll
{
	[BepInPlugin("com.scoutisdelicious.PaperDoll", "PaperDoll", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerAnimations), "Start")]
		public class PaperDollPatch
		{
			private static void Postfix(PlayerAnimations __instance)
			{
				GameObject val = Object.Instantiate<GameObject>(cameraObject, ((Component)__instance).transform);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogError((object)("FAILED TO LOAD IN " + (object)val));
					return;
				}
				GameObject val2 = Object.Instantiate<GameObject>(dollCanvas);
				if ((Object)(object)val2 == (Object)null)
				{
					Logger.LogError((object)("FAILED TO LOAD IN " + (object)val2));
				}
			}
		}

		public const string PluginGuid = "com.scoutisdelicious.PaperDoll";

		public const string PluginName = "PaperDoll";

		public const string PluginVersion = "1.0.0";

		internal static ManualLogSource Logger;

		public static Plugin instance;

		public static GameObject cameraObject;

		public static RenderTexture dollRenderTexture;

		public static GameObject dollCanvas;

		public static AssetBundle dollBundle;

		private void Awake()
		{
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			instance = this;
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			Logger.LogInfo((object)"Loading in the paper doll");
			dollBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "paperdoll.bundle"));
			if ((Object)(object)dollBundle == (Object)null)
			{
				Logger.LogError((object)"FAILED TO LOAD ASSETBUNDLE");
				return;
			}
			Logger.LogInfo((object)("Loaded in " + (object)dollBundle));
			cameraObject = dollBundle.LoadAsset<GameObject>("DollCamera");
			if ((Object)(object)cameraObject == (Object)null)
			{
				Logger.LogError((object)"FAILED TO LOAD CAMERA");
				return;
			}
			Logger.LogInfo((object)("Loaded in " + (object)cameraObject));
			dollCanvas = dollBundle.LoadAsset<GameObject>("DollCanvas");
			if ((Object)(object)dollCanvas == (Object)null)
			{
				Logger.LogError((object)"FAILED TO LOAD CANVAS");
				return;
			}
			Logger.LogInfo((object)("Loaded in " + (object)dollCanvas));
			dollRenderTexture = dollBundle.LoadAsset<RenderTexture>("RenderTexture");
			if ((Object)(object)dollRenderTexture == (Object)null)
			{
				Logger.LogError((object)"FAILED TO LOAD RENDER TEXTURE");
				return;
			}
			Logger.LogInfo((object)("Loaded in " + (object)dollRenderTexture));
			new Harmony("com.scoutisdelicious.PaperDoll").PatchAll();
		}
	}
}