Decompiled source of WallJumpHUD v1.0.0

WallJumpHUD.dll

Decompiled 10 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using ArchipelagoULTRAKILL;
using ArchipelagoULTRAKILL.Components;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using WallJumpHUD.Properties;

[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("WallJumpHUD")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WallJumpHUD")]
[assembly: AssemblyTitle("WallJumpHUD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace WallJumpHUD
{
	public class ConfigManager
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static PostBoolValueChangeEvent <>9__8_0;

			public static PostBoolValueChangeEvent <>9__8_1;

			public static PostColorValueChangeEvent <>9__8_2;

			public static PostBoolValueChangeEvent <>9__8_3;

			public static PostEnumValueChangeEvent<CrosshairAlignment> <>9__8_4;

			internal void <Init>b__8_0(bool e)
			{
				if ((Object)(object)WallJumpWeaponController.Instance != (Object)null)
				{
					WallJumpWeaponController.Instance.SetStuffActive(e);
				}
			}

			internal void <Init>b__8_1(bool e)
			{
				if ((Object)(object)WallJumpWeaponController.Instance != (Object)null)
				{
					WallJumpWeaponController.Instance.UpdateColor();
				}
			}

			internal void <Init>b__8_2(Color e)
			{
				if ((Object)(object)WallJumpWeaponController.Instance != (Object)null)
				{
					WallJumpWeaponController.Instance.UpdateColor();
				}
			}

			internal void <Init>b__8_3(bool e)
			{
				if ((Object)(object)WallJumpCrosshairController.Instance != (Object)null)
				{
					WallJumpCrosshairController.Instance.SetIconsActive(e);
				}
			}

			internal void <Init>b__8_4(CrosshairAlignment e)
			{
				if ((Object)(object)WallJumpCrosshairController.Instance != (Object)null)
				{
					WallJumpCrosshairController.Instance.SetIconsRotation(e);
					if ((Object)(object)MonoSingleton<PowerUpMeter>.Instance != (Object)null && MonoSingleton<PowerUpMeter>.Instance.latestMaxJuice > 0f)
					{
						WallJumpCrosshairController.Instance.OnPowerUpStarted();
					}
				}
			}
		}

		public static PluginConfigurator config;

		public static BoolField weaponShow;

		public static BoolField weaponMatch;

		public static ColorField weaponColor;

		public static BoolField crosshairShow;

		public static EnumField<CrosshairAlignment> crosshairAlignment;

		public static BoolField crosshairMatch;

		public static ColorField crosshairColor;

		public static void Init()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			if (config != null)
			{
				return;
			}
			config = PluginConfigurator.Create("WallJumpHUD", "trpg.uk.walljumphud");
			string text = Path.Combine(Core.workingDir, "icon.png");
			if (File.Exists(text))
			{
				config.SetIconWithURL(text);
			}
			new ConfigHeader(config.rootPanel, "--WEAPON HUD--", 24);
			new ConfigHeader(config.rootPanel, "Weapon HUD icon is only visible if HUD type is Standard.", 12);
			weaponShow = new BoolField(config.rootPanel, "SHOW ON WEAPON HUD", "weaponShow", true);
			BoolField obj = weaponShow;
			object obj2 = <>c.<>9__8_0;
			if (obj2 == null)
			{
				PostBoolValueChangeEvent val = delegate(bool e)
				{
					if ((Object)(object)WallJumpWeaponController.Instance != (Object)null)
					{
						WallJumpWeaponController.Instance.SetStuffActive(e);
					}
				};
				<>c.<>9__8_0 = val;
				obj2 = (object)val;
			}
			obj.postValueChangeEvent += (PostBoolValueChangeEvent)obj2;
			weaponMatch = new BoolField(config.rootPanel, "MATCH STAMINA COLOR", "weaponMatch", false);
			BoolField obj3 = weaponMatch;
			object obj4 = <>c.<>9__8_1;
			if (obj4 == null)
			{
				PostBoolValueChangeEvent val2 = delegate
				{
					if ((Object)(object)WallJumpWeaponController.Instance != (Object)null)
					{
						WallJumpWeaponController.Instance.UpdateColor();
					}
				};
				<>c.<>9__8_1 = val2;
				obj4 = (object)val2;
			}
			obj3.postValueChangeEvent += (PostBoolValueChangeEvent)obj4;
			weaponColor = new ColorField(config.rootPanel, "WEAPON HUD COLOR", "weaponColor", Color.white);
			ColorField obj5 = weaponColor;
			object obj6 = <>c.<>9__8_2;
			if (obj6 == null)
			{
				PostColorValueChangeEvent val3 = delegate
				{
					if ((Object)(object)WallJumpWeaponController.Instance != (Object)null)
					{
						WallJumpWeaponController.Instance.UpdateColor();
					}
				};
				<>c.<>9__8_2 = val3;
				obj6 = (object)val3;
			}
			obj5.postValueChangeEvent += (PostColorValueChangeEvent)obj6;
			new ConfigHeader(config.rootPanel, "--CROSSHAIR HUD--", 24);
			crosshairShow = new BoolField(config.rootPanel, "SHOW ON CROSSHAIR HUD", "crosshairShow", true);
			BoolField obj7 = crosshairShow;
			object obj8 = <>c.<>9__8_3;
			if (obj8 == null)
			{
				PostBoolValueChangeEvent val4 = delegate(bool e)
				{
					if ((Object)(object)WallJumpCrosshairController.Instance != (Object)null)
					{
						WallJumpCrosshairController.Instance.SetIconsActive(e);
					}
				};
				<>c.<>9__8_3 = val4;
				obj8 = (object)val4;
			}
			obj7.postValueChangeEvent += (PostBoolValueChangeEvent)obj8;
			crosshairAlignment = new EnumField<CrosshairAlignment>(config.rootPanel, "ALIGNMENT", "crosshairAlignment", CrosshairAlignment.Right);
			crosshairAlignment.postValueChangeEvent += delegate(CrosshairAlignment e)
			{
				if ((Object)(object)WallJumpCrosshairController.Instance != (Object)null)
				{
					WallJumpCrosshairController.Instance.SetIconsRotation(e);
					if ((Object)(object)MonoSingleton<PowerUpMeter>.Instance != (Object)null && MonoSingleton<PowerUpMeter>.Instance.latestMaxJuice > 0f)
					{
						WallJumpCrosshairController.Instance.OnPowerUpStarted();
					}
				}
			};
			crosshairMatch = new BoolField(config.rootPanel, "MATCH STAMINA COLOR", "crosshairMatch", false);
			crosshairColor = new ColorField(config.rootPanel, "CROSSHAIR HUD COLOR", "crosshairColor", Color.white);
		}
	}
	[BepInPlugin("trpg.uk.walljumphud", "WallJumpHUD", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Core : BaseUnityPlugin
	{
		public const string PluginGUID = "trpg.uk.walljumphud";

		public const string PluginName = "WallJumpHUD";

		public const string PluginVersion = "1.0.0";

		public static string workingPath;

		public static string workingDir;

		public static ManualLogSource Logger = Logger.CreateLogSource("WallJumpHUD");

		public static AssetBundle bundle = AssetBundle.LoadFromMemory(Resources.trpg_walljumphud);

		public static bool IsArchipelagoLoaded { get; private set; }

		public static int MaxWalljumps
		{
			get
			{
				if (IsArchipelagoLoaded)
				{
					return GetArchipelagoWallJumps();
				}
				return 3;
			}
		}

		public static Color WeaponColor
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (ConfigManager.weaponMatch.value)
				{
					return MonoSingleton<ColorBlindSettings>.Instance.staminaColor;
				}
				return ConfigManager.weaponColor.value;
			}
		}

		public static Color CrosshairColor
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (ConfigManager.crosshairMatch.value)
				{
					return MonoSingleton<ColorBlindSettings>.Instance.staminaColor;
				}
				return ConfigManager.crosshairColor.value;
			}
		}

		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("WallJumpHUD");
			val.PatchAll();
			workingPath = Assembly.GetExecutingAssembly().Location;
			workingDir = Path.GetDirectoryName(workingPath);
			ConfigManager.Init();
			IsArchipelagoLoaded = false;
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				if (pluginInfo.Value.Metadata.GUID == "trpg.archipelagoultrakill")
				{
					IsArchipelagoLoaded = true;
					Logger.LogInfo((object)"Archipelago is loaded.");
					break;
				}
			}
		}

		private static int GetArchipelagoWallJumps()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)PlayerHelper.CurrentPowerup == 6)
			{
				return 0;
			}
			if (Core.DataExists())
			{
				return Core.data.walljumps;
			}
			return 3;
		}
	}
	public enum Direction
	{
		Normal,
		Reverse
	}
	public enum CrosshairAlignment
	{
		Top,
		Left,
		Right,
		Bottom
	}
	public class NewMovementListener : MonoBehaviour
	{
		public delegate void OnWallJumpsChangedDelegate(int number);

		private int previous;

		public static NewMovementListener Instance { get; private set; }

		public static event OnWallJumpsChangedDelegate OnWallJumpsChanged;

		private void Awake()
		{
			if (!((Object)(object)Instance != (Object)null) || !((Object)(object)Instance != (Object)(object)this))
			{
				Instance = this;
				previous = MonoSingleton<NewMovement>.Instance.currentWallJumps;
			}
		}

		private void Update()
		{
			if (previous != MonoSingleton<NewMovement>.Instance.currentWallJumps)
			{
				if (NewMovementListener.OnWallJumpsChanged != null)
				{
					NewMovementListener.OnWallJumpsChanged(3 - MonoSingleton<NewMovement>.Instance.currentWallJumps);
				}
				previous = MonoSingleton<NewMovement>.Instance.currentWallJumps;
			}
		}
	}
	public class PowerUpMeterListener : MonoBehaviour
	{
		public delegate void OnPowerUpStartedDelegate();

		public delegate void OnPowerUpEndedDelegate();

		private float previous;

		public static PowerUpMeterListener Instance { get; private set; }

		public static event OnPowerUpStartedDelegate OnPowerUpStarted;

		public static event OnPowerUpEndedDelegate OnPowerUpEnded;

		private void Awake()
		{
			if (!((Object)(object)Instance != (Object)null) || !((Object)(object)Instance != (Object)(object)this))
			{
				Instance = this;
				previous = 0f;
			}
		}

		private void Update()
		{
			if (previous == 0f && previous < MonoSingleton<PowerUpMeter>.Instance.latestMaxJuice)
			{
				if (PowerUpMeterListener.OnPowerUpStarted != null)
				{
					PowerUpMeterListener.OnPowerUpStarted();
				}
			}
			else if (previous > 0f && MonoSingleton<PowerUpMeter>.Instance.latestMaxJuice == 0f && PowerUpMeterListener.OnPowerUpEnded != null)
			{
				PowerUpMeterListener.OnPowerUpEnded();
			}
			previous = MonoSingleton<PowerUpMeter>.Instance.latestMaxJuice;
		}
	}
	public class WallJumpCrosshairController : MonoBehaviour
	{
		public Image crosshair1;

		public Image crosshair2;

		public Image crosshair3;

		public float time = 2f;

		public float maxTime = 2f;

		public float minTime = 0f;

		public NewMovement nm;

		public Traverse nmT;

		public static WallJumpCrosshairController Instance { get; private set; }

		public Direction Direction
		{
			get
			{
				if (ConfigManager.crosshairAlignment.value == CrosshairAlignment.Left || ConfigManager.crosshairAlignment.value == CrosshairAlignment.Top)
				{
					return Direction.Reverse;
				}
				return Direction.Normal;
			}
		}

		private void Start()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Instance != (Object)null) || !((Object)(object)Instance != (Object)(object)this))
			{
				Instance = this;
				nm = MonoSingleton<NewMovement>.Instance;
				nmT = Traverse.Create((object)nm);
				GameObject val = new GameObject();
				((Object)val).name = "WallJumps";
				val.layer = 5;
				val.transform.SetParent(((Component)this).transform);
				val.transform.localPosition = Vector3.zero;
				val.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
				GameObject val2 = new GameObject();
				((Object)val2).name = "1";
				val2.layer = 5;
				val2.transform.SetParent(val.transform);
				val2.transform.localPosition = Vector3.zero;
				val2.transform.localScale = Vector3.one;
				crosshair1 = val2.AddComponent<Image>();
				GameObject val3 = new GameObject();
				((Object)val3).name = "2";
				val3.layer = 5;
				val3.transform.SetParent(val.transform);
				val3.transform.localPosition = Vector3.zero;
				val3.transform.localScale = Vector3.one;
				crosshair2 = val3.AddComponent<Image>();
				GameObject val4 = new GameObject();
				((Object)val4).name = "3";
				val4.layer = 5;
				val4.transform.SetParent(val.transform);
				val4.transform.localPosition = Vector3.zero;
				val4.transform.localScale = Vector3.one;
				crosshair3 = val4.AddComponent<Image>();
				crosshair1.sprite = Core.bundle.LoadAsset<Sprite>("assets/1.png");
				crosshair2.sprite = Core.bundle.LoadAsset<Sprite>("assets/2.png");
				crosshair3.sprite = Core.bundle.LoadAsset<Sprite>("assets/3.png");
				SetIconsRotation(ConfigManager.crosshairAlignment.value);
				SetIconsActive(ConfigManager.crosshairShow.value);
				SetWallJumps(Core.MaxWalljumps);
				NewMovementListener.OnWallJumpsChanged += SetWallJumps;
				PowerUpMeterListener.OnPowerUpStarted += OnPowerUpStarted;
				PowerUpMeterListener.OnPowerUpEnded += OnPowerUpEnded;
			}
		}

		private void OnDestroy()
		{
			NewMovementListener.OnWallJumpsChanged -= SetWallJumps;
			PowerUpMeterListener.OnPowerUpStarted -= OnPowerUpStarted;
			PowerUpMeterListener.OnPowerUpEnded -= OnPowerUpEnded;
		}

		private void Update()
		{
			if (ConfigManager.crosshairShow.value)
			{
				if ((double)nmT.Field<float>("fallTime").Value > 0.25)
				{
					time = maxTime;
				}
				else if (time > minTime)
				{
					time -= Time.deltaTime;
				}
				SetIconsOpacity(Mathf.Clamp01(time));
			}
		}

		public void SetIconsActive(bool active)
		{
			if (!((Object)(object)crosshair1 == (Object)null) && !((Object)(object)crosshair2 == (Object)null) && !((Object)(object)crosshair3 == (Object)null))
			{
				((Component)crosshair1).gameObject.SetActive(active);
				((Component)crosshair2).gameObject.SetActive(active);
				((Component)crosshair3).gameObject.SetActive(active);
			}
		}

		public void SetIconsRotation(CrosshairAlignment alignment)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)crosshair1 == (Object)null) && !((Object)(object)crosshair2 == (Object)null) && !((Object)(object)crosshair3 == (Object)null))
			{
				((Component)crosshair1).GetComponent<Transform>().localRotation = default(Quaternion);
				((Component)crosshair2).GetComponent<Transform>().localRotation = default(Quaternion);
				((Component)crosshair3).GetComponent<Transform>().localRotation = default(Quaternion);
				switch (alignment)
				{
				case CrosshairAlignment.Left:
					((Component)crosshair1).GetComponent<Transform>().Rotate(0f, 0f, 270f, (Space)1);
					((Component)crosshair2).GetComponent<Transform>().Rotate(0f, 0f, 270f, (Space)1);
					((Component)crosshair3).GetComponent<Transform>().Rotate(0f, 0f, 270f, (Space)1);
					break;
				case CrosshairAlignment.Top:
					((Component)crosshair1).GetComponent<Transform>().Rotate(0f, 0f, 180f, (Space)1);
					((Component)crosshair2).GetComponent<Transform>().Rotate(0f, 0f, 180f, (Space)1);
					((Component)crosshair3).GetComponent<Transform>().Rotate(0f, 0f, 180f, (Space)1);
					break;
				case CrosshairAlignment.Right:
					((Component)crosshair1).GetComponent<Transform>().Rotate(0f, 0f, 90f, (Space)1);
					((Component)crosshair2).GetComponent<Transform>().Rotate(0f, 0f, 90f, (Space)1);
					((Component)crosshair3).GetComponent<Transform>().Rotate(0f, 0f, 90f, (Space)1);
					break;
				}
			}
		}

		public void OnPowerUpStarted()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			SetWallJumps(nm.gc.onGround ? Core.MaxWalljumps : nm.currentWallJumps);
			if (!((Object)(object)crosshair1 == (Object)null) && !((Object)(object)crosshair2 == (Object)null) && !((Object)(object)crosshair3 == (Object)null) && HUDOptions.powerUpMeterEnabled)
			{
				float num = 12f;
				float num2 = 6f;
				switch (ConfigManager.crosshairAlignment.value)
				{
				case CrosshairAlignment.Top:
					((Component)crosshair1).GetComponent<Transform>().localPosition = new Vector3(num2, num, 0f);
					((Component)crosshair2).GetComponent<Transform>().localPosition = new Vector3(0f, num, 0f);
					((Component)crosshair3).GetComponent<Transform>().localPosition = new Vector3(0f - num2, num, 0f);
					break;
				case CrosshairAlignment.Left:
					((Component)crosshair1).GetComponent<Transform>().localPosition = new Vector3(0f - num, num2, 0f);
					((Component)crosshair2).GetComponent<Transform>().localPosition = new Vector3(0f - num, 0f, 0f);
					((Component)crosshair3).GetComponent<Transform>().localPosition = new Vector3(0f - num, 0f - num2, 0f);
					break;
				case CrosshairAlignment.Right:
					((Component)crosshair1).GetComponent<Transform>().localPosition = new Vector3(num, 0f - num2, 0f);
					((Component)crosshair2).GetComponent<Transform>().localPosition = new Vector3(num, 0f, 0f);
					((Component)crosshair3).GetComponent<Transform>().localPosition = new Vector3(num, num2, 0f);
					break;
				case CrosshairAlignment.Bottom:
					((Component)crosshair1).GetComponent<Transform>().localPosition = new Vector3(0f - num2, 0f - num, 0f);
					((Component)crosshair2).GetComponent<Transform>().localPosition = new Vector3(0f, 0f - num, 0f);
					((Component)crosshair3).GetComponent<Transform>().localPosition = new Vector3(num2, 0f - num, 0f);
					break;
				}
			}
		}

		public void OnPowerUpEnded()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			SetWallJumps(nm.gc.onGround ? Core.MaxWalljumps : nm.currentWallJumps);
			if (!((Object)(object)crosshair1 == (Object)null) && !((Object)(object)crosshair2 == (Object)null) && !((Object)(object)crosshair3 == (Object)null))
			{
				((Component)crosshair1).GetComponent<Transform>().localPosition = Vector3.zero;
				((Component)crosshair2).GetComponent<Transform>().localPosition = Vector3.zero;
				((Component)crosshair3).GetComponent<Transform>().localPosition = Vector3.zero;
			}
		}

		public void SetIconsOpacity(float time)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)crosshair1 == (Object)null) && !((Object)(object)crosshair2 == (Object)null) && !((Object)(object)crosshair3 == (Object)null))
			{
				Color crosshairColor = Core.CrosshairColor;
				crosshairColor.a = time;
				((Graphic)crosshair1).color = crosshairColor;
				((Graphic)crosshair2).color = crosshairColor;
				((Graphic)crosshair3).color = crosshairColor;
			}
		}

		public void SetWallJumps(int jumps)
		{
			if (jumps > Core.MaxWalljumps)
			{
				jumps = Core.MaxWalljumps;
			}
			if (jumps < 0)
			{
				jumps = 0;
			}
			switch (jumps)
			{
			case 3:
				((Component)crosshair1).gameObject.SetActive(true);
				((Component)crosshair2).gameObject.SetActive(true);
				((Component)crosshair3).gameObject.SetActive(true);
				break;
			case 2:
				if (Direction == Direction.Reverse)
				{
					((Component)crosshair1).gameObject.SetActive(false);
					((Component)crosshair2).gameObject.SetActive(true);
					((Component)crosshair3).gameObject.SetActive(true);
				}
				else
				{
					((Component)crosshair1).gameObject.SetActive(true);
					((Component)crosshair2).gameObject.SetActive(true);
					((Component)crosshair3).gameObject.SetActive(false);
				}
				break;
			case 1:
				if (Direction == Direction.Reverse)
				{
					((Component)crosshair1).gameObject.SetActive(false);
					((Component)crosshair2).gameObject.SetActive(false);
					((Component)crosshair3).gameObject.SetActive(true);
				}
				else
				{
					((Component)crosshair1).gameObject.SetActive(true);
					((Component)crosshair2).gameObject.SetActive(false);
					((Component)crosshair3).gameObject.SetActive(false);
				}
				break;
			case 0:
				((Component)crosshair1).gameObject.SetActive(false);
				((Component)crosshair2).gameObject.SetActive(false);
				((Component)crosshair3).gameObject.SetActive(false);
				break;
			}
		}
	}
	public class WallJumpWeaponController : MonoBehaviour
	{
		public Image icon;

		public TextMeshProUGUI text;

		public static WallJumpWeaponController Instance { get; private set; }

		private void Start()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Instance != (Object)null) || !((Object)(object)Instance != (Object)(object)this))
			{
				Instance = this;
				TMP_FontAsset font = ((TMP_Text)((Component)((Component)this).transform.parent.parent.parent).GetComponentInChildren<TextMeshProUGUI>()).font;
				GameObject val = new GameObject();
				((Object)val).name = "WallJumpsIcon";
				val.layer = 5;
				val.transform.SetParent(((Component)this).transform);
				val.transform.localPosition = new Vector3(85f, -35f, 0f);
				val.transform.localRotation = default(Quaternion);
				val.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
				icon = val.AddComponent<Image>();
				icon.sprite = Core.bundle.LoadAsset<Sprite>("assets/icon.png");
				((Graphic)icon).color = Core.WeaponColor;
				GameObject val2 = new GameObject();
				((Object)val2).name = "WallJumpsText";
				val2.layer = 5;
				val2.transform.SetParent(((Component)this).transform);
				val2.transform.localPosition = new Vector3(65f, -34f, 0f);
				val2.transform.localRotation = default(Quaternion);
				val2.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
				text = val2.AddComponent<TextMeshProUGUI>();
				((TMP_Text)text).font = font;
				((TMP_Text)text).alignment = (TextAlignmentOptions)514;
				((TMP_Text)text).text = Core.MaxWalljumps.ToString();
				((Graphic)text).color = Core.WeaponColor;
				SetStuffActive(ConfigManager.weaponShow.value);
				NewMovementListener.OnWallJumpsChanged += SetWallJumps;
				PowerUpMeterListener.OnPowerUpStarted += OnPowerUpChange;
				PowerUpMeterListener.OnPowerUpEnded += OnPowerUpChange;
			}
		}

		private void OnDestroy()
		{
			NewMovementListener.OnWallJumpsChanged -= SetWallJumps;
			PowerUpMeterListener.OnPowerUpStarted -= OnPowerUpChange;
			PowerUpMeterListener.OnPowerUpEnded -= OnPowerUpChange;
		}

		public void SetWallJumps(int number)
		{
			if (!((Object)(object)text == (Object)null))
			{
				if (number > Core.MaxWalljumps)
				{
					number = Core.MaxWalljumps;
				}
				((TMP_Text)text).text = number.ToString();
			}
		}

		public void OnPowerUpChange()
		{
			SetWallJumps(MonoSingleton<NewMovement>.Instance.gc.onGround ? Core.MaxWalljumps : MonoSingleton<NewMovement>.Instance.currentWallJumps);
		}

		public void UpdateColor()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)icon == (Object)null) && !((Object)(object)text == (Object)null))
			{
				((Graphic)icon).color = Core.WeaponColor;
				((Graphic)text).color = Core.WeaponColor;
			}
		}

		public void SetStuffActive(bool active)
		{
			if (!((Object)(object)icon == (Object)null) && !((Object)(object)text == (Object)null))
			{
				((Component)icon).gameObject.SetActive(active);
				((Component)text).gameObject.SetActive(active);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "WallJumpHUD";

		public const string PLUGIN_NAME = "WallJumpHUD";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace WallJumpHUD.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("WallJumpHUD.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] trpg_walljumphud
		{
			get
			{
				object @object = ResourceManager.GetObject("trpg_walljumphud", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace WallJumpHUD.Patches
{
	[HarmonyPatch(typeof(HUDOptions), "Start")]
	public class HUDOptions_Start_Patch
	{
		public static void Postfix(HUDOptions __instance)
		{
			if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponentInChildren<Crosshair>(true)))
			{
				((Component)((Component)__instance).gameObject.GetComponentInChildren<Crosshair>(true)).gameObject.AddComponent<WallJumpCrosshairController>();
			}
		}
	}
	[HarmonyPatch(typeof(NewMovement), "Start")]
	public class NewMovement_Start_Patch
	{
		public static void Postfix(NewMovement __instance)
		{
			((Component)__instance).gameObject.AddComponent<NewMovementListener>();
		}
	}
	[HarmonyPatch(typeof(PowerUpMeter), "Start")]
	public class PowerUpMeter_Start_Patch
	{
		public static void Postfix(PowerUpMeter __instance)
		{
			((Component)__instance).gameObject.AddComponent<PowerUpMeterListener>();
		}
	}
	[HarmonyPatch(typeof(WeaponHUD), "Awake")]
	public class WeaponHUD_Awake_Patch
	{
		public static void Postfix(WeaponHUD __instance)
		{
			((Component)__instance).gameObject.AddComponent<WallJumpWeaponController>();
		}
	}
}