using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using On.RoR2.UI.MainMenu;
using RoR2.UI;
using RoR2.UI.MainMenu;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
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.1", 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;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.rob.DonationButton", "DonationButton", "3.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string MODUID = "com.rob.DonationButton";
public static AssetBundle mainAssetBundle;
public static GameObject donationButtonPrefab;
public static bool mainMenuBegoneInstalled => Chainloader.PluginInfos.ContainsKey("com.rob.MainMenuBegone");
private void Awake()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DonationButton.robbutton"))
{
mainAssetBundle = AssetBundle.LoadFromStream(stream);
}
donationButtonPrefab = mainAssetBundle.LoadAsset<GameObject>("mdlButton");
((Renderer)donationButtonPrefab.GetComponent<MeshRenderer>()).material.shader = Resources.Load<Shader>("Shaders/Deferred/HGStandard");
BaseMainMenuScreen.Awake += new hook_Awake(BaseMainMenuScreen_Awake);
if (mainMenuBegoneInstalled)
{
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
}
}
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "title")
{
GameObject val = Object.Instantiate<GameObject>(donationButtonPrefab);
val.transform.position = new Vector3(0f, 0f, 24f);
val.transform.rotation = Quaternion.Euler(new Vector3(0f, 170f, 0f));
val.transform.localScale = new Vector3(18f, 8f, 4f);
}
}
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
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Expected O, but got Unknown
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: 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));
GameObject val3 = Object.Instantiate<GameObject>(((Component)((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel/JuicePanel/GenericMenuButton (Singleplayer)")).gameObject);
val3.transform.parent = ((Component)self).transform.Find("SafeZone/GenericMenuButtonPanel");
RectTransform component7 = val3.GetComponent<RectTransform>();
((Transform)component7).localPosition = new Vector3(1600f, -100f, 0f);
((Transform)component7).localScale = new Vector3(1.4f, 2.1f, 2f);
HGButton component8 = val3.GetComponent<HGButton>();
component8.hoverToken = "Open up rob's Ko-fi in your default web browser.";
LanguageTextMeshController component9 = val3.GetComponent<LanguageTextMeshController>();
component9.token = "Donate to rob";
((Button)component8).onClick = new ButtonClickedEvent();
((UnityEvent)((Button)component8).onClick).AddListener(new UnityAction(Lol));
}
}
internal static void Lol()
{
Application.OpenURL("https://ko-fi.com/robdev");
}
}