Decompiled source of MoreButtons v1.0.0

MoreButtons.dll

Decompiled a year ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2.UI.MainMenu;
using RoR2;
using RoR2.UI.MainMenu;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("MoreButtons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreButtons")]
[assembly: AssemblyTitle("MoreButtons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 MoreButtons
{
	[BepInPlugin("HIFU.MoreButtons", "MoreButtons", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.MoreButtons";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "MoreButtons";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource logger;

		public static List<GameObject> buttons = new List<GameObject>();

		public void Awake()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			logger = ((BaseUnityPlugin)this).Logger;
			MainMenuController.StartManaged += new hook_StartManaged(MainMenuController_StartManaged);
		}

		private void MainMenuController_StartManaged(orig_StartManaged orig, MainMenuController self)
		{
			orig.Invoke(self);
			Transform transform = self.mainMenuButtonPanel.transform;
			Transform child = transform.GetChild(0);
			((Behaviour)((Component)child).GetComponent<VerticalLayoutGroup>()).enabled = false;
			for (int i = 0; i < child.childCount; i++)
			{
				GameObject gameObject = ((Component)child.GetChild(i)).gameObject;
				((MonoBehaviour)self).StartCoroutine(ChangeDimensions(gameObject, self));
				buttons.Add(gameObject);
			}
			for (int j = 0; j < buttons.Count; j++)
			{
				GameObject val = buttons[j];
				if (Object.op_Implicit((Object)(object)val))
				{
					for (int k = 0; k < 50; k++)
					{
						GameObject button = Object.Instantiate<GameObject>(val);
						((MonoBehaviour)self).StartCoroutine(ChangeDimensions(button, self));
					}
					buttons.Remove(val);
				}
			}
		}

		public IEnumerator ChangeDimensions(GameObject button, MainMenuController self)
		{
			yield return (object)new WaitForSeconds(0.01f);
			Transform genericMenuButtonPanel = self.mainMenuButtonPanel.transform;
			Transform juicePanel = genericMenuButtonPanel.GetChild(0);
			yield return (object)new WaitForSeconds(0.01f);
			button.transform.SetParent(juicePanel);
			RectTransform rect = default(RectTransform);
			if (button.TryGetComponent<RectTransform>(ref rect))
			{
				((Transform)rect).localPosition = new Vector3(RoR2Application.rng.RangeFloat(-800f, 800f), RoR2Application.rng.RangeFloat(-598f, 438f), 0f);
				rect.sizeDelta = new Vector2(RoR2Application.rng.RangeFloat(100f, 500f), RoR2Application.rng.RangeFloat(20f, 100f));
			}
		}
	}
}