Decompiled source of AddDonationButtonToMainMenu v1.0.2

DonationButton.dll

Decompiled a week ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using On.RoR2.UI.MainMenu;
using RoR2.UI;
using RoR2.UI.MainMenu;
using UnityEngine;
using UnityEngine.Events;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DonationButton")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DonationButton")]
[assembly: AssemblyTitle("DonationButton")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DonationButton;

[BepInPlugin("com.rob.DonationButton", "DonationButton", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
	public const string MODUID = "com.rob.DonationButton";

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		BaseMainMenuScreen.Awake += new hook_Awake(BaseMainMenuScreen_Awake);
	}

	private void BaseMainMenuScreen_Awake(orig_Awake orig, BaseMainMenuScreen self)
	{
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Expected O, but got Unknown
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Expected O, but got Unknown
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Expected O, but got Unknown
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Expected O, but got Unknown
		orig.Invoke(self);
		if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)self).transform.Find("SafeZone")) && Object.op_Implicit((Object)(object)((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel")) && Object.op_Implicit((Object)(object)((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel/JuicePanel")) && Object.op_Implicit((Object)(object)((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel/JuicePanel/GenericMenuButton (Singleplayer)")))
		{
			GameObject val = Object.Instantiate<GameObject>(((Component)((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel/JuicePanel/GenericMenuButton (Singleplayer)")).gameObject);
			val.transform.parent = ((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel");
			RectTransform component = val.GetComponent<RectTransform>();
			((Transform)component).localPosition = new Vector3(500f, -800f, 0f);
			((Transform)component).localScale = Vector3.one * 2f;
			HGButton component2 = val.GetComponent<HGButton>();
			component2.hoverToken = "Open up rob's Ko-fi in your default web browser.";
			LanguageTextMeshController component3 = val.GetComponent<LanguageTextMeshController>();
			component3.token = "Donate to rob";
			((Button)component2).onClick = new ButtonClickedEvent();
			((UnityEvent)((Button)component2).onClick).AddListener(new UnityAction(Lol));
			GameObject val2 = Object.Instantiate<GameObject>(((Component)((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel/JuicePanel/GenericMenuButton (Singleplayer)")).gameObject);
			val2.transform.parent = ((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel");
			RectTransform component4 = val2.GetComponent<RectTransform>();
			((Transform)component4).localPosition = new Vector3(1000f, -500f, 0f);
			((Transform)component4).localScale = Vector3.one * 2f;
			HGButton component5 = val2.GetComponent<HGButton>();
			component5.hoverToken = "Open up rob's Ko-fi in your default web browser.";
			LanguageTextMeshController component6 = val2.GetComponent<LanguageTextMeshController>();
			component6.token = "Donate to rob";
			((Button)component5).onClick = new ButtonClickedEvent();
			((UnityEvent)((Button)component5).onClick).AddListener(new UnityAction(Lol));
		}
	}

	internal static void Lol()
	{
		Application.OpenURL("https://ko-fi.com/robdev");
	}
}