Decompiled source of QualityOfLife v0.2.1

plugins/QualityOfLife.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.Mono;
using Game.Settings;
using HarmonyLib;
using Menus;
using Menus.UI.Settings;
using Microsoft.CodeAnalysis;
using Obstacles;
using Player;
using TMPro;
using UI.Inputs;
using UI.VectorGraphics;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("QualityOfLife")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyInformationalVersion("0.2.1+b6aa1362165686df97b42438e8cc38d677d0972e")]
[assembly: AssemblyProduct("QualityOfLife")]
[assembly: AssemblyTitle("QualityOfLife")]
[assembly: AssemblyVersion("0.2.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 QualityOfLife
{
	internal sealed class DarkMode : MonoBehaviour
	{
		private sealed class Entry
		{
			public Color[] Original;

			public Color[] Written;

			public bool IsText;

			public float Floor;

			public Material GameMaterial;
		}

		private const int RescanFrames = 20;

		private const float TextOnDark = 0.92f;

		internal static readonly Color Wipe = new Color(0.12f, 0.13f, 0.16f, 1f);

		private static readonly int UnderlayColor = Shader.PropertyToID("_UnderlayColor");

		private static readonly Color DarkGlow = new Color(0.06f, 0.07f, 0.09f, 0.9f);

		private static DarkMode _instance;

		private readonly Dictionary<Canvas, float> _canvases = new Dictionary<Canvas, float>();

		private readonly Dictionary<Material, Material> _darkGlow = new Dictionary<Material, Material>();

		private readonly Dictionary<Graphic, Entry> _entries = new Dictionary<Graphic, Entry>();

		private readonly List<Graphic> _scratch = new List<Graphic>();

		private int _frame;

		public static void Install(GameObject host)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			_instance = host.AddComponent<DarkMode>();
			Canvas.preWillRenderCanvases += new WillRenderCanvases(_instance.BeforeUiDraws);
		}

		public static void Add(Canvas canvas, float floor = 0.12f)
		{
			if (!((Object)(object)canvas == (Object)null) && !_instance._canvases.ContainsKey(canvas))
			{
				_instance._canvases[canvas] = floor;
				_instance.Scan(canvas, floor);
				_instance.ApplyAll();
			}
		}

		public static void Refresh()
		{
			_instance.ApplyAll();
		}

		private void BeforeUiDraws()
		{
			foreach (Canvas item in _canvases.Keys.Where((Canvas c) => (Object)(object)c == (Object)null).ToList())
			{
				_canvases.Remove(item);
			}
			if (!Plugin.DarkModeEnabled.Value)
			{
				return;
			}
			if (++_frame % 20 == 0)
			{
				foreach (KeyValuePair<Canvas, float> canvase in _canvases)
				{
					if (((Behaviour)canvase.Key).isActiveAndEnabled)
					{
						Scan(canvase.Key, canvase.Value);
					}
				}
			}
			ApplyAll();
		}

		private void Scan(Canvas canvas, float floor)
		{
			((Component)canvas).GetComponentsInChildren<Graphic>(true, _scratch);
			foreach (Graphic item in _scratch)
			{
				if (!_entries.ContainsKey(item) && Candidate(item))
				{
					_entries[item] = new Entry
					{
						IsText = (item is TMP_Text),
						Floor = floor
					};
				}
			}
		}

		private void ApplyAll()
		{
			bool value = Plugin.DarkModeEnabled.Value;
			List<Graphic> list = null;
			foreach (KeyValuePair<Graphic, Entry> entry in _entries)
			{
				Graphic key = entry.Key;
				if ((Object)(object)key == (Object)null)
				{
					(list ?? (list = new List<Graphic>())).Add(key);
				}
				else if (!value || ((Behaviour)key).isActiveAndEnabled)
				{
					Apply(key, entry.Value, value && (entry.Value.IsText || IsShape(key)));
				}
			}
			if (list == null)
			{
				return;
			}
			foreach (Graphic item in list)
			{
				_entries.Remove(item);
			}
		}

		private static void Apply(Graphic g, Entry e, bool on)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (e.IsText)
			{
				Glow((TMP_Text)g, e, on);
			}
			Color[] array = Read(g);
			if (e.Written == null || !Same(array, e.Written))
			{
				e.Original = array;
			}
			if (!on)
			{
				if (e.Written != null && Same(array, e.Written))
				{
					Write(g, e.Original);
				}
				e.Written = null;
				return;
			}
			Color[] array2 = (e.IsText ? LightText(g, e.Original) : e.Original.Select((Color c) => Darken(c, e.Floor)).ToArray());
			if (!Same(array, array2))
			{
				Write(g, array2);
			}
			e.Written = array2;
		}

		private static void Glow(TMP_Text text, Entry e, bool on)
		{
			//IL_0070: 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_007e: 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_0090: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			Material fontSharedMaterial = text.fontSharedMaterial;
			if ((Object)(object)fontSharedMaterial == (Object)null)
			{
				return;
			}
			bool flag = _instance._darkGlow.ContainsValue(fontSharedMaterial);
			if (!on || !OnDarkened((Graphic)(object)text))
			{
				if (flag && (Object)(object)e.GameMaterial != (Object)null)
				{
					text.fontSharedMaterial = e.GameMaterial;
				}
			}
			else
			{
				if (flag || !fontSharedMaterial.IsKeywordEnabled("UNDERLAY_ON") || !fontSharedMaterial.HasProperty(UnderlayColor))
				{
					return;
				}
				Color color = fontSharedMaterial.GetColor(UnderlayColor);
				if (!(Mathf.Max(new float[3] { color.r, color.g, color.b }) < 0.5f))
				{
					if (!_instance._darkGlow.TryGetValue(fontSharedMaterial, out var value))
					{
						value = new Material(fontSharedMaterial)
						{
							name = ((Object)fontSharedMaterial).name + " (dark glow)"
						};
						value.SetColor(UnderlayColor, DarkGlow);
						_instance._darkGlow[fontSharedMaterial] = value;
					}
					e.GameMaterial = fontSharedMaterial;
					text.fontSharedMaterial = value;
				}
			}
		}

		private static bool Candidate(Graphic g)
		{
			if ((Object)(object)((Component)g).GetComponentInParent<SettingOption>(true) != (Object)null)
			{
				return false;
			}
			if (!(g is TMP_Text))
			{
				return IsShape(g);
			}
			return true;
		}

		private static bool IsShape(Graphic g)
		{
			MaskableVectorGraphic val = (MaskableVectorGraphic)(object)((g is MaskableVectorGraphic) ? g : null);
			if (val == null)
			{
				Image val2 = (Image)(object)((g is Image) ? g : null);
				if (val2 == null)
				{
					RawImage val3 = (RawImage)(object)((g is RawImage) ? g : null);
					if (val3 != null)
					{
						return (Object)(object)val3.texture == (Object)null;
					}
					return false;
				}
				if (!((Object)(object)val2.sprite == (Object)null))
				{
					return ShapeTexture(((Object)val2.sprite).name);
				}
				return true;
			}
			if (!((Object)(object)val.texture == (Object)null))
			{
				return ShapeTexture(((Object)val.texture).name);
			}
			return true;
		}

		private static bool ShapeTexture(string name)
		{
			if (!name.Contains("AlphaGradient"))
			{
				return name.StartsWith("LevelSelectElement_CornerGradient");
			}
			return true;
		}

		private static Color[] Read(Graphic g)
		{
			//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)
			MaskableVectorGraphic val = (MaskableVectorGraphic)(object)((g is MaskableVectorGraphic) ? g : null);
			if (val != null)
			{
				return val.threeColorsGradient.colorKeys.Select((GradientColorKey k) => k.color).ToArray();
			}
			return (Color[])(object)new Color[1] { g.color };
		}

		private static void Write(Graphic g, Color[] colours)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			MaskableVectorGraphic val = (MaskableVectorGraphic)(object)((g is MaskableVectorGraphic) ? g : null);
			if (val != null)
			{
				GradientColorKey[] colorKeys = val.threeColorsGradient.colorKeys;
				for (int i = 0; i < colorKeys.Length && i < colours.Length; i++)
				{
					colorKeys[i].color = colours[i];
				}
				val.EditGradientColors(new Gradient
				{
					colorKeys = colorKeys,
					alphaKeys = val.threeColorsGradient.alphaKeys
				});
				((Graphic)val).SetVerticesDirty();
			}
			else
			{
				g.color = colours[0];
			}
		}

		private static bool Same(Color[] a, Color[] b)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (a.Length != b.Length)
			{
				return false;
			}
			for (int i = 0; i < a.Length; i++)
			{
				if (a[i] != b[i])
				{
					return false;
				}
			}
			return true;
		}

		internal static Color Darken(Color c, float floor)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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)
			float num = Mathf.Max(new float[3] { c.r, c.g, c.b });
			float num2 = Mathf.Min(new float[3] { c.r, c.g, c.b });
			if (num < 0.8f || num - num2 > 0.17f)
			{
				return c;
			}
			float num3 = floor + (1f - num) * 0.9f;
			return new Color(Mathf.Clamp01(num3 + (c.r - num) * 0.5f), Mathf.Clamp01(num3 * 1.1f + (c.g - num) * 0.5f), Mathf.Clamp01(num3 * 1.3f + (c.b - num) * 0.5f), c.a);
		}

		private static Color[] LightText(Graphic g, Color[] original)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0037: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			Color val = original[0];
			float num = Mathf.Max(new float[3] { val.r, val.g, val.b });
			float num2 = Mathf.Min(new float[3] { val.r, val.g, val.b });
			if (num > 0.5f || num - num2 > 0.35f || !OnDarkened(g))
			{
				return original;
			}
			return (Color[])(object)new Color[1]
			{
				new Color(0.92f, 0.92f, Mathf.Min(1f, 0.9568f), val.a)
			};
		}

		private static bool OnDarkened(Graphic text)
		{
			Transform val = ((Component)text).transform;
			while ((Object)(object)val.parent != (Object)null)
			{
				for (int num = val.GetSiblingIndex() - 1; num >= 0; num--)
				{
					if (Behind(val.parent.GetChild(num), out var darkened))
					{
						return darkened;
					}
				}
				if (Behind(val.parent, out var darkened2))
				{
					return darkened2;
				}
				val = val.parent;
			}
			return true;
		}

		private static bool Behind(Transform t, out bool darkened)
		{
			darkened = false;
			if (!((Component)t).gameObject.activeInHierarchy)
			{
				return false;
			}
			Mask component = ((Component)t).GetComponent<Mask>();
			if ((Object)(object)component != (Object)null && !component.showMaskGraphic)
			{
				return false;
			}
			Graphic val = ((IEnumerable<Graphic>)((Component)t).GetComponents<Graphic>()).FirstOrDefault((Func<Graphic, bool>)((Graphic b) => ((Behaviour)b).enabled && !(b is TMP_Text) && b.color.a > 0.05f && IsShape(b)));
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			darkened = _instance._entries.TryGetValue(val, out var value) && value.Written != null && !Same(value.Written, value.Original);
			return true;
		}
	}
	internal sealed class DarkModeOption : SettingOption
	{
		private bool _value;

		private Toggle _toggle;

		public static void AddTo(SettingsMenu menu)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			for (int i = 0; i < menu.options.Length; i++)
			{
				SettingOption[] settingOptionList = menu.options[i].settingOptionList;
				int num = Array.FindIndex(settingOptionList, (SettingOption o) => o is SettingOptionUseVerticalSync);
				if (num >= 0)
				{
					SettingOptionUseVerticalSync val = (SettingOptionUseVerticalSync)settingOptionList[num];
					GameObject obj = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)val).transform.parent, false);
					((Object)obj).name = "DarkModeOption";
					obj.transform.SetSiblingIndex(((Component)val).transform.GetSiblingIndex() + 1);
					SettingOptionUseVerticalSync component = obj.GetComponent<SettingOptionUseVerticalSync>();
					obj.SetActive(false);
					DarkModeOption darkModeOption = obj.AddComponent<DarkModeOption>();
					((SettingOption)darkModeOption).mainContainer = ((SettingOption)component).mainContainer;
					((SettingOption)darkModeOption).customButton = ((SettingOption)component).customButton;
					((SettingOption)darkModeOption).nameLabel = ((SettingOption)component).nameLabel;
					((SettingOption)darkModeOption).valueLabel = ((SettingOption)component).valueLabel;
					((SettingOption)darkModeOption).scrollRect = ((SettingOption)component).scrollRect;
					((SettingOption)darkModeOption).topScrollGradient = ((SettingOption)component).topScrollGradient;
					((SettingOption)darkModeOption).bottomScrollGradient = ((SettingOption)component).bottomScrollGradient;
					darkModeOption._toggle = component.valueToggle;
					Object.DestroyImmediate((Object)(object)component);
					((SettingOption)darkModeOption).customButton.useLocalizationString = false;
					((SettingOption)darkModeOption).customButton.labelContent = null;
					((SettingOption)darkModeOption).nameLabel.text = "Dark mode";
					((UnityEvent<bool>)(object)darkModeOption._toggle.onValueChanged).AddListener((UnityAction<bool>)darkModeOption.SetValue);
					obj.SetActive(true);
					menu.options[i].settingOptionList = settingOptionList.Take(num + 1).Append((SettingOption)(object)darkModeOption).Concat(settingOptionList.Skip(num + 1))
						.ToArray();
					return;
				}
			}
			Plugin.Log.LogWarning((object)"No Vertical synchronization setting found; the Dark mode toggle is only in the config file.");
		}

		public override void Init(GameSettingsValues settingsToEdit, UnityAction onSelect)
		{
			((SettingOption)this).Init(settingsToEdit, onSelect);
			_value = Plugin.DarkModeEnabled.Value;
			base.nameLabel.text = "Dark mode";
			_toggle.isOn = _value;
		}

		public override void UpdateNameLabel(string labelText)
		{
			base.nameLabel.text = "Dark mode";
		}

		public override void UpdateValueLabel(string labelText)
		{
			_toggle.isOn = _value;
		}

		private void SetValue(bool value)
		{
			_value = value;
		}

		public override void Previous()
		{
			Flip();
		}

		public override void Next()
		{
			Flip();
		}

		public override void Validate()
		{
			Flip();
		}

		public override void Apply()
		{
			Plugin.DarkModeEnabled.Value = _value;
			DarkMode.Refresh();
		}

		private void Flip()
		{
			_value = !_value;
			_toggle.isOn = _value;
		}
	}
	internal static class DarkModePatches
	{
		[HarmonyPatch(typeof(InGameMenu), "Awake")]
		[HarmonyPostfix]
		private static void InGameScreens(InGameMenu __instance)
		{
			Safely(delegate
			{
				DarkMode.Add(__instance.obstacleSelectionCanvas);
				DarkMode.Add(__instance.scoreBoardCanvas);
				DarkMode.Add(__instance.timeTrialScoreBoardCanvas);
				DarkMode.Add(__instance.endGameCanvas);
			});
		}

		[HarmonyPatch(typeof(LevelSelect), "Awake")]
		[HarmonyPostfix]
		private static void MapSelector(LevelSelect __instance)
		{
			Safely(delegate
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				Scene scene = ((Component)__instance).gameObject.scene;
				foreach (Canvas item in from c in Object.FindObjectsOfType<Canvas>(true)
					where ((Component)c).gameObject.scene == scene && c.isRootCanvas
					select c)
				{
					DarkMode.Add(item);
				}
			});
		}

		[HarmonyPatch(typeof(InGameMenu), "StartTransition")]
		[HarmonyPrefix]
		private static void DarkWipe(ref Color transitionColor)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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)
			if (Plugin.DarkModeEnabled.Value && transitionColor == Color.white)
			{
				transitionColor = DarkMode.Wipe;
			}
		}

		[HarmonyPatch(typeof(SettingsMenu), "Awake")]
		[HarmonyPostfix]
		private static void SettingsToggle(SettingsMenu __instance)
		{
			Safely(delegate
			{
				if (!((Object)(object)SettingsMenu.instance != (Object)(object)__instance))
				{
					DarkModeOption.AddTo(__instance);
					DarkMode.Add(__instance.canvas, 0.19f);
				}
			});
		}

		private static void Safely(Action action)
		{
			try
			{
				action();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Dark mode hook failed; that screen stays as it was. " + ex));
			}
		}
	}
	internal static class HandSpeed
	{
		private static readonly Dictionary<PlayerObstacleHandNetworking, ObstacleSpeedMode> Modes = new Dictionary<PlayerObstacleHandNetworking, ObstacleSpeedMode>();

		private static readonly Dictionary<InputDeviceHintsMenu, (InputHintUIComponent hint, ObstacleSpeedMode? shown)> Hints = new Dictionary<InputDeviceHintsMenu, (InputHintUIComponent, ObstacleSpeedMode?)>();

		[HarmonyPatch(typeof(PlayerObstacleHandNetworking), "Update")]
		[HarmonyPrefix]
		private static void CycleOnPress(PlayerObstacleHandNetworking __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_004a: Invalid comparison between Unknown and I4
			if (((NetworkBehaviour)__instance).IsOwner && __instance.Active && (int)__instance.state == 1 && !SettingsMenu.IsOpen && SpeedPressed(__instance.playerInfos))
			{
				if (!Modes.TryGetValue(__instance, out var value))
				{
					value = (ObstacleSpeedMode)1;
				}
				Modes[__instance] = (ObstacleSpeedMode)(((int)value == 0) ? 1 : (((int)value == 1) ? 2 : 0));
			}
		}

		private static bool SpeedPressed(PlayerData player)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			object obj;
			if (player == null)
			{
				obj = null;
			}
			else
			{
				PlayerInput inputs = player.inputs;
				if (inputs == null)
				{
					obj = null;
				}
				else
				{
					InputActionAsset actions = inputs.actions;
					obj = ((actions != null) ? actions.FindAction("ObstaclePlacement/EnableSpeedUp", false) : null);
				}
			}
			InputAction val = (InputAction)obj;
			if (val == null)
			{
				return false;
			}
			Enumerator<InputControl> enumerator = val.controls.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					InputControl current = enumerator.Current;
					ButtonControl val2 = (ButtonControl)(object)((current is ButtonControl) ? current : null);
					if (val2 != null && val2.wasPressedThisFrame)
					{
						return true;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
			return false;
		}

		[HarmonyPatch(typeof(InputDeviceHintsMenu), "PlayerInputUpdate")]
		[HarmonyPostfix]
		private static void ShowSpeedHint(InputDeviceHintsMenu __instance)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Invalid comparison between Unknown and I4
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			PlayerObstacleHandNetworking val = (((Object)(object)__instance.linkedPlayer != (Object)null) ? __instance.linkedPlayer.playerObstacleHandNetworking : null);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)__instance.speedUpHint == (Object)null) && !((Object)(object)__instance.pointHint == (Object)null))
			{
				if (!Modes.TryGetValue(val, out var value))
				{
					value = (ObstacleSpeedMode)1;
				}
				if (!Hints.TryGetValue(__instance, out (InputHintUIComponent, ObstacleSpeedMode?) value2) || (Object)(object)value2.Item1 == (Object)null)
				{
					GameObject val2 = Object.Instantiate<GameObject>(((Component)__instance.speedUpHint).gameObject, ((Component)__instance.pointHint).transform.parent, false);
					((Object)val2).name = "InputHintEnableSpeedUp_Hand";
					val2.transform.SetSiblingIndex(((Component)__instance.pointHint).transform.GetSiblingIndex());
					val2.SetActive(true);
					value2 = (val2.GetComponent<InputHintUIComponent>(), null);
				}
				if (value2.Item2 != (ObstacleSpeedMode?)value)
				{
					value2.Item1.displayName = (((int)value == 0) ? __instance.slowSpeedInputHintLocalizedString : (((int)value == 2) ? __instance.fastSpeedInputHintLocalizedString : __instance.standardSpeedInputHintLocalizedString));
					value2.Item1.Refresh("");
					value2.Item2 = value;
				}
				Hints[__instance] = value2;
			}
		}

		[HarmonyPatch(typeof(PlayerObstacleHandNetworking), "MoveX")]
		[HarmonyPatch(typeof(PlayerObstacleHandNetworking), "MoveY")]
		[HarmonyPatch(typeof(PlayerObstacleHandNetworking), "MoveZ")]
		[HarmonyPrefix]
		private static void Scale(PlayerObstacleHandNetworking __instance, ref float offset)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if (Modes.TryGetValue(__instance, out var value))
			{
				offset *= (((int)value == 0) ? 0.125f : (((int)value == 2) ? 3.75f : 1f));
			}
		}
	}
	[BepInPlugin("onlynothing.qualityoflife", "QualityOfLife", "0.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> DarkModeEnabled;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			DarkModeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DarkMode", "Enabled", false, "Dark card picking, scoreboards and map selector. Also in the game's Settings, Graphics tab.");
			DarkMode.Install(((Component)this).gameObject);
			Harmony.CreateAndPatchAll(typeof(DarkModePatches), (string)null).PatchAll(typeof(HandSpeed));
			Log.LogInfo((object)"QualityOfLife loaded.");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "onlynothing.qualityoflife";

		public const string PLUGIN_NAME = "QualityOfLife";

		public const string PLUGIN_VERSION = "0.2.1";
	}
}