Decompiled source of 24HourClock v1.0.0

24HourClock.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;
using _24HourClock.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("24HourClock")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("24HourClock")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7433d458-65fb-427d-8bcc-a4a4da6b7910")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace _24HourClock
{
	[BepInPlugin("zoomstv.24HourClock", "24HourClock", "1.0.0.0")]
	public class PluginBase : BaseUnityPlugin
	{
		private const string modGUID = "zoomstv.24HourClock";

		private const string modName = "24HourClock";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("zoomstv.24HourClock");

		public static PluginBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("zoomstv.24HourClock");
			mls.LogInfo((object)"24HourClock has awakened");
			harmony.PatchAll(typeof(PluginBase));
			harmony.PatchAll(typeof(HUDManagerPatch));
		}
	}
}
namespace _24HourClock.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		public static HUDManagerPatch Instance;

		private static TextMeshProUGUI clockNumber;

		private void Awake()
		{
			if (Instance == null)
			{
				Instance = this;
			}
		}

		[HarmonyPatch("SetClock")]
		[HarmonyPostfix]
		private static void SetClockPatch(float timeNormalized, float numberOfHours, bool createNewLine = true)
		{
			clockNumber = HUDManager.Instance.clockNumber;
			int num = (int)(timeNormalized * (60f * numberOfHours)) + 360;
			int num2 = num / 60;
			num %= 60;
			string text = num2.ToString("00") + ":" + num.ToString("00");
			((TMP_Text)clockNumber).text = text;
		}
	}
}