Decompiled source of ElectroMenu v1.0.0

ElectroMenu.dll

Decompiled a week ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("ElectroMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds Electrostats on the main menu")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ElectroMenu")]
[assembly: AssemblyTitle("ElectroMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ElectroMenu;

[BepInPlugin("ElectroMenu", "ElectroMenu", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(HomeController), "Start")]
	public static class HomeControllerStartPatches
	{
		[HarmonyPriority(0)]
		public static void Postfix()
		{
			OverwriteImage("MULTIContainer", "MultiplayerButtonElectro.png");
			OverwriteImage("COLLECTcontainer", "CollectButtonElectro.png");
			OverwriteImage("IMPROVcontainer", "ImprovButtonElectro.png");
		}
	}

	public static Plugin Instance;

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		new Harmony("ElectroMenu").PatchAll();
	}

	private static void OverwriteImage(string containerName, string imageName)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("MainCanvas/MainMenu/" + containerName);
		GameObject gameObject = ((Component)val.transform.Find("FG")).gameObject;
		Image component = gameObject.GetComponent<Image>();
		component.useSpriteMesh = true;
		((Graphic)component).color = Color.white;
		byte[] array = File.ReadAllBytes(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) + "/Assets/" + imageName);
		Texture2D val2 = new Texture2D(0, 0);
		ImageConversion.LoadImage(val2, array);
		component.sprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), Vector2.zero, 300f);
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "ElectroMenu";

	public const string PLUGIN_NAME = "ElectroMenu";

	public const string PLUGIN_VERSION = "1.0.0";
}