Decompiled source of EquipmentAnyways v1.0.2

EquipmentAnyways.dll

Decompiled 10 hours ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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: AssemblyTitle("EquipmentAnyways")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EquipmentAnyways")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8f19f41a-fbd9-4cca-abeb-bdb89afd3193")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace EquipmentAnywaysMod;

[BepInPlugin("com.morsecodeguy.equipmentanyways", "Equipment Anyways", "1.0.0")]
public class EquipmentAnyways : BaseUnityPlugin
{
	private const string targetButtonName = "EquipmentButton";

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(FindAndActivateAllButtons());
	}

	private IEnumerator FindAndActivateAllButtons()
	{
		while (true)
		{
			GameObject[] allObjects = Object.FindObjectsOfType<GameObject>();
			GameObject[] array = allObjects;
			foreach (GameObject obj in array)
			{
				if (!(((Object)obj).name == "EquipmentButton"))
				{
					continue;
				}
				Button buttonComponent = obj.GetComponent<Button>();
				if ((Object)(object)buttonComponent != (Object)null)
				{
					if (!((Selectable)buttonComponent).interactable)
					{
						((Selectable)buttonComponent).interactable = true;
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Found and enabled button: " + ((Object)obj).name + "."));
					}
					Transform textChild = obj.transform.Find("Text");
					if ((Object)(object)textChild != (Object)null)
					{
						Text textComponent = ((Component)textChild).GetComponent<Text>();
						if ((Object)(object)textComponent != (Object)null)
						{
							((Graphic)textComponent).color = new Color(0.5804f, 0.9529f, 0.8941f, 1f);
						}
					}
				}
				Component disableForDemo = obj.GetComponent("DisableForDemo");
				if ((Object)(object)disableForDemo != (Object)null)
				{
					Object.Destroy((Object)(object)disableForDemo);
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Removed DisableForDemo component from " + ((Object)obj).name + "."));
				}
			}
			yield return (object)new WaitForSeconds(1f);
		}
	}
}