using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; 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; public enum TextAlignment { Top, Bottom, Center, BottomLeft, BottomRight, CenterLeft, CenterRight, TopLeft, TopRight } [BepInPlugin("mazknight.whiteknuckle.TemporaryJumpVisualizer", "TemporaryJumpVisualizer", "1.2.0")] public class Plugin : BaseUnityPlugin { private const string pluginGuid = "mazknight.whiteknuckle.TemporaryJumpVisualizer"; private const string pluginName = "TemporaryJumpVisualizer"; public const string pluginVersion = "1.2.0"; public static ConfigEntry xAnchorPosition; public static ConfigEntry yAnchorPosition; public static ConfigEntry textAlignment; public static ConfigEntry temporaryOnlyJumpsColor; public static ConfigEntry regularJumpsLeftColor; public static ConfigEntry regularJumpsColor; public static ConfigEntry alwaysShowJumpCounter; public static ConfigEntry fontSize; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_008b: 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_00e2: Unknown result type (might be due to invalid IL or missing references) Harmony val = new Harmony("mazknight.whiteknuckle.TemporaryJumpVisualizer"); val.PatchAll(); xAnchorPosition = ((BaseUnityPlugin)this).Config.Bind("Alignment", "xPosition", 0.5f, "The x position to have the display. 0 means very left, 1 means very left"); yAnchorPosition = ((BaseUnityPlugin)this).Config.Bind("Alignment", "yPosition", 1f, "The y position to have the display. 0 means very bottom, 1 means very top"); textAlignment = ((BaseUnityPlugin)this).Config.Bind("Alignment", "textAlignment", TextAlignment.Bottom, "Where the text should be in relation to the chosen position. "); temporaryOnlyJumpsColor = ((BaseUnityPlugin)this).Config.Bind("Color", "temporaryJumpsColor", Color.red, "What color the number should be if you have only temporary jumps available"); regularJumpsLeftColor = ((BaseUnityPlugin)this).Config.Bind("Color", "regularJumpsLeftColor", new Color(1f, 0.5f, 0f), "What number should the number be if there are regular mid air jumps left (go in game to see what I mean)"); regularJumpsColor = ((BaseUnityPlugin)this).Config.Bind("Color", "regularJumpsColor", Color.green, "What color the number should be if you have regular mid air jumps available"); alwaysShowJumpCounter = ((BaseUnityPlugin)this).Config.Bind("Other", "alwaysShowJumpCounter", false, "If false, will only show when you have temporary jumps. Otherwise will always show."); fontSize = ((BaseUnityPlugin)this).Config.Bind("Other", "fontSize", 40f, "Why do you need a description"); ((BaseUnityPlugin)this).Config.SettingChanged += delegate { Patches.UpdateTextPosition(); }; } } [HarmonyPatch] public static class Patches { public static bool HasAppeared; public static TextMeshProUGUI FrontText; public static TextMeshProUGUI BackText; public static RectMask2D FrontMask2D; public static RectMask2D BackMask2D; internal static int MaxDoubleJumps = 0; private static Dictionary attributes = new Dictionary { { TextAlignment.Top, "Y" }, { TextAlignment.TopLeft, "Yx" }, { TextAlignment.TopRight, "YX" }, { TextAlignment.Center, "" }, { TextAlignment.CenterLeft, "x" }, { TextAlignment.CenterRight, "X" }, { TextAlignment.Bottom, "y" }, { TextAlignment.BottomLeft, "yx" }, { TextAlignment.BottomRight, "yX" } }; [HarmonyPostfix] [HarmonyPatch(typeof(ENT_Player), "Update")] public static void Update() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_028d: 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); if ((Object)(object)FrontText == (Object)null) { CreateText(); } if (num == 0 && !Plugin.alwaysShowJumpCounter.Value) { ((TMP_Text)FrontText).text = ""; } else { ((TMP_Text)FrontText).text = num.ToString(); } ((TMP_Text)BackText).text = ((TMP_Text)FrontText).text; float percentage = GetPercentage(); RectTransform rectTransform = FrontMask2D.rectTransform; Bounds textBounds = ((TMP_Text)FrontText).textBounds; rectTransform.SetSizeWithCurrentAnchors((Axis)1, ((Bounds)(ref textBounds)).size.y * percentage); RectTransform rectTransform2 = FrontMask2D.rectTransform; textBounds = ((TMP_Text)FrontText).textBounds; rectTransform2.SetSizeWithCurrentAnchors((Axis)0, ((Bounds)(ref textBounds)).size.x); RectTransform rectTransform3 = BackMask2D.rectTransform; textBounds = ((TMP_Text)BackText).textBounds; rectTransform3.SetSizeWithCurrentAnchors((Axis)1, ((Bounds)(ref textBounds)).size.y * (1f - percentage)); RectTransform rectTransform4 = BackMask2D.rectTransform; textBounds = ((TMP_Text)BackText).textBounds; rectTransform4.SetSizeWithCurrentAnchors((Axis)0, ((Bounds)(ref textBounds)).size.x); RectTransform rectTransform5 = ((TMP_Text)FrontText).rectTransform; textBounds = ((TMP_Text)FrontText).textBounds; rectTransform5.anchoredPosition = new Vector2(0f, ((Bounds)(ref textBounds)).size.y * (1f - percentage) / 2f); RectTransform rectTransform6 = FrontMask2D.rectTransform; Vector2 textAlignmentVector = GetTextAlignmentVector(); textBounds = ((TMP_Text)FrontText).textBounds; rectTransform6.anchoredPosition = textAlignmentVector + new Vector2(0f, (0f - ((Bounds)(ref textBounds)).size.y) * (1f - percentage) / 2f); RectTransform rectTransform7 = ((TMP_Text)BackText).rectTransform; textBounds = ((TMP_Text)FrontText).textBounds; rectTransform7.anchoredPosition = new Vector2(0f, (0f - ((Bounds)(ref textBounds)).size.y) * percentage / 2f); RectTransform rectTransform8 = BackMask2D.rectTransform; Vector2 textAlignmentVector2 = GetTextAlignmentVector(); textBounds = ((TMP_Text)FrontText).textBounds; rectTransform8.anchoredPosition = textAlignmentVector2 + new Vector2(0f, ((Bounds)(ref textBounds)).size.y * percentage / 2f); if (percentage == 0f) { ((TMP_Text)FrontText).text = ""; } ((Graphic)FrontText).color = Plugin.regularJumpsColor.Value; ((Graphic)BackText).color = ((percentage > 0f) ? Plugin.regularJumpsLeftColor.Value : Plugin.temporaryOnlyJumpsColor.Value); } [HarmonyPrefix] [HarmonyPatch(typeof(CL_GameManager), "Awake")] public static void ResetJumpCounter() { if (!((Object)(object)CL_GameManager.gamemode == (Object)null)) { MaxDoubleJumps = 0; } } public static float GetPercentage() { int num = (int)AccessTools.Field(typeof(ENT_Player), "extraJumpsRemaining").GetValue(ENT_Player.playerObject); if (MaxDoubleJumps < num) { MaxDoubleJumps = num; } if (MaxDoubleJumps == 0) { return 0f; } return (float)num / (float)MaxDoubleJumps; } 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) 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")) { val = val2.transform.Find("Canvas").Find("Game UI"); } } if (!((Object)(object)val == (Object)null)) { GameObject val3 = new GameObject("ExtraJumpDisplay"); GameObject val4 = new GameObject("BackText"); FrontText = val3.AddComponent(); ((TMP_Text)FrontText).text = "0"; BackText = val4.AddComponent(); ((TMP_Text)BackText).text = "0"; ((TMP_Text)FrontText).alignment = (TextAlignmentOptions)514; ((TMP_Text)BackText).alignment = (TextAlignmentOptions)514; GameObject val5 = new GameObject("FrontMask"); FrontMask2D = val5.AddComponent(); val5.transform.SetParent(((Component)val).transform); GameObject val6 = new GameObject("BackMask"); BackMask2D = val6.AddComponent(); val6.transform.SetParent(((Component)val).transform); TMP_FontAsset font = ((TMP_Text)((Component)val.parent.Find("Progression_Session_Unlock_Window").Find("Game Over Title Text")).gameObject.GetComponent()).font; UpdateTextPosition(); ((TMP_Text)FrontText).transform.SetParent(val5.transform, false); ((TMP_Text)FrontText).rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ((TMP_Text)FrontText).rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ((TMP_Text)FrontText).rectTransform.anchoredPosition = Vector2.zero; ((TMP_Text)FrontText).font = font; ((TMP_Text)FrontText).fontSize = Plugin.fontSize.Value; ((TMP_Text)BackText).transform.SetParent(val6.transform, false); ((TMP_Text)BackText).rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ((TMP_Text)BackText).rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ((TMP_Text)BackText).rectTransform.anchoredPosition = Vector2.zero; ((TMP_Text)BackText).font = font; ((TMP_Text)BackText).fontSize = Plugin.fontSize.Value; } } internal static void UpdateTextPosition() { //IL_001f: 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) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) FrontMask2D.rectTransform.anchorMin = new Vector2(Plugin.xAnchorPosition.Value, Plugin.yAnchorPosition.Value); FrontMask2D.rectTransform.anchorMax = new Vector2(Plugin.xAnchorPosition.Value, Plugin.yAnchorPosition.Value); FrontMask2D.rectTransform.anchoredPosition = GetTextAlignmentVector(); BackMask2D.rectTransform.anchorMin = new Vector2(Plugin.xAnchorPosition.Value, Plugin.yAnchorPosition.Value); BackMask2D.rectTransform.anchorMax = new Vector2(Plugin.xAnchorPosition.Value, Plugin.yAnchorPosition.Value); BackMask2D.rectTransform.anchoredPosition = GetTextAlignmentVector(); ((TMP_Text)FrontText).fontSize = Plugin.fontSize.Value; ((TMP_Text)BackText).fontSize = Plugin.fontSize.Value; } private static Vector2 GetTextAlignmentVector() { //IL_001c: 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) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) Vector2 result = default(Vector2); ((Vector2)(ref result))..ctor(0f, 0f); float num = ((TMP_Text)FrontText).rectTransform.sizeDelta.y / 2f; float num2 = ((TMP_Text)FrontText).rectTransform.sizeDelta.x / 2f; string text = attributes[Plugin.textAlignment.Value]; for (int i = 0; i < text.Length; i++) { char c = text[i]; if (c.Equals("y".ToCharArray()[0])) { result.y -= num; } else if (c.Equals("Y".ToCharArray()[0])) { result.y += num; } if (c.Equals("x".ToCharArray()[0])) { result.x -= num2; } else if (c.Equals("X".ToCharArray()[0])) { result.x += num2; } } return result; } }