Decompiled source of MycoNoBackgroundHover v1.0.3

BepInEx/plugins/MycoNoBackgroundHover.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MycoNoBackgroundHover.Patches;
using Pigeon;
using Pigeon.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("MycoNoBackgroundHover")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+fd474fb197974289cb8be4b7ddb8f66f6a9ff0e1")]
[assembly: AssemblyProduct("MycoNoBackgroundHover")]
[assembly: AssemblyTitle("MycoNoBackgroundHover")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[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 MycoNoBackgroundHover
{
	[MycoMod(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("MycoNoBackgroundHover", "MycoNoBackgroundHover", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private Harmony _harmony = new Harmony("MycoNoBackgroundHover");

		[DllImport("user32.dll")]
		private static extern IntPtr GetForegroundWindow();

		[DllImport("user32.dll")]
		private static extern IntPtr GetActiveWindow();

		public static bool IsGameFocused()
		{
			return GetForegroundWindow() == GetActiveWindow();
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			_harmony.PatchAll(typeof(DefaultButtonPatch));
			_harmony.PatchAll(typeof(DurationButtonPatch));
			_harmony.PatchAll(typeof(SpriteButtonPatch));
			_harmony.PatchAll(typeof(ColorButtonPatch));
			_harmony.PatchAll(typeof(ColorButtonInstantPatch));
			_harmony.PatchAll(typeof(AlphaGroupButtonPatch));
			_harmony.PatchAll(typeof(OutlineThicknessButtonPatch));
			_harmony.PatchAll(typeof(PositionButtonPatch));
			_harmony.PatchAll(typeof(RectSizeButtonPatch));
			_harmony.PatchAll(typeof(RectSizeButtonActivePatch));
			_harmony.PatchAll(typeof(HoverInfoDisplayPatch));
			Logger.LogInfo((object)"MycoNoBackgroundHover is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MycoNoBackgroundHover";

		public const string PLUGIN_NAME = "MycoNoBackgroundHover";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace MycoNoBackgroundHover.Patches
{
	[HarmonyPatch(typeof(AlphaGroupButton))]
	public class AlphaGroupButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(ColorButtonInstant))]
	public class ColorButtonInstantPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(ColorButton))]
	public class ColorButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(DefaultButton))]
	public class DefaultButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("HoverEnter")]
		private static bool Prefix_HoverEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(DurationButton))]
	public class DurationButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(HoverInfoDisplay))]
	public class HoverInfoDisplayPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnHoverEnter")]
		private static bool OnHoverEnter_Prefix()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("Activate")]
		private static bool Activate_Prefix()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(OutlineThicknessButton))]
	public class OutlineThicknessButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(PositionButton))]
	public class PositionButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(RectSizeButtonActive))]
	public class RectSizeButtonActivePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("SetHover")]
		private static bool Prefix_SetHover()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(RectSizeButton))]
	public class RectSizeButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
	[HarmonyPatch(typeof(SpriteButton))]
	public class SpriteButtonPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("HoverEnter")]
		private static bool Prefix_HoverEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerEnter")]
		private static bool Prefix_OnPointerEnter()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerExit")]
		private static bool Prefix_OnPointerExit()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerUp")]
		private static bool Prefix_OnPointerUp()
		{
			return Plugin.IsGameFocused();
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnPointerDown")]
		private static bool Prefix_OnPointerDown()
		{
			return Plugin.IsGameFocused();
		}
	}
}