Decompiled source of FPSTracker v1.0.0

plugins/FPSTracker.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using PluginConfig.API;
using PluginConfig.API.Fields;
using PluginConfig.API.Functionals;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FPSTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FPSTracker")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("01dc442b-9de4-428b-9ec8-46881fe20256")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FPSTracker;

public class FPSDisplay : MonoBehaviour
{
	public GameObject stuff;

	private Text fpsText;

	public int sampleSize = 30;

	public float sampleTimeLimit = 1f;

	private float sampleTimer;

	private int sampleCounter;

	private float sampleTotal;

	private float sampleAverage;

	private float xPos;

	private float yPos;

	public void Start()
	{
		//IL_0081: 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)
		stuff = ((Component)((Component)this).transform.Find("Stuff")).gameObject;
		fpsText = ((Component)((Component)this).transform.Find("Stuff").Find("Text")).GetComponent<Text>();
		stuff.SetActive(ConfigManager.fpsDisplay.value);
		sampleSize = ConfigManager.fpsDisplaySampleSize.value;
		sampleTimeLimit = ConfigManager.fpsDisplayTimeLimit.value;
		xPos = ((Component)this).gameObject.GetComponent<RectTransform>().anchoredPosition.x;
		yPos = ((Component)this).gameObject.GetComponent<RectTransform>().anchoredPosition.y;
		Offset(ConfigManager.fpsDisplayOffsetX.value, ConfigManager.fpsDisplayOffsetY.value);
	}

	public void Update()
	{
		float num = 1f / Time.unscaledDeltaTime;
		sampleTotal += num;
		sampleCounter++;
		sampleTimer += Time.unscaledDeltaTime;
		if (sampleCounter >= sampleSize || sampleTimer >= sampleTimeLimit)
		{
			sampleAverage = sampleTotal / (float)sampleCounter;
			if (Object.op_Implicit((Object)(object)stuff))
			{
				UpdateText();
			}
			Refresh();
		}
	}

	public void Offset(float xOff, float yOff)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(xPos + xOff, yPos + yOff);
	}

	public void Refresh()
	{
		sampleCounter = 0;
		sampleAverage = 0f;
		sampleTotal = 0f;
		sampleTimer = 0f;
	}

	public void UpdateText()
	{
		fpsText.text = Math.Round(sampleAverage).ToString();
	}

	public void AddSampleToTotal(float fps)
	{
		sampleTotal += fps;
		sampleCounter++;
	}
}
public class FPSGraph : MonoBehaviour
{
	public GameObject stuff;

	private RectTransform graphContainer;

	private Texture2D graphTexture;

	private Sprite graphSprite;

	private Image graphImage;

	private Color[] clearStuff;

	private float updateTimer;

	public float updateTime = 0.1f;

	private int fpsDataTotal = 75;

	private int textureSize = 75;

	public int targetFps = 240;

	private bool cheapGraph;

	private float[] fpsData;

	private int fpsDataCount;

	private List<GameObject> plottedPoints = new List<GameObject>();

	private float sampleTotal;

	private int sampleCount;

	private int tableMax = 90;

	private float xPos;

	private float yPos;

	public void Start()
	{
		//IL_0071: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Expected O, but got Unknown
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		stuff = ((Component)((Component)this).transform.Find("Stuff")).gameObject;
		graphContainer = ((Component)((Component)this).transform.Find("Stuff").Find("GraphContainer")).gameObject.GetComponent<RectTransform>();
		fpsDataTotal = ConfigManager.fpsGraphDataPoints.value;
		textureSize = ConfigManager.fpsGraphQuality.value;
		xPos = ((Component)this).gameObject.GetComponent<RectTransform>().anchoredPosition.x;
		yPos = ((Component)this).gameObject.GetComponent<RectTransform>().anchoredPosition.y;
		Offset(ConfigManager.fpsGraphOffsetX.value, ConfigManager.fpsGraphOffsetY.value);
		fpsData = new float[fpsDataTotal];
		graphImage = ((Component)((Component)this).transform.Find("Stuff").Find("GraphContainer")).gameObject.GetComponent<Image>();
		graphTexture = new Texture2D(textureSize, textureSize, (TextureFormat)4, false);
		graphSprite = Sprite.Create(graphTexture, new Rect(0f, 0f, (float)((Texture)graphTexture).width, (float)((Texture)graphTexture).height), new Vector2(0.5f, 0.5f));
		((Texture)graphTexture).filterMode = (FilterMode)0;
		graphImage.sprite = graphSprite;
		clearStuff = (Color[])(object)new Color[((Texture)graphTexture).width * ((Texture)graphTexture).height];
		cheapGraph = true;
		stuff.SetActive(ConfigManager.fpsGraph.value);
		updateTime = ConfigManager.fpsGraphTimeLimit.value;
		targetFps = ConfigManager.fpsGraphTargetFps.value;
		PlotData();
	}

	public void Update()
	{
		updateTimer += Time.unscaledDeltaTime;
		float num = 1f / Time.unscaledDeltaTime;
		sampleTotal += num;
		sampleCount++;
		if (updateTimer >= updateTime)
		{
			if (sampleCount > 0)
			{
				PushSample(sampleTotal / (float)sampleCount);
			}
			else
			{
				PushSample(num);
			}
			if (stuff.activeSelf)
			{
				PlotData();
			}
			updateTimer = 0f;
			sampleTotal = 0f;
			sampleCount = 0;
		}
	}

	public void PlotPoint(Vector2 pos)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Point"), ((Component)graphContainer).transform);
		RectTransform component = val.GetComponent<RectTransform>();
		component.sizeDelta = new Vector2(2f, 2f);
		component.anchoredPosition = pos;
		plottedPoints.Add(val);
	}

	public void PushSample(float value)
	{
		for (int num = fpsDataCount; num >= 0; num--)
		{
			if (num + 1 < fpsData.Length)
			{
				fpsData[num + 1] = fpsData[num];
			}
		}
		fpsData[0] = value;
		if (fpsData.Length > fpsDataCount)
		{
			fpsDataCount++;
		}
	}

	public void PlotData()
	{
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: 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_00e2: 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_00b6: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
		graphTexture.SetPixels(clearStuff);
		float num = ((float)((Texture)graphTexture).width - 1f) / ((float)fpsDataTotal - 1f);
		float num2 = ((float)((Texture)graphTexture).height - 1f) / ((float)targetFps * 2f);
		if (ConfigManager.fpsGraphMarker.value)
		{
			float num3 = (float)(((Texture)graphTexture).height - 1) / 4f;
			Vector2 startPos = default(Vector2);
			Vector2 endPos = default(Vector2);
			for (int i = 0; i < 5; i++)
			{
				((Vector2)(ref startPos))..ctor(0f, Mathf.Round(num3 * (float)i));
				((Vector2)(ref endPos))..ctor((float)(((Texture)graphTexture).width - 1), Mathf.Round(num3 * (float)i));
				if (i == 2)
				{
					DrawLineInTexture(startPos, endPos, new Color(1f, 0f, 0f, ConfigManager.fpsGraphMarkerVisibility.value));
				}
				else
				{
					DrawLineInTexture(startPos, endPos, new Color(0.5f, 0.5f, 0.5f, ConfigManager.fpsGraphMarkerVisibility.value));
				}
			}
		}
		Vector2 startPos2 = default(Vector2);
		Vector2 endPos2 = default(Vector2);
		for (int j = 0; j < fpsDataCount; j++)
		{
			if (j + 1 < fpsDataCount)
			{
				((Vector2)(ref startPos2))..ctor(Mathf.Round((float)j * num), Mathf.Round(Mathf.Clamp(fpsData[j] * num2, 0f, (float)(((Texture)graphTexture).height - 1))));
				((Vector2)(ref endPos2))..ctor(Mathf.Round((float)(j + 1) * num), Mathf.Round(Mathf.Clamp(fpsData[j + 1] * num2, 0f, (float)(((Texture)graphTexture).height - 1))));
				DrawLineInTexture(startPos2, endPos2, Color.white);
			}
		}
		graphTexture.Apply();
	}

	public void Refresh()
	{
		updateTimer = 0f;
		sampleTotal = 0f;
		sampleCount = 0;
		fpsData = new float[fpsDataTotal];
		fpsDataCount = 0;
	}

	public void ChangeDataPointTotal(int newTotal)
	{
		float[] array = new float[newTotal];
		for (int i = 0; i < fpsDataCount; i++)
		{
			if (i >= newTotal)
			{
				fpsDataCount = newTotal;
				break;
			}
			array[i] = fpsData[i];
		}
		fpsData = array;
		fpsDataTotal = newTotal;
	}

	public void ResizeGraphTexture(int size)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Expected O, but got Unknown
		//IL_0038: 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)
		graphTexture = new Texture2D(size, size, (TextureFormat)4, false);
		graphSprite = Sprite.Create(graphTexture, new Rect(0f, 0f, (float)((Texture)graphTexture).width, (float)((Texture)graphTexture).height), new Vector2(0.5f, 0.5f));
		((Texture)graphTexture).filterMode = (FilterMode)0;
		graphImage.sprite = graphSprite;
		clearStuff = (Color[])(object)new Color[((Texture)graphTexture).width * ((Texture)graphTexture).height];
	}

	public void Offset(float xOff, float yOff)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(xPos + xOff, yPos + yOff);
	}

	public void ClearPlottedData()
	{
	}

	public void DrawLineInTexture(Vector2 startPos, Vector2 endPos, Color color)
	{
		//IL_0000: 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_0018: 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)
		int num = (int)startPos.x;
		int num2 = (int)startPos.y;
		int num3 = (int)endPos.x;
		int num4 = (int)endPos.y;
		int num5 = Math.Abs(num3 - num);
		int num6 = -Math.Abs(num4 - num2);
		int num7 = ((num < num3) ? 1 : (-1));
		int num8 = ((num2 < num4) ? 1 : (-1));
		int num9 = num5 + num6;
		while (true)
		{
			graphTexture.SetPixel(num, num2, color);
			if (num == num3 && num2 == num4)
			{
				break;
			}
			int num10 = 2 * num9;
			if (num10 >= num6)
			{
				if (num == num3)
				{
					break;
				}
				num9 += num6;
				num += num7;
			}
			if (num10 <= num5)
			{
				if (num2 == num4)
				{
					break;
				}
				num9 += num5;
				num2 += num8;
			}
		}
	}

	public void AddToTotal(float fps)
	{
		sampleTotal += fps;
		sampleCount++;
	}
}
public static class ConfigManager
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static BoolValueChangeEventDelegate <>9__20_0;

		public static IntValueChangeEventDelegate <>9__20_1;

		public static FloatValueChangeEventDelegate <>9__20_2;

		public static FloatValueChangeEventDelegate <>9__20_3;

		public static FloatValueChangeEventDelegate <>9__20_4;

		public static BoolValueChangeEventDelegate <>9__20_5;

		public static FloatValueChangeEventDelegate <>9__20_6;

		public static IntValueChangeEventDelegate <>9__20_7;

		public static IntValueChangeEventDelegate <>9__20_8;

		public static IntValueChangeEventDelegate <>9__20_9;

		public static BoolValueChangeEventDelegate <>9__20_10;

		public static OnValueChangeEventDelegate <>9__20_11;

		public static FloatValueChangeEventDelegate <>9__20_12;

		public static FloatValueChangeEventDelegate <>9__20_13;

		internal void <Setup>b__20_0(BoolValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsDisplay.GetComponent<FPSDisplay>().stuff.SetActive(e.value);
				((ConfigField)fpsDisplaySampleSize).hidden = !e.value;
				((ConfigField)fpsDisplayTimeLimit).hidden = !e.value;
				((ConfigField)fpsDisplayOffsetX).hidden = !e.value;
				((ConfigField)fpsDisplayOffsetY).hidden = !e.value;
			}
		}

		internal void <Setup>b__20_1(IntValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsDisplay.GetComponent<FPSDisplay>().sampleSize = e.value;
			}
		}

		internal void <Setup>b__20_2(FloatValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsDisplay.GetComponent<FPSDisplay>().sampleTimeLimit = e.value;
			}
		}

		internal void <Setup>b__20_3(FloatValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsDisplay.GetComponent<FPSDisplay>().Offset(e.value, fpsDisplayOffsetY.value);
			}
		}

		internal void <Setup>b__20_4(FloatValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsDisplay.GetComponent<FPSDisplay>().Offset(fpsDisplayOffsetX.value, e.value);
			}
		}

		internal void <Setup>b__20_5(BoolValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().stuff.SetActive(e.value);
				if (e.value)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
				}
			}
		}

		internal void <Setup>b__20_6(FloatValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().updateTime = e.value;
			}
		}

		internal void <Setup>b__20_7(IntValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().targetFps = e.value;
				Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
			}
		}

		internal void <Setup>b__20_8(IntValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().ChangeDataPointTotal(e.value);
			}
		}

		internal void <Setup>b__20_9(IntValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().ResizeGraphTexture(e.value);
				Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
			}
		}

		internal void <Setup>b__20_10(BoolValueChangeEvent e)
		{
			fpsGraphMarker.value = e.value;
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
			}
		}

		internal void <Setup>b__20_11(FloatSliderValueChangeEvent e)
		{
			fpsGraphMarkerVisibility.value = e.newValue;
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
			}
		}

		internal void <Setup>b__20_12(FloatValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().Offset(e.value, fpsGraphOffsetY.value);
			}
		}

		internal void <Setup>b__20_13(FloatValueChangeEvent e)
		{
			if (Plugin.startup)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().Offset(fpsGraphOffsetX.value, e.value);
			}
		}
	}

	private static PluginConfigurator config;

	public static BoolField fpsDisplay;

	public static IntField fpsDisplaySampleSize;

	public static FloatField fpsDisplayTimeLimit;

	public static FloatField fpsDisplayOffsetX;

	public static FloatField fpsDisplayOffsetY;

	public static KeyCodeField fpsDisplayKeyBind;

	public static BoolField fpsGraph;

	public static FloatField fpsGraphTimeLimit;

	public static IntField fpsGraphTargetFps;

	public static IntField fpsGraphDataPoints;

	public static IntField fpsGraphQuality;

	public static BoolField fpsGraphMarker;

	public static FloatSliderField fpsGraphMarkerVisibility;

	public static FloatField fpsGraphOffsetX;

	public static FloatField fpsGraphOffsetY;

	public static KeyCodeField fpsGraphKeyBind;

	public static ButtonField fpsRefresh;

	private static string workingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	private static string iconFilePath = Path.Combine(Path.Combine(workingDirectory, "Data"), "icon.png");

	public static void Setup()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Expected O, but got Unknown
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Expected O, but got Unknown
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Expected O, but got Unknown
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Expected O, but got Unknown
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Expected O, but got Unknown
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Expected O, but got Unknown
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Expected O, but got Unknown
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Expected O, but got Unknown
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Expected O, but got Unknown
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Expected O, but got Unknown
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Expected O, but got Unknown
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Expected O, but got Unknown
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Expected O, but got Unknown
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Expected O, but got Unknown
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Expected O, but got Unknown
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Expected O, but got Unknown
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Expected O, but got Unknown
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Expected O, but got Unknown
		//IL_0354: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Expected O, but got Unknown
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Expected O, but got Unknown
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Expected O, but got Unknown
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03da: Expected O, but got Unknown
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0403: Expected O, but got Unknown
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_042c: Expected O, but got Unknown
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_044f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Expected O, but got Unknown
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Expected O, but got Unknown
		//IL_049c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a7: Expected O, but got Unknown
		//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d0: Expected O, but got Unknown
		config = PluginConfigurator.Create("FPSTracker", "ironfarm.uk.fps");
		fpsDisplay = new BoolField(config.rootPanel, "FPS Display", "bool.fps_display", true);
		fpsDisplaySampleSize = new IntField(config.rootPanel, "FPS Display Sample Size", "int.fps_display_sample_size", 30, 1, 5318008);
		fpsDisplayTimeLimit = new FloatField(config.rootPanel, "FPS Display Time Limit", "float.fps_display_time_limit", 1f, 0f, 42069f);
		fpsDisplayOffsetX = new FloatField(config.rootPanel, "X Offset", "float.fps_display_offset_x", 0f);
		fpsDisplayOffsetY = new FloatField(config.rootPanel, "Y Offset", "float.fps_display_offset_y", 0f);
		fpsDisplayKeyBind = new KeyCodeField(config.rootPanel, "FPS Display Bind", "keycode.fps_display_key_bind", (KeyCode)0);
		fpsGraph = new BoolField(config.rootPanel, "FPS Graph", "bool.fps_graph", true);
		fpsGraphTimeLimit = new FloatField(config.rootPanel, "FPS Graph Time Limit", "float.fps_graph_time_limit", 0.5f, 0f, 42069f);
		fpsGraphTargetFps = new IntField(config.rootPanel, "FPS Graph Target FPS", "int.fps_graph_target_fps", 60, 1, 42069);
		fpsGraphDataPoints = new IntField(config.rootPanel, "FPS Graph Data Points", "int.fps_graph_data_points", 25, 2, 100000);
		fpsGraphQuality = new IntField(config.rootPanel, "FPS Graph Quality", "int.fps_graph_quality", 185, 1, 100000);
		fpsGraphOffsetX = new FloatField(config.rootPanel, "X Offset", "float.fps_graph_offset_x", 0f);
		fpsGraphOffsetY = new FloatField(config.rootPanel, "Y Offset", "float.fps_graph_offset_y", 0f);
		fpsGraphKeyBind = new KeyCodeField(config.rootPanel, "FPS Graph Bind", "keycode.fps_graph_key_bind", (KeyCode)0);
		fpsGraphMarker = new BoolField(config.rootPanel, "FPS Graph Marker", "bool.fps_graph_marker", true);
		fpsGraphMarkerVisibility = new FloatSliderField(config.rootPanel, "FPS Graph Marker Visibility", "float_slider.fps_graph_marker_visiblility", new Tuple<float, float>(0f, 1f), 0.5f, 2);
		fpsRefresh = new ButtonField(config.rootPanel, "Refresh Displays", "button.refresh");
		fpsRefresh.onClick += new OnClick(Plugin.Refresh);
		BoolField obj = fpsDisplay;
		object obj2 = <>c.<>9__20_0;
		if (obj2 == null)
		{
			BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsDisplay.GetComponent<FPSDisplay>().stuff.SetActive(e.value);
					((ConfigField)fpsDisplaySampleSize).hidden = !e.value;
					((ConfigField)fpsDisplayTimeLimit).hidden = !e.value;
					((ConfigField)fpsDisplayOffsetX).hidden = !e.value;
					((ConfigField)fpsDisplayOffsetY).hidden = !e.value;
				}
			};
			<>c.<>9__20_0 = val;
			obj2 = (object)val;
		}
		obj.onValueChange += (BoolValueChangeEventDelegate)obj2;
		IntField obj3 = fpsDisplaySampleSize;
		object obj4 = <>c.<>9__20_1;
		if (obj4 == null)
		{
			IntValueChangeEventDelegate val2 = delegate(IntValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsDisplay.GetComponent<FPSDisplay>().sampleSize = e.value;
				}
			};
			<>c.<>9__20_1 = val2;
			obj4 = (object)val2;
		}
		obj3.onValueChange += (IntValueChangeEventDelegate)obj4;
		FloatField obj5 = fpsDisplayTimeLimit;
		object obj6 = <>c.<>9__20_2;
		if (obj6 == null)
		{
			FloatValueChangeEventDelegate val3 = delegate(FloatValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsDisplay.GetComponent<FPSDisplay>().sampleTimeLimit = e.value;
				}
			};
			<>c.<>9__20_2 = val3;
			obj6 = (object)val3;
		}
		obj5.onValueChange += (FloatValueChangeEventDelegate)obj6;
		FloatField obj7 = fpsDisplayOffsetX;
		object obj8 = <>c.<>9__20_3;
		if (obj8 == null)
		{
			FloatValueChangeEventDelegate val4 = delegate(FloatValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsDisplay.GetComponent<FPSDisplay>().Offset(e.value, fpsDisplayOffsetY.value);
				}
			};
			<>c.<>9__20_3 = val4;
			obj8 = (object)val4;
		}
		obj7.onValueChange += (FloatValueChangeEventDelegate)obj8;
		FloatField obj9 = fpsDisplayOffsetY;
		object obj10 = <>c.<>9__20_4;
		if (obj10 == null)
		{
			FloatValueChangeEventDelegate val5 = delegate(FloatValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsDisplay.GetComponent<FPSDisplay>().Offset(fpsDisplayOffsetX.value, e.value);
				}
			};
			<>c.<>9__20_4 = val5;
			obj10 = (object)val5;
		}
		obj9.onValueChange += (FloatValueChangeEventDelegate)obj10;
		BoolField obj11 = fpsGraph;
		object obj12 = <>c.<>9__20_5;
		if (obj12 == null)
		{
			BoolValueChangeEventDelegate val6 = delegate(BoolValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().stuff.SetActive(e.value);
					if (e.value)
					{
						Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
					}
				}
			};
			<>c.<>9__20_5 = val6;
			obj12 = (object)val6;
		}
		obj11.onValueChange += (BoolValueChangeEventDelegate)obj12;
		FloatField obj13 = fpsGraphTimeLimit;
		object obj14 = <>c.<>9__20_6;
		if (obj14 == null)
		{
			FloatValueChangeEventDelegate val7 = delegate(FloatValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().updateTime = e.value;
				}
			};
			<>c.<>9__20_6 = val7;
			obj14 = (object)val7;
		}
		obj13.onValueChange += (FloatValueChangeEventDelegate)obj14;
		IntField obj15 = fpsGraphTargetFps;
		object obj16 = <>c.<>9__20_7;
		if (obj16 == null)
		{
			IntValueChangeEventDelegate val8 = delegate(IntValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().targetFps = e.value;
					Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
				}
			};
			<>c.<>9__20_7 = val8;
			obj16 = (object)val8;
		}
		obj15.onValueChange += (IntValueChangeEventDelegate)obj16;
		IntField obj17 = fpsGraphDataPoints;
		object obj18 = <>c.<>9__20_8;
		if (obj18 == null)
		{
			IntValueChangeEventDelegate val9 = delegate(IntValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().ChangeDataPointTotal(e.value);
				}
			};
			<>c.<>9__20_8 = val9;
			obj18 = (object)val9;
		}
		obj17.onValueChange += (IntValueChangeEventDelegate)obj18;
		IntField obj19 = fpsGraphQuality;
		object obj20 = <>c.<>9__20_9;
		if (obj20 == null)
		{
			IntValueChangeEventDelegate val10 = delegate(IntValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().ResizeGraphTexture(e.value);
					Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
				}
			};
			<>c.<>9__20_9 = val10;
			obj20 = (object)val10;
		}
		obj19.onValueChange += (IntValueChangeEventDelegate)obj20;
		BoolField obj21 = fpsGraphMarker;
		object obj22 = <>c.<>9__20_10;
		if (obj22 == null)
		{
			BoolValueChangeEventDelegate val11 = delegate(BoolValueChangeEvent e)
			{
				fpsGraphMarker.value = e.value;
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
				}
			};
			<>c.<>9__20_10 = val11;
			obj22 = (object)val11;
		}
		obj21.onValueChange += (BoolValueChangeEventDelegate)obj22;
		FloatSliderField obj23 = fpsGraphMarkerVisibility;
		object obj24 = <>c.<>9__20_11;
		if (obj24 == null)
		{
			OnValueChangeEventDelegate val12 = delegate(FloatSliderValueChangeEvent e)
			{
				fpsGraphMarkerVisibility.value = e.newValue;
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
				}
			};
			<>c.<>9__20_11 = val12;
			obj24 = (object)val12;
		}
		obj23.onValueChange += (OnValueChangeEventDelegate)obj24;
		FloatField obj25 = fpsGraphOffsetX;
		object obj26 = <>c.<>9__20_12;
		if (obj26 == null)
		{
			FloatValueChangeEventDelegate val13 = delegate(FloatValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().Offset(e.value, fpsGraphOffsetY.value);
				}
			};
			<>c.<>9__20_12 = val13;
			obj26 = (object)val13;
		}
		obj25.onValueChange += (FloatValueChangeEventDelegate)obj26;
		FloatField obj27 = fpsGraphOffsetY;
		object obj28 = <>c.<>9__20_13;
		if (obj28 == null)
		{
			FloatValueChangeEventDelegate val14 = delegate(FloatValueChangeEvent e)
			{
				if (Plugin.startup)
				{
					Plugin.fpsGraph.GetComponent<FPSGraph>().Offset(fpsGraphOffsetX.value, e.value);
				}
			};
			<>c.<>9__20_13 = val14;
			obj28 = (object)val14;
		}
		obj27.onValueChange += (FloatValueChangeEventDelegate)obj28;
		config.SetIconWithURL("file://" + iconFilePath);
	}

	public static void UpdateSettings()
	{
		if (Plugin.startup)
		{
			Plugin.fpsDisplay.GetComponent<FPSDisplay>().stuff.SetActive(fpsDisplay.value);
			if (fpsDisplay.value)
			{
				Plugin.fpsDisplay.GetComponent<FPSDisplay>().UpdateText();
			}
			Plugin.fpsGraph.GetComponent<FPSGraph>().stuff.SetActive(fpsGraph.value);
			if (fpsGraph.value)
			{
				Plugin.fpsGraph.GetComponent<FPSGraph>().PlotData();
			}
		}
	}
}
[BepInPlugin("ironfarm.uk.fps", "FPSTracker", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public static AssetBundle bundle;

	public static GameObject fpsDisplay;

	public static GameObject fpsCanvas;

	public static GameObject fpsGraph;

	private Text fpsText;

	private string scene;

	public static bool startup;

	public void Start()
	{
		Debug.Log((object)"Im trippin");
		ConfigManager.Setup();
		scene = SceneHelper.CurrentScene;
		SceneManager.sceneLoaded += SceneChange;
	}

	public void dob()
	{
	}

	public void SceneChange(Scene scene, LoadSceneMode mode)
	{
		if (!startup)
		{
			startup = true;
			Debug.Log((object)"Loading FPS Tracker");
			bundle = AssetBundle.LoadFromFile(Path.Combine(Path.Combine(ModDir(), "Data"), "fps_assets"));
			fpsCanvas = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("FPS Canvas"));
			Object.DontDestroyOnLoad((Object)(object)fpsCanvas);
			fpsDisplay = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("FPS Display"), fpsCanvas.transform);
			fpsDisplay.AddComponent<FPSDisplay>();
			fpsGraph = Object.Instantiate<GameObject>(bundle.LoadAsset<GameObject>("FPS Graph"), fpsCanvas.transform);
			fpsGraph.AddComponent<FPSGraph>();
		}
	}

	public static void Refresh()
	{
		if (startup)
		{
			fpsDisplay.GetComponent<FPSDisplay>().Refresh();
			fpsGraph.GetComponent<FPSGraph>().Refresh();
			fpsGraph.GetComponent<FPSGraph>().PlotData();
		}
	}

	public void Update()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyUp(ConfigManager.fpsDisplayKeyBind.value))
		{
			ConfigManager.fpsDisplay.value = !ConfigManager.fpsDisplay.value;
			ConfigManager.fpsDisplay.TriggerValueChangeEvent();
		}
		if (Input.GetKeyUp(ConfigManager.fpsGraphKeyBind.value))
		{
			ConfigManager.fpsGraph.value = !ConfigManager.fpsGraph.value;
			ConfigManager.fpsGraph.TriggerValueChangeEvent();
		}
	}

	public static string ModDir()
	{
		return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
	}
}
internal class PluginInfo
{
	public const string Name = "FPSTracker";

	public const string GUID = "ironfarm.uk.fps";

	public const string Version = "1.0.0";
}