Decompiled source of ParkTeamNames v1.1.0

Mods/ParkTeamNames.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using ParkTeamNames;
using RUMBLE.Managers;
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(main), "ParkTeamNames", "1.1.0", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("ParkTeamNames")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ParkTeamNames")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d9135f41-2b1d-4768-bc4c-c1108fdf9a5a")]
[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 ParkTeamNames;

public class main : MelonMod
{
	private string currentScene = "";

	private bool sceneChanged = false;

	private PlayerManager playerManager;

	private bool[] KeyReleased;

	private bool[] KeyPressed;

	private int[] ColorType;

	private Material[] material;

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		sceneChanged = true;
	}

	public override void OnUpdate()
	{
		if (currentScene != "Park")
		{
			return;
		}
		if (Input.GetKeyDown((KeyCode)49) && KeyReleased[0] && playerManager.AllPlayers.Count > 1)
		{
			KeyPressed[0] = true;
			ColorType[0]++;
			if (ColorType[0] == material.Length)
			{
				ColorType[0] = 0;
			}
			KeyReleased[0] = false;
		}
		if (Input.GetKeyUp((KeyCode)49) && !KeyReleased[0])
		{
			KeyReleased[0] = true;
		}
		if (Input.GetKeyDown((KeyCode)50) && KeyReleased[1] && playerManager.AllPlayers.Count > 2)
		{
			KeyPressed[1] = true;
			ColorType[1]++;
			if (ColorType[1] == material.Length)
			{
				ColorType[1] = 0;
			}
			KeyReleased[1] = false;
		}
		if (Input.GetKeyUp((KeyCode)50) && !KeyReleased[1])
		{
			KeyReleased[1] = true;
		}
		if (Input.GetKeyDown((KeyCode)51) && KeyReleased[2] && playerManager.AllPlayers.Count > 3)
		{
			KeyPressed[2] = true;
			ColorType[2]++;
			if (ColorType[2] == material.Length)
			{
				ColorType[2] = 0;
			}
			KeyReleased[2] = false;
		}
		if (Input.GetKeyUp((KeyCode)51) && !KeyReleased[2])
		{
			KeyReleased[2] = true;
		}
		if (Input.GetKeyDown((KeyCode)52) && KeyReleased[3] && playerManager.AllPlayers.Count > 4)
		{
			KeyPressed[3] = true;
			ColorType[3]++;
			if (ColorType[3] == material.Length)
			{
				ColorType[3] = 0;
			}
			KeyReleased[3] = false;
		}
		if (Input.GetKeyUp((KeyCode)52) && !KeyReleased[3])
		{
			KeyReleased[3] = true;
		}
		if (Input.GetKeyDown((KeyCode)53) && KeyReleased[4] && playerManager.AllPlayers.Count > 5)
		{
			KeyPressed[4] = true;
			ColorType[4]++;
			if (ColorType[4] == material.Length)
			{
				ColorType[4] = 0;
			}
			KeyReleased[4] = false;
		}
		if (Input.GetKeyUp((KeyCode)53) && !KeyReleased[4])
		{
			KeyReleased[4] = true;
		}
	}

	public override void OnFixedUpdate()
	{
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Expected O, but got Unknown
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Expected O, but got Unknown
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Expected O, but got Unknown
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Expected O, but got Unknown
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Expected O, but got Unknown
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		if (sceneChanged)
		{
			if (currentScene == "Loader")
			{
				KeyPressed = new bool[5];
				KeyReleased = new bool[5];
				KeyReleased[0] = true;
				KeyReleased[1] = true;
				KeyReleased[2] = true;
				KeyReleased[3] = true;
				KeyReleased[4] = true;
				ColorType = new int[5];
				material = (Material[])(object)new Material[6];
			}
			else if (currentScene == "Park")
			{
				try
				{
					playerManager = GameObject.Find("Game Instance/Initializable/PlayerManager").GetComponent<PlayerManager>();
					material[0] = ((Component)((Component)playerManager.localPlayer.Controller).gameObject.transform.GetChild(7).GetChild(0).GetChild(0)).GetComponent<Image>().material;
					material[1] = new Material(((Component)((Component)playerManager.localPlayer.Controller).gameObject.transform.GetChild(7).GetChild(0).GetChild(0)).GetComponent<Image>().material.shader);
					material[2] = new Material(material[1].shader);
					material[3] = new Material(material[1].shader);
					material[4] = new Material(material[1].shader);
					material[5] = new Material(material[1].shader);
					material[1].color = new Color(1f, 0f, 0f, 1f);
					material[2].color = new Color(1f, 0f, 1f, 1f);
					material[3].color = new Color(0f, 0f, 1f, 1f);
					material[4].color = new Color(0f, 1f, 1f, 1f);
					material[5].color = new Color(0f, 1f, 0f, 1f);
					for (int i = 0; i < 5; i++)
					{
						ColorType[i] = 0;
					}
				}
				catch
				{
					return;
				}
			}
			sceneChanged = false;
		}
		else
		{
			if (!(currentScene == "Park"))
			{
				return;
			}
			for (int j = 0; j < 5; j++)
			{
				if (KeyPressed[j])
				{
					((Component)((Component)playerManager.AllPlayers[j + 1].Controller).gameObject.transform.GetChild(8).GetChild(0).GetChild(0)).GetComponent<Image>().material = material[ColorType[j]];
					KeyPressed[j] = false;
				}
			}
		}
	}
}