Decompiled source of Lady Ethereal Background Remover v1.0.0

LadyEtherealBackgroundRemover.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LadyEtherealBackgroundRemover.Core;
using Microsoft.CodeAnalysis;
using NineSolsAPI;
using UnityEngine;
using UnityEngine.SceneManagement;

[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("LadyEtherealBackgroundRemover")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lady Ethereal Background Remover")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LadyEtherealBackgroundRemover")]
[assembly: AssemblyTitle("LadyEtherealBackgroundRemover")]
[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.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
	[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 LadyEtherealBackgroundRemover
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LadyEtherealBackgroundRemover";

		public const string PLUGIN_NAME = "LadyEtherealBackgroundRemover";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LadyEtherealBackgroundRemover.ModSystem
{
	[HarmonyPatch]
	public class GamePatches
	{
		private const string LADY_ETHEREAL_SCENE = "A7_S5_Boss_ButterFly";

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameLevel), "Awake")]
		private static void TitleScreenSpawn(GameLevel __instance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "A7_S5_Boss_ButterFly")
			{
				((Component)__instance).gameObject.AddComponent<LadyEtherealBackgroundManager>();
			}
		}
	}
	public interface ICoroutineRunner
	{
		Coroutine StartCoroutine(IEnumerator routine);

		void StopCoroutine(IEnumerator routine);
	}
	public class LadyEtherealBackgroundManager : MonoBehaviour
	{
		private const string UNTOGGLE_OBJECT_NAME = "BGBigHead";

		private void Awake()
		{
			DeactivateBackground();
		}

		private void DeactivateBackground()
		{
			Animator[] componentsInChildren = ((Component)this).GetComponentsInChildren<Animator>(true);
			foreach (Animator val in componentsInChildren)
			{
				if (!(((Object)val).name != "BGBigHead"))
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("LadyEtherealBackgroundRemover", "LadyEtherealBackgroundRemover", "1.0.0")]
	public class LadyEtherealBackgroundRemoverMain : BaseUnityPlugin, ICoroutineRunner
	{
		public Harmony Harmony;

		public static LadyEtherealBackgroundRemoverMain Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Initialize();
			DisplayLoadedVersion();
		}

		private void Initialize()
		{
			KLog.Init(((BaseUnityPlugin)this).Logger);
			RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
			Harmony = Harmony.CreateAndPatchAll(typeof(LadyEtherealBackgroundRemoverMain).Assembly, (string)null);
		}

		private void DisplayLoadedVersion()
		{
			ToastManager.Toast((object)"LadyEtherealBackgroundRemover v1.0.0: Loaded.");
		}

		private void OnDestroy()
		{
			Harmony.UnpatchSelf();
		}

		Coroutine ICoroutineRunner.StartCoroutine(IEnumerator routine)
		{
			return ((MonoBehaviour)this).StartCoroutine(routine);
		}

		void ICoroutineRunner.StopCoroutine(IEnumerator routine)
		{
			((MonoBehaviour)this).StopCoroutine(routine);
		}
	}
}
namespace LadyEtherealBackgroundRemover.Core
{
	internal static class KLog
	{
		private static ManualLogSource logSource;

		private static string PREFIX = "KLOG! ";

		internal static void Init(ManualLogSource logSource)
		{
			KLog.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			logSource.LogDebug((object)(PREFIX + data));
		}

		internal static void Error(object data)
		{
			logSource.LogError((object)(PREFIX + data));
		}

		internal static void Fatal(object data)
		{
			logSource.LogFatal((object)(PREFIX + data));
		}

		internal static void Info(object data)
		{
			logSource.LogInfo((object)(PREFIX + data));
		}

		internal static void Message(object data)
		{
			logSource.LogMessage((object)(PREFIX + data));
		}

		internal static void Warning(object data)
		{
			logSource.LogWarning((object)(PREFIX + data));
		}
	}
}