Decompiled source of StyleGreenScreen v1.0.0

GreenOverlay.dll

Decompiled 11 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GreenOverlay")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GreenOverlay")]
[assembly: AssemblyTitle("GreenOverlay")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace GreenOverlay
{
	[BepInPlugin("GreenOverlay", "GreenOverlay", "1.0.0")]
	public class GreenOverlay : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private static GameObject overlayCanvas;

		private bool weaponsHidden = false;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"GreenOverlay loaded!");
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)290))
			{
				ToggleWeapons();
			}
			if (Input.GetKeyDown((KeyCode)291))
			{
				CreateOverlay();
			}
		}

		private void ToggleWeapons()
		{
			string[] array = new string[2] { "Guns", "Punch" };
			foreach (string text in array)
			{
				GameObject val = GameObject.Find(text);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogInfo((object)(text + " not found!"));
					continue;
				}
				Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
				Renderer[] array2 = componentsInChildren;
				foreach (Renderer val2 in array2)
				{
					if (!(val2 is ParticleSystemRenderer) && !(val2 is TrailRenderer) && !(val2 is LineRenderer))
					{
						val2.enabled = !weaponsHidden;
					}
				}
			}
			weaponsHidden = !weaponsHidden;
			Logger.LogInfo((object)$"Weapons hidden: {weaponsHidden}");
		}

		private void CreateOverlay()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_019e: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)overlayCanvas != (Object)null)
			{
				Object.Destroy((Object)(object)overlayCanvas);
				overlayCanvas = null;
			}
			Canvas val = null;
			Canvas[] array = Object.FindObjectsOfType<Canvas>();
			foreach (Canvas val2 in array)
			{
				if (((Object)((Component)val2).gameObject).name == "StyleCanvas")
				{
					val = val2;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogInfo((object)"StyleCanvas not found!");
				return;
			}
			overlayCanvas = new GameObject("GreenOverlayCanvas");
			overlayCanvas.layer = 13;
			overlayCanvas.transform.SetParent(((Component)val).transform.parent, false);
			overlayCanvas.transform.localPosition = ((Component)val).transform.localPosition;
			overlayCanvas.transform.localRotation = ((Component)val).transform.localRotation;
			overlayCanvas.transform.localScale = ((Component)val).transform.localScale;
			Canvas val3 = overlayCanvas.AddComponent<Canvas>();
			val3.renderMode = (RenderMode)2;
			val3.sortingOrder = 1;
			RectTransform component = overlayCanvas.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(882f, 496f);
			GameObject val4 = new GameObject("GreenPanel");
			val4.layer = 13;
			val4.transform.SetParent(overlayCanvas.transform, false);
			Image val5 = val4.AddComponent<Image>();
			((Graphic)val5).color = new Color(0f, 1f, 0f, 1f);
			RectTransform component2 = val4.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, -0.5f);
			component2.anchorMax = new Vector2(1f, 1.5f);
			component2.offsetMin = Vector2.zero;
			component2.offsetMax = Vector2.zero;
			Logger.LogInfo((object)"Done!");
		}
	}
}