Decompiled source of GameStats v1.0.0

GameStats.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("GameStats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GameStats")]
[assembly: AssemblyTitle("GameStats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GameStats
{
	[BepInPlugin("GameStats", "GameStats", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal bool isActive = false;

		internal DateTime _lastTime;

		internal int _framesRendered = 0;

		internal int _fps;

		internal int _frameCount;

		internal GameObject[] allObjects;

		internal PhysicsBodyList<Circle> circles;

		internal PhysicsBodyList<Box> boxes;

		internal int framesUntilCheck = 60;

		public Rect windowRect = new Rect((float)(Screen.width - 220), 60f, 200f, 175f);

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GameStats is loaded!");
		}

		private void Update()
		{
			if (framesUntilCheck == 0)
			{
				allObjects = Object.FindObjectsOfType<GameObject>();
				if ((Object)(object)DetPhysics.Get() != (Object)null)
				{
					circles = DetPhysics.Get().circles;
					boxes = DetPhysics.Get().boxes;
				}
				framesUntilCheck = 60;
			}
			else
			{
				framesUntilCheck--;
			}
			_framesRendered++;
			_frameCount++;
			if ((DateTime.Now - _lastTime).TotalSeconds >= 1.0)
			{
				_fps = _framesRendered;
				_framesRendered = 0;
				_lastTime = DateTime.Now;
			}
		}

		private void OnGUI()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00a1: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			GUI.backgroundColor = new Color(1f, 0.2901961f, 82f / 85f);
			if (GUI.Button(new Rect((float)(Screen.width - 145), 20f, 125f, 30f), "Show/Hide Stats"))
			{
				isActive = !isActive;
			}
			if (isActive)
			{
				windowRect = GUI.Window(1001, new Rect((float)(Screen.width - 195), 60f, 175f, 175f), new WindowFunction(StatsMenu), "Stats");
			}
		}

		private void StatsMenu(int windowID)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			GUI.DragWindow();
			GUI.Label(new Rect(10f, 20f, 100f, 20f), $"FPS: {_fps}");
			GUI.Label(new Rect(10f, 40f, 100f, 20f), $"Frames: {_frameCount}");
			GUI.Label(new Rect(10f, 60f, 200f, 20f), $"GameObjects: {allObjects.Length}");
			if (boxes != null && circles != null)
			{
				GUI.Label(new Rect(10f, 80f, 200f, 20f), $"PhysObjects: {boxes.Length + circles.Length}");
			}
			else
			{
				GUI.Label(new Rect(10f, 80f, 200f, 20f), $"PhysObjects: {0}");
			}
			Rect val = new Rect(10f, 100f, 200f, 20f);
			Scene activeScene = SceneManager.GetActiveScene();
			GUI.Label(val, "Scene: " + ((Scene)(ref activeScene)).name);
			GUI.Label(new Rect(10f, 120f, 200f, 20f), $"Connected: {NetworkInterface.GetIsNetworkAvailable()}");
			GUI.Label(new Rect(10f, 145f, 200f, 30f), "Made by @reallybaddev");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "GameStats";

		public const string PLUGIN_NAME = "GameStats";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}