Decompiled source of DangerCursor v0.2.0

plugins/com.azen.dangerCursor.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PEAKLib.UI.Elements;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.TextCore;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.azen.dangerCursor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0")]
[assembly: AssemblyProduct("com.azen.dangerCursor")]
[assembly: AssemblyTitle("DangerCursor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace DangerCursor
{
	public class ColorModal : MonoBehaviour
	{
		private ConfigEntry<string> _entry;

		private string _defaultHex = "#FFFFFF";

		private float _hue;

		private float _s = 1f;

		private float _v = 1f;

		private Image _svImage;

		private RectTransform _svMarker;

		private Texture2D _svTex;

		private Sprite _svSprite;

		private Image _swatch;

		private TextMeshProUGUI _hexTxt;

		private TMP_InputField _hexInput;

		private HueWheel _hueWheel;

		private GameObject _panel;

		private GameObject _eyedropperLayer;

		private Image _eyeCaptureImg;

		private Image _magFill;

		private TextMeshProUGUI _eyeHex;

		private Texture2D _capture;

		private Sprite _captureSprite;

		private bool _desktopPick;

		private CursorLockMode _prevLock;

		private bool _prevCursorVisible;

		private const float WheelSize = 280f;

		private const float SvSize = 164f;

		private const float InnerRatio = 0.72f;

		public static void Open(ConfigEntry<string> entry, Component page, string title, bool stack = false)
		{
			GameObject val = UiIntegration.CreateOverlayRoot("DC_ColorOverlay");
			ColorModal colorModal = val.AddComponent<ColorModal>();
			colorModal.Build(entry, title);
			if (stack)
			{
				UiIntegration.PushModal(val);
			}
			else
			{
				UiIntegration.SetModal(val);
			}
		}

		private static string DefaultHexFor(ConfigEntry<string> entry)
		{
			return DangerCursorDefaults.HexForColorKey(((ConfigEntryBase)entry).Definition.Key);
		}

		private void Build(ConfigEntry<string> entry, string title)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Expected O, but got Unknown
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Expected O, but got Unknown
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Expected O, but got Unknown
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Expected O, but got Unknown
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Expected O, but got Unknown
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Expected O, but got Unknown
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			_entry = entry;
			_defaultHex = DefaultHexFor(entry);
			Color val = UiIntegration.ParseHex(entry.Value, Color.white);
			Color.RGBToHSV(val, ref _hue, ref _s, ref _v);
			RectTransform val2 = (RectTransform)((Component)this).transform;
			DcUi.Stretch(val2);
			GameObject val3 = new GameObject("Dimmer", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val3.transform.SetParent((Transform)(object)val2, false);
			Image component = val3.GetComponent<Image>();
			DcUi.Stretch(((Graphic)component).rectTransform);
			((Graphic)component).color = new Color(0.04f, 0.03f, 0.03f, 0.78f);
			Button component2 = val3.GetComponent<Button>();
			((Selectable)component2).transition = (Transition)0;
			((UnityEvent)component2.onClick).AddListener(new UnityAction(Close));
			float num = Mathf.Clamp((float)Screen.width * 0.42f, 520f, 680f);
			float num2 = Mathf.Clamp((float)Screen.height * 0.64f, 440f, 560f);
			GameObject val4 = new GameObject("Panel", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.transform.SetParent((Transform)(object)val2, false);
			Image component3 = val4.GetComponent<Image>();
			RectTransform rectTransform = ((Graphic)component3).rectTransform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0.5f, 0.5f);
			rectTransform.anchorMax = val5;
			rectTransform.anchorMin = val5;
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.sizeDelta = new Vector2(num, num2);
			DcUi.ApplyRounded(component3, 18);
			((Graphic)component3).color = DcUi.Bg;
			((Graphic)component3).raycastTarget = true;
			_panel = val4;
			VerticalLayoutGroup val6 = val4.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val6).padding = new RectOffset(20, 20, 16, 16);
			((HorizontalOrVerticalLayoutGroup)val6).spacing = 12f;
			((LayoutGroup)val6).childAlignment = (TextAnchor)1;
			((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val6).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false;
			TextMeshProUGUI val7 = DcUi.Label((Transform)(object)rectTransform, title, 18f, DcUi.Text, (TextAlignmentOptions)514);
			DcUi.Lay(((Component)val7).gameObject, 0f, 28f, 1f);
			GameObject val8 = new GameObject("Main", new Type[1] { typeof(RectTransform) });
			val8.transform.SetParent((Transform)(object)rectTransform, false);
			DcUi.Lay(val8, 0f, 0f, 1f);
			val8.GetComponent<LayoutElement>().flexibleHeight = 1f;
			HorizontalLayoutGroup val9 = val8.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val9).spacing = 18f;
			((LayoutGroup)val9).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val9).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val9).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val9).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val9).childForceExpandHeight = false;
			BuildWheel(val8.transform);
			GameObject val10 = new GameObject("Right", new Type[1] { typeof(RectTransform) });
			val10.transform.SetParent(val8.transform, false);
			DcUi.Lay(val10, 0f, 0f, 1f);
			val10.GetComponent<LayoutElement>().flexibleHeight = 1f;
			VerticalLayoutGroup val11 = val10.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val11).spacing = 8f;
			((LayoutGroup)val11).childAlignment = (TextAnchor)0;
			((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val11).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val11).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val11).childForceExpandHeight = false;
			GameObject val12 = new GameObject("Preview", new Type[1] { typeof(RectTransform) });
			val12.transform.SetParent(val10.transform, false);
			DcUi.Lay(val12, 0f, 64f);
			HorizontalLayoutGroup val13 = val12.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val13).spacing = 12f;
			((LayoutGroup)val13).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val13).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val13).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val13).childForceExpandWidth = false;
			_swatch = DcUi.Swatch(val12.transform, 56f, val);
			GameObject val14 = new GameObject("HexCol", new Type[1] { typeof(RectTransform) });
			val14.transform.SetParent(val12.transform, false);
			DcUi.Lay(val14, 0f, 56f, 1f);
			VerticalLayoutGroup val15 = val14.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val15).spacing = 4f;
			((LayoutGroup)val15).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val15).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val15).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val15).childForceExpandWidth = true;
			_hexTxt = DcUi.Label(val14.transform, entry.Value, 16f, DcUi.TextDim, (TextAlignmentOptions)4097);
			((TMP_Text)_hexTxt).characterSpacing = 2f;
			DcUi.Lay(((Component)_hexTxt).gameObject, 0f, 22f, 1f);
			DcUi.SoftButton(val14.transform, "Pipette", 110f, 28f, BeginEyedropper);
			_hexInput = DcUi.HexField(val10.transform, entry.Value, delegate(string hex)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				Color val18 = UiIntegration.ParseHex(hex, Color.white);
				Color.RGBToHSV(val18, ref _hue, ref _s, ref _v);
				RebuildSv();
				_hueWheel.SetHue(_hue);
				Apply(UiIntegration.ToHex(val18), syncInput: false);
			});
			BuildPresets(val10.transform);
			GameObject val16 = new GameObject("Actions", new Type[1] { typeof(RectTransform) });
			val16.transform.SetParent((Transform)(object)rectTransform, false);
			DcUi.Lay(val16, 0f, 36f, 1f);
			HorizontalLayoutGroup val17 = val16.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val17).spacing = 8f;
			((LayoutGroup)val17).padding = new RectOffset(80, 80, 0, 0);
			((LayoutGroup)val17).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val17).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val17).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val17).childForceExpandWidth = true;
			DcUi.SoftButton(val16.transform, "Done", 0f, 36f, Close, primary: true, 1f);
			DcUi.SoftButton(val16.transform, "Reset", 0f, 36f, delegate
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: 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)
				Color val18 = UiIntegration.ParseHex(_defaultHex, Color.white);
				Color.RGBToHSV(val18, ref _hue, ref _s, ref _v);
				RebuildSv();
				_hueWheel.SetHue(_hue);
				Apply(_defaultHex, syncInput: true);
			}, primary: false, 1f);
			BuildEyedropperLayer(val2);
			((Graphic)_swatch).color = val;
		}

		private void BuildWheel(Transform parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: 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_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Expected O, but got Unknown
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Expected O, but got Unknown
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("WheelHost", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			DcUi.Lay(val, 280f, 280f);
			GameObject val2 = new GameObject("HueWheel", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val2.transform.SetParent(val.transform, false);
			Image component = val2.GetComponent<Image>();
			DcUi.Stretch(((Graphic)component).rectTransform);
			component.sprite = UiIntegration.MakeHueWheelSprite();
			component.type = (Type)0;
			component.preserveAspect = true;
			((Graphic)component).raycastTarget = true;
			GameObject val3 = new GameObject("HueMarker", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(val2.transform, false);
			RectTransform val4 = (RectTransform)val3.transform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0.5f, 0.5f);
			val4.anchorMax = val5;
			val4.anchorMin = val5;
			val4.pivot = new Vector2(0.5f, 0.5f);
			val4.sizeDelta = new Vector2(16f, 16f);
			GameObject val6 = new GameObject("Border", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val6.transform.SetParent(val3.transform, false);
			Image component2 = val6.GetComponent<Image>();
			DcUi.Stretch(((Graphic)component2).rectTransform);
			((Graphic)component2).color = Color.white;
			((Graphic)component2).raycastTarget = false;
			GameObject val7 = new GameObject("Fill", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val7.transform.SetParent(val3.transform, false);
			Image component3 = val7.GetComponent<Image>();
			DcUi.Stretch(((Graphic)component3).rectTransform);
			((Graphic)component3).rectTransform.offsetMin = new Vector2(2.5f, 2.5f);
			((Graphic)component3).rectTransform.offsetMax = new Vector2(-2.5f, -2.5f);
			((Graphic)component3).color = Color.white;
			((Graphic)component3).raycastTarget = false;
			_hueWheel = val2.AddComponent<HueWheel>();
			_hueWheel.marker = val4;
			_hueWheel.fill = component3;
			_hueWheel.innerRatio = 0.72f;
			_hueWheel.OnHue = delegate(float h)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				_hue = h;
				RebuildSv();
				Apply(UiIntegration.ToHex(Color.HSVToRGB(h, _s, _v)), syncInput: true);
			};
			_hueWheel.SetHue(_hue);
			GameObject val8 = new GameObject("SV", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val8.transform.SetParent(val.transform, false);
			_svImage = val8.GetComponent<Image>();
			RectTransform rectTransform = ((Graphic)_svImage).rectTransform;
			((Vector2)(ref val5))..ctor(0.5f, 0.5f);
			rectTransform.anchorMax = val5;
			rectTransform.anchorMin = val5;
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.sizeDelta = new Vector2(164f, 164f);
			_svTex = UiIntegration.MakeSvTexture(_hue);
			_svSprite = Sprite.Create(_svTex, new Rect(0f, 0f, (float)((Texture)_svTex).width, (float)((Texture)_svTex).height), new Vector2(0.5f, 0.5f));
			((Object)_svSprite).hideFlags = (HideFlags)52;
			_svImage.sprite = _svSprite;
			_svImage.type = (Type)0;
			((Graphic)_svImage).raycastTarget = true;
			GameObject val9 = new GameObject("Marker", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val9.transform.SetParent(val8.transform, false);
			_svMarker = ((Graphic)val9.GetComponent<Image>()).rectTransform;
			RectTransform svMarker = _svMarker;
			RectTransform svMarker2 = _svMarker;
			((Vector2)(ref val5))..ctor(0f, 0f);
			svMarker2.anchorMax = val5;
			svMarker.anchorMin = val5;
			_svMarker.pivot = new Vector2(0.5f, 0.5f);
			_svMarker.sizeDelta = new Vector2(10f, 10f);
			((Graphic)val9.GetComponent<Image>()).color = Color.white;
			((Graphic)val9.GetComponent<Image>()).raycastTarget = false;
			SvPicker svPicker = val8.AddComponent<SvPicker>();
			svPicker.marker = _svMarker;
			svPicker.OnPick = delegate(float s, float v)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				_s = s;
				_v = v;
				Apply(UiIntegration.ToHex(Color.HSVToRGB(_hue, s, v)), syncInput: true);
			};
			svPicker.SetMarker(_s, _v);
		}

		private void BuildPresets(Transform parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0053: 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_00a1: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			GameObject val = new GameObject("Presets", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			DcUi.Lay(val, 0f, 84f, 1f);
			GridLayoutGroup val2 = val.AddComponent<GridLayoutGroup>();
			val2.cellSize = new Vector2(28f, 28f);
			val2.spacing = new Vector2(6f, 6f);
			val2.constraint = (Constraint)1;
			val2.constraintCount = 6;
			((LayoutGroup)val2).childAlignment = (TextAnchor)0;
			for (int i = 0; i < UiIntegration.Presets.Length; i++)
			{
				Color val3 = UiIntegration.Presets[i];
				GameObject val4 = new GameObject("P" + i, new Type[3]
				{
					typeof(RectTransform),
					typeof(Image),
					typeof(Button)
				});
				val4.transform.SetParent(val.transform, false);
				Image component = val4.GetComponent<Image>();
				((Graphic)component).color = val3;
				GameObject val5 = new GameObject("Rim", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val5.transform.SetParent(val4.transform, false);
				val5.transform.SetAsFirstSibling();
				Image component2 = val5.GetComponent<Image>();
				DcUi.Stretch(((Graphic)component2).rectTransform);
				((Graphic)component2).rectTransform.offsetMin = new Vector2(-1f, -1f);
				((Graphic)component2).rectTransform.offsetMax = new Vector2(1f, 1f);
				((Graphic)component2).color = DcUi.Border;
				((Graphic)component2).raycastTarget = false;
				Color captured = val3;
				Button component3 = val4.GetComponent<Button>();
				((Selectable)component3).targetGraphic = (Graphic)(object)component;
				((Selectable)component3).transition = (Transition)0;
				((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0059: Unknown result type (might be due to invalid IL or missing references)
					Color.RGBToHSV(captured, ref _hue, ref _s, ref _v);
					RebuildSv();
					_hueWheel.SetHue(_hue);
					Apply(UiIntegration.ToHex(captured), syncInput: true);
				});
				DcUi.ApplyRounded(component, 6);
				DcUi.AddHover(val4, 1.12f);
			}
		}

		private void BuildEyedropperLayer(RectTransform root)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Expected O, but got Unknown
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			_eyedropperLayer = new GameObject("EyedropperLayer", new Type[1] { typeof(RectTransform) });
			_eyedropperLayer.transform.SetParent((Transform)(object)root, false);
			DcUi.Stretch((RectTransform)_eyedropperLayer.transform);
			_eyedropperLayer.SetActive(false);
			GameObject val = new GameObject("Capture", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent(_eyedropperLayer.transform, false);
			_eyeCaptureImg = val.GetComponent<Image>();
			DcUi.Stretch(((Graphic)_eyeCaptureImg).rectTransform);
			((Graphic)_eyeCaptureImg).color = Color.white;
			((Graphic)_eyeCaptureImg).raycastTarget = true;
			Button component = val.GetComponent<Button>();
			((Selectable)component).transition = (Transition)0;
			((UnityEvent)component.onClick).AddListener(new UnityAction(ConfirmDesktopPick));
			TextMeshProUGUI val2 = DcUi.Label(_eyedropperLayer.transform, "Desktop snapshot — click a pixel · Esc cancel", 15f, DcUi.Text, (TextAlignmentOptions)514);
			RectTransform rectTransform = ((TMP_Text)val2).rectTransform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 1f);
			rectTransform.anchorMax = val3;
			rectTransform.anchorMin = val3;
			rectTransform.pivot = new Vector2(0.5f, 1f);
			rectTransform.anchoredPosition = new Vector2(0f, -20f);
			rectTransform.sizeDelta = new Vector2(900f, 34f);
			GameObject val4 = new GameObject("Magnifier", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.transform.SetParent(_eyedropperLayer.transform, false);
			Image component2 = val4.GetComponent<Image>();
			RectTransform rectTransform2 = ((Graphic)component2).rectTransform;
			val3 = (rectTransform2.anchorMin = (rectTransform2.anchorMax = Vector2.zero));
			rectTransform2.pivot = new Vector2(0.5f, 0f);
			rectTransform2.sizeDelta = new Vector2(72f, 88f);
			DcUi.ApplyRounded(component2, 12);
			((Graphic)component2).color = DcUi.Surface;
			((Graphic)component2).raycastTarget = false;
			GameObject val6 = new GameObject("Fill", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val6.transform.SetParent(val4.transform, false);
			_magFill = val6.GetComponent<Image>();
			RectTransform rectTransform3 = ((Graphic)_magFill).rectTransform;
			rectTransform3.anchorMin = new Vector2(0.5f, 1f);
			rectTransform3.anchorMax = new Vector2(0.5f, 1f);
			rectTransform3.pivot = new Vector2(0.5f, 1f);
			rectTransform3.anchoredPosition = new Vector2(0f, -8f);
			rectTransform3.sizeDelta = new Vector2(52f, 52f);
			DcUi.ApplyRounded(_magFill, 8);
			((Graphic)_magFill).raycastTarget = false;
			_eyeHex = DcUi.Label(val4.transform, "#FFFFFF", 12f, DcUi.TextDim, (TextAlignmentOptions)514);
			RectTransform rectTransform4 = ((TMP_Text)_eyeHex).rectTransform;
			rectTransform4.anchorMin = new Vector2(0.5f, 0f);
			rectTransform4.anchorMax = new Vector2(0.5f, 0f);
			rectTransform4.pivot = new Vector2(0.5f, 0f);
			rectTransform4.anchoredPosition = new Vector2(0f, 6f);
			rectTransform4.sizeDelta = new Vector2(70f, 18f);
		}

		private void Update()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			if (!((Object)(object)_eyedropperLayer == (Object)null) && _eyedropperLayer.activeSelf && _desktopPick)
			{
				Color val = SampleAtMouse();
				if ((Object)(object)_magFill != (Object)null)
				{
					((Graphic)_magFill).color = val;
				}
				if ((Object)(object)_eyeHex != (Object)null)
				{
					((TMP_Text)_eyeHex).text = UiIntegration.ToHex(val);
				}
				if ((Object)(object)_magFill != (Object)null)
				{
					((Component)_magFill).transform.parent.position = Input.mousePosition + new Vector3(40f, 40f, 0f);
				}
			}
		}

		internal bool TryEscapeEyedropper()
		{
			if ((Object)(object)_eyedropperLayer == (Object)null || !_eyedropperLayer.activeSelf)
			{
				return false;
			}
			ExitEyedropper();
			return true;
		}

		private Color SampleAtMouse()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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)
			if (DesktopColorSample.TrySampleUnderCursor(out var color))
			{
				return color;
			}
			if ((Object)(object)_capture == (Object)null)
			{
				return Color.white;
			}
			float num = Mathf.Clamp01(Input.mousePosition.x / (float)Screen.width);
			float num2 = Mathf.Clamp01(Input.mousePosition.y / (float)Screen.height);
			int num3 = Mathf.Clamp((int)(num * (float)(((Texture)_capture).width - 1)), 0, ((Texture)_capture).width - 1);
			int num4 = Mathf.Clamp((int)(num2 * (float)(((Texture)_capture).height - 1)), 0, ((Texture)_capture).height - 1);
			return _capture.GetPixel(num3, num4);
		}

		private void ConfirmDesktopPick()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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)
			Color val = SampleAtMouse();
			Color.RGBToHSV(val, ref _hue, ref _s, ref _v);
			RebuildSv();
			_hueWheel.SetHue(_hue);
			Apply(UiIntegration.ToHex(val), syncInput: true);
			ExitEyedropper();
		}

		private void BeginEyedropper()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			_prevLock = Cursor.lockState;
			_prevCursorVisible = Cursor.visible;
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
			if ((Object)(object)_capture != (Object)null)
			{
				Object.Destroy((Object)(object)_capture);
			}
			if ((Object)(object)_captureSprite != (Object)null)
			{
				Object.Destroy((Object)(object)_captureSprite);
			}
			_capture = DesktopColorSample.CaptureDesktop(out var _, out var _) ?? UiIntegration.CaptureGameView();
			if (!((Object)(object)_capture == (Object)null))
			{
				_captureSprite = Sprite.Create(_capture, new Rect(0f, 0f, (float)((Texture)_capture).width, (float)((Texture)_capture).height), new Vector2(0.5f, 0.5f));
				((Object)_captureSprite).hideFlags = (HideFlags)52;
				_eyeCaptureImg.sprite = _captureSprite;
				_eyeCaptureImg.type = (Type)0;
				_eyeCaptureImg.preserveAspect = false;
				((Component)_eyeCaptureImg).gameObject.SetActive(true);
				_desktopPick = true;
				if ((Object)(object)_panel != (Object)null)
				{
					_panel.SetActive(false);
				}
				Transform val = ((Component)this).transform.Find("Dimmer");
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(false);
				}
				_eyedropperLayer.SetActive(true);
				_eyedropperLayer.transform.SetAsLastSibling();
			}
		}

		private void ExitEyedropper()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			_desktopPick = false;
			Cursor.lockState = _prevLock;
			Cursor.visible = _prevCursorVisible;
			if ((Object)(object)_panel != (Object)null)
			{
				_panel.SetActive(true);
			}
			Transform val = ((Component)this).transform.Find("Dimmer");
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).gameObject.SetActive(true);
			}
			if ((Object)(object)_eyedropperLayer != (Object)null)
			{
				_eyedropperLayer.SetActive(false);
			}
		}

		private void RebuildSv()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_svTex != (Object)null)
			{
				Object.Destroy((Object)(object)_svTex);
			}
			if ((Object)(object)_svSprite != (Object)null)
			{
				Object.Destroy((Object)(object)_svSprite);
			}
			_svTex = UiIntegration.MakeSvTexture(_hue);
			_svSprite = Sprite.Create(_svTex, new Rect(0f, 0f, (float)((Texture)_svTex).width, (float)((Texture)_svTex).height), new Vector2(0.5f, 0.5f));
			((Object)_svSprite).hideFlags = (HideFlags)52;
			_svImage.sprite = _svSprite;
			SvPicker componentInChildren = ((Component)this).GetComponentInChildren<SvPicker>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.SetMarker(_s, _v);
			}
		}

		private void Apply(string hex, bool syncInput)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			_entry.Value = hex;
			((Graphic)_swatch).color = UiIntegration.ParseHex(hex, Color.white);
			((TMP_Text)_hexTxt).text = hex;
			if (syncInput && (Object)(object)_hexInput != (Object)null && _hexInput.text != hex)
			{
				_hexInput.SetTextWithoutNotify(hex);
			}
			SvPicker componentInChildren = ((Component)this).GetComponentInChildren<SvPicker>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.SetMarker(_s, _v);
			}
		}

		private void Close()
		{
			UiIntegration.CloseModal();
		}

		private void OnDestroy()
		{
			if ((Object)(object)_svTex != (Object)null)
			{
				Object.Destroy((Object)(object)_svTex);
			}
			if ((Object)(object)_svSprite != (Object)null)
			{
				Object.Destroy((Object)(object)_svSprite);
			}
			if ((Object)(object)_captureSprite != (Object)null)
			{
				Object.Destroy((Object)(object)_captureSprite);
			}
			if ((Object)(object)_capture != (Object)null)
			{
				Object.Destroy((Object)(object)_capture);
			}
			if ((Object)(object)UiIntegration._modal == (Object)(object)((Component)this).gameObject)
			{
				UiIntegration._modal = null;
			}
		}
	}
	public class CursorLabel : MonoBehaviour
	{
		private static readonly ManualLogSource Log = Logger.CreateLogSource("DangerCursor.CursorLabel");

		private static readonly LayerMask PhysMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Terrain", "Map", "Default", "Rope" }));

		private Camera _cam;

		private TextMeshProUGUI _screen;

		private float _flashTimer;

		private bool _active;

		private Color _color = Color.white;

		private string _text = string.Empty;

		private bool _everActive;

		public bool IsActive => _active;

		public Color CurrentColor
		{
			get
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (!_active)
				{
					return new Color(1f, 1f, 1f, 0.5f);
				}
				return _color;
			}
		}

		private void Update()
		{
			try
			{
				UpdateInternal();
			}
			catch (Exception ex)
			{
				Log.LogError((object)("CursorLabel.Update crashed: " + ex));
				SetActive(active: false);
			}
		}

		private void UpdateInternal()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!Object.op_Implicit((Object)(object)localCharacter) || localCharacter.data.dead || localCharacter.data.fullyPassedOut)
			{
				SetActive(active: false);
				_cam = null;
				return;
			}
			if ((Object)(object)_cam == (Object)null)
			{
				_cam = HelperFunctions.GetMainCamera();
				if ((Object)(object)_cam == (Object)null)
				{
					SetActive(active: false);
					return;
				}
			}
			DangerCursorConfig instance = DangerCursorConfig.Instance;
			bool keyDown = Input.GetKeyDown(instance.CursorKey.Value);
			bool key = Input.GetKey(instance.CursorKey.Value);
			if (keyDown)
			{
				_flashTimer = instance.CursorFlashSeconds.Value;
			}
			if (key)
			{
				_flashTimer = Mathf.Max(_flashTimer, 0.2f);
				_active = true;
			}
			else if (_flashTimer > 0f)
			{
				_flashTimer -= Time.deltaTime;
				_active = _flashTimer > 0f;
			}
			else
			{
				_active = false;
			}
			if (!_active)
			{
				SetActive(active: false);
				return;
			}
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(((Component)_cam).transform.position, ((Component)_cam).transform.forward, ref val, 1000f, LayerMask.op_Implicit(PhysMask), (QueryTriggerInteraction)1))
			{
				SetActive(active: false);
				return;
			}
			FallPrediction fallPrediction = FallPredictor.Predict(localCharacter, ((RaycastHit)(ref val)).point);
			_color = fallPrediction.Color;
			_text = ((fallPrediction.Label.Length > 0) ? fallPrediction.Label : (instance.ShowDistance.Value ? (fallPrediction.FallDist.ToString("F1") + "m") : "SAFE"));
			Vector3 val2 = _cam.WorldToScreenPoint(((RaycastHit)(ref val)).point);
			if (val2.z <= 0f)
			{
				SetActive(active: false);
				return;
			}
			EnsureLabel();
			if ((Object)(object)_screen == (Object)null)
			{
				SetActive(active: false);
				return;
			}
			if (!_everActive)
			{
				_everActive = true;
				Log.LogInfo((object)$"Cursor active. Aim point {((RaycastHit)(ref val)).point}, label '{_text}', color {_color}.");
			}
			((TMP_Text)_screen).text = _text;
			LabelContrast.Apply((TMP_Text)(object)_screen, _color);
			FitLabel(_screen, _text);
			((Transform)((TMP_Text)_screen).rectTransform).position = LabelOffset.ApplyToScreenPoint(val2, instance.CursorOffsetX.Value, instance.CursorOffsetY.Value);
			if (!((Component)_screen).gameObject.activeSelf)
			{
				((Component)_screen).gameObject.SetActive(true);
			}
		}

		private void EnsureLabel()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_screen != (Object)null)
			{
				return;
			}
			Canvas val = (((Object)(object)GUIManager.instance != (Object)null) ? GUIManager.instance.hudCanvas : null);
			if (!((Object)(object)val == (Object)null))
			{
				GameObject val2 = new GameObject("DangerCursor_CursorLabel", new Type[1] { typeof(RectTransform) });
				val2.transform.SetParent(((Component)val).transform, false);
				TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
				TMP_FontAsset val4 = FontResolver.ResolveFont();
				if ((Object)(object)val4 != (Object)null)
				{
					((TMP_Text)val3).font = val4;
				}
				((TMP_Text)val3).fontSize = Mathf.Max(18, (DangerCursorConfig.Instance != null) ? DangerCursorConfig.Instance.MarkerFontSize.Value : 22);
				((TMP_Text)val3).fontStyle = (FontStyles)1;
				((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val3).rectTransform.pivot = new Vector2(0.5f, 0.5f);
				((TMP_Text)val3).rectTransform.sizeDelta = new Vector2(200f, 36f);
				LabelContrast.Apply((TMP_Text)(object)val3, Color.white);
				_screen = val3;
				Log.LogInfo((object)"Cursor label created on hudCanvas.");
			}
		}

		private static void FitLabel(TextMeshProUGUI tmp, string text)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tmp == (Object)null))
			{
				Vector2 preferredValues = ((TMP_Text)tmp).GetPreferredValues(text);
				((TMP_Text)tmp).rectTransform.sizeDelta = new Vector2(preferredValues.x + 8f, preferredValues.y + 4f);
			}
		}

		private void SetActive(bool active)
		{
			_active = active;
			if ((Object)(object)_screen != (Object)null && ((Component)_screen).gameObject.activeSelf != active)
			{
				((Component)_screen).gameObject.SetActive(active);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_screen != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_screen).gameObject);
			}
		}
	}
	public enum LabelMode
	{
		Screen2D,
		World3D
	}
	public class DangerCursorConfig
	{
		public static DangerCursorConfig Instance { get; internal set; }

		public ConfigEntry<KeyCode> CursorKey { get; }

		public ConfigEntry<KeyCode> PingKey { get; }

		public ConfigEntry<bool> MarkerEnabled { get; }

		public ConfigEntry<LabelMode> MarkerMode { get; }

		public ConfigEntry<bool> ShowDistance { get; }

		public ConfigEntry<string> SafeColor { get; }

		public ConfigEntry<string> InjuryColor { get; }

		public ConfigEntry<string> DangerColor { get; }

		public ConfigEntry<string> FatalColor { get; }

		public ConfigEntry<string> InvincibleColor { get; }

		public ConfigEntry<float> CursorFlashSeconds { get; }

		public ConfigEntry<float> CursorOffsetX { get; }

		public ConfigEntry<float> CursorOffsetY { get; }

		public ConfigEntry<float> MarkerOffsetX { get; }

		public ConfigEntry<float> MarkerOffsetY { get; }

		public ConfigEntry<float> MarkerWorldOffsetX { get; }

		public ConfigEntry<float> MarkerWorldOffsetY { get; }

		public ConfigEntry<int> MarkerFontSize { get; }

		public ConfigEntry<bool> OutlineEnabled { get; }

		public ConfigEntry<float> OutlineWidth { get; }

		public ConfigEntry<string> OutlineColor { get; }

		public ConfigEntry<bool> ShadowEnabled { get; }

		public ConfigEntry<float> ShadowStrength { get; }

		public ConfigEntry<string> ShadowColor { get; }

		public ConfigEntry<bool> AutoContrast { get; }

		public Color Safe => ParseHex(SafeColor.Value, DangerCursorDefaults.SafeColor);

		public Color Injury => ParseHex(InjuryColor.Value, DangerCursorDefaults.InjuryColor);

		public Color Danger => ParseHex(DangerColor.Value, DangerCursorDefaults.DangerColor);

		public Color Fatal => ParseHex(FatalColor.Value, DangerCursorDefaults.FatalColor);

		public Color Invincible => ParseHex(InvincibleColor.Value, DangerCursorDefaults.InvincibleColor);

		public Color Outline => ParseHex(OutlineColor.Value, DangerCursorDefaults.OutlineColor);

		public Color Shadow => ParseHex(ShadowColor.Value, DangerCursorDefaults.ShadowColor);

		public DangerCursorConfig(ConfigFile config)
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Expected O, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			CursorKey = config.Bind<KeyCode>("General", "Cursor Key", (KeyCode)324, "Key that shows the fall damage prediction at your aim point. Tap for a short flash, hold for a live scan. Default: Right Mouse Button.");
			PingKey = config.Bind<KeyCode>("General", "Ping Key", (KeyCode)0, "Alternative key to place a ping marker at your aim point (the vanilla bind is the mouse wheel). Set to None to disable.");
			MarkerEnabled = config.Bind<bool>("General", "Markers Enabled", true, "Show the fall damage prediction label on ping markers.");
			MarkerMode = config.Bind<LabelMode>("General", "Marker Label Mode", LabelMode.Screen2D, "Screen2D renders the label on the HUD (default), World3D renders it as world-space text at the marker.");
			ShowDistance = config.Bind<bool>("General", "Show Distance", true, "Include the fall distance in meters in the prediction label.");
			SafeColor = config.Bind<string>("Colors", "Safe Color", "#4ADE80", "Hex color when no damage is predicted. Default mint stays clear on snow.");
			InjuryColor = config.Bind<string>("Colors", "Injury Color", "#FACC15", "Hex color when the fall deals minor damage.");
			DangerColor = config.Bind<string>("Colors", "Danger Color", "#FF8A3D", "Hex color when the fall deals heavy damage.");
			FatalColor = config.Bind<string>("Colors", "Fatal Color", "#FF4B6E", "Hex color when the fall would pass you out or kill you.");
			InvincibleColor = config.Bind<string>("Colors", "Invincible Color", "#5CE1FF", "Hex color while invincible (Milk / Bing-Bong shield).");
			CursorFlashSeconds = config.Bind<float>("Display", "Tap Flash Duration", 1.25f, new ConfigDescription("How long (seconds) the danger label stays after a quick tap of the cursor key. Holding the key keeps a live scan until you release.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
			CursorOffsetX = config.Bind<float>("Display", "Cursor Label Offset X", 0f, "Offset of the SCAN label from the aim point (Set Position preview). Does not move the reticle.");
			CursorOffsetY = config.Bind<float>("Display", "Cursor Label Offset Y", -40f, "Vertical scan-label offset from the aim point.");
			MarkerOffsetX = config.Bind<float>("Display", "Marker Label Offset X", 0f, "Screen2D: horizontal ping-label offset from the ping marker (HUD pixels).");
			MarkerOffsetY = config.Bind<float>("Display", "Marker Label Offset Y", 42f, "Screen2D: vertical ping-label offset from the ping marker (HUD pixels).");
			MarkerWorldOffsetX = config.Bind<float>("Display", "Marker World Offset X", 0f, "World3D: horizontal ping-label offset from the ping marker.");
			MarkerWorldOffsetY = config.Bind<float>("Display", "Marker World Offset Y", 42f, "World3D: vertical ping-label offset from the ping marker.");
			MarkerFontSize = config.Bind<int>("Display", "Marker Font Size", 22, "Font size of the marker label.");
			OutlineEnabled = config.Bind<bool>("Display", "Outline Enabled", true, "Thin quality outline around labels (keeps text readable in daytime snow).");
			OutlineWidth = config.Bind<float>("Display", "Outline Width", 0.15f, new ConfigDescription("Outline thickness. ~0.15 is a crisp hairline; above ~0.3 starts looking heavy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.6f), Array.Empty<object>()));
			OutlineColor = config.Bind<string>("Display", "Outline Color", "#1C1917", "Hex color of the label outline (warm ink by default).");
			ShadowEnabled = config.Bind<bool>("Display", "Shadow Enabled", true, "Soft aura under the label (pairs with the thin outline).");
			ShadowStrength = config.Bind<float>("Display", "Shadow Strength", 0.32f, new ConfigDescription("Aura / shadow intensity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ShadowColor = config.Bind<string>("Display", "Shadow Color", "#0F0E0C", "Hex color of the soft aura.");
			AutoContrast = config.Bind<bool>("Display", "Auto Contrast", true, "Guarantees a thin opposite-luma outline + soft aura so labels stay visible on snow and rock.");
		}

		internal static Color ParseHex(string hex, Color fallback)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(hex))
			{
				return fallback;
			}
			string text = hex.Trim();
			if (!text.StartsWith("#"))
			{
				text = "#" + text;
			}
			Color result = default(Color);
			if (!ColorUtility.TryParseHtmlString(text, ref result))
			{
				return fallback;
			}
			return result;
		}
	}
	internal static class DangerCursorDefaults
	{
		public const string Safe = "#4ADE80";

		public const string Injury = "#FACC15";

		public const string Danger = "#FF8A3D";

		public const string Fatal = "#FF4B6E";

		public const string Invincible = "#5CE1FF";

		public const string Outline = "#1C1917";

		public const string Shadow = "#0F0E0C";

		public const float CursorOffsetX = 0f;

		public const float CursorOffsetY = -40f;

		public const float MarkerOffsetX = 0f;

		public const float MarkerOffsetY = 42f;

		public const float MarkerWorldOffsetX = 0f;

		public const float MarkerWorldOffsetY = 42f;

		public const float TapFlashSeconds = 1.25f;

		public const int MarkerFontSize = 22;

		public const float OutlineWidth = 0.15f;

		public const float ShadowStrength = 0.32f;

		public const bool OutlineEnabled = true;

		public const bool ShadowEnabled = true;

		public const bool AutoContrast = true;

		public static Color SafeColor => Parse("#4ADE80", new Color(0.29f, 0.87f, 0.5f));

		public static Color InjuryColor => Parse("#FACC15", new Color(0.98f, 0.8f, 0.08f));

		public static Color DangerColor => Parse("#FF8A3D", new Color(1f, 0.54f, 0.24f));

		public static Color FatalColor => Parse("#FF4B6E", new Color(1f, 0.29f, 0.43f));

		public static Color InvincibleColor => Parse("#5CE1FF", new Color(0.36f, 0.88f, 1f));

		public static Color OutlineColor => Parse("#1C1917", new Color(0.11f, 0.1f, 0.09f));

		public static Color ShadowColor => Parse("#0F0E0C", new Color(0.06f, 0.05f, 0.05f));

		public static string HexForColorKey(string key)
		{
			return key switch
			{
				"Safe Color" => "#4ADE80", 
				"Injury Color" => "#FACC15", 
				"Danger Color" => "#FF8A3D", 
				"Fatal Color" => "#FF4B6E", 
				"Invincible Color" => "#5CE1FF", 
				"Outline Color" => "#1C1917", 
				"Shadow Color" => "#0F0E0C", 
				_ => "#4ADE80", 
			};
		}

		private static Color Parse(string hex, Color fallback)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return DangerCursorConfig.ParseHex(hex, fallback);
		}
	}
	internal static class DcUi
	{
		public static readonly Color Bg = Hex(1315087u);

		public static readonly Color Surface = Hex(1841173u);

		public static readonly Color Elevated = Hex(2498844u);

		public static readonly Color Border = new Color(0.55f, 0.48f, 0.4f, 0.28f);

		public static readonly Color Text = Hex(15920096u);

		public static readonly Color TextDim = new Color(0.85f, 0.8f, 0.72f, 0.72f);

		public static readonly Color Accent = Hex(13935988u);

		public static readonly Color AccentInk = Hex(1709328u);

		private static Sprite? _roundPanel;

		private static Sprite? _roundButton;

		public static Color Hex(uint rgb)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)((rgb >> 16) & 0xFF) / 255f;
			float num2 = (float)((rgb >> 8) & 0xFF) / 255f;
			float num3 = (float)(rgb & 0xFF) / 255f;
			return new Color(num, num2, num3, 1f);
		}

		public static void Stretch(RectTransform rt)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			rt.offsetMin = Vector2.zero;
			rt.offsetMax = Vector2.zero;
			rt.pivot = new Vector2(0.5f, 0.5f);
			rt.anchoredPosition = Vector2.zero;
			rt.sizeDelta = Vector2.zero;
		}

		public static LayoutElement Lay(GameObject go, float w = 0f, float h = 0f, float flexW = 0f)
		{
			LayoutElement val = go.GetComponent<LayoutElement>() ?? go.AddComponent<LayoutElement>();
			val.preferredWidth = w;
			val.preferredHeight = h;
			val.flexibleWidth = flexW;
			val.flexibleHeight = 0f;
			return val;
		}

		public static Sprite RoundedSprite(int radius = 16, int size = 64)
		{
			if (radius >= 14)
			{
				if ((Object)(object)_roundPanel != (Object)null)
				{
					return _roundPanel;
				}
				return _roundPanel = BuildRoundedSprite(size, radius);
			}
			if ((Object)(object)_roundButton != (Object)null)
			{
				return _roundButton;
			}
			return _roundButton = BuildRoundedSprite(size, radius);
		}

		private static Sprite BuildRoundedSprite(int size, int radius)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			float num = radius;
			float num2 = num * num;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num3 = 0f;
					float num4 = 0f;
					if ((float)j < num)
					{
						num3 = num - (float)j;
					}
					else if ((float)j >= (float)size - num)
					{
						num3 = (float)j - ((float)size - num - 1f);
					}
					if ((float)i < num)
					{
						num4 = num - (float)i;
					}
					else if ((float)i >= (float)size - num)
					{
						num4 = (float)i - ((float)size - num - 1f);
					}
					float num5 = 1f;
					if (num3 > 0f && num4 > 0f)
					{
						float num6 = num3 * num3 + num4 * num4;
						num5 = ((num6 <= num2) ? 1f : Mathf.Clamp01(1f - (Mathf.Sqrt(num6) - num)));
					}
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num5));
				}
			}
			val.Apply();
			((Object)val).hideFlags = (HideFlags)52;
			float num7 = radius;
			Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(num7, num7, num7, num7));
			((Object)val2).hideFlags = (HideFlags)52;
			return val2;
		}

		public static void ApplyRounded(Image img, int radius = 16)
		{
			img.sprite = RoundedSprite(radius);
			img.type = (Type)1;
			img.pixelsPerUnitMultiplier = 1f;
		}

		public static HoverScale AddHover(GameObject go, float scale = 1.05f)
		{
			HoverScale hoverScale = go.GetComponent<HoverScale>() ?? go.AddComponent<HoverScale>();
			hoverScale.HoverScaleFactor = scale;
			return hoverScale;
		}

		public static TextMeshProUGUI Label(Transform parent, string text, float size = 15f, Color? color = null, TextAlignmentOptions align = (TextAlignmentOptions)4097)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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)
			GameObject val = new GameObject("Lbl", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			TMP_FontAsset val3 = FontResolver.ResolveReadableFont();
			if ((Object)(object)val3 != (Object)null)
			{
				((TMP_Text)val2).font = val3;
			}
			((TMP_Text)val2).text = text;
			((TMP_Text)val2).fontSize = size;
			((TMP_Text)val2).fontStyle = (FontStyles)0;
			((TMP_Text)val2).fontWeight = (FontWeight)400;
			((TMP_Text)val2).alignment = align;
			((Graphic)val2).color = (Color)(((??)color) ?? Text);
			((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
			((Graphic)val2).raycastTarget = false;
			return val2;
		}

		public static Button SoftButton(Transform parent, string text, float width, float height, Action onClick, bool primary = false, float flexW = 0f)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			GameObject val = new GameObject("Btn_" + text, new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent(parent, false);
			Image component = val.GetComponent<Image>();
			ApplyRounded(component, 10);
			((Graphic)component).color = (primary ? Accent : Elevated);
			((Graphic)component).raycastTarget = true;
			TextMeshProUGUI val2 = Label(val.transform, text, primary ? 15f : 14f, primary ? AccentInk : Text, (TextAlignmentOptions)514);
			Stretch(((TMP_Text)val2).rectTransform);
			Button component2 = val.GetComponent<Button>();
			((Selectable)component2).targetGraphic = (Graphic)(object)component;
			((Selectable)component2).transition = (Transition)1;
			ColorBlock colors = ((Selectable)component2).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).highlightedColor = new Color(1.08f, 1.05f, 1.02f, 1f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.92f, 0.9f, 0.88f, 1f);
			((ColorBlock)(ref colors)).fadeDuration = 0.06f;
			((Selectable)component2).colors = colors;
			((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
			{
				onClick();
			});
			AddHover(val, primary ? 1.04f : 1.06f);
			Lay(val, width, height, flexW);
			return component2;
		}

		public static Button TextButton(Transform parent, string text, Action onClick, float height = 28f)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Link_" + text, new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent(parent, false);
			Image component = val.GetComponent<Image>();
			((Graphic)component).color = new Color(1f, 1f, 1f, 0.001f);
			((Graphic)component).raycastTarget = true;
			TextMeshProUGUI val2 = Label(val.transform, text, 14f, Accent, (TextAlignmentOptions)514);
			Stretch(((TMP_Text)val2).rectTransform);
			Button component2 = val.GetComponent<Button>();
			((Selectable)component2).targetGraphic = (Graphic)(object)component;
			((Selectable)component2).transition = (Transition)0;
			((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
			{
				onClick();
			});
			float w = Mathf.Max(56f, ((TMP_Text)val2).GetPreferredValues(text).x + 16f);
			AddHover(val, 1.08f);
			Lay(val, w, height);
			return component2;
		}

		public static TMP_InputField HexField(Transform parent, string value, Action<string> onValidHex)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			GameObject val = new GameObject("HexField", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			Image component = val.GetComponent<Image>();
			ApplyRounded(component, 8);
			((Graphic)component).color = Elevated;
			((Graphic)component).raycastTarget = true;
			GameObject val2 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
			TMP_FontAsset val4 = FontResolver.ResolveReadableFont();
			if ((Object)(object)val4 != (Object)null)
			{
				((TMP_Text)val3).font = val4;
			}
			((TMP_Text)val3).fontSize = 15f;
			((TMP_Text)val3).fontStyle = (FontStyles)0;
			((Graphic)val3).color = Text;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)val3).textWrappingMode = (TextWrappingModes)0;
			Stretch(((TMP_Text)val3).rectTransform);
			((TMP_Text)val3).rectTransform.offsetMin = new Vector2(12f, 2f);
			((TMP_Text)val3).rectTransform.offsetMax = new Vector2(-12f, -2f);
			GameObject val5 = new GameObject("Placeholder", new Type[1] { typeof(RectTransform) });
			val5.transform.SetParent(val.transform, false);
			TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)val4 != (Object)null)
			{
				((TMP_Text)val6).font = val4;
			}
			((TMP_Text)val6).fontSize = 15f;
			((TMP_Text)val6).fontStyle = (FontStyles)0;
			((Graphic)val6).color = TextDim;
			((TMP_Text)val6).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)val6).text = "#FFFFFF";
			Stretch(((TMP_Text)val6).rectTransform);
			((TMP_Text)val6).rectTransform.offsetMin = new Vector2(12f, 2f);
			((TMP_Text)val6).rectTransform.offsetMax = new Vector2(-12f, -2f);
			TMP_InputField val7 = val.AddComponent<TMP_InputField>();
			val7.textViewport = (RectTransform)val2.transform;
			val7.textComponent = (TMP_Text)(object)val3;
			val7.placeholder = (Graphic)(object)val6;
			val7.contentType = (ContentType)0;
			val7.characterLimit = 9;
			val7.text = value;
			((UnityEvent<string>)(object)val7.onValueChanged).AddListener((UnityAction<string>)delegate(string v)
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				string text = (v ?? string.Empty).Trim();
				if (text.Length >= 4)
				{
					string text2 = (text.StartsWith("#") ? text : ("#" + text));
					Color c = default(Color);
					if (ColorUtility.TryParseHtmlString(text2, ref c))
					{
						onValidHex(UiIntegration.ToHex(c));
					}
				}
			});
			Lay(val, 0f, 36f, 1f);
			return val7;
		}

		public static Image Swatch(Transform parent, float size, Color color)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Swatch", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			Image component = val.GetComponent<Image>();
			ApplyRounded(component, 6);
			((Graphic)component).color = color;
			((Graphic)component).raycastTarget = false;
			Lay(val, size, size);
			return component;
		}
	}
	public class HoverScale : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public float HoverScaleFactor = 1.05f;

		public float Speed = 14f;

		private Vector3 _base = Vector3.one;

		private float _target = 1f;

		private bool _ready;

		private void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			_base = ((Component)this).transform.localScale;
			if (((Vector3)(ref _base)).sqrMagnitude < 0.0001f)
			{
				_base = Vector3.one;
			}
			_target = 1f;
			_ready = true;
		}

		private void Update()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (_ready)
			{
				Vector3 val = _base * _target;
				((Component)this).transform.localScale = Vector3.Lerp(((Component)this).transform.localScale, val, Time.unscaledDeltaTime * Speed);
			}
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			_target = HoverScaleFactor;
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			_target = 1f;
		}
	}
	internal static class DesktopColorSample
	{
		private struct POINT
		{
			public int X;

			public int Y;
		}

		private struct BitmapInfoHeader
		{
			public uint biSize;

			public int biWidth;

			public int biHeight;

			public ushort biPlanes;

			public ushort biBitCount;

			public uint biCompression;

			public uint biSizeImage;

			public int biXPelsPerMeter;

			public int biYPelsPerMeter;

			public uint biClrUsed;

			public uint biClrImportant;
		}

		private struct BitmapInfo
		{
			public BitmapInfoHeader bmiHeader;
		}

		private const int SmXVirtualScreen = 76;

		private const int SmYVirtualScreen = 77;

		private const int SmCxVirtualScreen = 78;

		private const int SmCyVirtualScreen = 79;

		private const int SrcCopy = 13369376;

		[DllImport("user32.dll")]
		private static extern bool GetCursorPos(out POINT lpPoint);

		[DllImport("user32.dll")]
		private static extern IntPtr GetDC(IntPtr hwnd);

		[DllImport("user32.dll")]
		private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

		[DllImport("user32.dll")]
		private static extern int GetSystemMetrics(int nIndex);

		[DllImport("gdi32.dll")]
		private static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);

		[DllImport("gdi32.dll")]
		private static extern IntPtr CreateCompatibleDC(IntPtr hdc);

		[DllImport("gdi32.dll")]
		private static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);

		[DllImport("gdi32.dll")]
		private static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdi);

		[DllImport("gdi32.dll")]
		private static extern bool BitBlt(IntPtr hdcDest, int xDest, int yDest, int w, int h, IntPtr hdcSrc, int xSrc, int ySrc, int rop);

		[DllImport("gdi32.dll")]
		private static extern bool DeleteObject(IntPtr hObject);

		[DllImport("gdi32.dll")]
		private static extern bool DeleteDC(IntPtr hdc);

		[DllImport("gdi32.dll")]
		private static extern int GetDIBits(IntPtr hdc, IntPtr hbmp, uint uStartScan, uint cScanLines, byte[] lpvBits, ref BitmapInfo lpbmi, uint uUsage);

		public static bool TrySampleUnderCursor(out Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			color = Color.white;
			try
			{
				if (!GetCursorPos(out var lpPoint))
				{
					return false;
				}
				IntPtr dC = GetDC(IntPtr.Zero);
				if (dC == IntPtr.Zero)
				{
					return false;
				}
				try
				{
					uint pixel = GetPixel(dC, lpPoint.X, lpPoint.Y);
					color = FromColorRef(pixel);
					return true;
				}
				finally
				{
					ReleaseDC(IntPtr.Zero, dC);
				}
			}
			catch
			{
				return false;
			}
		}

		public static bool TryGetCursorScreenPos(out Vector2 screenPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			screenPos = default(Vector2);
			try
			{
				if (!GetCursorPos(out var lpPoint))
				{
					return false;
				}
				screenPos = new Vector2((float)lpPoint.X, (float)lpPoint.Y);
				return true;
			}
			catch
			{
				return false;
			}
		}

		public static Texture2D? CaptureDesktop(out int originX, out int originY)
		{
			//IL_0050: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			originX = 0;
			originY = 0;
			try
			{
				IntPtr dC = GetDC(IntPtr.Zero);
				if (dC == IntPtr.Zero)
				{
					return null;
				}
				int num = GetSystemMetrics(78);
				int num2 = GetSystemMetrics(79);
				originX = GetSystemMetrics(76);
				originY = GetSystemMetrics(77);
				if (num <= 0 || num2 <= 0)
				{
					Resolution currentResolution = Screen.currentResolution;
					num = ((Resolution)(ref currentResolution)).width;
					currentResolution = Screen.currentResolution;
					num2 = ((Resolution)(ref currentResolution)).height;
					originX = 0;
					originY = 0;
				}
				IntPtr intPtr = CreateCompatibleDC(dC);
				IntPtr intPtr2 = CreateCompatibleBitmap(dC, num, num2);
				IntPtr hgdi = SelectObject(intPtr, intPtr2);
				Texture2D val = null;
				if (BitBlt(intPtr, 0, 0, num, num2, dC, originX, originY, 13369376))
				{
					BitmapInfo lpbmi = new BitmapInfo
					{
						bmiHeader = 
						{
							biSize = (uint)Marshal.SizeOf<BitmapInfoHeader>(),
							biWidth = num,
							biHeight = -num2,
							biPlanes = 1,
							biBitCount = 32,
							biCompression = 0u
						}
					};
					byte[] array = new byte[num * num2 * 4];
					if (GetDIBits(intPtr, intPtr2, 0u, (uint)num2, array, ref lpbmi, 0u) != 0)
					{
						val = new Texture2D(num, num2, (TextureFormat)4, false);
						Color32[] array2 = (Color32[])(object)new Color32[num * num2];
						for (int i = 0; i < num2; i++)
						{
							for (int j = 0; j < num; j++)
							{
								int num3 = (i * num + j) * 4;
								int num4 = (num2 - 1 - i) * num + j;
								array2[num4] = new Color32(array[num3 + 2], array[num3 + 1], array[num3], byte.MaxValue);
							}
						}
						val.SetPixels32(array2);
						val.Apply(false, false);
						((Object)val).hideFlags = (HideFlags)52;
					}
				}
				SelectObject(intPtr, hgdi);
				DeleteObject(intPtr2);
				DeleteDC(intPtr);
				ReleaseDC(IntPtr.Zero, dC);
				return val;
			}
			catch
			{
				return null;
			}
		}

		private static Color FromColorRef(uint pixel)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)(pixel & 0xFF) / 255f;
			float num2 = (float)((pixel >> 8) & 0xFF) / 255f;
			float num3 = (float)((pixel >> 16) & 0xFF) / 255f;
			return new Color(num, num2, num3, 1f);
		}
	}
	public enum DangerLevel
	{
		Safe,
		Injury,
		Danger,
		Fatal
	}
	public readonly struct FallPrediction
	{
		public readonly bool HasTarget;

		public readonly bool Floating;

		public readonly bool Invincible;

		public readonly float FallDist;

		public readonly float Injury;

		public readonly float HealthAvailable;

		public readonly DangerLevel Level;

		public readonly Color Color;

		public readonly string Label;

		public bool ShowLabel => Label.Length > 0;

		public FallPrediction(bool hasTarget, bool floating, bool invincible, float fallDist, float injury, float healthAvailable, DangerLevel level, Color color, string label)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			HasTarget = hasTarget;
			Floating = floating;
			Invincible = invincible;
			FallDist = fallDist;
			Injury = injury;
			HealthAvailable = healthAvailable;
			Level = level;
			Color = color;
			Label = label;
		}
	}
	public static class FallPredictor
	{
		private const float FallTimeThreshold = 1.48f;

		private const float DistanceThreshold = 1.8f;

		private const float Gravity = 20f;

		private const float GravityTime = 13f;

		private const float SkeletonMultiplier = 8f;

		private const float InjuryFloor = 0.025f;

		private const float DangerFloor = 0.25f;

		private const float PassOutLine = 0.99f;

		public static FallPrediction Predict(Character character, Vector3 targetPoint)
		{
			//IL_0022: 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)
			//IL_00a6: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			DangerCursorConfig instance = DangerCursorConfig.Instance;
			if (!Object.op_Implicit((Object)(object)character))
			{
				return new FallPrediction(hasTarget: false, floating: false, invincible: false, 0f, 0f, 0f, DangerLevel.Safe, instance.Safe, string.Empty);
			}
			if (character.data.isInvincible)
			{
				return new FallPrediction(hasTarget: true, floating: false, invincible: true, 0f, 0f, 0f, DangerLevel.Safe, instance.Invincible, "INVINCIBLE (MILK/SHIELD)");
			}
			float healthAvailable = Mathf.Max(0.001f, 1f - character.refs.afflictions.statusSum);
			float num = ((Component)character.refs.hip).transform.position.y - 0.85f;
			float num2 = num - targetPoint.y;
			float balloonFloatMultiplier = character.refs.movement.balloonFloatMultiplier;
			if (balloonFloatMultiplier <= 0f)
			{
				return new FallPrediction(hasTarget: true, floating: true, invincible: false, num2, 0f, healthAvailable, DangerLevel.Safe, instance.Safe, "FLOATING (BALLOONS)");
			}
			float num3 = 13f * balloonFloatMultiplier;
			float num4 = Mathf.Sqrt(2f * Mathf.Max(0f, num2) / num3);
			if (character.data.sinceGrounded - character.data.sinceJump > -0.05f)
			{
				num4 -= 0.5f;
			}
			int currentBalloonCount = character.refs.balloons.currentBalloonCount;
			if (currentBalloonCount > 0)
			{
				float num5 = Mathf.Clamp(2f - 0.2f * (float)currentBalloonCount, 0.5f, 2f);
				num4 = Mathf.Min(num4, num5);
			}
			if (num4 < 1.48f || num2 < 1.8f)
			{
				return new FallPrediction(hasTarget: true, floating: false, invincible: false, num2, 0f, healthAvailable, DangerLevel.Safe, instance.Safe, string.Empty);
			}
			float num6 = Mathf.Pow(Mathf.InverseLerp(1.5f, 3f, num4), 1.5f);
			float num7 = Mathf.Sqrt(2f * (20f * balloonFloatMultiplier) * Mathf.Max(0f, num2));
			float num8 = Mathf.Pow(Mathf.InverseLerp(10f, 20f, num7), 1.5f);
			float num9 = Mathf.Min(num6, num8);
			num9 *= Ascents.fallDamageMultiplier;
			if (character.data.isSkeleton)
			{
				num9 *= 8f;
			}
			float statusSum = character.refs.afflictions.statusSum;
			float num10 = Mathf.Max(0.025f, 0.99f - statusSum);
			string text = (instance.ShowDistance.Value ? (num2.ToString("F1") + "m ! ") : string.Empty);
			if (num9 >= num10)
			{
				return new FallPrediction(hasTarget: true, floating: false, invincible: false, num2, num9, healthAvailable, DangerLevel.Fatal, instance.Fatal, text + "FATAL");
			}
			if (num9 >= 0.25f)
			{
				return new FallPrediction(hasTarget: true, floating: false, invincible: false, num2, num9, healthAvailable, DangerLevel.Danger, instance.Danger, text + "DANGER");
			}
			if (num9 >= 0.025f)
			{
				return new FallPrediction(hasTarget: true, floating: false, invincible: false, num2, num9, healthAvailable, DangerLevel.Injury, instance.Injury, text + "INJURY");
			}
			return new FallPrediction(hasTarget: true, floating: false, invincible: false, num2, num9, healthAvailable, DangerLevel.Safe, instance.Safe, instance.ShowDistance.Value ? (text + "SAFE") : string.Empty);
		}
	}
	internal static class LabelContrast
	{
		internal readonly struct StrokePlan
		{
			public readonly Color Face;

			public readonly bool OutlineOn;

			public readonly float OutlineWidth;

			public readonly Color OutlineColor;

			public readonly bool ShadowOn;

			public readonly float ShadowStrength;

			public readonly Color ShadowColor;

			public StrokePlan(Color face, bool outlineOn, float outlineWidth, Color outlineColor, bool shadowOn, float shadowStrength, Color shadowColor)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				Face = face;
				OutlineOn = outlineOn;
				OutlineWidth = outlineWidth;
				OutlineColor = outlineColor;
				ShadowOn = shadowOn;
				ShadowStrength = shadowStrength;
				ShadowColor = shadowColor;
			}
		}

		private const float MidLuma = 0.45f;

		private const float QualityHairline = 0.15f;

		private const float SoftAura = 0.36f;

		private const float SoftAuraLightFace = 0.48f;

		private const float FaceDilateWithOutline = 0.12f;

		private const float FaceDilateClean = 0.2f;

		private const float HaloContrastGap = 0.28f;

		private const float MinUiContrast = 2.6f;

		private static readonly Color InkDark = new Color(0.09f, 0.08f, 0.07f, 0.92f);

		private static readonly Color InkLight = new Color(1f, 0.98f, 0.95f, 0.88f);

		private static readonly Color AuraDark = new Color(0.06f, 0.05f, 0.04f, 0.55f);

		private static readonly Color AuraLight = new Color(1f, 0.98f, 0.94f, 0.45f);

		internal static void Apply(TMP_Text tmp, Color face)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_001b: 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)
			if (!((Object)(object)tmp == (Object)null))
			{
				DangerCursorConfig instance = DangerCursorConfig.Instance;
				if (instance == null)
				{
					ApplyRaw(tmp, face, outlineOn: true, 0.15f, DangerCursorDefaults.OutlineColor, shadowOn: true, 0.32f, DangerCursorDefaults.ShadowColor, auto: true);
				}
				else
				{
					ApplyRaw(tmp, face, instance.OutlineEnabled.Value, instance.OutlineWidth.Value, instance.Outline, instance.ShadowEnabled.Value, instance.ShadowStrength.Value, instance.Shadow, instance.AutoContrast.Value);
				}
			}
		}

		internal static void ApplyRaw(TMP_Text tmp, Color face, bool outlineOn, float outlineWidth, Color outlineColor, bool shadowOn, float shadowStrength, Color shadowColor, bool auto)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tmp == (Object)null))
			{
				StrokePlan plan = EnsureReadable(face, outlineOn, outlineWidth, outlineColor, shadowOn, shadowStrength, shadowColor, auto);
				ApplyPlan(tmp, plan);
			}
		}

		internal static StrokePlan EnsureReadable(Color face, bool outlineOn, float outlineWidth, Color outlineColor, bool shadowOn, float shadowStrength, Color shadowColor, bool auto)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			float a = Mathf.Clamp01((face.a <= 0.001f) ? 1f : face.a);
			Color val = face;
			val.a = 1f;
			bool flag = Luminance(val) >= 0.45f;
			float num = (outlineOn ? Mathf.Clamp(outlineWidth, 0f, 0.6f) : 0f);
			Color val2 = outlineColor;
			val2.a = Mathf.Clamp01((val2.a <= 0.01f) ? 1f : val2.a);
			float num2 = (shadowOn ? Mathf.Clamp01(shadowStrength) : 0f);
			Color val3 = shadowColor;
			val3.a = Mathf.Clamp01((val3.a <= 0.01f) ? 1f : val3.a);
			if (auto)
			{
				Color val4 = (flag ? InkDark : InkLight);
				Color val5 = (flag ? AuraDark : AuraLight);
				if (num <= 0.001f)
				{
					num = 0.15f;
					val2 = val4;
				}
				else
				{
					num = Mathf.Max(num, 0.15f);
					if (LumaGap(val2, val) < 0.28f)
					{
						val2 = val4;
					}
				}
				if (num2 <= 0.001f)
				{
					num2 = (flag ? 0.48f : 0.36f);
					val3 = val5;
				}
				else
				{
					num2 = Mathf.Max(num2, flag ? 0.32f : 0.27f);
					if (LumaGap(val3, val) < 0.28f)
					{
						val3 = val5;
					}
				}
			}
			Color face2 = val;
			face2.a = a;
			return new StrokePlan(face2, num > 0.001f, num, val2, num2 > 0.001f, num2, val3);
		}

		internal static void ApplyPlan(TMP_Text tmp, StrokePlan plan)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)tmp).color = plan.Face;
			tmp.fontStyle = (FontStyles)(tmp.fontStyle | 1);
			float num = (plan.OutlineOn ? plan.OutlineWidth : 0f);
			float num2 = (plan.ShadowOn ? plan.ShadowStrength : 0f);
			bool flag = Luminance(plan.Face) >= 0.45f;
			tmp.outlineColor = Color32.op_Implicit(plan.OutlineColor);
			tmp.outlineWidth = num;
			Material fontMaterial = tmp.fontMaterial;
			if ((Object)(object)fontMaterial == (Object)null)
			{
				return;
			}
			float num3 = ((num > 0.001f) ? 0.12f : 0.2f);
			if (fontMaterial.HasProperty(ShaderUtilities.ID_FaceDilate))
			{
				fontMaterial.SetFloat(ShaderUtilities.ID_FaceDilate, num3);
			}
			if (num > 0.001f)
			{
				fontMaterial.EnableKeyword("OUTLINE_ON");
				Color outlineColor = plan.OutlineColor;
				if (outlineColor.a > 0.95f)
				{
					outlineColor.a = 0.9f;
				}
				fontMaterial.SetColor(ShaderUtilities.ID_OutlineColor, outlineColor);
				fontMaterial.SetFloat(ShaderUtilities.ID_OutlineWidth, num);
				tmp.outlineColor = Color32.op_Implicit(outlineColor);
			}
			else
			{
				fontMaterial.DisableKeyword("OUTLINE_ON");
				fontMaterial.SetFloat(ShaderUtilities.ID_OutlineWidth, 0f);
				tmp.outlineWidth = 0f;
			}
			if (num2 > 0.001f)
			{
				fontMaterial.EnableKeyword("UNDERLAY_ON");
				Color shadowColor = plan.ShadowColor;
				shadowColor.a = Mathf.Lerp(flag ? 0.35f : 0.25f, flag ? 0.72f : 0.55f, num2);
				fontMaterial.SetColor(ShaderUtilities.ID_UnderlayColor, shadowColor);
				fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, 0.04f);
				fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -0.04f);
				fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayDilate, Mathf.Lerp(0.1f, flag ? 0.34f : 0.24f, num2));
				fontMaterial.SetFloat(ShaderUtilities.ID_UnderlaySoftness, Mathf.Lerp(0.58f, 0.4f, num2));
			}
			else
			{
				fontMaterial.DisableKeyword("UNDERLAY_ON");
				fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayDilate, 0f);
			}
		}

		internal static string EvaluateReadability(Color face, bool outlineOn, float outlineWidth, Color outlineColor, bool shadowOn, float shadowStrength, Color shadowColor, bool auto)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			StrokePlan plan = EnsureReadable(face, outlineOn, outlineWidth, outlineColor, shadowOn, shadowStrength, shadowColor, auto);
			Color background = default(Color);
			((Color)(ref background))..ctor(0.92f, 0.94f, 0.96f);
			Color background2 = default(Color);
			((Color)(ref background2))..ctor(0.08f, 0.09f, 0.1f);
			bool flag = EffectiveContrast(plan, background) >= 2.6f;
			bool flag2 = EffectiveContrast(plan, background2) >= 2.6f;
			if (flag && flag2)
			{
				return "Readable: OK";
			}
			if (!flag && !flag2)
			{
				return "Readable: Weak on light & dark";
			}
			if (!flag)
			{
				return "Readable: Weak on light";
			}
			return "Readable: Weak on dark";
		}

		internal static float EffectiveContrast(StrokePlan plan, Color background)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			float num = ContrastRatio(plan.Face, background);
			if (plan.OutlineOn && plan.OutlineWidth > 0.001f)
			{
				num = Mathf.Max(num, ContrastRatio(plan.OutlineColor, background));
			}
			if (plan.ShadowOn && plan.ShadowStrength > 0.001f)
			{
				num = Mathf.Max(num, ContrastRatio(plan.ShadowColor, background) * 0.85f);
			}
			return num;
		}

		internal static Color OppositeHalo(Color face)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (!(Luminance(face) >= 0.45f))
			{
				return InkLight;
			}
			return InkDark;
		}

		internal static float Luminance(Color c)
		{
			//IL_0005: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			return 0.2126f * c.r + 0.7152f * c.g + 0.0722f * c.b;
		}

		private static float LumaGap(Color a, Color b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Abs(Luminance(a) - Luminance(b));
		}

		internal static float ContrastRatio(Color a, Color b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			float num = Luminance(a) + 0.05f;
			float num2 = Luminance(b) + 0.05f;
			if (!(num > num2))
			{
				return num2 / num;
			}
			return num / num2;
		}
	}
	internal static class LabelSamples
	{
		internal readonly struct Sample
		{
			public readonly string Id;

			public readonly string Text;

			public readonly Color Color;

			public Sample(string id, string text, Color color)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				Id = id;
				Text = text;
				Color = color;
			}
		}

		internal static Sample[] All()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			DangerCursorConfig instance = DangerCursorConfig.Instance;
			bool value = instance.ShowDistance.Value;
			string text = (value ? "12.3m" : string.Empty);
			string text2 = (value ? "12.3m ! " : string.Empty);
			return new Sample[5]
			{
				new Sample("Safe", value ? text : "SAFE", instance.Safe),
				new Sample("Injury", text2 + "INJURY", instance.Injury),
				new Sample("Danger", text2 + "DANGER", instance.Danger),
				new Sample("Fatal", text2 + "FATAL", instance.Fatal),
				new Sample("Invincible", "INVINCIBLE (MILK/SHIELD)", instance.Invincible)
			};
		}
	}
	internal static class LabelOffset
	{
		private const float RefWidth = 1920f;

		private const float RefHeight = 1080f;

		private const float Match = 0.5f;

		internal static Vector2 ToScreenPixels(float offsetX, float offsetY)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Lerp((float)Screen.width / 1920f, (float)Screen.height / 1080f, 0.5f);
			if (num < 0.01f)
			{
				num = 1f;
			}
			return new Vector2(offsetX * num, offsetY * num);
		}

		internal static Vector2 FromScreenPixels(float pixelX, float pixelY)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Lerp((float)Screen.width / 1920f, (float)Screen.height / 1080f, 0.5f);
			if (num < 0.01f)
			{
				num = 1f;
			}
			return new Vector2(pixelX / num, pixelY / num);
		}

		internal static Vector3 ApplyToScreenPoint(Vector3 screenPos, float offsetX, float offsetY)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to i