The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of DayNightUI v1.1.1
plugins/LeerDayNightUI.dll
Decompiled a month agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PEAK")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PEAK")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("94d12321-9932-43d2-ba03-502c40b6fcee")] [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")] [BepInPlugin("com.leer.daynightui", "DayNight UI", "1.2.1")] public class DayNightUIMod : BaseUnityPlugin { private Texture2D sunTexture; private Texture2D moonTexture; private Sprite sunSprite; private Sprite moonSprite; private Image sunImage; private Image moonImage; private Text timeText; private DayNightManager manager; private Font gameFont; private ConfigEntry<bool> showTimeText; private ConfigEntry<float> posX; private ConfigEntry<float> posY; private void Awake() { showTimeText = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowTimeText", false, "Show the time as text on screen"); posX = ((BaseUnityPlugin)this).Config.Bind<float>("UI Position", "PosX", -60f, "X offset for clock and icons (top-right corner anchor)"); posY = ((BaseUnityPlugin)this).Config.Bind<float>("UI Position", "PosY", -60f, "Y offset for clock and icons (top-right corner anchor)"); SceneManager.sceneLoaded += OnSceneLoaded; LoadTextures(); LoadFont(); } private void LoadTextures() { string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "daynightui_sprites"); sunTexture = LoadTexture(Path.Combine(path, "Peak_Sun.png")); moonTexture = LoadTexture(Path.Combine(path, "Peak_Moon.png")); if ((Object)(object)sunTexture != (Object)null) { sunSprite = SpriteFromTexture(sunTexture); } if ((Object)(object)moonTexture != (Object)null) { moonSprite = SpriteFromTexture(moonTexture); } } private void LoadFont() { gameFont = Font.CreateDynamicFontFromOSFont("Arial Bold", 16); } private Texture2D LoadTexture(string filePath) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (!File.Exists(filePath)) { return null; } byte[] array = File.ReadAllBytes(filePath); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, array)) { return null; } return val; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!(((Scene)(ref scene)).name == "Title") && !(((Scene)(ref scene)).name == "Airport")) { manager = Object.FindObjectOfType<DayNightManager>(); if (!((Object)(object)manager == (Object)null)) { CreateUI(); } } } private void CreateUI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GameObject.Find("DayNightUICanvas") != (Object)null)) { GameObject val = new GameObject("DayNightUICanvas"); Canvas obj = val.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 999; CanvasScaler obj2 = val.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.screenMatchMode = (ScreenMatchMode)0; obj2.matchWidthOrHeight = 1f; val.AddComponent<GraphicRaycaster>(); Vector2 anchoredPos = default(Vector2); ((Vector2)(ref anchoredPos))..ctor(posX.Value, posY.Value); Vector2 size = default(Vector2); ((Vector2)(ref size))..ctor(64f, 64f); GameObject val2 = new GameObject("MoonImage"); val2.transform.SetParent(val.transform); moonImage = val2.AddComponent<Image>(); SetupImage(moonImage, moonSprite, anchoredPos, size); ((Component)moonImage).gameObject.AddComponent<Shadow>().effectColor = new Color(0f, 0f, 0f, 0.6f); GameObject val3 = new GameObject("SunImage"); val3.transform.SetParent(val.transform); sunImage = val3.AddComponent<Image>(); SetupImage(sunImage, sunSprite, anchoredPos, size); ((Component)sunImage).gameObject.AddComponent<Shadow>().effectColor = new Color(0f, 0f, 0f, 0.6f); GameObject val4 = new GameObject("TimeText"); val4.transform.SetParent(val.transform); timeText = val4.AddComponent<Text>(); SetupText(timeText, anchoredPos); ((Component)timeText).gameObject.AddComponent<Shadow>().effectColor = new Color(0f, 0f, 0f, 0.6f); if ((Object)(object)gameFont != (Object)null) { timeText.font = gameFont; } ((Behaviour)timeText).enabled = showTimeText.Value; } } private void SetupImage(Image img, Sprite sprite, Vector2 anchoredPos, Vector2 size) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) img.sprite = sprite; img.type = (Type)3; img.fillMethod = (FillMethod)4; img.fillOrigin = 0; img.fillClockwise = false; img.fillAmount = 1f; RectTransform rectTransform = ((Graphic)img).rectTransform; rectTransform.anchorMin = new Vector2(1f, 1f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.pivot = new Vector2(1f, 1f); rectTransform.anchoredPosition = anchoredPos; rectTransform.sizeDelta = size; } private void SetupText(Text txt, Vector2 anchoredPos) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((Graphic)txt).rectTransform; rectTransform.anchorMin = new Vector2(1f, 1f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.pivot = new Vector2(1f, 1f); rectTransform.anchoredPosition = anchoredPos; rectTransform.sizeDelta = new Vector2(64f, 64f); txt.alignment = (TextAnchor)4; ((Graphic)txt).color = Color.white; txt.fontSize = 18; ((Graphic)txt).raycastTarget = false; } private void Update() { if ((Object)(object)sunImage == (Object)null || (Object)(object)moonImage == (Object)null || (Object)(object)sunSprite == (Object)null || (Object)(object)moonSprite == (Object)null) { return; } if ((Object)(object)manager == (Object)null) { manager = Object.FindObjectOfType<DayNightManager>(); if ((Object)(object)manager == (Object)null) { return; } } float timeOfDay = manager.timeOfDay; if (showTimeText.Value && (Object)(object)timeText != (Object)null) { int num = Mathf.FloorToInt(timeOfDay); int num2 = Mathf.FloorToInt((timeOfDay - (float)num) * 60f); timeText.text = $"{num:00}:{num2:00}"; ((Behaviour)timeText).enabled = true; } else if ((Object)(object)timeText != (Object)null) { ((Behaviour)timeText).enabled = false; } if (timeOfDay >= 5f && timeOfDay < 21f) { float num3 = 1f - (timeOfDay - 5f) / 16f; sunImage.fillAmount = Mathf.Clamp01(num3); moonImage.fillAmount = 1f; ((Component)sunImage).transform.SetAsLastSibling(); if (showTimeText.Value) { ((Component)timeText).transform.SetAsLastSibling(); } return; } float num4 = ((timeOfDay < 5f) ? (timeOfDay + 24f) : timeOfDay); float num5 = 1f - (num4 - 21f) / 8f; moonImage.fillAmount = Mathf.Clamp01(num5); sunImage.fillAmount = 1f; ((Component)moonImage).transform.SetAsLastSibling(); if (showTimeText.Value) { ((Component)timeText).transform.SetAsLastSibling(); } } private Sprite SpriteFromTexture(Texture2D tex) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f)); } }