using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")] [assembly: AssemblyCompany("FPSCounter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FPSCounter")] [assembly: AssemblyTitle("FPSCounter")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FPSCounter { [BepInPlugin("com.yourname.fpscounter", "FPS Counter", "1.0.0")] public class Plugin : BaseUnityPlugin { private static GameObject counterObject; public static ConfigEntry Enabled; public static ConfigEntry FontSize; public static ConfigEntry PositionX; public static ConfigEntry PositionY; public static ConfigEntry Color; private void Awake() { Enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Show the FPS counter"); FontSize = ((BaseUnityPlugin)this).Config.Bind("General", "FontSize", 20, "Size of the FPS counter text"); PositionX = ((BaseUnityPlugin)this).Config.Bind("General", "PositionX", 10, "Horizontal position of the counter"); PositionY = ((BaseUnityPlugin)this).Config.Bind("General", "PositionY", 10, "Vertical position of the counter"); Color = ((BaseUnityPlugin)this).Config.Bind("General", "Color", "auto", "Color of the text. Use 'auto' for green/yellow/red, or a hex code like 'FF0000' for red"); SceneManager.sceneLoaded += OnSceneLoaded; ((BaseUnityPlugin)this).Logger.LogInfo((object)"FPS Counter loaded!"); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if ((Object)(object)counterObject == (Object)null) { counterObject = new GameObject("FPSCounterObject"); counterObject.AddComponent(); Object.DontDestroyOnLoad((Object)(object)counterObject); } } } public class FPSDisplay : MonoBehaviour { private float fps; private float timer; private float updateInterval = 0.5f; private void Update() { timer += Time.unscaledDeltaTime; if (timer >= updateInterval) { fps = 1f / Time.unscaledDeltaTime; timer = 0f; } } private void OnGUI() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.Enabled.Value) { int num = Mathf.RoundToInt(fps); string text = "FPS: " + num; GUIStyle val = new GUIStyle(GUI.skin.label); val.fontSize = Plugin.FontSize.Value; val.fontStyle = (FontStyle)1; string text2 = Plugin.Color.Value.ToLower(); Color textColor = default(Color); if (text2 == "auto") { textColor = ((num >= 60) ? Color.green : ((num >= 30) ? Color.yellow : Color.red)); } else if (!ColorUtility.TryParseHtmlString("#" + text2, ref textColor)) { textColor = Color.white; } int value = Plugin.PositionX.Value; int value2 = Plugin.PositionY.Value; val.normal.textColor = Color.black; GUI.Label(new Rect((float)(value + 1), (float)(value2 + 1), 200f, 30f), text, val); val.normal.textColor = textColor; GUI.Label(new Rect((float)value, (float)value2, 200f, 30f), text, val); } } } }