using System;
using System.Diagnostics;
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;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ReckssBlade")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReckssBlade")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0f16d5df-974c-48ba-a098-e46d8fe08611")]
[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.reckss.erenshor.realtimeclock", "Real-World Clock (MMB Draggable Rect)", "1.0.0")]
public class RealTimeClockMod : BaseUnityPlugin
{
private ConfigEntry<bool> showClock;
private ConfigEntry<string> timeFormat;
private ConfigEntry<int> fontSize;
private ConfigEntry<float> posX;
private ConfigEntry<float> posY;
private GUIStyle clockStyle;
private Rect clockRect;
private bool dragging;
private Vector2 dragOffset;
private void Awake()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
showClock = ((BaseUnityPlugin)this).Config.Bind<bool>("Clock", "ShowClock", true, "Show the real-world clock");
timeFormat = ((BaseUnityPlugin)this).Config.Bind<string>("Clock", "TimeFormat", "HH:mm:ss", "C# DateTime format");
fontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Clock", "FontSize", 24, "Clock font size");
posX = ((BaseUnityPlugin)this).Config.Bind<float>("Clock", "PositionX", 10f, "Saved X position");
posY = ((BaseUnityPlugin)this).Config.Bind<float>("Clock", "PositionY", 10f, "Saved Y position");
GUIStyle val = new GUIStyle
{
fontSize = fontSize.Value
};
val.normal.textColor = Color.white;
clockStyle = val;
clockRect = new Rect(posX.Value, posY.Value, 100f, 30f);
SceneManager.sceneLoaded += delegate
{
ClampRect();
};
}
private void OnGUI()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Invalid comparison between Unknown and I4
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Invalid comparison between Unknown and I4
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
if (showClock.Value)
{
clockStyle.fontSize = fontSize.Value;
string text = DateTime.Now.ToString(timeFormat.Value);
Vector2 val = clockStyle.CalcSize(new GUIContent(text));
((Rect)(ref clockRect)).width = val.x + 8f;
((Rect)(ref clockRect)).height = val.y + 4f;
Event current = Event.current;
if ((int)current.type == 0 && current.button == 2 && ((Rect)(ref clockRect)).Contains(current.mousePosition))
{
dragging = true;
dragOffset = current.mousePosition - new Vector2(((Rect)(ref clockRect)).x, ((Rect)(ref clockRect)).y);
current.Use();
}
else if ((int)current.type == 3 && current.button == 2 && dragging)
{
((Rect)(ref clockRect)).position = current.mousePosition - dragOffset;
current.Use();
}
else if ((int)current.type == 1 && current.button == 2 && dragging)
{
dragging = false;
ClampRect();
posX.Value = ((Rect)(ref clockRect)).x;
posY.Value = ((Rect)(ref clockRect)).y;
((BaseUnityPlugin)this).Config.Save();
current.Use();
}
ClampRect();
GUI.Box(clockRect, GUIContent.none);
GUI.Label(new Rect(((Rect)(ref clockRect)).x + 4f, ((Rect)(ref clockRect)).y + 2f, val.x, val.y), text, clockStyle);
}
}
private void ClampRect()
{
((Rect)(ref clockRect)).x = Mathf.Clamp(((Rect)(ref clockRect)).x, 0f, (float)Screen.width - ((Rect)(ref clockRect)).width);
((Rect)(ref clockRect)).y = Mathf.Clamp(((Rect)(ref clockRect)).y, 0f, (float)Screen.height - ((Rect)(ref clockRect)).height);
}
}