Decompiled source of TemporaryJumpVisualizer v1.0.0

plugins/LowTempJumpSoundEffect.dll

Decompiled 16 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
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: AssemblyTitle("LowTempJumpSoundEffect")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LowTempJumpSoundEffect")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0B7A8722-60D8-41BE-9287-0A128571B541")]
[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 LowTempJumpSoundEffect;

[BepInPlugin("mazknight.whiteknuckle.LowTempJumpSoundEffect", "LowTemporaryJumpSoundEffect", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string pluginGuid = "mazknight.whiteknuckle.LowTempJumpSoundEffect";

	private const string pluginName = "LowTemporaryJumpSoundEffect";

	public const string pluginVersion = "1.0.0";

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("mazknight.whiteknuckle.LowTempJumpSoundEffect");
		val.PatchAll();
	}
}
[HarmonyPatch]
public static class Patches
{
	public static bool HasAppeared;

	public static TextMeshProUGUI text;

	[HarmonyPostfix]
	[HarmonyPatch(typeof(ENT_Player), "Update")]
	public static void Update()
	{
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		int num = (int)AccessTools.Field(typeof(ENT_Player), "temporaryExtraJumpsRemaining").GetValue(ENT_Player.playerObject);
		int num2 = (int)AccessTools.Field(typeof(ENT_Player), "extraJumpsRemaining").GetValue(ENT_Player.playerObject);
		if ((Object)(object)text == (Object)null)
		{
			CreateText();
		}
		if (num == 0)
		{
			((TMP_Text)text).text = "";
		}
		else
		{
			((TMP_Text)text).text = num.ToString();
		}
		if (num2 > 0)
		{
			((Graphic)text).color = Color.green;
		}
		else
		{
			((Graphic)text).color = Color.red;
		}
	}

	private static void CreateText()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Expected O, but got Unknown
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		Scene activeScene = SceneManager.GetActiveScene();
		GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
		Transform val = null;
		GameObject[] array = rootGameObjects;
		foreach (GameObject val2 in array)
		{
			if (((Object)val2).name != "GameManager")
			{
				continue;
			}
			foreach (Transform item in val2.transform)
			{
				Transform val3 = item;
				if (((Object)val3).name != "Canvas")
				{
					continue;
				}
				val = val3;
				break;
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			foreach (Transform item2 in val)
			{
				Transform val4 = item2;
				if (((Object)val4).name != "Game UI")
				{
					continue;
				}
				val = val4;
				break;
			}
		}
		if (!((Object)(object)val == (Object)null))
		{
			GameObject val5 = new GameObject("ExtraJumpDisplay");
			text = val5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)text).text = "0";
			((TMP_Text)text).alignment = (TextAlignmentOptions)514;
			((TMP_Text)text).rectTransform.anchorMin = new Vector2(0.5f, 1f);
			((TMP_Text)text).rectTransform.anchorMax = new Vector2(0.5f, 1f);
			((TMP_Text)text).rectTransform.anchoredPosition = new Vector2(0f, (0f - ((TMP_Text)text).rectTransform.sizeDelta.y) / 2f);
			Debug.Log((object)(0f - ((TMP_Text)text).rectTransform.sizeDelta.y));
			((TMP_Text)text).transform.SetParent(((Component)val).transform, false);
		}
	}
}