Decompiled source of Better Clock v2.0.0

Mod_Lethal_Company.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using TMPro;
using UnityEngine;
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("Mod_Lethal_Company")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod_Lethal_Company")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("721919be-17ca-4b5e-9a43-3e46738d8707")]
[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("The_Dalek.betterClock", "Clock Size Mod", "2.0.0")]
public class ClockSizeMod : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("The_Dalek.betterClock");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(HUDManager), "SetClock")]
public class ClockSizePatch
{
	private static bool Prefix(ref string __result, HUDManager __instance, float timeNormalized, float numberOfHours, bool createNewLine)
	{
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		string text = (createNewLine ? "\n" : " ");
		int num = (int)(timeNormalized * (60f * numberOfHours)) + 360;
		int num2 = (int)Mathf.Floor((float)(num / 60));
		if (num2 >= 24)
		{
			num2 %= 24;
		}
		int num3 = num % 60;
		string text2 = $"{num2:00}:{num3:00}";
		((TMP_Text)__instance.clockNumber).text = text2;
		__result = text2;
		RectTransform rectTransform = ((TMP_Text)__instance.clockNumber).rectTransform;
		rectTransform.anchoredPosition = new Vector2(30f, 80f);
		if ((Object)(object)__instance.clockNumber != (Object)null)
		{
			Image componentInParent = ((Component)__instance.clockNumber).GetComponentInParent<Image>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				((Behaviour)componentInParent).enabled = false;
			}
		}
		return false;
	}
}
[HarmonyPatch(typeof(HUDManager), "SetClockIcon")]
public class ClockImageSizePatch
{
	private static void Postfix(HUDManager __instance)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance.clockIcon != (Object)null)
		{
			RectTransform rectTransform = ((Graphic)__instance.clockIcon).rectTransform;
			rectTransform.anchoredPosition = new Vector2(-50f, 80f);
			rectTransform.sizeDelta = new Vector2(50f, 50f);
		}
	}
}
[HarmonyPatch]
internal class ClockVisible
{
	[HarmonyPrefix]
	[HarmonyPatch(typeof(HUDManager), "Update")]
	private static bool Update(ref HUDElement ___Clock)
	{
		___Clock.targetAlpha = 1f;
		return true;
	}
}