Decompiled source of CrosshairColorFixer v1.0.0

CrosshairColorFixer.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CrosshairColorFixer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Changes the color of the health bar near the crosshair to the one specified in the settings")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CrosshairColorFixer")]
[assembly: AssemblyTitle("CrosshairColorFixer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CrosshairColorFixer;

[BepInPlugin("xzxADIxzx.CorsshairColorFixer", "CrosshairColorFixer", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private ColorBlindSettings cb => MonoSingleton<ColorBlindSettings>.Instance;

	private void Awake()
	{
		SceneManager.sceneLoaded += delegate
		{
			((MonoBehaviour)this).Invoke("ApplyFix", 0.1f);
		};
	}

	private void ApplyFix()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		CanvasController instance = MonoSingleton<CanvasController>.Instance;
		object obj;
		if (instance == null)
		{
			obj = null;
		}
		else
		{
			Transform obj2 = ((Component)instance).transform.Find("Crosshair Filler/Crosshair/HealthBars");
			obj = ((obj2 != null) ? ((Component)obj2).GetComponentsInChildren<Image>(true) : null);
		}
		Image[] array = (Image[])obj;
		if (array != null && Object.op_Implicit((Object)(object)cb))
		{
			((Graphic)array[0]).color = cb.healthBarAfterImageColor;
			((Graphic)array[1]).color = cb.healthBarColor;
			((Graphic)array[2]).color = cb.antiHpColor;
			((Graphic)array[3]).color = cb.healthBarAfterImageColor;
			((Graphic)array[4]).color = cb.overHealColor;
		}
	}
}