Decompiled source of TootTallyKeyOverlay v2.1.2

plugin/TootTallyKeyOverlay.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BaboonAPI.Hooks.Initializer;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TootTallyCore;
using TootTallyCore.Graphics;
using TootTallyCore.Utils.TootTallyModules;
using TootTallySettings;
using TootTallySettings.TootTallySettingsObjects;
using UnityEngine;
using UnityEngine.Events;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TootTallyKeyOverlay")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("KeyOverlay, a visual representation of key strokes for streaming or recordings")]
[assembly: AssemblyFileVersion("2.1.2.0")]
[assembly: AssemblyInformationalVersion("2.1.2")]
[assembly: AssemblyProduct("TootTallyKeyOverlay")]
[assembly: AssemblyTitle("TootTallyKeyOverlay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.2.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 TootTallyKeyOverlay
{
	public class KeyOverlayController : MonoBehaviour
	{
		private static readonly KeyCode[] _PREVIEW_KEYCODES;

		private KeyOverlayUIHolder _uiHolder;

		private Dictionary<KeyCode, SingleKey> _keyPressedDict;

		private List<KeyCode> _tootKeys;

		public bool isActive;

		private bool _isPreview;

		public void Init(bool isPreview = false)
		{
			_uiHolder = new KeyOverlayUIHolder(((Component)this).gameObject, isPreview);
			_tootKeys = new List<KeyCode>();
			for (int i = 0; i < GlobalVariables.localsettings.keyboard_tooting_keys.Length; i++)
			{
				if (GlobalVariables.localsettings.keyboard_tooting_keys[i])
				{
					_tootKeys.Add(GlobalVariables.keyboard_key_keycodes[i]);
				}
			}
			_keyPressedDict = new Dictionary<KeyCode, SingleKey>();
			((Behaviour)this).enabled = true;
			isActive = true;
			_isPreview = isPreview;
		}

		public void Update()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			if (!isActive)
			{
				return;
			}
			if (_isPreview)
			{
				if (Random.Range(0f, 1f) >= 0.96f)
				{
					int num = (int)Random.Range(0f, Mathf.Min(Plugin.Instance.KeyCountLimit.Value, (float)_PREVIEW_KEYCODES.Length));
					KeyCode key2 = _PREVIEW_KEYCODES[num];
					if (_keyPressedDict.ContainsKey(key2))
					{
						if (_keyPressedDict[key2].isPressed)
						{
							ManualKeyRelease(key2);
						}
						else
						{
							ManualKeyPress(key2);
						}
					}
					else
					{
						ManualKeyPress(key2);
					}
				}
				CollectionExtensions.Do<SingleKey>((IEnumerable<SingleKey>)_keyPressedDict.Values, (Action<SingleKey>)delegate(SingleKey k)
				{
					k.Update();
				});
				return;
			}
			_tootKeys.ForEach(delegate(KeyCode key)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				if (Input.GetKey(key))
				{
					if (!_keyPressedDict.ContainsKey(key))
					{
						if (!((float)_keyPressedDict.Count >= Plugin.Instance.KeyCountLimit.Value))
						{
							_keyPressedDict.Add(key, _uiHolder.CreateNewKey(key));
							_keyPressedDict[key].OnKeyPress();
							Plugin.LogInfo($"New key pressed, adding {key} to overlay.");
						}
					}
					else if (!_keyPressedDict[key].isPressed)
					{
						_keyPressedDict[key].OnKeyPress();
					}
				}
				else if (_keyPressedDict.ContainsKey(key) && _keyPressedDict[key].isPressed)
				{
					_keyPressedDict[key].OnKeyRelease();
				}
			});
			CollectionExtensions.Do<SingleKey>((IEnumerable<SingleKey>)_keyPressedDict.Values, (Action<SingleKey>)delegate(SingleKey k)
			{
				k.Update();
			});
		}

		public void OnDestroy()
		{
			_tootKeys?.Clear();
			_keyPressedDict?.Clear();
		}

		public void ManualKeyPress(KeyCode key)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			if (!_keyPressedDict.ContainsKey(key) && (float)_keyPressedDict.Count < Plugin.Instance.KeyCountLimit.Value)
			{
				_keyPressedDict.Add(key, _uiHolder.CreateNewKey(key));
				_keyPressedDict[key].OnKeyPress();
			}
			else if (_keyPressedDict.ContainsKey(key) && !_keyPressedDict[key].isPressed)
			{
				_keyPressedDict[key].OnKeyPress();
			}
		}

		public void ManualKeyRelease(KeyCode key)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (_keyPressedDict.ContainsKey(key) && _keyPressedDict[key].isPressed)
			{
				_keyPressedDict[key].OnKeyRelease();
			}
		}

		public void UpdateGraphics()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			_uiHolder.UpdateGraphics();
			if ((float)_keyPressedDict.Count > Plugin.Instance.KeyCountLimit.Value)
			{
				for (int i = (int)Plugin.Instance.KeyCountLimit.Value; i < _PREVIEW_KEYCODES.Length; i++)
				{
					KeyCode key = _PREVIEW_KEYCODES[i];
					if (_keyPressedDict.ContainsKey(key))
					{
						_keyPressedDict[key].Dispose();
						_keyPressedDict.Remove(key);
					}
				}
			}
			CollectionExtensions.Do<SingleKey>((IEnumerable<SingleKey>)_keyPressedDict.Values, (Action<SingleKey>)delegate(SingleKey x)
			{
				x.UpdateGraphics();
			});
		}

		public void Disable()
		{
			isActive = false;
		}

		public void Enable()
		{
			isActive = true;
		}

		static KeyOverlayController()
		{
			KeyCode[] array = new KeyCode[10];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			_PREVIEW_KEYCODES = (KeyCode[])(object)array;
		}
	}
	public static class KeyOverlayManager
	{
		private static KeyOverlayController _keyOverlayController;

		[HarmonyPatch(typeof(GameController), "Start")]
		[HarmonyPostfix]
		public static void OnGameControllerStartSetupOverlay(GameController __instance)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			if (!__instance.freeplay)
			{
				GameObject val = GameObject.Find("GameplayCanvas/UIHolder");
				GameObject val2 = new GameObject("KeyOverlayUIHolder", new Type[3]
				{
					typeof(RectTransform),
					typeof(GridLayoutGroup),
					typeof(KeyOverlayController)
				});
				val2.transform.SetParent(val.transform);
				((Object)val2).name = "KeyOverlayUIHolder";
				_keyOverlayController = val2.GetComponent<KeyOverlayController>();
				_keyOverlayController.Init();
			}
		}

		[HarmonyPatch(typeof(GameController), "Update")]
		[HarmonyPostfix]
		public static void OnUpdateDetectKeyPressed(GameController __instance)
		{
		}
	}
	public class KeyOverlaySettingsPage : TootTallySettingPage
	{
		private static readonly ColorBlock _pageBtnColors;

		private KeyOverlayController _keyOverlayPreview;

		private TootTallySettingDropdown _positionDropdown;

		private TootTallySettingDropdown _beamDirectionDropdown;

		private TootTallySettingToggle _horizontalToggle;

		private TootTallySettingSlider _posXSlider;

		private TootTallySettingSlider _posYSlider;

		private TootTallySettingSlider _keyCountLimitSlider;

		private TootTallySettingSlider _keyElementSizeSlider;

		private TootTallySettingSlider _keyOutlineSizeSlider;

		private TootTallySettingSlider _beamSpeedSlider;

		private TootTallySettingSlider _beamLengthSlider;

		private TootTallySettingColorSliders _beamColorSliders;

		private TootTallySettingColorSliders _keyOuterSliders;

		private TootTallySettingColorSliders _keyPressedOuterSliders;

		private TootTallySettingColorSliders _keyInnerSliders;

		private TootTallySettingColorSliders _keyPressedInnerSliders;

		private TootTallySettingColorSliders _keyTextSliders;

		private TootTallySettingColorSliders _keyPressedTextSliders;

		public KeyOverlaySettingsPage()
			: base("Key Overlay", "Key Overlay", 40f, new Color(0f, 0f, 0f, 0f), _pageBtnColors)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			((TootTallySettingPage)this).AddLabel("Position Alignment", (FontStyles)0, (TextAlignmentOptions)4097);
			_positionDropdown = ((TootTallySettingPage)this).AddDropdown("Position Alignment", (ConfigEntryBase)(object)Plugin.Instance.PositionAlignment);
			_posXSlider = ((TootTallySettingPage)this).AddSlider("PosX Offset", -800f, 800f, 500f, "PosX Offset", Plugin.Instance.PosXOffset, true);
			_posYSlider = ((TootTallySettingPage)this).AddSlider("PosY Offset", -800f, 800f, 500f, "PosY Offset", Plugin.Instance.PosYOffset, true);
			_horizontalToggle = ((TootTallySettingPage)this).AddToggle("Horizontal Alignment", Plugin.Instance.HorizontalAlignment, (UnityAction<bool>)null);
			_keyCountLimitSlider = ((TootTallySettingPage)this).AddSlider("Key Count Limit", 1f, 10f, Plugin.Instance.KeyCountLimit, true);
			_keyElementSizeSlider = ((TootTallySettingPage)this).AddSlider("Key Element Size", 4f, 32f, Plugin.Instance.KeyElementSize, true);
			_keyOutlineSizeSlider = ((TootTallySettingPage)this).AddSlider("Key Outline Size", 0f, 8f, Plugin.Instance.KeyOutlineThiccness, true);
			((TootTallySettingPage)this).AddLabel("Beam Direction", (FontStyles)0, (TextAlignmentOptions)4097);
			_beamDirectionDropdown = ((TootTallySettingPage)this).AddDropdown("Beam Direction", (ConfigEntryBase)(object)Plugin.Instance.BeamDirection);
			_beamSpeedSlider = ((TootTallySettingPage)this).AddSlider("Beam Speed", 60f, 600f, Plugin.Instance.BeamSpeed, true);
			_beamLengthSlider = ((TootTallySettingPage)this).AddSlider("Beam Length", 30f, 600f, Plugin.Instance.BeamLength, true);
			((TootTallySettingPage)this).AddLabel("Beam Color", (FontStyles)0, (TextAlignmentOptions)4097);
			_beamColorSliders = ((TootTallySettingPage)this).AddColorSliders("Beam Color", "Beam Color", Plugin.Instance.BeamColor);
			((TootTallySettingPage)this).AddLabel("KeyOuterColor", (FontStyles)0, (TextAlignmentOptions)4097);
			_keyOuterSliders = ((TootTallySettingPage)this).AddColorSliders("KeyOuterColor", "KeyOuterColor", Plugin.Instance.KeyOuterColor);
			((TootTallySettingPage)this).AddLabel("KeyPressedOuterColor", (FontStyles)0, (TextAlignmentOptions)4097);
			_keyPressedOuterSliders = ((TootTallySettingPage)this).AddColorSliders("KeyPressedOuterColor", "KeyPressedOuterColor", Plugin.Instance.KeyPressedOuterColor);
			((TootTallySettingPage)this).AddLabel("KeyInnerColor", (FontStyles)0, (TextAlignmentOptions)4097);
			_keyInnerSliders = ((TootTallySettingPage)this).AddColorSliders("KeyInnerColor", "KeyInnerColor", Plugin.Instance.KeyInnerColor);
			((TootTallySettingPage)this).AddLabel("KeyPressedInnerColor", (FontStyles)0, (TextAlignmentOptions)4097);
			_keyPressedInnerSliders = ((TootTallySettingPage)this).AddColorSliders("KeyPressedInnerColor", "KeyPressedInnerColor", Plugin.Instance.KeyPressedInnerColor);
			((TootTallySettingPage)this).AddLabel("KeyTextColor", (FontStyles)0, (TextAlignmentOptions)4097);
			_keyTextSliders = ((TootTallySettingPage)this).AddColorSliders("KeyTextColor", "KeyTextColor", Plugin.Instance.KeyTextColor);
			((TootTallySettingPage)this).AddLabel("KeyPressedTextColor", (FontStyles)0, (TextAlignmentOptions)4097);
			_keyPressedTextSliders = ((TootTallySettingPage)this).AddColorSliders("KeyPressedTextColor", "KeyPressedTextColor", Plugin.Instance.KeyPressedTextColor);
		}

		public override void Initialize()
		{
			((TootTallySettingPage)this).Initialize();
			((UnityEvent<bool>)(object)_horizontalToggle.toggle.onValueChanged).AddListener((UnityAction<bool>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyCountLimitSlider.slider.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyElementSizeSlider.slider.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyOutlineSizeSlider.slider.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<int>)(object)_beamDirectionDropdown.dropdown.onValueChanged).AddListener((UnityAction<int>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_beamSpeedSlider.slider.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_beamLengthSlider.slider.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_beamColorSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_beamColorSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_beamColorSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyOuterSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyOuterSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyOuterSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedOuterSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedOuterSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedOuterSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyInnerSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyInnerSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyInnerSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedInnerSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedInnerSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedInnerSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyTextSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyTextSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyTextSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedTextSliders.sliderR.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedTextSliders.sliderG.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
			((UnityEvent<float>)(object)_keyPressedTextSliders.sliderB.onValueChanged).AddListener((UnityAction<float>)UpdatePreviewGraphics);
		}

		public override void OnShow()
		{
			InitPreview();
			((TootTallySettingPage)this).OnShow();
		}

		public override void OnHide()
		{
			DestroyPreview();
			((TootTallySettingPage)this).OnHide();
		}

		private void InitPreview()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_keyOverlayPreview != (Object)null)
			{
				DestroyPreview();
			}
			GameObject val = new GameObject("KeyOverlayUIHolder", new Type[3]
			{
				typeof(RectTransform),
				typeof(GridLayoutGroup),
				typeof(KeyOverlayController)
			});
			val.transform.SetParent(base.gridPanel.transform);
			((Object)val).name = "KeyOverlayUIHolder";
			LayoutElement val2 = val.AddComponent<LayoutElement>();
			val2.ignoreLayout = true;
			_keyOverlayPreview = val.GetComponent<KeyOverlayController>();
			_keyOverlayPreview.Init(isPreview: true);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchoredPosition = new Vector2(1000f, 1800f);
			((Transform)component).localScale = Vector3.one * 2.5f;
		}

		private void DestroyPreview()
		{
			Object.DestroyImmediate((Object)(object)_keyOverlayPreview);
			_keyOverlayPreview = null;
		}

		private void UpdatePreviewGraphics(bool b)
		{
			_keyOverlayPreview.UpdateGraphics();
		}

		private void UpdatePreviewGraphics(int b)
		{
			_keyOverlayPreview.UpdateGraphics();
		}

		private void UpdatePreviewGraphics(float f)
		{
			_keyOverlayPreview.UpdateGraphics();
		}

		static KeyOverlaySettingsPage()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock pageBtnColors = default(ColorBlock);
			((ColorBlock)(ref pageBtnColors)).colorMultiplier = 1f;
			((ColorBlock)(ref pageBtnColors)).fadeDuration = 0.2f;
			((ColorBlock)(ref pageBtnColors)).disabledColor = Color.gray;
			((ColorBlock)(ref pageBtnColors)).normalColor = new Color(1f, 0f, 0f);
			((ColorBlock)(ref pageBtnColors)).pressedColor = new Color(1f, 0.2f, 0.2f);
			((ColorBlock)(ref pageBtnColors)).highlightedColor = new Color(0.8f, 0f, 0f);
			((ColorBlock)(ref pageBtnColors)).selectedColor = new Color(1f, 0f, 0f);
			_pageBtnColors = pageBtnColors;
		}
	}
	public class KeyOverlayUIHolder
	{
		public enum UIAlignment
		{
			BottomRight,
			BottomLeft,
			TopRight,
			TopLeft
		}

		public enum BeamDirection
		{
			Left,
			Up,
			Right,
			Down
		}

		private float fullSize;

		private float elementSize;

		private float marginSize;

		private GameObject _uiHolder;

		private GridLayoutGroup _gridLayout;

		private RectTransform _rectTransform;

		private GameObject _singleKeyPrefab;

		public KeyOverlayUIHolder(GameObject uiHolder, bool isPreview = false)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			elementSize = Plugin.Instance.KeyElementSize.Value;
			marginSize = Plugin.Instance.KeyOutlineThiccness.Value;
			fullSize = elementSize + marginSize;
			_uiHolder = uiHolder;
			_rectTransform = _uiHolder.GetComponent<RectTransform>();
			_gridLayout = _uiHolder.GetComponent<GridLayoutGroup>();
			_rectTransform.offsetMin = (_rectTransform.offsetMax = Vector2.zero);
			((Transform)_rectTransform).localScale = Vector3.one;
			_rectTransform.sizeDelta = Vector2.one * 55f;
			Vector2 val = default(Vector2);
			if (!isPreview)
			{
				switch (Plugin.Instance.PositionAlignment.Value)
				{
				case UIAlignment.TopLeft:
				{
					((LayoutGroup)_gridLayout).childAlignment = (TextAnchor)0;
					RectTransform rectTransform8 = _rectTransform;
					RectTransform rectTransform9 = _rectTransform;
					RectTransform rectTransform10 = _rectTransform;
					((Vector2)(ref val))..ctor(0f, 1f);
					rectTransform10.pivot = val;
					Vector2 anchorMin = (rectTransform9.anchorMax = val);
					rectTransform8.anchorMin = anchorMin;
					break;
				}
				case UIAlignment.TopRight:
				{
					((LayoutGroup)_gridLayout).childAlignment = (TextAnchor)2;
					RectTransform rectTransform6 = _rectTransform;
					RectTransform rectTransform7 = _rectTransform;
					val = (_rectTransform.pivot = Vector2.one);
					Vector2 anchorMin = (rectTransform7.anchorMax = val);
					rectTransform6.anchorMin = anchorMin;
					break;
				}
				case UIAlignment.BottomLeft:
				{
					((LayoutGroup)_gridLayout).childAlignment = (TextAnchor)6;
					RectTransform rectTransform4 = _rectTransform;
					RectTransform rectTransform5 = _rectTransform;
					val = (_rectTransform.pivot = Vector2.zero);
					Vector2 anchorMin = (rectTransform5.anchorMax = val);
					rectTransform4.anchorMin = anchorMin;
					break;
				}
				default:
				{
					((LayoutGroup)_gridLayout).childAlignment = (TextAnchor)8;
					RectTransform rectTransform = _rectTransform;
					RectTransform rectTransform2 = _rectTransform;
					RectTransform rectTransform3 = _rectTransform;
					((Vector2)(ref val))..ctor(1f, 0f);
					rectTransform3.pivot = val;
					Vector2 anchorMin = (rectTransform2.anchorMax = val);
					rectTransform.anchorMin = anchorMin;
					break;
				}
				}
				_rectTransform.anchoredPosition3D = new Vector3(Plugin.Instance.PosXOffset.Value, Plugin.Instance.PosYOffset.Value, 0f);
			}
			else
			{
				((LayoutGroup)_gridLayout).childAlignment = (TextAnchor)8;
				RectTransform rectTransform11 = _rectTransform;
				RectTransform rectTransform12 = _rectTransform;
				RectTransform rectTransform13 = _rectTransform;
				((Vector2)(ref val))..ctor(1f, 0f);
				rectTransform13.pivot = val;
				rectTransform11.anchorMin = (rectTransform12.anchorMax = val);
			}
			_gridLayout.constraintCount = 1;
			_gridLayout.spacing = Vector2.one * 2f;
			_gridLayout.cellSize = Vector2.one * fullSize;
			SetSingleKeyPrefab();
			UpdateGraphics();
		}

		private void SetSingleKeyPrefab()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			_singleKeyPrefab = new GameObject("SingleKeyPrefab", new Type[1] { typeof(Image) });
			GameObject val = new GameObject("InnerImage", new Type[1] { typeof(Image) });
			val.transform.SetParent(_singleKeyPrefab.transform);
			GameObject val2 = new GameObject("InnerImage", new Type[1] { typeof(RawImage) });
			val2.transform.SetParent(_singleKeyPrefab.transform);
			TMP_Text val3 = GameObjectFactory.CreateSingleText(val.transform, "TextKey", "X", (TextFont)0);
			TMP_Text component = ((Component)val3).GetComponent<TMP_Text>();
			RectTransform rectTransform = component.rectTransform;
			RectTransform rectTransform2 = component.rectTransform;
			Vector2 val4 = (component.rectTransform.pivot = Vector2.zero);
			Vector2 anchorMin = (rectTransform2.anchorMax = val4);
			rectTransform.anchorMin = anchorMin;
			component.enableAutoSizing = true;
			component.fontSize = 18f;
			component.fontSizeMin = 5f;
			TMP_Text val6 = GameObjectFactory.CreateSingleText(val.transform, "TextKeyPress", "0", (TextFont)0);
			TMP_Text component2 = ((Component)val6).GetComponent<TMP_Text>();
			RectTransform rectTransform3 = component2.rectTransform;
			RectTransform rectTransform4 = component2.rectTransform;
			val4 = (component2.rectTransform.pivot = Vector2.zero);
			anchorMin = (rectTransform4.anchorMax = val4);
			rectTransform3.anchorMin = anchorMin;
			component2.text = "0";
			component2.fontSize = 6f;
			component2.fontSizeMin = 5f;
		}

		public void UpdateGraphics()
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			elementSize = Plugin.Instance.KeyElementSize.Value;
			marginSize = Plugin.Instance.KeyOutlineThiccness.Value;
			fullSize = elementSize + marginSize;
			if (Plugin.Instance.HorizontalAlignment.Value)
			{
				_gridLayout.constraint = (Constraint)2;
				_gridLayout.startAxis = (Axis)0;
			}
			else
			{
				_gridLayout.constraint = (Constraint)1;
				_gridLayout.startAxis = (Axis)1;
			}
			_gridLayout.cellSize = Vector2.one * fullSize;
		}

		public SingleKey CreateNewKey(KeyCode key)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return new SingleKey(Object.Instantiate<GameObject>(_singleKeyPrefab, _uiHolder.transform), key);
		}
	}
	[BepInPlugin("TootTallyKeyOverlay", "TootTallyKeyOverlay", "2.1.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin, ITootTallyModule
	{
		public static Plugin Instance;

		private const string CONFIG_NAME = "TootTallyKeyOverlay.cfg";

		private Harmony _harmony;

		public static TootTallySettingPage settingPage;

		public ConfigEntry<bool> ModuleConfigEnabled { get; set; }

		public bool IsConfigInitialized { get; set; }

		public string Name
		{
			get
			{
				return "KeyOverlay";
			}
			set
			{
				Name = value;
			}
		}

		public ConfigEntry<KeyOverlayUIHolder.UIAlignment> PositionAlignment { get; set; }

		public ConfigEntry<float> PosXOffset { get; set; }

		public ConfigEntry<float> PosYOffset { get; set; }

		public ConfigEntry<KeyOverlayUIHolder.BeamDirection> BeamDirection { get; set; }

		public ConfigEntry<Color> BeamColor { get; set; }

		public ConfigEntry<Color> KeyOuterColor { get; set; }

		public ConfigEntry<Color> KeyPressedOuterColor { get; set; }

		public ConfigEntry<Color> KeyInnerColor { get; set; }

		public ConfigEntry<Color> KeyPressedInnerColor { get; set; }

		public ConfigEntry<Color> KeyTextColor { get; set; }

		public ConfigEntry<Color> KeyPressedTextColor { get; set; }

		public ConfigEntry<float> KeyElementSize { get; set; }

		public ConfigEntry<float> KeyOutlineThiccness { get; set; }

		public ConfigEntry<float> BeamSpeed { get; set; }

		public ConfigEntry<float> BeamLength { get; set; }

		public ConfigEntry<float> KeyCountLimit { get; set; }

		public ConfigEntry<bool> HorizontalAlignment { get; set; }

		public static void LogInfo(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
		}

		public static void LogError(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogError((object)msg);
		}

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				Instance = this;
				_harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize);
			}
		}

		private void TryInitialize()
		{
			ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Modules", "KeyOverlay", true, "Enabled visual display for key strokes during a song.");
			TootTallyModuleManager.AddModule((ITootTallyModule)(object)this);
			Plugin.Instance.AddModuleToSettingPage((ITootTallyModule)(object)this);
		}

		public void LoadModule()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(Paths.BepInExRootPath, "config/");
			ConfigFile val = new ConfigFile(text + "TootTallyKeyOverlay.cfg", true)
			{
				SaveOnConfigSet = true
			};
			PositionAlignment = val.Bind<KeyOverlayUIHolder.UIAlignment>("General", "PositionAlignment", KeyOverlayUIHolder.UIAlignment.BottomRight, "Rough position of the overlay on the screen.");
			PosXOffset = val.Bind<float>("General", "PosXOffset", 0f, "X position offset for the overlay.");
			PosYOffset = val.Bind<float>("General", "PosYOffset", 0f, "Y position offset for the overlay.");
			KeyCountLimit = val.Bind<float>("General", "KeyCountLimit", 4f, "Limit of keys displayed at the same time. Limited to 10 because on average, humans have less than 10 fingers.");
			KeyElementSize = val.Bind<float>("General", "KeyElementSize", 18f, "Size in pixels of a single key element.");
			KeyOutlineThiccness = val.Bind<float>("General", "KeyOutlineThiccness", 2f, "Size in pixels of a single key element.");
			HorizontalAlignment = val.Bind<bool>("General", "HorizontalAlignment", false, "Switch to horizontal layout.");
			BeamDirection = val.Bind<KeyOverlayUIHolder.BeamDirection>("General", "BeamDirection", KeyOverlayUIHolder.BeamDirection.Left, "Rough position of the overlay on the screen.");
			BeamSpeed = val.Bind<float>("General", "BeamSpeed", 200f, "Speed of the beam when pressing a key. Frame dependent and default at 200fps");
			BeamLength = val.Bind<float>("General", "BeamLength", 150f, "Length of the beam when pressing a key. Default 150px");
			BeamColor = val.Bind<Color>("General", "BeamColor", Color.gray, "Color of the beam when pressing a key.");
			KeyOuterColor = val.Bind<Color>("General", "KeyOuterColor", Color.white, "Color of the outline of a single key element.");
			KeyPressedOuterColor = val.Bind<Color>("General", "KeyPressedOuterColor", Color.gray, "Color of the outline of a single key element when key is pressed.");
			KeyInnerColor = val.Bind<Color>("General", "KeyInnerColor", Color.black, "Color of the inside of a single key element.");
			KeyPressedInnerColor = val.Bind<Color>("General", "KeyPressedInnerColor", Color.gray, "Color of the inside of a single key element when key is pressed.");
			KeyTextColor = val.Bind<Color>("General", "KeyTextColor", Color.white, "Color of the text of a single key element.");
			KeyPressedTextColor = val.Bind<Color>("General", "KeyPressedTextColor", Color.gray, "Color of the text of a single key element when key is pressed.");
			settingPage = TootTallySettingsManager.AddNewPage((TootTallySettingPage)(object)new KeyOverlaySettingsPage());
			Plugin.TryAddThunderstoreIconToPageButton(((BaseUnityPlugin)Instance).Info.Location, Name, settingPage);
			_harmony.PatchAll(typeof(KeyOverlayManager));
			LogInfo("Module loaded!");
		}

		public void UnloadModule()
		{
			_harmony.UnpatchSelf();
			settingPage.Remove();
			LogInfo("Module unloaded!");
		}
	}
	public class SingleKey
	{
		private GameObject _fullGO;

		private GameObject _innerGO;

		private Image _outerImage;

		private Image _innerImage;

		private RawImage _innerBeam;

		private RectTransform _innerBeamRectTransform;

		private RectTransform _fullGORect;

		private RectTransform _innerGoRect;

		private Color[] _innerBeamPixelArray;

		private Color _innerBeamPressColor;

		private Color _innerBeamReleaseColor;

		private Texture2D _innerBeamTexture;

		private TMP_Text _text;

		private TMP_Text _pressCountText;

		private int _pressCount;

		private int _beamLength;

		private float _elapsedTime;

		private float _refreshRate;

		public bool isPressed;

		public bool lastIsPressed;

		public SingleKey(GameObject gameObject, KeyCode key)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			_fullGO = gameObject;
			_fullGORect = _fullGO.GetComponent<RectTransform>();
			_outerImage = _fullGO.GetComponent<Image>();
			_innerGO = ((Component)_fullGO.transform.GetChild(0)).gameObject;
			_innerGoRect = _innerGO.GetComponent<RectTransform>();
			_innerImage = _innerGO.GetComponent<Image>();
			_innerBeam = ((Component)_fullGO.transform.GetChild(1)).GetComponent<RawImage>();
			_innerBeamRectTransform = ((Component)_innerBeam).GetComponent<RectTransform>();
			_innerBeamRectTransform.pivot = Vector2.one;
			_innerBeamReleaseColor = new Color(0f, 0f, 0f, 0f);
			_text = ((Component)_innerGO.transform.GetChild(0)).GetComponent<TMP_Text>();
			_text.text = ((object)(KeyCode)(ref key)).ToString();
			_pressCountText = ((Component)_innerGO.transform.GetChild(1)).GetComponent<TMP_Text>();
			UpdateGraphics();
		}

		public void Update()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			_elapsedTime += Time.deltaTime;
			if (_elapsedTime < 1f / _refreshRate)
			{
				return;
			}
			_elapsedTime = 0f;
			for (int i = 0; i < _innerBeamPixelArray.Length - 1; i++)
			{
				if ((float)i <= (float)_beamLength / 10f && _innerBeamPixelArray[i + 1] != _innerBeamReleaseColor)
				{
					_innerBeamPixelArray[i] = Color.Lerp(_innerBeamReleaseColor, _innerBeamPressColor, (float)i / ((float)_beamLength / 10f));
				}
				else
				{
					_innerBeamPixelArray[i] = _innerBeamPixelArray[i + 1];
				}
			}
			_innerBeamTexture.SetPixels(0, 0, _beamLength, 1, _innerBeamPixelArray);
			_innerBeamTexture.Apply();
			_innerBeam.texture = (Texture)(object)_innerBeamTexture;
		}

		public void OnKeyPress()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)_innerImage).color = Plugin.Instance.KeyPressedInnerColor.Value;
			((Graphic)_outerImage).color = Plugin.Instance.KeyPressedOuterColor.Value;
			_innerBeamPixelArray[_innerBeamPixelArray.Length - 1] = _innerBeamPressColor;
			_pressCount++;
			((Graphic)_pressCountText).color = Plugin.Instance.KeyPressedTextColor.Value;
			_pressCountText.text = _pressCount.ToString();
			isPressed = true;
		}

		public void OnKeyRelease()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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)
			((Graphic)_innerImage).color = Plugin.Instance.KeyInnerColor.Value;
			((Graphic)_outerImage).color = Plugin.Instance.KeyOuterColor.Value;
			_innerBeamPixelArray[_innerBeamPixelArray.Length - 1] = _innerBeamReleaseColor;
			((Graphic)_pressCountText).color = Plugin.Instance.KeyTextColor.Value;
			isPressed = false;
		}

		public void Dispose()
		{
			Object.DestroyImmediate((Object)(object)_fullGO);
		}

		public void UpdateGraphics()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			_refreshRate = Plugin.Instance.BeamSpeed.Value;
			_beamLength = (int)Plugin.Instance.BeamLength.Value;
			_fullGORect.sizeDelta = Vector2.one * (Plugin.Instance.KeyElementSize.Value + Plugin.Instance.KeyOutlineThiccness.Value);
			_innerGoRect.sizeDelta = Vector2.one * Plugin.Instance.KeyElementSize.Value;
			_innerBeamTexture = new Texture2D(_beamLength, 1, (TextureFormat)20, false);
			_innerBeamPixelArray = (Color[])(object)new Color[_beamLength];
			Array.Fill(_innerBeamPixelArray, _innerBeamReleaseColor);
			_innerBeamTexture.SetPixels(0, 0, _beamLength, 1, _innerBeamPixelArray);
			_innerBeamTexture.Apply();
			_innerBeam.texture = (Texture)(object)_innerBeamTexture;
			((Graphic)_innerBeam).color = Plugin.Instance.BeamColor.Value;
			_innerBeamRectTransform.sizeDelta = new Vector2(Plugin.Instance.BeamLength.Value, Plugin.Instance.KeyElementSize.Value + Plugin.Instance.KeyOutlineThiccness.Value);
			Vector2 val = default(Vector2);
			switch (Plugin.Instance.BeamDirection.Value)
			{
			case KeyOverlayUIHolder.BeamDirection.Up:
				val = (_innerBeamRectTransform.anchorMax = (_innerBeamRectTransform.anchorMin = Vector2.one));
				((Transform)_innerBeamRectTransform).eulerAngles = new Vector3(0f, 0f, -90f);
				break;
			case KeyOverlayUIHolder.BeamDirection.Down:
				val = (_innerBeamRectTransform.anchorMax = (_innerBeamRectTransform.anchorMin = Vector2.zero));
				((Transform)_innerBeamRectTransform).eulerAngles = new Vector3(0f, 0f, 90f);
				break;
			case KeyOverlayUIHolder.BeamDirection.Right:
			{
				RectTransform innerBeamRectTransform3 = _innerBeamRectTransform;
				RectTransform innerBeamRectTransform4 = _innerBeamRectTransform;
				((Vector2)(ref val))..ctor(1f, 0f);
				innerBeamRectTransform4.anchorMin = val;
				innerBeamRectTransform3.anchorMax = val;
				((Transform)_innerBeamRectTransform).eulerAngles = new Vector3(0f, 0f, 180f);
				break;
			}
			default:
			{
				RectTransform innerBeamRectTransform = _innerBeamRectTransform;
				RectTransform innerBeamRectTransform2 = _innerBeamRectTransform;
				((Vector2)(ref val))..ctor(0f, 1f);
				innerBeamRectTransform2.anchorMin = val;
				innerBeamRectTransform.anchorMax = val;
				((Transform)_innerBeamRectTransform).eulerAngles = new Vector3(0f, 0f, 0f);
				break;
			}
			}
			((Graphic)_innerImage).color = Plugin.Instance.KeyInnerColor.Value;
			((Graphic)_outerImage).color = Plugin.Instance.KeyOuterColor.Value;
			_innerBeamPressColor = new Color(Plugin.Instance.BeamColor.Value.r, Plugin.Instance.BeamColor.Value.g, Plugin.Instance.BeamColor.Value.b, 0.7f);
			Color value = Plugin.Instance.KeyTextColor.Value;
			((Graphic)_text).color = new Color(value.r, value.g, value.b, 0.3f);
			((Graphic)_pressCountText).color = value;
			val = (_pressCountText.rectTransform.sizeDelta = (_text.rectTransform.sizeDelta = Vector2.one * Plugin.Instance.KeyElementSize.Value));
			_text.margin = Vector4.one * Plugin.Instance.KeyOutlineThiccness.Value;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TootTallyKeyOverlay";

		public const string PLUGIN_NAME = "TootTallyKeyOverlay";

		public const string PLUGIN_VERSION = "2.1.2";
	}
}