Decompiled source of ParkSettings v1.0.3

Mods/ParkSettings.dll

Decompiled a week ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.UI;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using ParkConsole;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "ParkSettings", "1.0.3", "TacoSlayer36", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 248, 231)]
[assembly: MelonAuthorColor(255, 255, 248, 231)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ParkSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ParkSettings")]
[assembly: AssemblyTitle("ParkSettings")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ParkConsole;

public static class BuildInfo
{
	public const string Name = "ParkSettings";

	public const string Version = "1.0.3";

	public const string Description = "Puts an extra settings menu in the Park";

	public const string Author = "TacoSlayer36";

	public const string Company = "";
}
public class Core : MelonMod
{
	private string currentScene;

	private GameObject settingsClone;

	private bool cloneInitialized = false;

	private const float micThresholdRenderDistance = 4f;

	private GameObject settingsClone_threshold => ((Component)settingsClone.transform.GetChild(2).GetChild(3).GetChild(3)
		.GetChild(3)).gameObject;

	private Transform playerHead
	{
		get
		{
			Transform result = null;
			try
			{
				result = ((Component)Singleton<PlayerManager>.Instance.localPlayer.Controller).transform.GetChild(2).GetChild(0).GetChild(0);
			}
			catch
			{
			}
			return result;
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		if (!cloneInitialized)
		{
			if (currentScene == "Gym")
			{
				MelonCoroutines.Start(cloneSettings());
			}
			return;
		}
		if (currentScene == "Park")
		{
			toPark();
		}
		if (currentScene == "Gym" || currentScene.Contains("Map"))
		{
			toGymOrMatch();
		}
	}

	private IEnumerator cloneSettings()
	{
		if ((Object)(object)settingsClone != (Object)null)
		{
			cloneInitialized = true;
			yield break;
		}
		int i = 0;
		while ((Object)(object)playerHead == (Object)null)
		{
			if (i++ > 700)
			{
				yield break;
			}
			yield return (object)new WaitForFixedUpdate();
		}
		settingsClone = Object.Instantiate<GameObject>(GameObject.Find("INTERACTABLES/Menu Slab"));
		((Object)settingsClone).name = "Settings Clone";
		Object.DontDestroyOnLoad((Object)(object)settingsClone);
		setSettingsActive(active: false);
		cloneInitialized = true;
	}

	public override void OnFixedUpdate()
	{
		//IL_002f: 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)
		if (cloneInitialized && !((Object)(object)playerHead == (Object)null))
		{
			settingsClone_threshold.SetActive(Vector3.Distance(settingsClone_threshold.transform.position, playerHead.position) <= 4f);
		}
	}

	private void setSettingsActive(bool active)
	{
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		((Component)settingsClone.transform.GetChild(0)).gameObject.SetActive(active);
		((Component)settingsClone.transform.GetChild(1)).gameObject.SetActive(active);
		((Component)settingsClone.transform.GetChild(2)).gameObject.SetActive(active);
		if (active)
		{
			settingsClone.transform.localScale = Vector3.one;
			return;
		}
		settingsClone.transform.localScale = Vector3.zero;
		settingsClone.transform.position = new Vector3(0f, -100f, 0f);
		settingsClone.transform.localRotation = Quaternion.identity;
	}

	private void toPark()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		setSettingsActive(active: true);
		settingsClone.transform.position = new Vector3(-29.22f, -1.34f, -4.8f);
		settingsClone.transform.rotation = Quaternion.Euler(0f, 99.4f, 0f);
		settingsClone.GetComponentInChildren<SettingsForm>().UpdateInteractionBaseObjects();
		((InteractionNumericalBase)((Component)settingsClone.transform.GetChild(0).GetChild(1)).GetComponentInChildren<InteractionSlider>()).MoveToValue(0f);
	}

	private void toGymOrMatch()
	{
		setSettingsActive(active: false);
		settingsClone.GetComponentInChildren<SettingsForm>().SetPageNo(0);
		((InteractionNumericalBase)((Component)settingsClone.transform.GetChild(0).GetChild(1)).GetComponentInChildren<InteractionSlider>()).currentValue = 0f;
	}
}