Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FSMSeer v1.1.2
FSMSeer/FSMSeer.dll
Decompiled 4 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FSMSeer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2")] [assembly: AssemblyProduct("FSMSeer")] [assembly: AssemblyTitle("FSMSeer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace FSMSeer { [BepInPlugin("me.cometcake575.fsmseer", "FSMSeer", "1.1.2")] public class FSMSeerPlugin : BaseUnityPlugin { private class FSMSeen : MonoBehaviour { public int scanned; } private class FSMSeer : MonoBehaviour { public PlayMakerFSM? fsm; public int offset; private Text? _text; private void Start() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Label label = MakeLabel(((Component)this).gameObject, _canvasObj, Vector2.zero, Centre, Centre); _text = label.textComponent; ((Graphic)_text).raycastTarget = false; } private void Update() { //IL_006a: 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_0083: 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) if (!Object.op_Implicit((Object)(object)fsm)) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (Object.op_Implicit((Object)(object)GameCameras.instance) && Object.op_Implicit((Object)(object)GameCameras.instance.mainCamera)) { ((Component)this).transform.position = GameCameras.instance.mainCamera.WorldToScreenPoint(((Component)fsm).transform.position) + new Vector3(0f, (float)(offset * 50)); if (!((Behaviour)fsm).enabled || fsm.ActiveStateName == "" || !_show) { _text.text = ""; } else { _text.text = fsm.FsmName + " – " + fsm.ActiveStateName; } } } } public class Label : MonoBehaviour { public string font = "Perpetua"; public Text? textComponent; private void Start() { textComponent.font = GetFont(font); } } private static bool _show; private static GameObject? _canvasObj; private static readonly Vector2 Centre = new Vector2(0.5f, 0.5f); private static readonly Dictionary<string, Font> Fonts = new Dictionary<string, Font>(); public const string Id = "me.cometcake575.fsmseer"; public static string Name => "FSMSeer"; public static string Version => "1.1.2"; private void Awake() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (me.cometcake575.fsmseer) has loaded!")); new Hook((MethodBase)typeof(PlayMakerFSM).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)new Action<Action<PlayMakerFSM>, PlayMakerFSM>(StartDebug)); Settings.Init(((BaseUnityPlugin)this).Config); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(Settings.ToggleKey.Value)) { _show = !_show; } } private static void StartDebug(Action<PlayMakerFSM> orig, PlayMakerFSM self) { //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) orig(self); SetupCanvas(); FSMSeen fSMSeen = ((Component)self).GetComponentInParent<FSMSeen>(); if (!Object.op_Implicit((Object)(object)fSMSeen)) { fSMSeen = ((Component)self).GetComponentInChildren<FSMSeen>(); } if (!Object.op_Implicit((Object)(object)fSMSeen)) { fSMSeen = ((Component)self).gameObject.AddComponent<FSMSeen>(); } fSMSeen.scanned++; GameObject val = new GameObject("[FSMSeer] " + self.FsmName + " Debug"); val.transform.parent = _canvasObj.transform; FSMSeer fSMSeer = val.AddComponent<FSMSeer>(); fSMSeer.fsm = self; fSMSeer.offset = fSMSeen.scanned; } private static void SetupCanvas() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_canvasObj)) { _canvasObj = new GameObject("[FSMSeer] FSM Visualiser Canvas"); Object.DontDestroyOnLoad((Object)(object)_canvasObj); _canvasObj.AddComponent<Canvas>().renderMode = (RenderMode)0; _canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1; _canvasObj.AddComponent<GraphicRaycaster>(); } } public static Label MakeLabel(GameObject gameObject, GameObject parent, Vector2 pos, Vector2 anchorMin, Vector2 anchorMax) { //IL_0049: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) RectTransform val = gameObject.AddComponent<RectTransform>(); Label label = gameObject.AddComponent<Label>(); label.textComponent = gameObject.AddComponent<Text>(); label.textComponent.supportRichText = false; label.textComponent.horizontalOverflow = (HorizontalWrapMode)1; label.textComponent.fontSize = 10; ((Component)label).transform.localScale = Vector3.one; ((Transform)val).SetParent(parent.transform, false); ((Transform)val).SetAsFirstSibling(); val.anchorMin = anchorMin; val.anchorMax = anchorMax; val.anchoredPosition = pos; return label; } public static Font GetFont(string fontName) { if (Fonts.TryGetValue(fontName, out Font value)) { return value; } Font[] array = Resources.FindObjectsOfTypeAll<Font>(); foreach (Font val in array) { if (((Object)val).name == fontName) { Fonts[fontName] = val; return val; } } return Fonts.GetValueOrDefault(fontName); } } public static class Settings { public static ConfigEntry<KeyCode>? ToggleKey; public static void Init(ConfigFile config) { ToggleKey = config.Bind<KeyCode>("States", "ToggleKey", (KeyCode)284, "The keybind used to toggle the FSM info."); } } }