Decompiled source of Menu Button Mayhem v1.0.0

RunButtonRun.dll

Decompiled 2 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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RunButtonRun")]
[assembly: AssemblyTitle("RunButtonRun")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.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;
		}
	}
	[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 RunButtonRun
{
	[BepInPlugin("Omniscye.RunButtonRun", "RunButtonRun", "1.0")]
	public class RunButtonRun : BaseUnityPlugin
	{
		internal static RunButtonRun Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: 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_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}
namespace Empress.RepoMods.MenuButtonDance
{
	[BepInPlugin("dev.empress.repo.menubuttondance", "Menu Button Dance", "1.4.0")]
	public class MenuButtonDancePlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(MenuManager), "PageOpen", new Type[]
		{
			typeof(MenuPageIndex),
			typeof(bool)
		})]
		public static class MenuManager_PageOpen_Patch
		{
			public static void Postfix(MenuPageIndex menuPageIndex, bool addedPageOnTop, ref MenuPage __result)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Invalid comparison between Unknown and I4
				if (!Enable.Value || (Object)(object)__result == (Object)null || (int)menuPageIndex > 0)
				{
					return;
				}
				try
				{
					GameObject gameObject = ((Component)__result).gameObject;
					RectTransform component = ((Component)__result).GetComponent<RectTransform>();
					RectTransform val = null;
					Canvas componentInParent = gameObject.GetComponentInParent<Canvas>();
					if ((Object)(object)componentInParent != (Object)null)
					{
						val = ((Component)componentInParent).GetComponent<RectTransform>();
					}
					int counter = 0;
					MenuButton[] componentsInChildren = gameObject.GetComponentsInChildren<MenuButton>(true);
					foreach (MenuButton val2 in componentsInChildren)
					{
						TryAttachAnimator(((Component)val2).gameObject, Object.op_Implicit((Object)(object)val) ? val : component, ref counter);
					}
					MenuBigButton[] componentsInChildren2 = gameObject.GetComponentsInChildren<MenuBigButton>(true);
					foreach (MenuBigButton val3 in componentsInChildren2)
					{
						TryAttachAnimator(((Component)val3).gameObject, Object.op_Implicit((Object)(object)val) ? val : component, ref counter);
					}
					Button[] componentsInChildren3 = gameObject.GetComponentsInChildren<Button>(true);
					foreach (Button val4 in componentsInChildren3)
					{
						TryAttachAnimator(((Component)val4).gameObject, Object.op_Implicit((Object)(object)val) ? val : component, ref counter);
					}
					Log.LogInfo((object)$"Menu Button Dance: attached to {counter} button(s) on Main page.");
				}
				catch (Exception arg)
				{
					Log.LogWarning((object)$"Menu Button Dance: failed to attach animators: {arg}");
				}
			}

			private static void TryAttachAnimator(GameObject go, RectTransform boundaryRT, ref int counter)
			{
				RectTransform component = go.GetComponent<RectTransform>();
				if (Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)go.GetComponent<MenuButtonWiggle>()))
				{
					MenuButtonWiggle menuButtonWiggle = go.AddComponent<MenuButtonWiggle>();
					menuButtonWiggle.pattern = Pattern.Value;
					menuButtonWiggle.radius = Radius.Value;
					menuButtonWiggle.ampX = AmplitudeX.Value;
					menuButtonWiggle.ampY = AmplitudeY.Value;
					menuButtonWiggle.speed = Speed.Value;
					menuButtonWiggle.rotDeg = RotationDegrees.Value;
					menuButtonWiggle.seed = Seed.Value;
					menuButtonWiggle.minSpeed = ChaosMinSpeed.Value;
					menuButtonWiggle.maxSpeed = Mathf.Max(ChaosMinSpeed.Value, ChaosMaxSpeed.Value);
					menuButtonWiggle.elasticity = Mathf.Clamp(ChaosElasticity.Value, 0.5f, 1.2f);
					menuButtonWiggle.padding = Mathf.Max(0f, ChaosPadding.Value);
					menuButtonWiggle.spinMax = Mathf.Max(0f, ChaosSpinMax.Value);
					menuButtonWiggle.lockUpright = LockUpright.Value;
					menuButtonWiggle.boundary = boundaryRT;
					menuButtonWiggle.reparentToCanvas = ChaosReparentToCanvas.Value;
					LayoutElement val = go.GetComponent<LayoutElement>();
					if ((Object)(object)val == (Object)null)
					{
						val = go.AddComponent<LayoutElement>();
					}
					val.ignoreLayout = true;
					counter++;
				}
			}
		}

		public class MenuButtonWiggle : MonoBehaviour
		{
			internal string pattern = "chaos";

			internal float radius = 20f;

			internal float ampX = 24f;

			internal float ampY = 16f;

			internal float speed = 1f;

			internal float rotDeg = 3f;

			internal int seed = 0;

			public float minSpeed = 80f;

			public float maxSpeed = 200f;

			public float elasticity = 1f;

			public float padding = 8f;

			public float spinMax = 60f;

			public bool lockUpright = true;

			public bool reparentToCanvas = true;

			public RectTransform boundary;

			private RectTransform _rt;

			private RectTransform _parentRT;

			private Vector2 _origin;

			private float _phase;

			private float _spdMul;

			private float _sx;

			private float _sy;

			private float _rotSign;

			private bool _initted;

			private Vector2 _vel;

			private float _spin;

			private float _spinVel;

			private RectTransform _origParent;

			private int _origSiblingIndex;

			private Vector3 _origLocalScale;

			private bool _detached;

			private static readonly Vector3[] _worldCorners = (Vector3[])(object)new Vector3[4];

			private void OnEnable()
			{
				InitIfNeeded();
			}

			private void Start()
			{
				InitIfNeeded();
			}

			private void InitIfNeeded()
			{
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: 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_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Unknown result type (might be due to invalid IL or missing references)
				if (_initted)
				{
					return;
				}
				_rt = ((Component)this).GetComponent<RectTransform>();
				if ((Object)(object)_rt == (Object)null)
				{
					((Behaviour)this).enabled = false;
					return;
				}
				ref RectTransform parentRT = ref _parentRT;
				Transform parent = ((Transform)_rt).parent;
				parentRT = (RectTransform)(object)((parent is RectTransform) ? parent : null);
				if ((Object)(object)_parentRT == (Object)null)
				{
					((Behaviour)this).enabled = false;
					return;
				}
				_origin = _rt.anchoredPosition;
				int num = ((Object)((Component)this).gameObject).name?.GetHashCode() ?? 0;
				int num2 = seed ^ num ^ (int)(_origin.x * 397f) ^ (int)(_origin.y * 7919f);
				Random random = new Random(num2);
				_phase = (float)random.NextDouble() * MathF.PI * 2f;
				_spdMul = 0.75f + (float)random.NextDouble() * 0.75f;
				_sx = 0.8f + (float)random.NextDouble() * 0.6f;
				_sy = 0.8f + (float)random.NextDouble() * 0.6f;
				_rotSign = ((random.Next(0, 2) == 0) ? (-1f) : 1f);
				float num3 = (float)random.NextDouble() * MathF.PI * 2f;
				float num4 = Mathf.Lerp(minSpeed, maxSpeed, (float)random.NextDouble());
				_vel = new Vector2(Mathf.Cos(num3), Mathf.Sin(num3)) * num4;
				_spin = 0f;
				_spinVel = (float)(random.NextDouble() * 2.0 - 1.0) * spinMax * 0.25f;
				if (reparentToCanvas && (Object)(object)boundary != (Object)null && (Object)(object)_parentRT != (Object)(object)boundary)
				{
					_origParent = _parentRT;
					_origSiblingIndex = ((Transform)_rt).GetSiblingIndex();
					_origLocalScale = ((Transform)_rt).localScale;
					((Transform)_rt).SetParent((Transform)(object)boundary, true);
					_parentRT = boundary;
					_detached = true;
				}
				_initted = true;
			}

			private void Update()
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: 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_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: 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_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				if (!_initted)
				{
					return;
				}
				if (pattern.Equals("chaos", StringComparison.OrdinalIgnoreCase))
				{
					UpdateChaos();
					return;
				}
				float num = Time.unscaledTime * speed * _spdMul + _phase;
				Vector2 val = Vector2.zero;
				string text = pattern.ToLowerInvariant();
				string text2 = text;
				if (!(text2 == "orbit"))
				{
					if (text2 == "bounce")
					{
						((Vector2)(ref val))..ctor(0f, Mathf.Sin(num) * ampY);
					}
					else
					{
						((Vector2)(ref val))..ctor(Mathf.Sin(num * _sx) * ampX, Mathf.Sin(num * _sy + MathF.PI / 2f) * ampY);
					}
				}
				else
				{
					val = new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * radius;
				}
				_rt.anchoredPosition = _origin + val;
				if (lockUpright)
				{
					((Transform)_rt).localRotation = Quaternion.identity;
					return;
				}
				float num2 = Mathf.Sin(num * 0.9f) * rotDeg * _rotSign;
				((Transform)_rt).localRotation = Quaternion.Euler(0f, 0f, num2);
			}

			private void UpdateChaos()
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: 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_0061: 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_0098: 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)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: 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_02e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_034e: Unknown result type (might be due to invalid IL or missing references)
				//IL_039c: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_031b: 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_0322: Unknown result type (might be due to invalid IL or missing references)
				//IL_0327: Unknown result type (might be due to invalid IL or missing references)
				//IL_032f: 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_0336: Unknown result type (might be due to invalid IL or missing references)
				//IL_033b: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0310: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ce: 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_033f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0341: Unknown result type (might be due to invalid IL or missing references)
				//IL_0346: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)boundary == (Object)null)
				{
					boundary = _parentRT;
				}
				float unscaledDeltaTime = Time.unscaledDeltaTime;
				if (unscaledDeltaTime <= 0f)
				{
					return;
				}
				Vector2 val = _vel * unscaledDeltaTime;
				Vector2 val2;
				if ((Object)(object)_parentRT == (Object)(object)boundary)
				{
					val2 = val;
				}
				else
				{
					Vector3 val3 = ((Transform)boundary).TransformVector(Vector2.op_Implicit(val));
					val2 = Vector2.op_Implicit(((Transform)_parentRT).InverseTransformVector(val3));
				}
				Vector2 val4 = _rt.anchoredPosition + val2;
				_rt.anchoredPosition = val4;
				_rt.GetWorldCorners(_worldCorners);
				float num = float.PositiveInfinity;
				float num2 = float.PositiveInfinity;
				float num3 = float.NegativeInfinity;
				float num4 = float.NegativeInfinity;
				for (int i = 0; i < 4; i++)
				{
					Vector3 val5 = ((Transform)boundary).InverseTransformPoint(_worldCorners[i]);
					if (val5.x < num)
					{
						num = val5.x;
					}
					if (val5.x > num3)
					{
						num3 = val5.x;
					}
					if (val5.y < num2)
					{
						num2 = val5.y;
					}
					if (val5.y > num4)
					{
						num4 = val5.y;
					}
				}
				Rect rect = boundary.rect;
				float num5 = ((Rect)(ref rect)).xMin + padding;
				float num6 = ((Rect)(ref rect)).xMax - padding;
				float num7 = ((Rect)(ref rect)).yMin + padding;
				float num8 = ((Rect)(ref rect)).yMax - padding;
				bool flag = false;
				bool flag2 = false;
				Vector2 zero = Vector2.zero;
				if (num < num5)
				{
					zero.x += num5 - num;
					_vel.x = Mathf.Abs(_vel.x) * elasticity;
					flag = true;
				}
				else if (num3 > num6)
				{
					zero.x -= num3 - num6;
					_vel.x = (0f - Mathf.Abs(_vel.x)) * elasticity;
					flag = true;
				}
				if (num2 < num7)
				{
					zero.y += num7 - num2;
					_vel.y = Mathf.Abs(_vel.y) * elasticity;
					flag2 = true;
				}
				else if (num4 > num8)
				{
					zero.y -= num4 - num8;
					_vel.y = (0f - Mathf.Abs(_vel.y)) * elasticity;
					flag2 = true;
				}
				if (zero != Vector2.zero)
				{
					Vector2 val6;
					if ((Object)(object)_parentRT == (Object)(object)boundary)
					{
						val6 = zero;
					}
					else
					{
						Vector3 val7 = ((Transform)boundary).TransformVector(Vector2.op_Implicit(zero));
						val6 = Vector2.op_Implicit(((Transform)_parentRT).InverseTransformVector(val7));
					}
					val4 += val6;
				}
				_rt.anchoredPosition = val4;
				float magnitude = ((Vector2)(ref _vel)).magnitude;
				float num9 = Mathf.Max(5f, minSpeed);
				float num10 = Mathf.Max(num9 + 1f, maxSpeed);
				if (magnitude < num9)
				{
					_vel = ((Vector2)(ref _vel)).normalized * num9;
				}
				else if (magnitude > num10)
				{
					_vel = ((Vector2)(ref _vel)).normalized * num10;
				}
				if (lockUpright)
				{
					((Transform)_rt).localRotation = Quaternion.identity;
					return;
				}
				_spin += _spinVel * unscaledDeltaTime;
				float num11 = Mathf.Atan2(_vel.y, _vel.x) * 57.29578f * 0.05f;
				if (flag || flag2)
				{
					float num12 = rotDeg * 30f * ((flag && flag2) ? 1.5f : 1f) * _rotSign;
					_spinVel = Mathf.Clamp(_spinVel + num12, 0f - spinMax, spinMax);
				}
				_spinVel = Mathf.MoveTowards(_spinVel, 0f, 20f * unscaledDeltaTime);
				float num13 = Mathf.Clamp(_spin + num11, 0f - spinMax, spinMax);
				((Transform)_rt).localRotation = Quaternion.Euler(0f, 0f, num13);
			}

			private void OnDisable()
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)_rt != (Object)null)
				{
					_rt.anchoredPosition = _origin;
					((Transform)_rt).localRotation = Quaternion.identity;
				}
				if (_detached && Object.op_Implicit((Object)(object)_origParent))
				{
					((Transform)_rt).SetParent((Transform)(object)_origParent, true);
					((Transform)_rt).SetSiblingIndex(_origSiblingIndex);
					((Transform)_rt).localScale = _origLocalScale;
					_detached = false;
				}
			}
		}

		public const string PluginGuid = "dev.empress.repo.menubuttondance";

		public const string PluginName = "Menu Button Dance";

		public const string PluginVersion = "1.4.0";

		internal static ManualLogSource Log;

		internal static Harmony Harmony;

		internal static ConfigEntry<bool> Enable;

		internal static ConfigEntry<string> Pattern;

		internal static ConfigEntry<float> Radius;

		internal static ConfigEntry<float> AmplitudeX;

		internal static ConfigEntry<float> AmplitudeY;

		internal static ConfigEntry<float> Speed;

		internal static ConfigEntry<float> RotationDegrees;

		internal static ConfigEntry<int> Seed;

		internal static ConfigEntry<float> ChaosMinSpeed;

		internal static ConfigEntry<float> ChaosMaxSpeed;

		internal static ConfigEntry<float> ChaosElasticity;

		internal static ConfigEntry<float> ChaosPadding;

		internal static ConfigEntry<float> ChaosSpinMax;

		internal static ConfigEntry<bool> LockUpright;

		internal static ConfigEntry<bool> ChaosReparentToCanvas;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("dev.empress.repo.menubuttondance");
			Enable = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable", true, "Master toggle.");
			Pattern = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Pattern", "chaos", "Movement pattern: orbit | lissajous | bounce | chaos");
			Radius = ((BaseUnityPlugin)this).Config.Bind<float>("Motion", "Radius", 22f, "Orbit radius (px) used by 'orbit'.");
			AmplitudeX = ((BaseUnityPlugin)this).Config.Bind<float>("Motion", "AmplitudeX", 26f, "Horizontal amplitude (px).");
			AmplitudeY = ((BaseUnityPlugin)this).Config.Bind<float>("Motion", "AmplitudeY", 18f, "Vertical amplitude (px).");
			Speed = ((BaseUnityPlugin)this).Config.Bind<float>("Motion", "Speed", 0.65f, "Base speed multiplier for non-chaos patterns.");
			RotationDegrees = ((BaseUnityPlugin)this).Config.Bind<float>("Motion", "RotationDegrees", 3.5f, "Small Z rotation for extra life.");
			Seed = ((BaseUnityPlugin)this).Config.Bind<int>("Motion", "Seed", 1337, "Deterministic randomness seed.");
			ChaosMinSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Chaos", "MinSpeed", 80f, "Minimum speed in px/sec.");
			ChaosMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Chaos", "MaxSpeed", 200f, "Maximum speed in px/sec.");
			ChaosElasticity = ((BaseUnityPlugin)this).Config.Bind<float>("Chaos", "Elasticity", 1f, "Bounce elasticity. 1 = perfect.");
			ChaosPadding = ((BaseUnityPlugin)this).Config.Bind<float>("Chaos", "Padding", 8f, "Inset from boundary rect (px).");
			ChaosSpinMax = ((BaseUnityPlugin)this).Config.Bind<float>("Chaos", "SpinMax", 60f, "Max spin speed (deg/sec). Ignored if LockUpright = true.");
			LockUpright = ((BaseUnityPlugin)this).Config.Bind<bool>("Chaos", "LockUpright", true, "If true, never rotate buttons. Keeps text/highlight aligned while they float.");
			ChaosReparentToCanvas = ((BaseUnityPlugin)this).Config.Bind<bool>("Chaos", "ReparentToCanvas", true, "If true, temporarily reparent buttons to root Canvas to bypass layout groups and masks so they can use the whole screen.");
			try
			{
				Harmony.PatchAll(typeof(MenuManager_PageOpen_Patch));
				Log.LogInfo((object)"Menu Button Dance 1.4.0 loaded.");
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Failed to patch: {arg}");
			}
		}

		private void OnDestroy()
		{
			try
			{
				Harmony harmony = Harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
			}
			catch
			{
			}
		}
	}
}