Decompiled source of PoseLogger v1.3.0

Mods/PoseLogger.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using PoseLogger;
using RUMBLE.Managers;
using RUMBLE.MoveSystem;
using RUMBLE.Players.Subsystems;
using TMPro;
using UnhollowerBaseLib;
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: MelonInfo(typeof(PoseLoggerClass), "PoseLogger", "1.3.0", "Baumritter", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("PoseLogger")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoseLogger")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7563b7ca-ebe1-428e-8669-99f62cbf56ab")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PoseLogger;

public class StructureTracking : MonoBehaviour
{
	public string StructureName { get; set; }

	public bool LastActive { get; set; }

	public float Timestamp { get; set; }

	public string MoveName { get; set; }
}
public class PoseLoggerClass : MelonMod
{
	private const int LgRkPool = 17;

	private const int DiscPool = 43;

	private const int BallPool = 51;

	private const int PillPool = 42;

	private const int CubePool = 50;

	private const int WallPool = 49;

	private const string Version = "Poselogger_v1.3.0";

	private const string SettingsFile = "UserData\\PoseLogger\\Settings\\Settings.txt";

	private const string BaseFolder = "UserData";

	private const string ModFolder = "PoseLogger";

	private const string LogFolder = "Logs";

	private const string SettingsFolder = "Settings";

	private const string PoseLogFileName = "PoseLog";

	private const string StructLogFileName = "StructLog";

	private const string LogFileSuffix = ".txt";

	private Vector3 Howard_BoardMainPosition = new Vector3(-2.615f, -3.52f, -19.05f);

	private Vector3 Howard_BoardMainRotation = new Vector3(0f, 250f, 0f);

	private Vector3 Training_BoardMainPosition = new Vector3(-42.0299f, 3.194f, -1.0598f);

	private Vector3 Training_BoardMainRotation = new Vector3(0f, 250f, 0f);

	private Vector3 Park_BoardMainPosition = new Vector3(-5.9f, -5.9f, -10f);

	private Vector3 Park_BoardMainRotation = new Vector3(0f, 196f, 0f);

	private bool debuglogging = false;

	private bool SceneInit = false;

	private bool logging = true;

	private bool buffer = false;

	private bool PoseStructureLink = false;

	private bool Combo = false;

	private bool BasePoseReset = false;

	private bool posefile = false;

	private bool structurefile = false;

	private bool onscreenlog = false;

	private bool onboardlog = false;

	private string PoseDataName = "";

	private string PoseName = "";

	private string currentScene = "";

	private string LogString = "";

	private string PoseLogFileString = "";

	private string StructLogFileString = "";

	private string LocalPlayerName = "";

	private string LastStructure = "";

	private float CurrTimestamp = 0f;

	private float LastTimestamp = 0f;

	private float TimeDiff = 0f;

	private DateTime LastTime;

	private TimeSpan LastDelay;

	private DateTime ComboTime;

	private List<StructureTracking> Tracker = new List<StructureTracking>();

	private List<string> BufferList = new List<string>();

	private List<string> BufferList2 = new List<string>();

	private List<string> MoveBuffer = new List<string>();

	private PlayerPoseSystem Player_Obj;

	private GameObject PoolManager;

	private GameObject TrackingBuffer;

	private GameObject[] TBChildren = (GameObject[])(object)new GameObject[20];

	private GameObject[] TBDelay = (GameObject[])(object)new GameObject[20];

	private ProcessableComponent[] Discs;

	private ProcessableComponent[] Balls;

	private ProcessableComponent[] Pills;

	private ProcessableComponent[] Cubes;

	private ProcessableComponent[] Walls;

	private ProcessableComponent[] LgRck;

	private GameObject Board_Howard;

	private GameObject Board_Training;

	private GameObject Board_Template;

	public override void OnLateInitializeMelon()
	{
		((MelonBase)this).OnLateInitializeMelon();
		CheckandCreateFolder("UserData\\PoseLogger");
		CheckandCreateFolder("UserData\\PoseLogger\\Logs");
		CheckandCreateFolder("UserData\\PoseLogger\\Settings");
		PoseLogFileString = "UserData\\PoseLogger\\Logs\\PoseLog" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
		StructLogFileString = "UserData\\PoseLogger\\Logs\\StructLog" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";
		if (debuglogging)
		{
			MelonLogger.Msg("PoseLogFile: " + PoseLogFileString);
		}
		if (debuglogging)
		{
			MelonLogger.Msg("PoseLogFile: " + StructLogFileString);
		}
		GetSettings();
		ClearLogFolder();
	}

	public override void OnUpdate()
	{
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: 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)
		((MelonBase)this).OnUpdate();
		if ((currentScene == "Gym" || currentScene == "Park") && !SceneInit)
		{
			try
			{
				LocalPlayerName = SanitizeName(GameObject.Find("Game Instance/Initializable/PlayerManager").GetComponent<PlayerManager>().LocalPlayer.Data.GeneralData.PublicUsername);
				if ((Object)(object)Player_Obj == (Object)null)
				{
					Player_Obj = ((Component)((Component)GameObject.Find("Game Instance/Initializable/PlayerManager").GetComponent<PlayerManager>().LocalPlayer.Controller).gameObject.transform.FindChild("Poses")).GetComponent<PlayerPoseSystem>();
				}
				if (debuglogging)
				{
					MelonLogger.Msg("Player Object found.");
				}
				if ((Object)(object)PoolManager == (Object)null)
				{
					PoolManager = GameObject.Find("Game Instance/Pre-Initializable/PoolManager");
				}
				if (debuglogging)
				{
					MelonLogger.Msg("PoolManager found.");
				}
				if (Discs == null)
				{
					Discs = Il2CppArrayBase<ProcessableComponent>.op_Implicit(((Component)PoolManager.transform.GetChild(43)).GetComponentsInChildren<ProcessableComponent>(true));
				}
				if (Balls == null)
				{
					Balls = Il2CppArrayBase<ProcessableComponent>.op_Implicit(((Component)PoolManager.transform.GetChild(51)).GetComponentsInChildren<ProcessableComponent>(true));
				}
				if (Pills == null)
				{
					Pills = Il2CppArrayBase<ProcessableComponent>.op_Implicit(((Component)PoolManager.transform.GetChild(42)).GetComponentsInChildren<ProcessableComponent>(true));
				}
				if (Cubes == null)
				{
					Cubes = Il2CppArrayBase<ProcessableComponent>.op_Implicit(((Component)PoolManager.transform.GetChild(50)).GetComponentsInChildren<ProcessableComponent>(true));
				}
				if (Walls == null)
				{
					Walls = Il2CppArrayBase<ProcessableComponent>.op_Implicit(((Component)PoolManager.transform.GetChild(49)).GetComponentsInChildren<ProcessableComponent>(true));
				}
				if (LgRck == null)
				{
					LgRck = Il2CppArrayBase<ProcessableComponent>.op_Implicit(((Component)PoolManager.transform.GetChild(17)).GetComponentsInChildren<ProcessableComponent>(true));
				}
				if (onscreenlog && !buffer)
				{
					CreateTrackingBuffer();
				}
				if (onboardlog && ((Object)(object)Board_Howard == (Object)null || (Object)(object)Board_Training == (Object)null))
				{
					if (currentScene == "Gym")
					{
						Board_Howard = SpawnLeaderBoard("Gym_Howard_Board", Howard_BoardMainPosition, Howard_BoardMainRotation, debuglogging);
						Board_Training = SpawnLeaderBoard("Gym_Training_Board", Training_BoardMainPosition, Training_BoardMainRotation, debuglogging);
						if ((Object)(object)Board_Template == (Object)null)
						{
							Board_Template = SpawnLeaderBoard("Park_Training_Board", Park_BoardMainPosition, Park_BoardMainRotation, debuglogging);
							Board_Template.SetActive(false);
							Object.DontDestroyOnLoad((Object)(object)Board_Template);
						}
					}
					if (currentScene == "Park")
					{
						Board_Training = Object.Instantiate<GameObject>(Board_Template);
						((Object)Board_Training).name = "Park_Training_Board";
						Board_Training.SetActive(true);
					}
				}
				BufferList.Add("Pose/Structure Tracker");
				BufferList2.Add("Time since last");
				if (debuglogging)
				{
					MelonLogger.Msg("Text added to Buffer.");
				}
				for (int i = 0; i < TBChildren.Length; i++)
				{
					WriteToBufferList("", BufferList);
					WriteToBufferList("", BufferList2);
				}
				if (debuglogging)
				{
					MelonLogger.Msg("Buffer filled.");
				}
				if (onscreenlog && buffer)
				{
					TrackingBuffer.SetActive(true);
					if (debuglogging)
					{
						MelonLogger.Msg("OnScreenLog visibility enabled.");
					}
				}
				if (onscreenlog)
				{
					AddToBuffer(BufferList, 0, 19);
					AddToBuffer(BufferList2, 20, 39);
					if (debuglogging)
					{
						MelonLogger.Msg("Buffer pushed to OnScreenLog");
					}
				}
				if (onboardlog)
				{
					UpdateBoard();
				}
				if (debuglogging)
				{
					MelonLogger.Msg("Buffer pushed to Board");
				}
				SceneInit = true;
				if (debuglogging)
				{
					MelonLogger.Msg((object)SceneInit);
				}
			}
			catch
			{
			}
		}
		if ((currentScene != "Gym" || currentScene != "Park") && onscreenlog && buffer)
		{
			TrackingBuffer.SetActive(false);
		}
		if ((currentScene == "Gym" || currentScene == "Park") && onscreenlog && buffer)
		{
			TrackingBuffer.SetActive(true);
		}
		if (Input.GetKeyDown((KeyCode)108))
		{
			logging = !logging;
			LogString = "Logging = " + logging;
			MelonLogger.Msg(LogString);
		}
		if (logging && SceneInit && (currentScene == "Gym" || currentScene == "Park"))
		{
			PoseLogging();
			StructureLogging(Discs);
			StructureLogging(Balls);
			StructureLogging(Pills);
			StructureLogging(Cubes);
			StructureLogging(Walls);
			StructureLogging(LgRck);
			PoseStructureLink = false;
		}
	}

	public string PadString(string Input, int Length)
	{
		try
		{
			for (int i = Input.Length; i < Length; i++)
			{
				Input = " " + Input;
			}
		}
		catch
		{
			Input = "PadError";
		}
		return Input;
	}

	public string FillString(string Input, int Length)
	{
		try
		{
			for (int i = Input.Length; i < Length; i++)
			{
				Input += " ";
			}
		}
		catch
		{
			Input = "FillError";
		}
		return Input;
	}

	public string SanitizeName(string Input)
	{
		bool flag = false;
		char[] array = Input.ToCharArray();
		string text = "";
		for (int i = 0; i < Input.Length; i++)
		{
			if (array[i] == '<' && array[i + 1] == '#')
			{
				flag = true;
			}
			if (!flag)
			{
				text += array[i];
			}
			if (array[i] == '>')
			{
				flag = false;
			}
		}
		return text;
	}

	public void GetSettings()
	{
		string contents = "Poselogger_v1.3.0" + Environment.NewLine + "<Logging Types>" + Environment.NewLine + "<File Logging>" + Environment.NewLine + "Enable Pose Log : True" + Environment.NewLine + "Enable Structure Log: True" + Environment.NewLine + "<OnScreenLog>" + Environment.NewLine + "Enable: True" + Environment.NewLine + "<BoardLog>" + Environment.NewLine + "Enable: True";
		if (File.Exists("UserData\\PoseLogger\\Settings\\Settings.txt"))
		{
			string[] array = File.ReadAllLines("UserData\\PoseLogger\\Settings\\Settings.txt");
			if (array[0].Contains("Poselogger_v1.3.0"))
			{
				if (array[3].Contains("True"))
				{
					posefile = true;
				}
				if (array[4].Contains("True"))
				{
					structurefile = true;
				}
				if (array[6].Contains("True"))
				{
					onscreenlog = true;
				}
				if (array[8].Contains("True"))
				{
					onboardlog = true;
				}
				MelonLogger.Msg("Settings File applied");
			}
			else
			{
				File.WriteAllText("UserData\\PoseLogger\\Settings\\Settings.txt", contents);
				posefile = true;
				structurefile = true;
				onscreenlog = true;
				onboardlog = true;
				MelonLogger.Msg("Default Settings applied");
			}
		}
		else
		{
			File.WriteAllText("UserData\\PoseLogger\\Settings\\Settings.txt", contents);
			posefile = true;
			structurefile = true;
			onscreenlog = true;
			onboardlog = true;
			MelonLogger.Msg("Default Settings applied");
		}
	}

	public void ClearLogFolder()
	{
		foreach (FileInfo item in (from x in new DirectoryInfo("UserData\\PoseLogger\\Logs").GetFiles()
			orderby x.LastWriteTime descending
			select x).Skip(10))
		{
			item.Delete();
		}
	}

	public void WriteToLogFile(string FileName, string Output, bool file)
	{
		if (file)
		{
			Output += Environment.NewLine;
			File.AppendAllText(FileName, Output);
		}
	}

	public void CheckandCreateFolder(string Input)
	{
		if (!Directory.Exists(Input))
		{
			Directory.CreateDirectory(Input);
			MelonLogger.Msg("Folder: " + Input.ToString() + " created.");
		}
	}

	public void PoseLogging()
	{
		try
		{
			CurrTimestamp = Player_Obj.lastPoseUsedTimestamp;
			if (CurrTimestamp != LastTimestamp)
			{
				PoseDataName = ((Object)Player_Obj.lastPoseForSFX).name;
				TimeDiff = (CurrTimestamp - LastTimestamp) * 1000f;
				switch (PoseDataName)
				{
				case "Sprint":
					PoseName = "Sprint";
					break;
				case "EXPLODE":
					PoseName = "Explode";
					PoseStructureLink = true;
					break;
				case "DoublePunch":
					PoseName = "Flick";
					PoseStructureLink = true;
					break;
				case "Poses_Hold":
					PoseName = "Hold";
					PoseStructureLink = true;
					break;
				case "Poses_SpawnCube":
					PoseName = "Cube";
					PoseStructureLink = true;
					break;
				case "Poses_Dash":
					PoseName = "Dash";
					break;
				case "Poses_Uppercut_015":
					PoseName = "Uppercut";
					PoseStructureLink = true;
					break;
				case "PosesSpawnWall":
					PoseName = "Wall";
					PoseStructureLink = true;
					break;
				case "Poses_Jump":
					PoseName = "Jump";
					break;
				case "Poses_Kick_015":
					PoseName = "Kick";
					PoseStructureLink = true;
					break;
				case "Poses_SpawnBall":
					PoseName = "Ball";
					PoseStructureLink = true;
					break;
				case "Poses_Stomp":
					PoseName = "Stomp";
					PoseStructureLink = true;
					break;
				case "Poses_Pillar_015":
					PoseName = "Pillar";
					PoseStructureLink = true;
					break;
				case "Poses_Straight_015":
					PoseName = "Straight";
					PoseStructureLink = true;
					break;
				case "MoveSystemDisc 1":
					PoseName = "Disc";
					PoseStructureLink = true;
					break;
				case "Poses_StructureX":
					PoseName = "Base Pose";
					break;
				default:
					PoseName = "No Name ?";
					break;
				}
				if ((TimeDiff >= 1500f && PoseName != "Sprint") || (TimeDiff >= 3500f && PoseName == "Sprint"))
				{
					WriteToLogFile(PoseLogFileString, "-----------------------------------------------------", posefile);
					for (int i = 0; i < TBChildren.Length; i++)
					{
						WriteToBufferList("", BufferList);
						WriteToBufferList("", BufferList2);
					}
					if (onscreenlog)
					{
						AddToBuffer(BufferList, 0, 19);
						AddToBuffer(BufferList2, 20, 39);
					}
					if (onboardlog)
					{
						UpdateBoard();
					}
					LastTime = DateTime.Now;
					if (PoseName == "Base Pose")
					{
						BasePoseReset = true;
					}
				}
				LogString = "Pose Name: " + PadString(PoseName, 10) + " | Time since last Pose:" + PadString(TimeDiff.ToString("0"), 6) + "ms";
				if (!PoseStructureLink && !PoseName.Contains("Base Pose"))
				{
					AddToScreenLogger("Pose struck: " + PoseName);
				}
				WriteToLogFile(PoseLogFileString, LogString, posefile);
			}
			LastTimestamp = Player_Obj.lastPoseUsedTimestamp;
		}
		catch
		{
		}
	}

	public void StructureLogging(ProcessableComponent[] Children)
	{
		StructureTracking current = new StructureTracking();
		StructureTracking structureTracking = new StructureTracking();
		try
		{
			for (int i = 0; i < Children.Length; i++)
			{
				switch (((Object)Children[i]).name)
				{
				case "Disc":
					current.StructureName = "Disc#";
					break;
				case "Ball":
					current.StructureName = "Ball#";
					break;
				case "Pillar":
					current.StructureName = "Pillar#";
					break;
				case "RockCube":
					current.StructureName = "Cube#";
					break;
				case "Wall":
					current.StructureName = "Wall#";
					break;
				case "LargeRock":
					current.StructureName = "Boulder#";
					break;
				}
				if (i < 10)
				{
					StructureTracking structureTracking2 = current;
					structureTracking2.StructureName = structureTracking2.StructureName + "0" + i;
				}
				else
				{
					current.StructureName += i;
				}
				current.LastActive = ((Component)Children[i]).gameObject.activeSelf;
				try
				{
					current.MoveName = ((Object)Children[i].previousStackConfiguration.ExecutedStack).name;
					if (current.MoveName == "Disc")
					{
						current.MoveName = "Spawn Move";
					}
				}
				catch
				{
					current.MoveName = "Nothing";
				}
				try
				{
					if (currentScene == "Gym")
					{
						current.Timestamp = Children[i].previousStackConfiguration.OfflineTimestamp;
					}
					if (currentScene == "Park")
					{
						current.Timestamp = Children[i].previousStackConfiguration.Timestamp;
					}
				}
				catch
				{
					current.Timestamp = -1f;
				}
				int num = Tracker.FindIndex((StructureTracking x) => x.StructureName == current.StructureName);
				if (num == -1)
				{
					Tracker.Add(new StructureTracking
					{
						StructureName = current.StructureName,
						LastActive = current.LastActive,
						Timestamp = current.Timestamp,
						MoveName = current.MoveName
					});
					num = Tracker.FindIndex((StructureTracking x) => x.StructureName == current.StructureName);
					continue;
				}
				structureTracking.StructureName = Tracker[num].StructureName;
				structureTracking.LastActive = Tracker[num].LastActive;
				structureTracking.Timestamp = Tracker[num].Timestamp;
				structureTracking.MoveName = Tracker[num].MoveName;
				string text;
				try
				{
					text = SanitizeName(((PlayerControllerSubsystem)((Il2CppObjectBase)Children[i].latestInfluencedProcessor).Cast<PlayerStackProcessor>()).ParentController.AssignedPlayer.Data.GeneralData.PublicUsername);
				}
				catch
				{
					text = "No Player";
				}
				string text2 = PadString(current.StructureName, 10);
				string text3 = FillString(current.MoveName, 12);
				string text4 = ((current.Timestamp - structureTracking.Timestamp) * 1000f).ToString("0");
				if (current.LastActive != structureTracking.LastActive)
				{
					if (current.LastActive)
					{
						string output = text2 + " spawned.";
						WriteToLogFile(StructLogFileString, output, structurefile);
						if (PoseStructureLink)
						{
							AddToScreenLogger("Spawned " + current.StructureName);
						}
					}
					else
					{
						string output = text2 + " broke.";
						WriteToLogFile(StructLogFileString, output, structurefile);
					}
				}
				if (current.LastActive && (current.Timestamp != structureTracking.Timestamp || current.MoveName != structureTracking.MoveName))
				{
					string output = text2 + " affected by " + text3;
					if (LocalPlayerName == text && !text3.Contains("Nothing") && !text3.Contains("Spawn Move"))
					{
						AddToScreenLogger(ComboTracker(current.StructureName, current.MoveName) + " on " + current.StructureName);
					}
					if (structureTracking.Timestamp == -1f)
					{
						output += "| First Modifier  ";
						output += "| Player: ";
						output += text;
						WriteToLogFile(StructLogFileString, output, structurefile);
					}
					else
					{
						if (currentScene == "Gym")
						{
							output += FillString("| Delay: " + text4 + "ms", 18);
						}
						if (currentScene == "Park")
						{
							output = ((current.Timestamp - structureTracking.Timestamp != 0f) ? (output + FillString("| Delay: ~" + text4 + "ms", 18)) : (output + FillString("| Delay: <128ms", 18)));
						}
						output += "| Player: ";
						output += text;
						WriteToLogFile(StructLogFileString, output, structurefile);
					}
				}
				Tracker[num] = new StructureTracking
				{
					StructureName = current.StructureName,
					LastActive = current.LastActive,
					Timestamp = current.Timestamp,
					MoveName = current.MoveName
				};
			}
		}
		catch
		{
			MelonLogger.Msg("StructureLogging broke.");
		}
	}

	public void AddToScreenLogger(string I1)
	{
		if (BasePoseReset)
		{
			LastTime = DateTime.Now;
			BasePoseReset = false;
		}
		if (Combo)
		{
			LastDelay += DateTime.Now - LastTime;
		}
		else
		{
			LastDelay = DateTime.Now - LastTime;
		}
		string text = ((!(LastDelay.TotalMilliseconds < 20.0)) ? (LastDelay.TotalMilliseconds.ToString("0") + "ms") : "First");
		if (Combo)
		{
			BufferList.RemoveAt(BufferList.Count - 1);
			BufferList.Add(I1);
		}
		else
		{
			WriteToBufferList(I1, BufferList);
		}
		if (Combo)
		{
			BufferList2.RemoveAt(BufferList.Count - 1);
			BufferList2.Add(text);
		}
		else
		{
			WriteToBufferList(text, BufferList2);
		}
		if (onscreenlog)
		{
			AddToBuffer(BufferList, 0, 19);
			AddToBuffer(BufferList2, 20, 39);
		}
		if (onboardlog)
		{
			UpdateBoard();
		}
		LastTime = DateTime.Now;
		Combo = false;
	}

	public void CreateTrackingBuffer()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_007c: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: 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_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0445: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("Game Instance/UI/LegacyRecordingCameraUI/Panel");
		GameObject val2 = new GameObject();
		float num = 16f;
		TrackingBuffer = Object.Instantiate<GameObject>(val);
		TrackingBuffer.SetActive(false);
		((Object)TrackingBuffer).name = "OnScreenLogger";
		TrackingBuffer.transform.SetParent(GameObject.Find("Game Instance/UI").transform);
		TrackingBuffer.transform.position = new Vector3(220f, 790f, 0f);
		TrackingBuffer.transform.localScale = new Vector3(1.041625f, 1.25f, 0f);
		((Graphic)TrackingBuffer.GetComponent<Image>()).color = new Color(0.2f, 0.2f, 0.2f, 0.8f);
		for (int i = 0; i < TrackingBuffer.transform.childCount; i++)
		{
			Object.Destroy((Object)(object)((Component)TrackingBuffer.transform.GetChild(i)).gameObject);
		}
		for (int j = 0; j < TBChildren.Length; j++)
		{
			TBChildren[j] = Object.Instantiate<GameObject>(val2);
			TBChildren[j].gameObject.AddComponent<TextMeshProUGUI>();
			TBChildren[j].transform.SetParent(TrackingBuffer.transform);
			if (j == 0)
			{
				((Object)TBChildren[j]).name = "Line_Head";
				TBChildren[j].transform.localPosition = new Vector3(-35f, 160f, 0f);
				((Component)TBChildren[j].transform).GetComponent<RectTransform>().sizeDelta = new Vector2(520f, 28f);
				((TMP_Text)((Component)TBChildren[j].transform).GetComponent<TextMeshProUGUI>()).text = "Pose/Structure Tracker";
				((TMP_Text)((Component)TBChildren[j].transform).GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			}
			else
			{
				((Object)TBChildren[j]).name = "Line" + j;
				TBChildren[j].transform.localPosition = new Vector3(-35f, 150f + num - num * (float)(j + 1), 0f);
				((Component)TBChildren[j].transform).GetComponent<RectTransform>().sizeDelta = new Vector2(520f, 28f);
				((TMP_Text)((Component)TBChildren[j].transform).GetComponent<TextMeshProUGUI>()).text = "Initialization Text";
				((TMP_Text)((Component)TBChildren[j].transform).GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)516;
			}
			TBChildren[j].transform.localScale = new Vector3(0.6f, 0.5f, 1f);
			((TMP_Text)((Component)TBChildren[j].transform).GetComponent<TextMeshProUGUI>()).fontSize = 24f;
			((Component)TBChildren[j].transform).GetComponent<TextMeshProUGUI>().autoSizeTextContainer = false;
		}
		for (int k = 0; k < TBDelay.Length; k++)
		{
			TBDelay[k] = Object.Instantiate<GameObject>(val2);
			TBDelay[k].gameObject.AddComponent<TextMeshProUGUI>();
			TBDelay[k].transform.SetParent(TrackingBuffer.transform);
			if (k == 0)
			{
				((Object)TBDelay[k]).name = "Delay_Head";
				TBDelay[k].transform.localPosition = new Vector3(135f, 160f, 0f);
				((TMP_Text)((Component)TBDelay[k].transform).GetComponent<TextMeshProUGUI>()).text = "Time since last";
			}
			else
			{
				((Object)TBDelay[k]).name = "Delay" + k;
				TBDelay[k].transform.localPosition = new Vector3(135f, 150f + num - num * (float)(k + 1), 0f);
				((TMP_Text)((Component)TBDelay[k].transform).GetComponent<TextMeshProUGUI>()).text = "";
			}
			((TMP_Text)((Component)TBDelay[k].transform).GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)516;
			((Component)TBDelay[k].transform).GetComponent<RectTransform>().sizeDelta = new Vector2(170f, 28f);
			TBDelay[k].transform.localScale = new Vector3(0.6f, 0.5f, 1f);
			((TMP_Text)((Component)TBDelay[k].transform).GetComponent<TextMeshProUGUI>()).fontSize = 24f;
			((Component)TBDelay[k].transform).GetComponent<TextMeshProUGUI>().autoSizeTextContainer = false;
		}
		Object.Destroy((Object)(object)val2);
		if (debuglogging)
		{
			MelonLogger.Msg("Buffer Object created.");
		}
		buffer = true;
	}

	public void WriteToBufferList(string Input, List<string> List)
	{
		if (List.Count > TBChildren.Length - 1)
		{
			List.RemoveAt(1);
			List.Add(Input);
		}
		else
		{
			List.Add(Input);
		}
	}

	public void AddToBuffer(List<string> Input, int Start, int End)
	{
		int num = 0;
		for (int i = Start; i <= End; i++)
		{
			((TMP_Text)((Component)TrackingBuffer.transform.GetChild(i)).GetComponent<TextMeshProUGUI>()).text = Input[num];
			num++;
		}
	}

	public string ComboTracker(string Structure, string Move)
	{
		TimeSpan timeSpan = DateTime.Now - ComboTime;
		switch (Move)
		{
		case "HoldRight":
			Move = "Hold";
			break;
		case "HoldLeft":
			Move = "Hold";
			break;
		}
		string result;
		if (LastStructure != Structure || timeSpan.TotalMilliseconds >= 350.0)
		{
			LastStructure = Structure;
			MoveBuffer.Clear();
			MoveBuffer.Add(Move);
			result = Move;
			Combo = false;
		}
		else
		{
			string text = MoveBuffer[0];
			string text2 = text;
			if (!(text2 == "Straight"))
			{
				if (text2 == "Struppercut" && Move == "Kick")
				{
					Move = "Strupperkick";
					MoveBuffer.RemoveAt(0);
				}
			}
			else if (Move == "Uppercut")
			{
				Move = "Struppercut";
				MoveBuffer.RemoveAt(0);
			}
			else if (Move == "Kick")
			{
				Move = "Hop";
				MoveBuffer.RemoveAt(0);
			}
			if (MoveBuffer.Count > 4)
			{
				MoveBuffer.RemoveAt(4);
				MoveBuffer.Insert(0, Move);
			}
			else
			{
				MoveBuffer.Insert(0, Move);
			}
			switch (MoveBuffer.Count)
			{
			case 1:
				result = MoveBuffer[0];
				Combo = true;
				break;
			case 2:
				result = MoveBuffer[1] + ">" + MoveBuffer[0];
				Combo = true;
				break;
			case 3:
				result = MoveBuffer[2] + ">" + MoveBuffer[1] + ">" + MoveBuffer[0];
				Combo = true;
				break;
			case 4:
				result = MoveBuffer[3] + ">" + MoveBuffer[2] + ">" + MoveBuffer[1] + ">" + MoveBuffer[0];
				Combo = true;
				break;
			case 5:
				result = MoveBuffer[4] + ">" + MoveBuffer[3] + ">" + MoveBuffer[2] + ">" + MoveBuffer[1] + ">" + MoveBuffer[0];
				Combo = true;
				break;
			default:
				result = "Error";
				Combo = true;
				break;
			}
		}
		ComboTime = DateTime.Now;
		return result;
	}

	private GameObject SpawnLeaderBoard(string Name, Vector3 BoardMainPosition, Vector3 BoardMainRotation, bool debuglog)
	{
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Expected O, but got Unknown
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		Vector3 localPosition = default(Vector3);
		((Vector3)(ref localPosition))..ctor(0f, 1.175f, 0f);
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(0.95f, 0.6f, 0.2f);
		Vector3 localPosition2 = default(Vector3);
		((Vector3)(ref localPosition2))..ctor(0f, 0.1f, -0.25f);
		Vector3 localPosition3 = default(Vector3);
		((Vector3)(ref localPosition3))..ctor(0f, -0.1f, -0.25f);
		GameObject val2 = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Leaderboard/Frame");
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Board Object get");
		}
		GameObject val3 = Object.Instantiate<GameObject>(val2);
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Board Object instantiate");
		}
		val3.transform.position = BoardMainPosition;
		val3.transform.eulerAngles = BoardMainRotation;
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Position changed");
		}
		((Object)val3).name = Name;
		((Object)val3.transform.GetChild(0)).name = "TopLog";
		((Object)val3.transform.GetChild(2)).name = "FootLeft";
		((Object)val3.transform.GetChild(3)).name = "FootRight";
		((Object)val3.transform.GetChild(4)).name = "LogLeft";
		((Object)val3.transform.GetChild(5)).name = "LogRight";
		((Object)val3.transform.GetChild(6)).name = "InnerWall";
		((Object)val3.transform.GetChild(11)).name = "LogBigTop";
		((Object)val3.transform.GetChild(12)).name = "BackPlane";
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Objects renamed");
		}
		val3.transform.GetChild(6).localPosition = localPosition;
		val3.transform.GetChild(6).localScale = val;
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Frame resized");
		}
		val2 = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Leaderboard/Text Objects/Titleplate/Leaderboard");
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Sample Text Object get");
		}
		for (int i = 0; i < 4; i++)
		{
			GameObject val4 = new GameObject
			{
				name = "Text" + i
			};
			val4.transform.SetParent(val3.transform.GetChild(6));
			if (debuglog)
			{
				MelonLogger.Msg(Name + ": Text Object " + i + " created");
			}
			if (i <= 1)
			{
				val4.transform.localPosition = localPosition2;
			}
			else
			{
				val4.transform.localPosition = localPosition3;
			}
			val4.transform.localScale = Invert_Values(val);
			val4.transform.eulerAngles = BoardMainRotation;
			val4.AddComponent<TextMeshPro>();
			((Component)val4.transform).GetComponent<RectTransform>().sizeDelta = new Vector2(1f, 1f);
			if (debuglog)
			{
				MelonLogger.Msg(Name + ": Text created and transformed");
			}
			((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).text = "Initialization Text";
			((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).fontSize = 0.6f;
			((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).font = ((TMP_Text)val2.GetComponent<TextMeshPro>()).font;
			((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).fontMaterial = ((TMP_Text)val2.GetComponent<TextMeshPro>()).fontMaterial;
			switch (i)
			{
			case 0:
				((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)257;
				break;
			case 1:
				((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)260;
				break;
			case 2:
				((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)1025;
				break;
			case 3:
				((TMP_Text)((Component)val4.transform).GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)1028;
				break;
			}
			if (debuglog)
			{
				MelonLogger.Msg(Name + ": Text Object " + i + " set");
			}
		}
		Object.Destroy((Object)(object)((Component)val3.transform.GetChild(1)).gameObject);
		Object.Destroy((Object)(object)((Component)val3.transform.GetChild(7)).gameObject);
		Object.Destroy((Object)(object)((Component)val3.transform.GetChild(8)).gameObject);
		Object.Destroy((Object)(object)((Component)val3.transform.GetChild(9)).gameObject);
		Object.Destroy((Object)(object)((Component)val3.transform.GetChild(10)).gameObject);
		if (debuglog)
		{
			MelonLogger.Msg(Name + ": Children destroyed");
		}
		return val3;
	}

	private void SetTextOnBoard(GameObject Board, int TextNumber, string Output)
	{
		((TMP_Text)((Component)Board.transform.FindChild("InnerWall").GetChild(TextNumber)).GetComponent<TextMeshPro>()).text = Output;
	}

	private void UpdateBoard()
	{
		string text = "";
		string text2 = "";
		string output = BufferList[0];
		string output2 = BufferList2[0];
		for (int i = 3; i < 20; i++)
		{
			text = ((i == 19) ? (text + BufferList[i]) : (text + BufferList[i] + Environment.NewLine));
		}
		for (int j = 3; j < 20; j++)
		{
			text2 = ((j == 19) ? (text2 + BufferList2[j]) : (text2 + BufferList2[j] + Environment.NewLine));
		}
		if (debuglogging)
		{
			MelonLogger.Msg("Text Blocks created");
		}
		if (currentScene == "Gym")
		{
			SetTextOnBoard(Board_Howard, 0, output);
			SetTextOnBoard(Board_Howard, 1, output2);
			SetTextOnBoard(Board_Howard, 2, text);
			SetTextOnBoard(Board_Howard, 3, text2);
			if (debuglogging)
			{
				MelonLogger.Msg("Text pushed to Howard Board");
			}
		}
		SetTextOnBoard(Board_Training, 0, output);
		SetTextOnBoard(Board_Training, 1, output2);
		SetTextOnBoard(Board_Training, 2, text);
		SetTextOnBoard(Board_Training, 3, text2);
		if (debuglogging)
		{
			MelonLogger.Msg("Text pushed to Training Board");
		}
	}

	private Vector3 Invert_Values(Vector3 Input)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_003a: 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)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 result = default(Vector3);
		result.x = 1f / Input.x;
		result.y = 1f / Input.y;
		result.z = 1f / Input.z;
		return result;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		SceneInit = false;
		currentScene = sceneName;
	}
}