Decompiled source of DebugMod v1.2.0

DebugMod.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Com.LuisPedroFonseca.ProCamera2D;
using DebugMod.Modules;
using DebugMod.Modules.Hitbox;
using HarmonyLib;
using InputExtension;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using MonsterLove.StateMachine;
using NineSolsAPI;
using NineSolsAPI.Utils;
using QFSW.QC;
using RCGFSM.Animation;
using RCGFSM.Transition;
using RCGFSM.Variable;
using RCGMaker.Core;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DebugMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+dc6e499d6152e0eee1c0ff4ddcabe7778e42164c")]
[assembly: AssemblyProduct("DebugMod")]
[assembly: AssemblyTitle("DebugMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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;
		}
	}
	internal static class IsExternalInit
	{
	}
}
namespace DebugMod
{
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[MeansImplicitUse]
	public class BindableMethod : Attribute
	{
		public string Name;

		public KeyCode[] DefaultKeybind;
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("DebugMod", "DebugMod", "1.2.0")]
	public class DebugMod : BaseUnityPlugin
	{
		public static DebugMod Instance;

		private DebugUI debugUI;

		private QuantumConsoleModule quantumConsoleModule;

		private Harmony harmony;

		private InfotextModule infotextModule;

		public HitboxModule HitboxModule = new HitboxModule();

		public SavestateModule SavestateModule = new SavestateModule();

		public SpeedrunTimerModule SpeedrunTimerModule;

		public FsmInspectorModule FsmInspectorModule;

		public GhostModule GhostModule = new GhostModule();

		private void Awake()
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Log.Info("Plugin DebugMod started loading...");
			try
			{
				harmony = Harmony.CreateAndPatchAll(typeof(DebugMod).Assembly, (string)null);
				Log.Info($"Patched {harmony.GetPatchedMethods().Count()} methods...");
			}
			catch (Exception data)
			{
				Log.Error(data);
			}
			debugUI = ((Component)this).gameObject.AddComponent<DebugUI>();
			quantumConsoleModule = new QuantumConsoleModule();
			infotextModule = new InfotextModule();
			SpeedrunTimerModule = new SpeedrunTimerModule();
			FsmInspectorModule = new FsmInspectorModule();
			GhostModule = new GhostModule();
			SavestateModule.SavestateLoaded += delegate
			{
				SpeedrunTimerModule.OnSavestateLoaded();
			};
			SavestateModule.SavestateCreated += delegate
			{
				SpeedrunTimerModule.OnSavestateCreated();
			};
			KeybindManager.Add((MonoBehaviour)(object)this, (Action)ToggleConsole, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)306,
				(KeyCode)46
			});
			KeybindManager.Add((MonoBehaviour)(object)this, (Action)ToggleSettings, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)306,
				(KeyCode)44
			});
			ConfigEntry<KeyboardShortcut> changeModeShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer", "Change Mode", default(KeyboardShortcut), (ConfigDescription)null);
			ConfigEntry<KeyboardShortcut> setEndpointShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("SpeedrunTimer", "Set Endpoint", default(KeyboardShortcut), (ConfigDescription)null);
			KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate
			{
				SpeedrunTimerModule.CycleTimerMode();
			}, (Func<KeyboardShortcut>)(() => changeModeShortcut.Value));
			KeybindManager.Add((MonoBehaviour)(object)this, (Action)delegate
			{
				SpeedrunTimerModule.SetEndpoint();
			}, (Func<KeyboardShortcut>)(() => setEndpointShortcut.Value));
			debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(FreecamModule));
			debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(TimeModule));
			debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(InfotextModule));
			debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(HitboxModule));
			debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(SavestateModule));
			debugUI.AddBindableMethods(((BaseUnityPlugin)this).Config, typeof(CheatModule));
			RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
			Log.Info("Plugin DebugMod is loaded!");
		}

		private void ToggleConsole()
		{
			if (Object.op_Implicit((Object)(object)QuantumConsole.Instance))
			{
				QuantumConsole.Instance.Toggle();
			}
		}

		private void ToggleSettings()
		{
			debugUI.settingsOpen = !debugUI.settingsOpen;
			if (Player.i == null)
			{
			}
		}

		private void Update()
		{
			//IL_005d: 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_0077: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			FreecamModule.Update();
			MapTeleportModule.Update();
			infotextModule.Update();
			if (!Input.GetKey((KeyCode)306))
			{
				return;
			}
			Cursor.visible = true;
			if (!Input.GetMouseButtonDown(0))
			{
				return;
			}
			ToastManager.Toast((object)"click");
			try
			{
				Camera theRealSceneCamera = SingletonBehaviour<CameraManager>.Instance.cameraCore.theRealSceneCamera;
				Vector3 worldPosition = theRealSceneCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0f - ((Component)theRealSceneCamera).transform.position.z));
				worldPosition.z = 0f;
				List<SpriteRenderer> list = PickSprite(worldPosition);
				StateMachineOwner val = null;
				foreach (SpriteRenderer item in list)
				{
					StateMachineOwner componentInParent = ((Component)item).GetComponentInParent<StateMachineOwner>();
					if (Object.op_Implicit((Object)(object)componentInParent))
					{
						val = componentInParent;
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					ToastManager.Toast((object)val);
				}
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)ex);
			}
		}

		private List<SpriteRenderer> PickSprite(Vector3 worldPosition)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			List<SpriteRenderer> list = new List<SpriteRenderer>();
			SpriteRenderer[] array = Object.FindObjectsOfType<SpriteRenderer>();
			SpriteRenderer[] array2 = array;
			foreach (SpriteRenderer val in array2)
			{
				if (IsWithinSpriteBounds(val, worldPosition))
				{
					string text = ((Object)((Component)val).gameObject).name.ToLower();
					Transform parent = ((Component)val).gameObject.transform.parent;
					string text2 = ((parent != null) ? ((Object)parent).name : null) ?? "";
					if (!text.Contains("light") && !text.Contains("fade") && !text.Contains("glow") && !text.Contains("attack") && !text2.Contains("Vibe") && !text2.Contains("Skin"))
					{
						list.Add(val);
					}
				}
			}
			return list;
			static bool IsWithinSpriteBounds(SpriteRenderer spriteRenderer, Vector3 position)
			{
				//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_000a: Unknown result type (might be due to invalid IL or missing references)
				Bounds bounds = ((Renderer)spriteRenderer).bounds;
				return ((Bounds)(ref bounds)).Contains(position);
			}
		}

		private void LateUpdate()
		{
			try
			{
				GhostModule.LateUpdate();
				SpeedrunTimerModule.LateUpdate();
			}
			catch (Exception data)
			{
				Log.Error(data);
			}
		}

		private void OnGUI()
		{
			SpeedrunTimerModule.OnGui();
			FsmInspectorModule.OnGui();
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
			HitboxModule.Unload();
			SavestateModule.Unload();
			quantumConsoleModule.Unload();
			GhostModule.Unload();
			SpeedrunTimerModule.Destroy();
			infotextModule.Destroy();
			Log.Info("Plugin DebugMod unloaded\n\n");
		}
	}
	internal class DebugActionToggle
	{
		public bool Value;

		public Action<bool> OnChange;
	}
	internal class DebugAction
	{
		public Action OnChange;
	}
	public class DebugUI : MonoBehaviour
	{
		public bool settingsOpen = false;

		private GUIStyle styleButton;

		private GUIStyle styleToggle;

		private Dictionary<string, DebugActionToggle> toggles = new Dictionary<string, DebugActionToggle>();

		private Dictionary<string, DebugAction> actions = new Dictionary<string, DebugAction>();

		private void Awake()
		{
			toggles.Clear();
		}

		private void OnDestroy()
		{
		}

		public void AddBindableMethods(ConfigFile config, Type ty)
		{
			//IL_00ce: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			MethodInfo[] methods = ty.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo methodInfo in methods)
			{
				BindableMethod customAttribute = methodInfo.GetCustomAttribute<BindableMethod>();
				if (customAttribute != null)
				{
					string key = customAttribute.Name ?? methodInfo.Name;
					Action action = (Action)Delegate.CreateDelegate(typeof(Action), methodInfo);
					string text = new string(Array.FindAll(customAttribute.Name.ToCharArray(), char.IsLetterOrDigit));
					ConfigEntry<KeyboardShortcut> keyboardShortcut = config.Bind<KeyboardShortcut>("Shortcuts", text, (customAttribute.DefaultKeybind != null) ? new KeyboardShortcut(customAttribute.DefaultKeybind[^1], customAttribute.DefaultKeybind[..^1]) : default(KeyboardShortcut), (ConfigDescription)null);
					actions.Add(key, new DebugAction
					{
						OnChange = action
					});
					KeybindManager.Add((MonoBehaviour)(object)this, action, (Func<KeyboardShortcut>)(() => keyboardShortcut.Value));
				}
			}
		}

		public void AddToggle(string actionName, Action<bool> onChange, bool defaultValue = false)
		{
			toggles.Add(actionName, new DebugActionToggle
			{
				Value = defaultValue,
				OnChange = onChange
			});
		}

		private void OnGUI()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			//IL_0082: Expected O, but got Unknown
			if (!settingsOpen)
			{
				return;
			}
			RCGInput.SetCursorVisible(true);
			if (styleButton == null)
			{
				styleButton = new GUIStyle(GUI.skin.box)
				{
					alignment = (TextAnchor)5,
					padding = new RectOffset(20, 20, 20, 20),
					fontSize = 20
				};
			}
			if (styleToggle == null)
			{
				styleToggle = new GUIStyle(GUI.skin.toggle)
				{
					fontSize = 20
				};
			}
			GUILayout.BeginArea(new Rect(20f, 20f, (float)(Screen.width - 40), (float)(Screen.height - 40)));
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			string key;
			foreach (KeyValuePair<string, DebugActionToggle> toggle in toggles)
			{
				toggle.Deconstruct(out key, out var value);
				string arg = key;
				DebugActionToggle debugActionToggle = value;
				if (GUILayout.Button($"{arg}: {debugActionToggle.Value}", styleButton, Array.Empty<GUILayoutOption>()))
				{
					debugActionToggle.Value = !debugActionToggle.Value;
					debugActionToggle.OnChange(debugActionToggle.Value);
					ToastManager.Toast((object)$"change {arg} to {debugActionToggle.Value}");
				}
			}
			foreach (KeyValuePair<string, DebugAction> action in actions)
			{
				action.Deconstruct(out key, out var value2);
				string text = key;
				DebugAction debugAction = value2;
				if (GUILayout.Button(text ?? "", styleButton, Array.Empty<GUILayoutOption>()))
				{
					debugAction.OnChange();
				}
			}
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
			GUILayout.FlexibleSpace();
			GUILayout.EndArea();
		}
	}
	[HarmonyPatch]
	public class FastLoads
	{
		private static bool DoFastLoads => FreecamModule.FreecamActive || SavestateModule.IsLoadingSavestate;

		[HarmonyPatch(typeof(GameCore), "FadeToBlack")]
		[HarmonyPrefix]
		private static void FadeToBlack(ref float fadeTime)
		{
			if (DoFastLoads)
			{
				fadeTime = 0f;
			}
		}

		[HarmonyPatch(typeof(GameCore), "FadeOutBlack")]
		[HarmonyPrefix]
		private static void FadeOutBlack(ref float fadeTime, ref float delayTime)
		{
			if (DoFastLoads)
			{
				fadeTime = 0f;
				delayTime = 0f;
			}
		}

		[HarmonyPatch(typeof(UIExtension), "AddUITask")]
		[HarmonyPrefix]
		private static void AddUiTask(MonoBehaviour mb, Action action, ref float delay)
		{
			if (DoFastLoads)
			{
				delay = 0f;
			}
		}

		[HarmonyPatch(typeof(GameCore), "ChangeScene", new Type[]
		{
			typeof(ChangeSceneData),
			typeof(bool),
			typeof(bool)
		})]
		[HarmonyPrefix]
		private static void ChangeScene(ref ChangeSceneData changeSceneData, ref bool showTip, bool captureLastImage)
		{
			if (DoFastLoads)
			{
				showTip = false;
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource logSource;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			logSource.LogWarning(data);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DebugMod";

		public const string PLUGIN_NAME = "DebugMod";

		public const string PLUGIN_VERSION = "1.2.0";
	}
}
namespace DebugMod.Modules
{
	[HarmonyPatch]
	public class CheatModule
	{
		[BindableMethod(Name = "Refill all")]
		private static void RefillAll()
		{
			Player i = Player.i;
			if (i != null)
			{
				((Health)i.health).GainFull();
				i.ammo.GainFull();
				i.chiContainer.GainFull();
			}
		}
	}
	[HarmonyPatch]
	public class FreecamModule
	{
		private const float Speed = 200f;

		private const float FastMultiplier = 3f;

		private const float ScrollSpeed = 1f;

		public static bool FreecamActive;

		private static PlayerInputStateType stateBefore = (PlayerInputStateType)3;

		private static Camera sceneCamera => SingletonBehaviour<GameCore>.Instance.gameLevel.sceneCamera;

		private static ProCamera2D proCamera => SingletonBehaviour<CameraManager>.Instance.cameraCore.proCamera2D;

		[BindableMethod(/*Could not decode attribute arguments.*/)]
		private static void ToggleFreecam()
		{
			//IL_008b: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			FreecamActive = !FreecamActive;
			Player i = Player.i;
			PlayerInputBinder playerInput = Player.i.playerInput;
			if (FreecamActive)
			{
				((Behaviour)i).enabled = false;
				((Health)i.health).BecomeInvincible((Object)(object)DebugMod.Instance);
				((Behaviour)proCamera).enabled = false;
				return;
			}
			((Behaviour)i).enabled = true;
			((Health)i.health).RemoveInvincible((Object)(object)DebugMod.Instance);
			((Behaviour)proCamera).enabled = true;
			Transform transform = ((Component)sceneCamera).transform;
			Vector3 position = ((Component)sceneCamera).transform.position;
			position.z = -240f;
			transform.position = position;
		}

		public static void Update()
		{
			//IL_0035: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			if (FreecamActive)
			{
				bool key = Input.GetKey((KeyCode)304);
				float num = 200f * (key ? 3f : 1f);
				float y = Input.mouseScrollDelta.y;
				if (y != 0f)
				{
					Transform transform = ((Component)sceneCamera).transform;
					float num2 = ((y < 0f) ? 1.1f : 0.9f);
					Vector3 position = transform.position;
					position.z = transform.position.z * num2 * 1f;
					transform.position = position;
				}
				int num3 = (Input.GetKey((KeyCode)100) ? 1 : 0) - (Input.GetKey((KeyCode)97) ? 1 : 0);
				int num4 = (Input.GetKey((KeyCode)119) ? 1 : 0) - (Input.GetKey((KeyCode)115) ? 1 : 0);
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor((float)num3, (float)num4);
				Player.i.SetPosition(((Component)Player.i).transform.position + Vector2.op_Implicit(val * (Time.deltaTime * num)));
				SingletonBehaviour<CameraManager>.Instance.camera2D.MoveCameraInstantlyToPosition(Vector2.op_Implicit(((Component)Player.i).transform.position), false);
			}
		}
	}
	[HarmonyPatch]
	public class FsmInspectorModule
	{
		private static GUIStyle? style;

		private string? text = null;

		private static FieldRef<FSMStateMachineRunner, List<IStateMachine>> stateMachineRunnerStateMachineList = AccessTools.FieldRefAccess<FSMStateMachineRunner, List<IStateMachine>>("stateMachineList");

		private static FieldRef<AbstractStateTransition, AbstractConditionComp[]> stateTransitionConditions = AccessTools.FieldRefAccess<AbstractStateTransition, AbstractConditionComp[]>("conditions");

		private bool hideAnimationTransitions = true;

		[HarmonyPatch(typeof(PlayerBaseState), "OnStateEnter")]
		[HarmonyPostfix]
		private static void OnStateEnter(ref PlayerBaseState __instance)
		{
		}

		[HarmonyPatch(typeof(Player), "ClearJumpState")]
		[HarmonyPostfix]
		private static void OnStateEnter(ref Player __instance)
		{
		}

		private string InspectFSMMonsterLove(FSMStateMachineRunner runner)
		{
			string text = "";
			List<IStateMachine> list = stateMachineRunnerStateMachineList.Invoke(runner);
			foreach (IStateMachine item in list)
			{
				Type arg = ((object)item).GetType().GenericTypeArguments[0];
				StateMapping currentStateMap = item.CurrentStateMap;
				text += $"State type: {arg}\n";
				text += $"Current state: {currentStateMap.stateObj}\n";
			}
			return text;
		}

		private string StateName(string name)
		{
			return StringExtensions.TrimStartMatches(name, (ReadOnlySpan<char>)"[State] ").ToString();
		}

		private string VariableName(AbstractVariable variable)
		{
			string text = StringExtensions.TrimEndMatches(StringExtensions.TrimStartMatches(((object)variable).ToString(), (ReadOnlySpan<char>)"[Variable] "), (ReadOnlySpan<char>)" (VariableBool)").ToString();
			return text + " " + variable.FinalData.GetSaveID;
		}

		private string TransitionName(AbstractStateTransition transition)
		{
			if (!Object.op_Implicit((Object)(object)transition))
			{
				return "null";
			}
			return StringExtensions.TrimStartMatches(StringExtensions.TrimStartMatches(((Object)transition).name, (ReadOnlySpan<char>)"[Action] ").ToString(), (ReadOnlySpan<char>)"[Transition] ").ToString();
		}

		private string InspectFSM(GameObject gameObject)
		{
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				return "null";
			}
			string text = "";
			FSMStateMachineRunner component = gameObject.GetComponent<FSMStateMachineRunner>();
			if (Object.op_Implicit((Object)(object)component))
			{
				return InspectFSMMonsterLove(component);
			}
			StateMachineOwner component2 = gameObject.GetComponent<StateMachineOwner>();
			if (!Object.op_Implicit((Object)(object)component2))
			{
				return "No fsm found";
			}
			GeneralFSMContext fsmContext = component2.FsmContext;
			text = text + "Current State: " + StringExtensions.TrimStartMatches(((Object)((Component)((StateMachineContext<GeneralState, GeneralState>)(object)fsmContext).fsm.State).gameObject).name, (ReadOnlySpan<char>)"[State] ").ToString() + "\n";
			text = text + "Last transition: " + TransitionName(fsmContext.LastTransition) + "\n";
			GeneralState[] states = ((StateMachineContext<GeneralState, GeneralState>)(object)fsmContext).States;
			foreach (GeneralState val in states)
			{
				text = text + "State " + StateName(((Object)val).name) + ":\n";
				text += "  Actions:\n";
				AbstractStateAction[] actions = val.Actions;
				foreach (AbstractStateAction val2 in actions)
				{
					if (val2 is StateTransitionAction)
					{
						continue;
					}
					string text2 = ((object)val2).ToString();
					AnimatorPlayAction val3 = (AnimatorPlayAction)(object)((val2 is AnimatorPlayAction) ? val2 : null);
					if (val3 != null)
					{
						if (hideAnimationTransitions)
						{
							continue;
						}
						text2 = "play animation " + val3.StateName + " on '" + ((Object)val3.animator).name + "'";
					}
					else
					{
						SetVariableBoolAction val4 = (SetVariableBoolAction)(object)((val2 is SetVariableBoolAction) ? val2 : null);
						if (val4 != null && !val4.Multiple)
						{
							text2 = $"set bool {VariableName((AbstractVariable)(object)val4.targetFlag)} = {val4.TargetValue}";
						}
					}
					if (!((Behaviour)val2).isActiveAndEnabled)
					{
						text2 = "(disabled) " + text2;
					}
					text = text + "    " + text2 + "\n";
				}
				text += "  Transitions:\n";
				AbstractStateTransition[] transitions = val.Transitions;
				foreach (AbstractStateTransition val5 in transitions)
				{
					ReadOnlySpan<char> readOnlySpan = StringExtensions.TrimStartMatches(StringExtensions.TrimStartMatches(((Object)val5).name, (ReadOnlySpan<char>)"[Action] ").ToString(), (ReadOnlySpan<char>)"[Transition] ");
					text = text + "    " + (val5.IsDefaultTransition ? "default" : "") + " to " + StateName(((Object)val5.target).name) + " (" + readOnlySpan.ToString() + ")\n";
					AbstractConditionComp[] array = stateTransitionConditions.Invoke(val5);
					foreach (AbstractConditionComp val6 in array)
					{
						string text3 = StringExtensions.TrimStartMatches(((Object)val6).name, (ReadOnlySpan<char>)"[Condition] ").ToString();
						FlagBoolCondition val7 = (FlagBoolCondition)(object)((val6 is FlagBoolCondition) ? val6 : null);
						if (val7 != null)
						{
							text3 = $"bool flag {VariableName((AbstractVariable)(object)val7.flagBool)} current {val7.flagBool.FlagValue}";
						}
						if (val6.FinalResultInverted)
						{
							text3 = "!" + text3;
						}
						text = text + "      " + text3 + "\n";
					}
				}
			}
			return text;
		}

		public void OnGui()
		{
			//IL_00f6: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			List<GameObject> list = new List<GameObject>();
			try
			{
				text = "";
				foreach (GameObject item in list)
				{
					text += ((item != null) ? ((Object)item).name : null);
					text += "\n";
					text += InspectFSM(item);
					text += "\n";
				}
				GameObject val = GameObject.Find("AG_S2/Room/Prefab/Treasure Chests 寶箱/LootProvider 刺蝟玉/0_DropPickable Bag FSM/ItemProvider/DropPickable FSM Prototype");
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)ex);
			}
			if (style == null)
			{
				style = new GUIStyle(GUI.skin.label)
				{
					fontSize = 20
				};
			}
			GUI.Label(new Rect(8f, 8f, 6000f, 1000f), text, style);
		}
	}
	public record GhostFrame(Vector3 Position, string SpriteName, int Facing)
	{
		[CompilerGenerated]
		protected virtual bool PrintMembers(StringBuilder builder)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			RuntimeHelpers.EnsureSufficientExecutionStack();
			builder.Append("Position = ");
			Vector3 position = Position;
			builder.Append(((object)(Vector3)(ref position)).ToString());
			builder.Append(", SpriteName = ");
			builder.Append((object?)SpriteName);
			builder.Append(", Facing = ");
			builder.Append(Facing.ToString());
			return true;
		}
	}
	internal class GhostPlayback
	{
		public SpriteRenderer PlayerCopy;

		public GhostFrame[] Frames;

		public int PlaybackIndex;
	}
	public class GhostModule
	{
		private Dictionary<string, Sprite> playerSprites = new Dictionary<string, Sprite>();

		private bool recording = false;

		private List<GhostFrame> recordingFrames = new List<GhostFrame>();

		private List<GhostPlayback> playbacks = new List<GhostPlayback>();

		public GhostFrame[] CurrentRecording => recordingFrames.ToArray();

		public void StartRecording()
		{
			recordingFrames.Clear();
			recording = true;
		}

		public void StopRecording()
		{
			recording = false;
		}

		public void ToggleRecording()
		{
			if (recording)
			{
				StopRecording();
			}
			else
			{
				StartRecording();
			}
		}

		public void Playback(GhostFrame[] frames)
		{
			Player i = Player.i;
			SpriteRenderer component = Object.Instantiate<GameObject>(((Component)i.PlayerSprite).gameObject).GetComponent<SpriteRenderer>();
			Object.DontDestroyOnLoad((Object)(object)component);
			playbacks.Add(new GhostPlayback
			{
				PlayerCopy = component,
				PlaybackIndex = 0,
				Frames = frames
			});
		}

		private void UpdateRecord()
		{
			//IL_0022: 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_0042: Expected I4, but got Unknown
			Player i = Player.i;
			if (Object.op_Implicit((Object)(object)i))
			{
				recordingFrames.Add(new GhostFrame(((Component)i).transform.position, ((Object)i.PlayerSprite.sprite).name, (int)((Actor)i).Facing));
			}
		}

		private void UpdatePlayback(GhostPlayback playback, GhostFrame ghostFrame)
		{
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			((Component)playback.PlayerCopy).transform.position = ghostFrame.Position + Vector3.down * 3.5f;
			playerSprites.TryGetValue(ghostFrame.SpriteName, out var value);
			playback.PlayerCopy.sprite = value;
			((Component)playback.PlayerCopy).transform.localScale = new Vector3((float)ghostFrame.Facing, 1f, 1f);
		}

		public void LateUpdate()
		{
			if (recording)
			{
				UpdateRecord();
			}
			for (int num = playbacks.Count - 1; num >= 0; num--)
			{
				GhostPlayback ghostPlayback = playbacks[num];
				if (ghostPlayback.PlaybackIndex < ghostPlayback.Frames.Length)
				{
					UpdatePlayback(ghostPlayback, ghostPlayback.Frames[ghostPlayback.PlaybackIndex]);
					ghostPlayback.PlaybackIndex++;
				}
				else
				{
					Object.Destroy((Object)(object)ghostPlayback.PlayerCopy);
					playbacks.RemoveAt(num);
				}
			}
			Player i = Player.i;
			if (i != null)
			{
				Sprite sprite = i.PlayerSprite.sprite;
				string name = ((Object)sprite).name;
				playerSprites.TryAdd(name, sprite);
			}
		}

		public void Unload()
		{
			playbacks.ForEach(delegate(GhostPlayback playback)
			{
				Object.Destroy((Object)(object)playback.PlayerCopy);
			});
			playbacks.Clear();
		}
	}
	public class InfotextModule
	{
		private static bool infotextActive;

		private TMP_Text debugCanvasInfoText;

		private FieldRef<Player, float> groundJumpReferenceY = AccessTools.FieldRefAccess<Player, float>("GroundJumpRefrenceY");

		public InfotextModule()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0072: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Info Text");
			val.transform.SetParent(((Component)NineSolsAPICore.FullscreenCanvas).gameObject.transform);
			debugCanvasInfoText = (TMP_Text)(object)val.AddComponent<TextMeshProUGUI>();
			debugCanvasInfoText.alignment = (TextAlignmentOptions)257;
			debugCanvasInfoText.fontSize = 20f;
			((Graphic)debugCanvasInfoText).color = Color.white;
			RectTransform component = ((Component)debugCanvasInfoText).GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.anchoredPosition = new Vector2(10f, -10f);
			component.sizeDelta = new Vector2(800f, 0f);
		}

		[BindableMethod(Name = "Toggle Infotext")]
		private static void ToggleFreecam()
		{
			infotextActive = !infotextActive;
		}

		public void Update()
		{
			if (infotextActive)
			{
				UpdateInfoText();
			}
			else
			{
				debugCanvasInfoText.text = "";
			}
		}

		private void UpdateInfoText()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_014e: 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_017c: Invalid comparison between Unknown and I4
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			if (!SingletonBehaviour<GameCore>.IsAvailable())
			{
				text += "not yet available\n";
				debugCanvasInfoText.text = text;
				return;
			}
			GameCore instance = SingletonBehaviour<GameCore>.Instance;
			if ((int)instance.currentCoreState != 1)
			{
				string enumName = typeof(GameCoreState).GetEnumName(instance.currentCoreState);
				text = text + enumName + "\n";
			}
			Player player = instance.player;
			if (Object.op_Implicit((Object)(object)player))
			{
				text += $"Pos: {Vector2.op_Implicit(((Component)player).transform.position)}\n";
				text += $"Speed: {((Actor)player).FinalVelocity}\n";
				text += $"HP: {player.health.CurrentHealthValue} (+{player.health.CurrentInternalInjury})\n";
				string enumName2 = typeof(PlayerStateType).GetEnumName(player.fsm.State);
				PlayerInputStateType state = player.playerInput.fsm.State;
				text = text + enumName2 + " " + (((int)state == 0) ? "" : ((object)(PlayerInputStateType)(ref state)).ToString()) + "\n";
				if ((int)player.jumpState > 0)
				{
					float currentVarJumpTimer = player.currentVarJumpTimer;
					text += string.Format("JumpState {0} {1} {2}\n", player.jumpState, (currentVarJumpTimer > 0f) ? currentVarJumpTimer.ToString("0.00") : "", player.IsAirJumping);
				}
				else
				{
					text += "\n";
				}
				List<(bool, string)> source = new List<(bool, string)>(4)
				{
					(player.isOnWall, "isOnWall"),
					(player.isOnLedge, "isOnLedge"),
					(player.isOnRope, "isOnRope"),
					(player.kicked, "kicked")
				};
				string text2 = GeneralExtensions.Join<(bool, string)>(source.Where(((bool, string) x) => x.Item1), (Func<(bool, string), string>)(((bool, string) x) => x.Item2), " ");
				text = text + text2 + "\n";
			}
			GameLevel gameLevel = instance.gameLevel;
			if (Object.op_Implicit((Object)(object)gameLevel))
			{
				text += $"[{gameLevel.SceneName}] ({gameLevel.BlockCountX}x{gameLevel.BlockCountY})\n";
			}
			if (instance.currentCutScene != null)
			{
				text += $"{instance.currentCutScene}";
			}
			debugCanvasInfoText.text = text;
		}

		public void Destroy()
		{
			Object.Destroy((Object)(object)((Component)debugCanvasInfoText).gameObject);
		}
	}
	public static class MapTeleportModule
	{
		public static void Update()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			bool forceReloadScene = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305);
			if (Input.GetMouseButtonDown(0) && SingletonBehaviour<UIManager>.IsAvailable())
			{
				try
				{
					TeleportToMap(Vector2.op_Implicit(Input.mousePosition), forceReloadScene);
				}
				catch (Exception arg)
				{
					ToastManager.Toast((object)$"Could not teleport: {arg}");
				}
			}
		}

		private static void TeleportToMap(Vector2 screenPosition, bool forceReloadScene)
		{
			//IL_0041: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_006a: 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_0071: 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)
			MapPanelController mapPanelController = SingletonBehaviour<UIManager>.Instance.mapPanelController;
			MapPanelController minimap = mapPanelController.completeMapPanel.Minimap;
			if (((Behaviour)minimap).isActiveAndEnabled)
			{
				RectTransform imageMaskRoot = minimap.ImageMaskRoot;
				Camera componentInChildren = ((Component)SingletonBehaviour<UIManager>.Instance).gameObject.GetComponentInChildren<Camera>();
				Vector2 val = default(Vector2);
				if (RectTransformUtility.ScreenPointToLocalPointInRectangle(imageMaskRoot, screenPosition, componentInChildren, ref val))
				{
					Vector2 imageRatio = val / imageMaskRoot.sizeDelta;
					Vector2 worldPosition = minimap.MapData.ImageRatioToWorldPosition(imageRatio);
					TeleportTo(worldPosition, minimap.MapData.sceneID, forceReloadScene);
				}
			}
		}

		public static void TeleportTo(Vector2 worldPosition, string sceneID, bool forceReloadScene)
		{
			//IL_0046: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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)
			SingletonBehaviour<UIManager>.Instance.menuUI.HideMenu();
			bool flag = sceneID == SingletonBehaviour<GameCore>.Instance.CurrentSceneName;
			if (!flag || forceReloadScene)
			{
				GoToScene(sceneID, Vector2.op_Implicit(worldPosition), showTip: true);
			}
			else
			{
				((Component)Player.i).transform.position = Vector2.op_Implicit(worldPosition);
			}
			SingletonBehaviour<CameraManager>.Instance.camera2D.MoveCameraInstantlyToPosition(Vector2.op_Implicit(((Component)Player.i).transform.position), false);
		}

		private static void GoToScene(string sceneName, Vector3 worldPosition, bool showTip = false)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0034: 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_003a: 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)
			ChangeSceneData val = default(ChangeSceneData);
			val.sceneName = sceneName;
			val.playerSpawnPosition = (SpawnPositionDelegate)(() => worldPosition);
			val.changeSceneMode = (ChangeSceneMode)5;
			ChangeSceneData val2 = val;
			SingletonBehaviour<GameCore>.Instance.ChangeScene(val2, showTip, false);
		}
	}
	internal static class Extensions
	{
		public static Vector2 ImageRatioToWorldPosition(this GameLevelMapData levelData, Vector2 imageRatio)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			float num = (imageRatio.x - levelData.ImageMapRatioMinX) / (levelData.ImageMapRatioMaxX - levelData.ImageMapRatioMinX);
			float num2 = (imageRatio.y - levelData.ImageMapRatioMinY) / (levelData.ImageMapRatioMaxY - levelData.ImageMapRatioMinY);
			float num3 = num * (float)levelData.MapWidth + (float)levelData.MapMinX;
			float num4 = num2 * (float)levelData.MapHeight + (float)levelData.MapMinY;
			return new Vector2(num3, num4);
		}
	}
	[HarmonyPatch]
	public class QuantumConsoleModule
	{
		private bool consoleInitialized;

		[HarmonyPatch(typeof(QuantumConsoleProcessor), "LoadCommandsFromType")]
		[HarmonyFinalizer]
		private static Exception LoadCommandsFromType(Type type, Exception __exception)
		{
			return null;
		}

		[HarmonyPatch(typeof(QuantumConsole), "IsSupportedState")]
		[HarmonyPrefix]
		private static bool IsSupportedState(ref bool __result)
		{
			__result = true;
			return false;
		}

		public QuantumConsoleModule()
		{
			QuantumConsoleProcessor.GenerateCommandTable(true, false);
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		public void Unload()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			if (!consoleInitialized && Object.op_Implicit((Object)(object)QuantumConsole.Instance))
			{
				QuantumConsole.Instance.OnActivate += QuantumConsoleActivate;
				QuantumConsole.Instance.OnDeactivate += QuantumConsoleDeactivate;
				consoleInitialized = true;
			}
		}

		private void QuantumConsoleActivate()
		{
			if (SingletonBehaviour<GameCore>.IsAvailable())
			{
				SingletonBehaviour<GameCore>.Instance.player.playerInput.VoteForState((PlayerInputStateType)7, (MonoBehaviour)(object)QuantumConsole.Instance);
			}
		}

		private void QuantumConsoleDeactivate()
		{
			if (SingletonBehaviour<GameCore>.IsAvailable())
			{
				SingletonBehaviour<GameCore>.Instance.player.playerInput.RevokeAllMyVote((MonoBehaviour)(object)QuantumConsole.Instance);
			}
		}
	}
	internal class Savestate
	{
		public string MetaJson;

		public byte[] Flags;

		public string Scene;

		public Vector3 PlayerPosition;

		public Vector2 PlayerVelocity;
	}
	public class SavestateModule
	{
		[CanBeNull]
		private static MethodInfo OldLoadFlagsMethodInfo = typeof(GameFlagManager).GetMethod("LoadFlags");

		[CanBeNull]
		private static MethodInfo NewLoadFlagsMethodInfo = typeof(GameFlagManager).GetMethod("LoadFlagsFromBinarySave");

		[CanBeNull]
		private static MethodInfo FlagsToBinary = typeof(GameFlagManager).GetMethod("FlagsToBinary");

		public static bool IsLoadingSavestate = false;

		private Dictionary<string, Savestate> savestates = new Dictionary<string, Savestate>();

		public event EventHandler SavestateLoaded;

		public event EventHandler SavestateCreated;

		[BindableMethod(Name = "Create Savestate")]
		private static void CreateSavestateMethod()
		{
			SavestateModule savestateModule = DebugMod.Instance.SavestateModule;
			savestateModule.CreateSavestate("0");
			ToastManager.Toast((object)"Savestate '0' created");
		}

		[BindableMethod(Name = "Load Savestate")]
		private static void LoadSavestateMethod()
		{
			SavestateModule savestateModule = DebugMod.Instance.SavestateModule;
			if (!savestateModule.savestates.TryGetValue("0", out var value))
			{
				ToastManager.Toast((object)"Savestate '0' not found");
				return;
			}
			try
			{
				savestateModule.LoadSavestate(value);
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)ex);
			}
		}

		[BindableMethod(Name = "Load Savestate\n(No reload)")]
		private static void LoadSavestateMethodNoReload()
		{
			SavestateModule savestateModule = DebugMod.Instance.SavestateModule;
			if (!savestateModule.savestates.TryGetValue("0", out var value))
			{
				ToastManager.Toast((object)"Savestate '0' not found");
				return;
			}
			try
			{
				savestateModule.LoadSavestateNoReload(value);
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)ex);
			}
		}

		private void CreateSavestate(string slot)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			SaveManager instance = SingletonBehaviour<SaveManager>.Instance;
			GameCore instance2 = SingletonBehaviour<GameCore>.Instance;
			Player i = Player.i;
			Vector3 position = ((Component)i).transform.position;
			Vector2 velocity = ((PhysicsMover)i).Velocity;
			SaveSlotMetaData val = instance2.playerGameData.SaveMetaData();
			string metaJson = JsonUtility.ToJson((object)val);
			byte[] flags = ((OldLoadFlagsMethodInfo != null) ? Encoding.UTF8.GetBytes(GameFlagManager.FlagsToJson(instance.allFlags)) : ((byte[])FlagsToBinary.Invoke(null, new object[1] { instance.allFlags })));
			Savestate obj = new Savestate
			{
				MetaJson = metaJson,
				Flags = flags
			};
			Scene scene = ((Component)instance2.gameLevel).gameObject.scene;
			obj.Scene = ((Scene)(ref scene)).name;
			obj.PlayerPosition = position;
			obj.PlayerVelocity = velocity;
			Savestate value = obj;
			savestates[slot] = value;
			this.SavestateCreated?.Invoke(this, EventArgs.Empty);
		}

		private void LoadFlags(Savestate savestate)
		{
			GameFlagCollection allFlags = SingletonBehaviour<SaveManager>.Instance.allFlags;
			if (OldLoadFlagsMethodInfo != null)
			{
				OldLoadFlagsMethodInfo.Invoke(null, new object[3]
				{
					Encoding.UTF8.GetString(savestate.Flags),
					allFlags,
					(object)(TestMode)0
				});
			}
			else if (NewLoadFlagsMethodInfo == null)
			{
				Log.Error("LoadFlagsFromBinarySave doesn't exist");
			}
			else
			{
				NewLoadFlagsMethodInfo.Invoke(null, new object[3]
				{
					savestate.Flags,
					allFlags,
					(object)(TestMode)0
				});
			}
		}

		private void LoadSavestate(Savestate savestate)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0072: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			IsLoadingSavestate = true;
			SaveManager instance = SingletonBehaviour<SaveManager>.Instance;
			LoadFlags(savestate);
			instance.allFlags.AllFlagInitStartAndEquip();
			Vector3 currentPos = savestate.PlayerPosition;
			SingletonBehaviour<GameCore>.Instance.ChangeScene(new ChangeSceneData
			{
				sceneName = savestate.Scene,
				panData = 
				{
					panType = (CameraPanType)0
				},
				panData = 
				{
					fromPosition = currentPos
				},
				playerSpawnPosition = (SpawnPositionDelegate)(() => currentPos),
				ChangedDoneEvent = delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					((PhysicsMover)Player.i).Velocity = savestate.PlayerVelocity;
					OnSavestateLoaded();
				}
			}, false, false);
			ToastManager.Toast((object)"Savestate loaded");
			IsLoadingSavestate = false;
		}

		private void LoadSavestateNoReload(Savestate savestate)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			IsLoadingSavestate = true;
			SaveManager instance = SingletonBehaviour<SaveManager>.Instance;
			LoadFlags(savestate);
			instance.allFlags.AllFlagInitStartAndEquip();
			SingletonBehaviour<GameCore>.Instance.ResetLevel(false);
			MapTeleportModule.TeleportTo(Vector2.op_Implicit(savestate.PlayerPosition), savestate.Scene, forceReloadScene: false);
			((PhysicsMover)Player.i).Velocity = savestate.PlayerVelocity;
			OnSavestateLoaded();
			ToastManager.Toast((object)"Savestate loaded");
			IsLoadingSavestate = false;
		}

		private void OnSavestateLoaded()
		{
			this.SavestateLoaded?.Invoke(this, EventArgs.Empty);
		}

		public void Unload()
		{
			savestates = new Dictionary<string, Savestate>();
		}
	}
	internal enum TimerMode
	{
		AfterSavestate,
		NextRoom
	}
	internal enum SpeedrunTimerState
	{
		Inactive,
		Running,
		StartNextRoom
	}
	[HarmonyPatch]
	public class SpeedrunTimerModule
	{
		private static bool isLoading;

		private const bool EnableGhost = false;

		private GUIStyle? style;

		private float segmentStartTime = 0f;

		private float time = 0f;

		private string? startRoom = null;

		private TimerMode timerMode = TimerMode.AfterSavestate;

		private SpeedrunTimerState state = SpeedrunTimerState.Inactive;

		private (Vector2, string)? endpoint = null;

		private bool done = false;

		private List<(string, float, GhostFrame[]?)>? lastSegments = null;

		private List<(string, float, GhostFrame[]?)> currentSegments = new List<(string, float, GhostFrame[])>();

		private float? lastTimeDelta;

		private Sprite? endpointSprite;

		private GameObject? endpointObject;

		private GhostModule GhostModule => DebugMod.Instance.GhostModule;

		[HarmonyPatch(typeof(GameCore), "InitializeGameLevel")]
		[HarmonyPostfix]
		private static void InitializeGameLevel()
		{
			isLoading = false;
			SpeedrunTimerModule speedrunTimerModule = DebugMod.Instance.SpeedrunTimerModule;
			if (speedrunTimerModule.startRoom != SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName)
			{
				speedrunTimerModule.OnLevelChangeDone();
			}
			speedrunTimerModule.SpawnEndpointTexture();
		}

		[HarmonyPatch(typeof(GameCore), "ChangeScene", new Type[]
		{
			typeof(ChangeSceneData),
			typeof(bool),
			typeof(bool)
		})]
		[HarmonyPostfix]
		private static void ChangeScene()
		{
			isLoading = true;
			SpeedrunTimerModule speedrunTimerModule = DebugMod.Instance.SpeedrunTimerModule;
			speedrunTimerModule.OnLevelChange();
		}

		private void OnLevelChange()
		{
			EndSegment();
		}

		private void OnLevelChangeDone()
		{
			SegmentBegin();
			if (state == SpeedrunTimerState.StartNextRoom && startRoom != SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName)
			{
				state = SpeedrunTimerState.Running;
			}
		}

		private void EndSegment()
		{
			if (state != SpeedrunTimerState.Running)
			{
				return;
			}
			float num = time - segmentStartTime;
			segmentStartTime = time;
			Log.Info($"Ending segment of {num:0.00}s {lastSegments?.Count}");
			GhostFrame[] item = null;
			bool flag = false;
			currentSegments.Add((SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName, num, item));
			if (lastSegments == null)
			{
				return;
			}
			int num2 = 0;
			float? num3 = null;
			float? num4 = null;
			while (true)
			{
				Log.Info(string.Format("{0} curr {1} last {2}", num2, currentSegments.Count, (lastSegments != null) ? lastSegments.Count.ToString() : "null"));
				if (num2 >= currentSegments.Count)
				{
					lastTimeDelta = num4 - num3;
					Log.Info($"lasttiemdelta of {lastTimeDelta:0.00}s");
					break;
				}
				if (num2 >= lastSegments.Count)
				{
					break;
				}
				(string, float, GhostFrame[]) tuple = lastSegments[num2];
				float? num5 = tuple.Item2;
				string item2 = tuple.Item1;
				num3 = num5;
				tuple = currentSegments[num2];
				float? num6 = tuple.Item2;
				string item3 = tuple.Item1;
				num4 = num6;
				if (item2 != item3)
				{
					break;
				}
				num2++;
			}
		}

		private (string, float, GhostFrame[]?)? GetMatchingLastSegment()
		{
			if (lastSegments == null)
			{
				return null;
			}
			(string, float, GhostFrame[])? tuple = null;
			int num = 0;
			while (true)
			{
				if (num >= lastSegments.Count)
				{
					return null;
				}
				tuple = lastSegments[num];
				if (num >= currentSegments.Count)
				{
					break;
				}
				num++;
			}
			return tuple;
		}

		private void SegmentBegin()
		{
			segmentStartTime = time;
			bool flag = false;
			bool flag2 = false;
		}

		public void OnSavestateCreated()
		{
			state = SpeedrunTimerState.Inactive;
			done = false;
			currentSegments = new List<(string, float, GhostFrame[])>();
			lastSegments = null;
			lastTimeDelta = null;
			segmentStartTime = 0f;
		}

		public void OnSavestateLoaded()
		{
			time = 0f;
			segmentStartTime = 0f;
			done = false;
			currentSegments = new List<(string, float, GhostFrame[])>();
			lastTimeDelta = null;
			startRoom = SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName;
			TimerMode timerMode = this.timerMode;
			if (1 == 0)
			{
			}
			SpeedrunTimerState speedrunTimerState = timerMode switch
			{
				TimerMode.AfterSavestate => SpeedrunTimerState.Running, 
				TimerMode.NextRoom => SpeedrunTimerState.StartNextRoom, 
				_ => throw new ArgumentOutOfRangeException(), 
			};
			if (1 == 0)
			{
			}
			state = speedrunTimerState;
			SegmentBegin();
		}

		private void SpawnEndpointTexture()
		{
			//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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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)
			(Vector2, string)? tuple = endpoint;
			if (!tuple.HasValue)
			{
				return;
			}
			var (val, text) = tuple.GetValueOrDefault();
			if (1 == 0 || SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName != text)
			{
				return;
			}
			if ((Object)(object)endpointSprite == (Object)null)
			{
				Texture2D val2 = Resources.LoadAll<Texture2D>("/").First((Texture2D t) => ((Object)t).name == "checkmark");
				endpointSprite = Sprite.CreateSprite(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0f), 16f, 0u, (SpriteMeshType)0, Vector4.zero, false, Array.Empty<SecondarySpriteTexture>());
			}
			if (Object.op_Implicit((Object)(object)endpointObject))
			{
				Object.Destroy((Object)(object)endpointObject);
			}
			GameObject val3 = new GameObject("flag");
			val3.transform.position = Vector2.op_Implicit(val);
			endpointObject = val3;
			SpriteRenderer val4 = endpointObject.AddComponent<SpriteRenderer>();
			val4.sprite = endpointSprite;
			((Renderer)val4).material.shader = Shader.Find("GUI/Text Shader");
			((Renderer)val4).material.color = new Color(0.8f, 0.2f, 1f, 1f);
		}

		public void SetEndpoint()
		{
			//IL_000b: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)Player.i).transform.position;
			string sceneName = SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName;
			endpoint = (Vector2.op_Implicit(position), sceneName);
			SpawnEndpointTexture();
		}

		private void EndpointReached()
		{
			if (state == SpeedrunTimerState.Running)
			{
				EndSegment();
				done = true;
				state = SpeedrunTimerState.Inactive;
				lastSegments = currentSegments;
				ToastManager.Toast((object)$"endpoint reached with {currentSegments.Count}");
				currentSegments = new List<(string, float, GhostFrame[])>();
			}
		}

		public void CycleTimerMode()
		{
			timerMode = (TimerMode)((int)(timerMode + 1) % 2);
			ToastManager.Toast((object)timerMode);
		}

		public void LateUpdate()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			if (state == SpeedrunTimerState.Inactive)
			{
				return;
			}
			try
			{
				if (state == SpeedrunTimerState.Running && !isLoading)
				{
					time += RCGTime.deltaTime;
				}
				(Vector2, string)? tuple = endpoint;
				if (!tuple.HasValue)
				{
					return;
				}
				var (val, text) = tuple.GetValueOrDefault();
				if (text == SingletonBehaviour<GameCore>.Instance.gameLevel.SceneName)
				{
					float num = Vector2.Distance(Vector2.op_Implicit(((Component)Player.i).transform.position), val);
					if (num < 20f)
					{
						EndpointReached();
					}
				}
			}
			catch (Exception arg)
			{
				Log.Error($"Error during speedruntime LateUpdate: {arg}");
			}
		}

		public void OnGui()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			if (done || state != 0)
			{
				if (style == null)
				{
					style = new GUIStyle(GUI.skin.label)
					{
						fontStyle = (FontStyle)1,
						fontSize = 30
					};
				}
				string text = string.Format("{0}{1:0.0}s", done ? "Done in " : "", time);
				float? num = lastTimeDelta;
				if (num.HasValue)
				{
					string text2 = string.Format("{0}{1:0.0}s", (lastTimeDelta > 0f) ? "+" : "", lastTimeDelta);
					text = text + "\nCompared to last: " + text2;
				}
				GUI.Label(new Rect(8f, 8f, 600f, 100f), text, style);
			}
		}

		public void Destroy()
		{
			if (Object.op_Implicit((Object)(object)endpointObject))
			{
				Object.Destroy((Object)(object)endpointObject);
			}
		}
	}
	public class TimeModule
	{
		[BindableMethod(Name = "Toggle Fastforward")]
		private static void OnFastForwardChange()
		{
			RCGTime.GlobalSimulationSpeed = ((RCGTime.GlobalSimulationSpeed != 1f) ? 1 : 2);
		}

		[BindableMethod(Name = "Play/Pause")]
		private static void PlayPause()
		{
			RCGTime.GlobalSimulationSpeed = ((RCGTime.GlobalSimulationSpeed == 0f) ? 1 : 0);
		}

		[BindableMethod(Name = "Advance Frame")]
		private static void FrameAdvance()
		{
			RCGTime.GlobalSimulationSpeed = 0f;
			((MonoBehaviour)DebugMod.Instance).StartCoroutine(AdvanceFrameCoro());
		}

		private static IEnumerator AdvanceFrameCoro()
		{
			RCGTime.GlobalSimulationSpeed = 1f;
			yield return null;
			RCGTime.GlobalSimulationSpeed = 0f;
		}
	}
}
namespace DebugMod.Modules.Hitbox
{
	public static class Drawing
	{
		private static Texture2D aaLineTex;

		private static Texture2D lineTex;

		private static Material blitMaterial;

		private static Material blendMaterial;

		private static Rect lineRect;

		public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
		{
			//IL_0001: 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_000f: 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_007c: 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_0097: 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_00d8: 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_00e6: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			float num = pointB.x - pointA.x;
			float num2 = pointB.y - pointA.y;
			float num3 = Mathf.Sqrt(num * num + num2 * num2);
			if (!(num3 < 0.001f))
			{
				Texture2D val;
				Material val2;
				if (antiAlias)
				{
					width *= 3f;
					val = aaLineTex;
					val2 = blendMaterial;
				}
				else
				{
					val = lineTex;
					val2 = blitMaterial;
				}
				float num4 = width * num2 / num3;
				float num5 = width * num / num3;
				Matrix4x4 identity = Matrix4x4.identity;
				identity.m00 = num;
				identity.m01 = 0f - num4;
				identity.m03 = pointA.x + 0.5f * num4;
				identity.m10 = num2;
				identity.m11 = num5;
				identity.m13 = pointA.y - 0.5f * num5;
				GL.PushMatrix();
				GL.MultMatrix(identity);
				Graphics.DrawTexture(lineRect, (Texture)(object)val, lineRect, 0, 0, 0, 0, color, val2);
				if (antiAlias)
				{
					Graphics.DrawTexture(lineRect, (Texture)(object)val, lineRect, 0, 0, 0, 0, color, val2);
				}
				GL.PopMatrix();
			}
		}

		public static void DrawCircle(Vector2 center, int radius, Color color, float width, int segmentsPerQuarter)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			DrawCircle(center, radius, color, width, antiAlias: false, segmentsPerQuarter);
		}

		public static void DrawCircle(Vector2 center, int radius, Color color, float width, bool antiAlias, int segmentsPerQuarter)
		{
			//IL_000c: 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_0022: 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_003a: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0089: 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_009e: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00fd: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: 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)
			//IL_0150: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)radius * 0.55191505f;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(center.x, center.y - (float)radius);
			Vector2 endTangent = default(Vector2);
			((Vector2)(ref endTangent))..ctor(center.x - num, center.y - (float)radius);
			Vector2 startTangent = default(Vector2);
			((Vector2)(ref startTangent))..ctor(center.x + num, center.y - (float)radius);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(center.x + (float)radius, center.y);
			Vector2 endTangent2 = default(Vector2);
			((Vector2)(ref endTangent2))..ctor(center.x + (float)radius, center.y - num);
			Vector2 startTangent2 = default(Vector2);
			((Vector2)(ref startTangent2))..ctor(center.x + (float)radius, center.y + num);
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(center.x, center.y + (float)radius);
			Vector2 startTangent3 = default(Vector2);
			((Vector2)(ref startTangent3))..ctor(center.x - num, center.y + (float)radius);
			Vector2 endTangent3 = default(Vector2);
			((Vector2)(ref endTangent3))..ctor(center.x + num, center.y + (float)radius);
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(center.x - (float)radius, center.y);
			Vector2 startTangent4 = default(Vector2);
			((Vector2)(ref startTangent4))..ctor(center.x - (float)radius, center.y - num);
			Vector2 endTangent4 = default(Vector2);
			((Vector2)(ref endTangent4))..ctor(center.x - (float)radius, center.y + num);
			DrawBezierLine(val, startTangent, val2, endTangent2, color, width, antiAlias, segmentsPerQuarter);
			DrawBezierLine(val2, startTangent2, val3, endTangent3, color, width, antiAlias, segmentsPerQuarter);
			DrawBezierLine(val3, startTangent3, val4, endTangent4, color, width, antiAlias, segmentsPerQuarter);
			DrawBezierLine(val4, startTangent4, val, endTangent, color, width, antiAlias, segmentsPerQuarter);
		}

		public static void DrawBezierLine(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, bool antiAlias, int segments)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0016: 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)
			//IL_0018: 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)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Vector2 pointA = CubeBezier(start, startTangent, end, endTangent, 0f);
			for (int i = 1; i < segments + 1; i++)
			{
				Vector2 val = CubeBezier(start, startTangent, end, endTangent, (float)i / (float)segments);
				DrawLine(pointA, val, color, width, antiAlias);
				pointA = val;
			}
		}

		private static Vector2 CubeBezier(Vector2 s, Vector2 st, Vector2 e, Vector2 et, float t)
		{
			//IL_000f: 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_0021: 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_0027: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			float num = 1f - t;
			return num * num * num * s + 3f * num * num * t * st + 3f * num * t * t * et + t * t * t * e;
		}

		static Drawing()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			aaLineTex = null;
			lineTex = null;
			blitMaterial = null;
			blendMaterial = null;
			lineRect = new Rect(0f, 0f, 1f, 1f);
			Initialize();
		}

		private static void Initialize()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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)
			if ((Object)(object)lineTex == (Object)null)
			{
				lineTex = new Texture2D(1, 1, (TextureFormat)5, false);
				lineTex.SetPixel(0, 1, Color.white);
				lineTex.Apply();
			}
			if ((Object)(object)aaLineTex == (Object)null)
			{
				aaLineTex = new Texture2D(1, 3, (TextureFormat)5, false);
				aaLineTex.SetPixel(0, 0, new Color(1f, 1f, 1f, 0f));
				aaLineTex.SetPixel(0, 1, Color.white);
				aaLineTex.SetPixel(0, 2, new Color(1f, 1f, 1f, 0f));
				aaLineTex.Apply();
			}
			blitMaterial = (Material)typeof(GUI).GetMethod("get_blitMaterial", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null);
			blendMaterial = (Material)typeof(GUI).GetMethod("get_blendMaterial", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null);
		}
	}
	public class HitboxModule
	{
		private static bool hitboxesVisible;

		private HitboxRender hitboxRender;

		[BindableMethod(/*Could not decode attribute arguments.*/)]
		private static void ToggleHitboxes()
		{
			hitboxesVisible = !hitboxesVisible;
			if (hitboxesVisible)
			{
				DebugMod.Instance.HitboxModule.Load();
			}
			else
			{
				DebugMod.Instance.HitboxModule.Unload();
			}
		}

		public void Load()
		{
			Unload();
			SceneManager.activeSceneChanged += CreateHitboxRender;
			CreateHitboxRender();
		}

		public void Unload()
		{
			SceneManager.activeSceneChanged -= CreateHitboxRender;
			DestroyHitboxRender();
		}

		private void CreateHitboxRender(Scene current, Scene next)
		{
			CreateHitboxRender();
		}

		private void CreateHitboxRender()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			DestroyHitboxRender();
			hitboxRender = new GameObject().AddComponent<HitboxRender>();
		}

		private void DestroyHitboxRender()
		{
			if ((Object)(object)hitboxRender != (Object)null)
			{
				Object.Destroy((Object)(object)hitboxRender);
				hitboxRender = null;
			}
		}

		private void UpdateHitboxRender(GameObject go)
		{
			if ((Object)(object)hitboxRender != (Object)null)
			{
				hitboxRender.UpdateHitbox(go);
			}
		}
	}
	public class HitboxRender : MonoBehaviour
	{
		private struct HitboxType : IComparable<HitboxType>
		{
			public static readonly HitboxType Player = new HitboxType(Color.yellow, 0);

			public static readonly HitboxType Enemy = new HitboxType(new Color(0.8f, 0f, 0f), 1);

			public static readonly HitboxType PathFindAgent = new HitboxType(Color.cyan, 2);

			public static readonly HitboxType Terrain = new HitboxType(new Color(0f, 0.8f, 0f), 3);

			public static readonly HitboxType Trigger = new HitboxType(new Color(0.5f, 0.5f, 1f), 4);

			public static readonly HitboxType EffectReceiver = new HitboxType(new Color(1f, 0.75f, 0.8f), 5);

			public static readonly HitboxType Trap = new HitboxType(new Color(0f, 0f, 0.5f), 6);

			public static readonly HitboxType AttackSensor = new HitboxType(new Color(0.5f, 0f, 0.5f), 7);

			public static readonly HitboxType AkGameObj = new HitboxType(new Color(0.8f, 0.8f, 0.5f), 8);

			public static readonly HitboxType MonsterPushAway = new HitboxType(new Color(0.9f, 0.3f, 0.4f), 9);

			public static readonly HitboxType PathFindTarget = new HitboxType(new Color(0.3f, 0.6f, 0.8f), 10);

			public static readonly HitboxType EffectDealer = new HitboxType(new Color(0.5f, 0.15f, 0.8f), 11);

			public static readonly HitboxType PlayerSensor = new HitboxType(new Color(0.5f, 0.95f, 0.3f), 12);

			public static readonly HitboxType ActorSensor = new HitboxType(new Color(0.1f, 0.95f, 0.3f), 13);

			public static readonly HitboxType GeneralFindable = new HitboxType(new Color(0.8f, 0.15f, 0.3f), 14);

			public static readonly HitboxType ChangeSceneTrigger = new HitboxType(new Color(0.8f, 0.85f, 0.3f), 15);

			public static readonly HitboxType Finder = new HitboxType(new Color(0.8f, 0.85f, 0.8f), 16);

			public static readonly HitboxType Interactable = new HitboxType(new Color(0.8f, 0.25f, 0.8f), 17);

			public static readonly HitboxType Other = new HitboxType(new Color(0.9f, 0.6f, 0.4f), 18);

			public readonly Color Color;

			public readonly int Depth;

			private HitboxType(Color color, int depth)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				Color = color;
				Depth = depth;
			}

			public int CompareTo(HitboxType other)
			{
				return other.Depth.CompareTo(Depth);
			}
		}

		private readonly SortedDictionary<HitboxType, HashSet<Collider2D>> colliders = new SortedDictionary<HitboxType, HashSet<Collider2D>>
		{
			{
				HitboxType.ActorSensor,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.AkGameObj,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.AttackSensor,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.ChangeSceneTrigger,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.EffectDealer,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.EffectReceiver,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Enemy,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.GeneralFindable,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.MonsterPushAway,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Other,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.PathFindAgent,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.PathFindTarget,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Player,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.PlayerSensor,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Terrain,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Trap,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Trigger,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Interactable,
				new HashSet<Collider2D>()
			},
			{
				HitboxType.Finder,
				new HashSet<Collider2D>()
			}
		};

		public static float LineWidth => Math.Max(0.7f, (float)Screen.width / 2000f);

		private void Start()
		{
			try
			{
				Collider2D[] array = Resources.FindObjectsOfTypeAll<Collider2D>();
				foreach (Collider2D collider2D in array)
				{
					TryAddHitboxes(collider2D);
				}
			}
			catch (Exception ex)
			{
				ToastManager.Toast((object)ex.ToString());
			}
		}

		public void UpdateHitbox(GameObject go)
		{
			Collider2D[] componentsInChildren = go.GetComponentsInChildren<Collider2D>(true);
			foreach (Collider2D collider2D in componentsInChildren)
			{
				TryAddHitboxes(collider2D);
			}
		}

		private Vector2 LocalToScreenPoint(Camera camera, Collider2D collider2D, Vector2 point)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Vector2.op_Implicit(camera.WorldToScreenPoint(Vector2.op_Implicit(Vector2.op_Implicit(((Component)collider2D).transform.TransformPoint(Vector2.op_Implicit(point + collider2D.offset))))));
			return new Vector2((float)(int)Math.Round(val.x), (float)(int)Math.Round((float)Screen.height - val.y));
		}

		private void TryAddHitboxes(Collider2D collider2D)
		{
			if (!((Object)(object)collider2D == (Object)null) && ((collider2D is BoxCollider2D || collider2D is PolygonCollider2D || collider2D is EdgeCollider2D || collider2D is CircleCollider2D) ? true : false))
			{
				GameObject gameObject = ((Component)collider2D).gameObject;
				if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<MonsterPushAway>()))
				{
					colliders[HitboxType.MonsterPushAway].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<Trap>()))
				{
					colliders[HitboxType.Trap].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<DamageDealer>()))
				{
					colliders[HitboxType.Enemy].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<TriggerDetector>()))
				{
					colliders[HitboxType.Trigger].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<AttackSensor>()))
				{
					colliders[HitboxType.AttackSensor].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<AkGameObj>()))
				{
					colliders[HitboxType.AkGameObj].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<PathArea>()))
				{
					colliders[HitboxType.Terrain].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<EffectReceiver>()))
				{
					colliders[HitboxType.EffectReceiver].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<EffectDealer>()))
				{
					colliders[HitboxType.EffectDealer].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<PathFindAgent>()))
				{
					colliders[HitboxType.PathFindAgent].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<PlayerSensor>()))
				{
					colliders[HitboxType.PlayerSensor].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<ActorSensor>()))
				{
					colliders[HitboxType.ActorSensor].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<PathFindTarget>()))
				{
					colliders[HitboxType.PathFindTarget].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<GeneralFindable>()))
				{
					colliders[HitboxType.GeneralFindable].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<ChangeSceneTrigger>()))
				{
					colliders[HitboxType.ChangeSceneTrigger].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<Player>()))
				{
					colliders[HitboxType.Player].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<HookableFinder>()))
				{
					colliders[HitboxType.Finder].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<GeneralFinder>()))
				{
					colliders[HitboxType.Finder].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<ItemPicker>()))
				{
					colliders[HitboxType.Player].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<InteractableArea>()))
				{
					colliders[HitboxType.Interactable].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<InteractableFinder>()))
				{
					colliders[HitboxType.Interactable].Add(collider2D);
				}
				else if (Object.op_Implicit((Object)(object)((Component)collider2D).GetComponent<Health>()))
				{
					colliders[HitboxType.Player].Add(collider2D);
				}
				else if (gameObject.GetComponents<object>().Length != 0)
				{
					colliders[HitboxType.Other].Add(collider2D);
				}
			}
		}

		private void OnGUI()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			Event current = Event.current;
			if (current == null || (int)current.type != 7 || !SingletonBehaviour<GameCore>.IsAvailable())
			{
				return;
			}
			GUI.depth = int.MaxValue;
			Camera sceneCamera = SingletonBehaviour<GameCore>.Instance.gameLevel.sceneCamera;
			float lineWidth = LineWidth;
			foreach (KeyValuePair<HitboxType, HashSet<Collider2D>> collider in colliders)
			{
				foreach (Collider2D item in collider.Value)
				{
					DrawHitbox(sceneCamera, item, collider.Key, lineWidth);
				}
			}
		}

		private void DrawHitbox(Camera camera, Collider2D collider2D, HitboxType hitboxType, float lineWidth)
		{
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: 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_01f7: 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_00a0: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00bf: 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_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)collider2D == (Object)null || !((Behaviour)collider2D).isActiveAndEnabled)
			{
				return;
			}
			int depth = GUI.depth;
			GUI.depth = hitboxType.Depth;
			if ((collider2D is BoxCollider2D || collider2D is EdgeCollider2D || collider2D is PolygonCollider2D) ? true : false)
			{
				BoxCollider2D val = (BoxCollider2D)(object)((collider2D is BoxCollider2D) ? collider2D : null);
				if (val == null)
				{
					EdgeCollider2D val2 = (EdgeCollider2D)(object)((collider2D is EdgeCollider2D) ? collider2D : null);
					if (val2 == null)
					{
						PolygonCollider2D val3 = (PolygonCollider2D)(object)((collider2D is PolygonCollider2D) ? collider2D : null);
						if (val3 != null)
						{
							for (int i = 0; i < val3.pathCount; i++)
							{
								List<Vector2> list = new List<Vector2>(val3.GetPath(i));
								if (list.Count > 0)
								{
									list.Add(list[0]);
								}
								DrawPointSequence(list, camera, collider2D, hitboxType, lineWidth);
							}
						}
					}
					else
					{
						DrawPointSequence(new List<Vector2>(val2.points), camera, collider2D, hitboxType, lineWidth);
					}
				}
				else
				{
					Vector2 val4 = val.size / 2f;
					Vector2 item = default(Vector2);
					((Vector2)(ref item))..ctor(0f - val4.x, val4.y);
					Vector2 item2 = val4;
					Vector2 item3 = default(Vector2);
					((Vector2)(ref item3))..ctor(val4.x, 0f - val4.y);
					Vector2 item4 = -val4;
					List<Vector2> points = new List<Vector2> { item, item2, item3, item4, item };
					DrawPointSequence(points, camera, collider2D, hitboxType, lineWidth);
				}
			}
			else
			{
				CircleCollider2D val5 = (CircleCollider2D)(object)((collider2D is CircleCollider2D) ? collider2D : null);
				if (val5 != null)
				{
					Vector2 val6 = LocalToScreenPoint(camera, collider2D, Vector2.zero);
					Vector2 val7 = LocalToScreenPoint(camera, collider2D, Vector2.right * val5.radius);
					int num = (int)Math.Round(Vector2.Distance(val6, val7));
					Drawing.DrawCircle(val6, num, hitboxType.Color, lineWidth, antiAlias: true, Mathf.Clamp(num / 16, 4, 32));
				}
			}
			GUI.depth = depth;
		}

		private void DrawPointSequence(List<Vector2> points, Camera camera, Collider2D collider2D, HitboxType hitboxType, float lineWidth)
		{
			//IL_000b: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//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_0027: 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)
			//IL_0029: 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)
			for (int i = 0; i < points.Count - 1; i++)
			{
				Vector2 pointA = LocalToScreenPoint(camera, collider2D, points[i]);
				Vector2 pointB = LocalToScreenPoint(camera, collider2D, points[i + 1]);
				Drawing.DrawLine(pointA, pointB, hitboxType.Color, lineWidth, antiAlias: true);
			}
		}
	}
}