Decompiled source of ColorfulTimer v1.0.1

ColorfulTimer.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ColorfulTimer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Change how your run timer looks like in White Knuckle.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+5c16731c3adf3a43b57c93a405c524738bfe359f")]
[assembly: AssemblyProduct("ColorfulTimer")]
[assembly: AssemblyTitle("ColorfulTimer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 ColorfulTimer
{
	[BepInPlugin("shishyando.WK.ColorfulTimer", "ColorfulTimer", "1.0.1")]
	public class ColorfulTimerPlugin : BaseUnityPlugin
	{
		public static ManualLogSource Beep;

		private readonly Harmony Harmony = new Harmony("shishyando.WK.ColorfulTimer");

		public static ConfigEntry<Color> TextColor;

		public static ConfigEntry<Color> OutlineColor;

		public static ConfigEntry<float> OutlineWidth;

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Beep = ((BaseUnityPlugin)this).Logger;
			TextColor = ((BaseUnityPlugin)this).Config.Bind<Color>("TimerColors", "textColor", Color.white, "some colors (press F1 twice to reload all settings ingame!):\r\n- white FFFFFFFF\r\n- black 000000FF\r\n- grey 999999FF\r\n- dark grey 666666FF\r\n- cyan 00FFFFFF\r\n- pink FF00FFFF\r\n- green 0CFF00FF\r\n- yellow FBFF00FF\r\n- orange FF8000FF\r\n\r\nLast two characters stand for alpha, FF = max, 00 = min\r\n");
			OutlineColor = ((BaseUnityPlugin)this).Config.Bind<Color>("TimerColors", "outlineColor", Color.black, (ConfigDescription)null);
			OutlineWidth = ((BaseUnityPlugin)this).Config.Bind<float>("TimerColors", "outlineWidth", 0.2f, (ConfigDescription)null);
			((BaseUnityPlugin)this).Config.ConfigReloaded += OnConfigChanged;
			Harmony.PatchAll();
			Beep.LogInfo((object)"shishyando.WK.ColorfulTimer is loaded");
		}

		public static void OnConfigChanged(object _, EventArgs __)
		{
			if (CL_UIManager.instance != null)
			{
				ApplyTimerColors(CL_UIManager.instance);
			}
		}

		public static void ApplyTimerColors(CL_UIManager instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			instance.timer.outlineColor = Color32.op_Implicit(OutlineColor.Value);
			instance.timer.outlineWidth = OutlineWidth.Value;
			((Graphic)instance.timer).color = TextColor.Value;
		}
	}
	[HarmonyPatch(typeof(CL_UIManager), "Awake")]
	public static class CL_UIManager_Patcher
	{
		[HarmonyPostfix]
		public static void Postfix(CL_UIManager __instance)
		{
			ColorfulTimerPlugin.ApplyTimerColors(__instance);
			((Component)__instance.timer).gameObject.AddComponent<SetActiveWatcher>();
		}
	}
	public class SetActiveWatcher : MonoBehaviour
	{
		private void OnDisable()
		{
			((ConfigEntryBase)ColorfulTimerPlugin.TextColor).ConfigFile.Reload();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "shishyando.WK.ColorfulTimer";

		public const string PLUGIN_NAME = "ColorfulTimer";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}