using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("PeakInfos")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PeakInfos")] [assembly: AssemblyTitle("PeakInfos")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeakInfos { [BepInPlugin("lurien.peak.infos", "Peak Infos", "1.0.0")] public class Plugin : BaseUnityPlugin { private Canvas canvas; private TextMeshProUGUI altitudeLabel; private TextMeshProUGUI timerLabel; private bool fontApplied; private float runStartTime; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode) { bool flag = ((Scene)(ref scene)).name.StartsWith("Level_"); if ((Object)(object)canvas != (Object)null) { ((Behaviour)canvas).enabled = flag; } if (flag) { runStartTime = Time.time; } }; GameObject val = new GameObject("PeakInfosCanvas"); Object.DontDestroyOnLoad((Object)(object)val); canvas = val.AddComponent(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 999; val.AddComponent(); ((Behaviour)canvas).enabled = false; altitudeLabel = MakeLabel(val.transform, "AltitudeLabel", 36f, new Vector2(0f, -1f)); timerLabel = MakeLabel(val.transform, "TimerLabel", 24f, new Vector2(0f, -42f)); } private TextMeshProUGUI MakeLabel(Transform parent, string name, float fontSize, Vector2 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent(); ((TMP_Text)val2).fontSize = fontSize; ((TMP_Text)val2).alignment = (TextAlignmentOptions)258; ((Graphic)val2).color = Color.white; ((Graphic)val2).raycastTarget = false; RectTransform rectTransform = ((TMP_Text)val2).rectTransform; rectTransform.sizeDelta = new Vector2(300f, 50f); rectTransform.anchorMin = new Vector2(0.5f, 1f); rectTransform.anchorMax = new Vector2(0.5f, 1f); rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.anchoredPosition = position; return val2; } private void Update() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (!fontApplied) { TMP_FontAsset val = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((TMP_FontAsset f) => ((Object)f).name == "DarumaDropOne-Regular SDF")); if ((Object)(object)val != (Object)null) { ((TMP_Text)altitudeLabel).font = val; ((TMP_Text)timerLabel).font = val; fontApplied = true; } } if (((Behaviour)canvas).enabled) { Character observedCharacter = Character.observedCharacter; if (!((Object)(object)observedCharacter == (Object)null)) { ((TMP_Text)altitudeLabel).text = $"{CharacterStats.UnitsToMeters(observedCharacter.Center.y)} m"; float num = Time.time - runStartTime; int num2 = (int)(num / 3600f); int num3 = (int)(num % 3600f / 60f); int num4 = (int)(num % 60f); ((TMP_Text)timerLabel).text = ((num2 > 0) ? $"{num2}:{num3:D2}:{num4:D2}" : $"{num3:D2}:{num4:D2}"); } } } } }