Decompiled source of ConfigurableButtonRemover v1.1.0

voices.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2.UI.MainMenu;
using RoR2.UI.MainMenu;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("voices")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("voices")]
[assembly: AssemblyTitle("voices")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 MenuUIRemover
{
	[BepInPlugin("pseudopulse.MenuUIRemover", "MenuUIRemover", "1.0.0")]
	public class MenuUIRemover : BaseUnityPlugin
	{
		public const string PluginGUID = "pseudopulse.MenuUIRemover";

		public const string PluginAuthor = "pseudopulse";

		public const string PluginName = "MenuUIRemover";

		public const string PluginVersion = "1.0.0";

		public 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(OnMenuStart);
		}

		private void OnMenuStart(orig_Awake orig, BaseMainMenuScreen self)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Debug.Log((object)"guh");
			string value = ((BaseUnityPlugin)this).Config.Bind<string>("Configuration", "Button Names", "", "The names of buttons you want removed or repositioned seperated by ':'. Matched leniently (for instance 'singleplayer' would match GenericMenuButton(SinglePlayer)). Format is: 'button name,[opt]xPos,[opt]yPos,opt[zPos]'").Value;
			string[] array = value.Split(new char[1] { ':' });
			Transform transform = GameObject.Find("MainMenu/MENU: Title/TitleMenu/SafeZone/GenericMenuButtonPanel").transform;
			foreach (Transform item in transform)
			{
				Transform val = item;
				foreach (Transform item2 in val)
				{
					Transform val2 = item2;
					GameObject gameObject = ((Component)val2).gameObject;
					foreach (string text in array)
					{
						string[] array2 = text.Split(new char[1] { ',' });
						if (!string.IsNullOrWhiteSpace(array2[0]) && ((Object)gameObject).name.ToLower().Contains(array2[0].ToLower()))
						{
							if (array2.Length < 4)
							{
								Object.Destroy((Object)(object)gameObject);
								break;
							}
							Debug.Log((object)"repositioning button");
							float num = float.Parse(array2[1]);
							float num2 = float.Parse(array2[2]);
							float num3 = float.Parse(array2[3]);
							gameObject.transform.position = new Vector3(num, num2, num3);
						}
					}
				}
			}
		}
	}
}