Decompiled source of EulersRuler v1.7.0

EulersRuler.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ComfyLib;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EulersRuler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EulersRuler")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("86a1824a-1bbe-404b-a4e3-f619d06ca938")]
[assembly: AssemblyFileVersion("1.7.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.0.0")]
[module: UnverifiableCode]
namespace ComfyLib
{
	public static class ConfigFileExtensions
	{
		internal sealed class ConfigurationManagerAttributes
		{
			public Action<ConfigEntryBase> CustomDrawer;

			public bool? Browsable;

			public bool? HideDefaultButton;

			public int? Order;
		}

		private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>();

		private static int GetSettingOrder(string section)
		{
			if (!_sectionToSettingOrder.TryGetValue(section, out var value))
			{
				value = 0;
			}
			_sectionToSettingOrder[section] = value - 1;
			return value;
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = GetSettingOrder(section)
				}
			}));
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Browsable = browsable,
					CustomDrawer = customDrawer,
					HideDefaultButton = hideDefaultButton,
					Order = GetSettingOrder(section)
				}
			}));
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler)
		{
			configEntry.SettingChanged += delegate
			{
				settingChangedHandler();
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}
	}
	public static class UIBuilder
	{
		public static TextMeshProUGUI CreateTMPLabel(Transform parentTransform)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = Object.Instantiate<TextMeshProUGUI>(UnifiedPopup.instance.bodyText, parentTransform, false);
			((Object)obj).name = "Label";
			((TMP_Text)obj).fontSize = 16f;
			((TMP_Text)obj).richText = true;
			((Graphic)obj).color = Color.white;
			((TMP_Text)obj).enableAutoSizing = false;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)0;
			((TMP_Text)obj).text = string.Empty;
			return obj;
		}
	}
	public static class CanvasGroupExtensions
	{
		public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha)
		{
			canvasGroup.alpha = alpha;
			return canvasGroup;
		}

		public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts)
		{
			canvasGroup.blocksRaycasts = blocksRaycasts;
			return canvasGroup;
		}
	}
	public static class ColorExtensions
	{
		public static Color SetAlpha(this Color color, float alpha)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			color.a = alpha;
			return color;
		}
	}
	public static class ContentSizeFitterExtensions
	{
		public static ContentSizeFitter SetHorizontalFit(this ContentSizeFitter fitter, FitMode fitMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			fitter.horizontalFit = fitMode;
			return fitter;
		}

		public static ContentSizeFitter SetVerticalFit(this ContentSizeFitter fitter, FitMode fitMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			fitter.verticalFit = fitMode;
			return fitter;
		}
	}
	public static class LayoutGroupExtensions
	{
		public static T SetChildControl<T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width.Value;
			}
			if (height.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlHeight = height.Value;
			}
			return layoutGroup;
		}

		public static T SetChildForceExpand<T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandWidth = width.Value;
			}
			if (height.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandHeight = height.Value;
			}
			return layoutGroup;
		}

		public static T SetChildAlignment<T>(this T layoutGroup, TextAnchor alignment) where T : HorizontalOrVerticalLayoutGroup
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((LayoutGroup)(object)layoutGroup).childAlignment = alignment;
			return layoutGroup;
		}

		public static T SetPadding<T>(this T layoutGroup, int? left = null, int? right = null, int? top = null, int? bottom = null) where T : HorizontalOrVerticalLayoutGroup
		{
			if (!left.HasValue && !right.HasValue && !top.HasValue && !bottom.HasValue)
			{
				throw new ArgumentException("Value for left, right, top or bottom must be provided.");
			}
			if (left.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.left = left.Value;
			}
			if (right.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.right = right.Value;
			}
			if (top.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.top = top.Value;
			}
			if (bottom.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.bottom = bottom.Value;
			}
			return layoutGroup;
		}

		public static T SetSpacing<T>(this T layoutGroup, float spacing) where T : HorizontalOrVerticalLayoutGroup
		{
			((HorizontalOrVerticalLayoutGroup)layoutGroup).spacing = spacing;
			return layoutGroup;
		}
	}
	public static class ImageExtensions
	{
		public static Image SetColor(this Image image, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)image).color = color;
			return image;
		}

		public static Image SetFillAmount(this Image image, float amount)
		{
			image.fillAmount = amount;
			return image;
		}

		public static Image SetFillCenter(this Image image, bool fillCenter)
		{
			image.fillCenter = fillCenter;
			return image;
		}

		public static Image SetFillMethod(this Image image, FillMethod fillMethod)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			image.fillMethod = fillMethod;
			return image;
		}

		public static Image SetFillOrigin(this Image image, OriginHorizontal origin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected I4, but got Unknown
			image.fillOrigin = (int)origin;
			return image;
		}

		public static Image SetFillOrigin(this Image image, OriginVertical origin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected I4, but got Unknown
			image.fillOrigin = (int)origin;
			return image;
		}

		public static Image SetMaskable(this Image image, bool maskable)
		{
			((MaskableGraphic)image).maskable = maskable;
			return image;
		}

		public static Image SetMaterial(this Image image, Material material)
		{
			((Graphic)image).material = material;
			return image;
		}

		public static Image SetPixelsPerUnitMultiplier(this Image image, float pixelsPerUnitMultiplier)
		{
			image.pixelsPerUnitMultiplier = pixelsPerUnitMultiplier;
			return image;
		}

		public static Image SetPreserveAspect(this Image image, bool preserveAspect)
		{
			image.preserveAspect = preserveAspect;
			return image;
		}

		public static Image SetRaycastTarget(this Image image, bool raycastTarget)
		{
			((Graphic)image).raycastTarget = raycastTarget;
			return image;
		}

		public static Image SetSprite(this Image image, Sprite sprite)
		{
			image.sprite = sprite;
			return image;
		}

		public static Image SetType(this Image image, Type type)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			image.type = type;
			return image;
		}
	}
	public static class LayoutElementExtensions
	{
		public static LayoutElement SetPreferred(this LayoutElement layoutElement, float? width = null, float? height = null)
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				layoutElement.preferredWidth = width.Value;
			}
			if (height.HasValue)
			{
				layoutElement.preferredHeight = height.Value;
			}
			return layoutElement;
		}

		public static LayoutElement SetFlexible(this LayoutElement layoutElement, float? width = null, float? height = null)
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				layoutElement.flexibleWidth = width.Value;
			}
			if (height.HasValue)
			{
				layoutElement.flexibleHeight = height.Value;
			}
			return layoutElement;
		}

		public static LayoutElement SetMinimum(this LayoutElement layoutElement, float? width = null, float? height = null)
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				layoutElement.minWidth = width.Value;
			}
			if (height.HasValue)
			{
				layoutElement.minHeight = height.Value;
			}
			return layoutElement;
		}

		public static LayoutElement SetIgnoreLayout(this LayoutElement layoutElement, bool ignoreLayout)
		{
			layoutElement.ignoreLayout = ignoreLayout;
			return layoutElement;
		}
	}
	public static class MaskExtensions
	{
		public static Mask SetShowMaskGraphic(this Mask mask, bool showMaskGraphic)
		{
			mask.showMaskGraphic = showMaskGraphic;
			return mask;
		}
	}
	public static class RectMask2DExtensions
	{
		public static RectMask2D SetSoftness(this RectMask2D rectMask2d, Vector2Int softness)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectMask2d.softness = softness;
			return rectMask2d;
		}
	}
	public static class RectTransformExtensions
	{
		public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 anchorMin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMin = anchorMin;
			return rectTransform;
		}

		public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 anchorMax)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMax = anchorMax;
			return rectTransform;
		}

		public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.pivot = pivot;
			return rectTransform;
		}

		public static RectTransform SetPosition(this RectTransform rectTransform, Vector2 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchoredPosition = position;
			return rectTransform;
		}

		public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.sizeDelta = sizeDelta;
			return rectTransform;
		}
	}
	public static class ScrollbarExtensions
	{
		public static T SetDirection<T>(this T scrollbar, Direction direction) where T : Scrollbar
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Scrollbar)scrollbar).direction = direction;
			return scrollbar;
		}

		public static T SetHandleRect<T>(this T scrollbar, RectTransform handleRect) where T : Scrollbar
		{
			((Scrollbar)scrollbar).handleRect = handleRect;
			return scrollbar;
		}
	}
	public static class SelectableExtensions
	{
		public static T SetColors<T>(this T selectable, ColorBlock colors) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Selectable)selectable).colors = colors;
			return selectable;
		}

		public static T SetImage<T>(this T selectable, Image image) where T : Selectable
		{
			((Selectable)selectable).image = image;
			return selectable;
		}

		public static T SetInteractable<T>(this T selectable, bool interactable) where T : Selectable
		{
			((Selectable)selectable).interactable = interactable;
			return selectable;
		}

		public static T SetSpriteState<T>(this T selectable, SpriteState spriteState) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Selectable)selectable).spriteState = spriteState;
			return selectable;
		}

		public static T SetTargetGraphic<T>(this T selectable, Graphic graphic) where T : Selectable
		{
			((Selectable)selectable).targetGraphic = graphic;
			return selectable;
		}

		public static T SetTransition<T>(this T selectable, Transition transition) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Selectable)selectable).transition = transition;
			return selectable;
		}

		public static T SetNavigationMode<T>(this T selectable, Mode mode) where T : Selectable
		{
			//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_000e: 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)
			Navigation navigation = ((Selectable)selectable).navigation;
			((Navigation)(ref navigation)).mode = mode;
			((Selectable)selectable).navigation = navigation;
			return selectable;
		}
	}
	public static class ScrollRectExtensions
	{
		public static T SetScrollSensitivity<T>(this T scrollRect, float sensitivity) where T : ScrollRect
		{
			((ScrollRect)scrollRect).scrollSensitivity = sensitivity;
			return scrollRect;
		}

		public static T SetVerticalScrollbar<T>(this T scrollRect, Scrollbar verticalScrollbar) where T : ScrollRect
		{
			((ScrollRect)scrollRect).verticalScrollbar = verticalScrollbar;
			return scrollRect;
		}

		public static T SetVerticalScrollPosition<T>(this T scrollRect, float position) where T : ScrollRect
		{
			((ScrollRect)scrollRect).verticalNormalizedPosition = position;
			return scrollRect;
		}

		public static T SetViewport<T>(this T scrollRect, RectTransform viewport) where T : ScrollRect
		{
			((ScrollRect)scrollRect).viewport = viewport;
			return scrollRect;
		}

		public static T SetContent<T>(this T scrollRect, RectTransform content) where T : ScrollRect
		{
			((ScrollRect)scrollRect).content = content;
			return scrollRect;
		}

		public static T SetHorizontal<T>(this T scrollRect, bool horizontal) where T : ScrollRect
		{
			((ScrollRect)scrollRect).horizontal = horizontal;
			return scrollRect;
		}

		public static T SetVertical<T>(this T scrollRect, bool vertical) where T : ScrollRect
		{
			((ScrollRect)scrollRect).vertical = vertical;
			return scrollRect;
		}

		public static T SetMovementType<T>(this T scrollRect, MovementType movementType) where T : ScrollRect
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((ScrollRect)scrollRect).movementType = movementType;
			return scrollRect;
		}
	}
	public static class TextMeshProExtensions
	{
		public static T SetAlignment<T>(this T tmpText, TextAlignmentOptions alignment) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).alignment = alignment;
			return tmpText;
		}

		public static T SetColor<T>(this T tmpText, Color color) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)(object)tmpText).color = color;
			return tmpText;
		}

		public static T SetEnableAutoSizing<T>(this T tmpText, bool enableAutoSizing) where T : TMP_Text
		{
			((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing;
			return tmpText;
		}

		public static T SetFont<T>(this T tmpText, TMP_FontAsset font) where T : TMP_Text
		{
			((TMP_Text)tmpText).font = font;
			return tmpText;
		}

		public static T SetFontSize<T>(this T tmpText, float fontSize) where T : TMP_Text
		{
			((TMP_Text)tmpText).fontSize = fontSize;
			return tmpText;
		}

		public static T SetFontMaterial<T>(this T tmpText, Material fontMaterial) where T : TMP_Text
		{
			((TMP_Text)tmpText).fontMaterial = fontMaterial;
			return tmpText;
		}

		public static T SetMargin<T>(this T tmpText, Vector4 margin) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).margin = margin;
			return tmpText;
		}

		public static T SetOutlineColorProperty<T>(this T tmpText, Color color) where T : TMP_Text
		{
			//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)
			((TMP_Text)tmpText).outlineColor = Color32.op_Implicit(color);
			return tmpText;
		}

		public static T SetOutlineWidth<T>(this T tmpText, float outlineWidth) where T : TMP_Text
		{
			((TMP_Text)tmpText).outlineWidth = outlineWidth;
			return tmpText;
		}

		public static T SetOverflowMode<T>(this T tmpText, TextOverflowModes overflowMode) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).overflowMode = overflowMode;
			return tmpText;
		}

		public static T SetRichText<T>(this T tmpText, bool richText) where T : TMP_Text
		{
			((TMP_Text)tmpText).richText = richText;
			return tmpText;
		}

		public static T SetTextWrappingMode<T>(this T tmpText, TextWrappingModes textWrappingMode) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).textWrappingMode = textWrappingMode;
			return tmpText;
		}
	}
	public static class Texture2DExtensions
	{
		public static Texture2D SetName(this Texture2D texture, string name)
		{
			((Object)texture).name = name;
			return texture;
		}

		public static Texture2D SetWrapMode(this Texture2D texture, TextureWrapMode wrapMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Texture)texture).wrapMode = wrapMode;
			return texture;
		}

		public static Texture2D SetFilterMode(this Texture2D texture, FilterMode filterMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Texture)texture).filterMode = filterMode;
			return texture;
		}
	}
	public static class ToggleExtensions
	{
		public static T SetGraphic<T>(this T toggle, Graphic graphic) where T : Toggle
		{
			((Toggle)toggle).graphic = graphic;
			return toggle;
		}

		public static T SetToggleTransition<T>(this T toggle, ToggleTransition toggleTransition) where T : Toggle
		{
			//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)
			((Toggle)toggle).toggleTransition = toggleTransition;
			return toggle;
		}
	}
	public static class UIResources
	{
		public static readonly Dictionary<string, Sprite> SpriteCache = new Dictionary<string, Sprite>();

		public static Sprite GetSprite(string spriteName)
		{
			if (!SpriteCache.TryGetValue(spriteName, out var value))
			{
				value = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name == spriteName));
				SpriteCache[spriteName] = value;
			}
			return value;
		}
	}
}
namespace EulersRuler
{
	public static class PanelUtils
	{
		public static readonly Gradient HealthPercentGradient = CreateHealthPercentGradient();

		public static readonly Gradient StabilityPercentGradient = CreateStabilityPercentGradient();

		public static void CreatePanels(Hud hud)
		{
			HoverPiecePanel.CreatePanel(hud);
			PlacementGhostPanel.CreatePanel(hud);
		}

		public static void TogglePanels(bool toggleOn)
		{
			HoverPiecePanel.DestroyPanel();
			PlacementGhostPanel.DestroyPanel();
			if (toggleOn && Object.op_Implicit((Object)(object)Hud.m_instance))
			{
				CreatePanels(Hud.m_instance);
			}
		}

		public static IEnumerator UpdatePropertiesCoroutine()
		{
			WaitForSeconds waitInterval = new WaitForSeconds(0.25f);
			while (true)
			{
				yield return waitInterval;
				if (PluginConfig.IsModEnabled.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer))
				{
					HoverPiecePanel.UpdateProperties(Player.m_localPlayer.m_hoveringPiece, PluginConfig.HoverPiecePanelEnabledRows.Value);
					PlacementGhostPanel.UpdateProperties(Player.m_localPlayer.m_placementGhost, PluginConfig.PlacementGhostPanelEnabledRows.Value);
				}
			}
		}

		public static Gradient CreateHealthPercentGradient()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)239, (byte)83, (byte)80, byte.MaxValue)), 0.25f),
				new GradientColorKey(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)238, (byte)88, byte.MaxValue)), 0.5f),
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)156, (byte)204, (byte)101, byte.MaxValue)), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(1f, 1f)
			});
			return val;
		}

		public static Gradient CreateStabilityPercentGradient()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)239, (byte)83, (byte)80, byte.MaxValue)), 0.25f),
				new GradientColorKey(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)238, (byte)88, byte.MaxValue)), 0.5f),
				new GradientColorKey(Color32.op_Implicit(new Color32((byte)100, (byte)181, (byte)246, byte.MaxValue)), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(1f, 1f)
			});
			return val;
		}
	}
	[BepInPlugin("redseiko.valheim.eulersruler", "EulersRuler", "1.7.0")]
	public sealed class EulersRuler : BaseUnityPlugin
	{
		public const string PluginGUID = "redseiko.valheim.eulersruler";

		public const string PluginName = "EulersRuler";

		public const string PluginVersion = "1.7.0";

		private Harmony _harmony;

		private void Awake()
		{
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
			_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.eulersruler");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public static class PluginConfig
	{
		[Flags]
		public enum HoverPiecePanelRow
		{
			None = 0,
			Name = 1,
			Health = 2,
			Stability = 4,
			Euler = 8,
			Quaternion = 0x10,
			PieceName = 0x20
		}

		[Flags]
		public enum PlacementGhostPanelRow
		{
			None = 0,
			Name = 1,
			Euler = 2,
			Quaternion = 4,
			PieceName = 0x20
		}

		public static ConfigEntry<bool> IsModEnabled { get; private set; }

		public static ConfigEntry<Vector2> HoverPiecePanelPosition { get; private set; }

		public static ConfigEntry<HoverPiecePanelRow> HoverPiecePanelEnabledRows { get; private set; }

		public static ConfigEntry<int> HoverPiecePanelFontSize { get; private set; }

		public static ConfigEntry<bool> ShowHoverPieceHealthBar { get; private set; }

		public static ConfigEntry<Vector2> PlacementGhostPanelPosition { get; private set; }

		public static ConfigEntry<PlacementGhostPanelRow> PlacementGhostPanelEnabledRows { get; private set; }

		public static ConfigEntry<int> PlacementGhostPanelFontSize { get; private set; }

		public static void BindConfig(ConfigFile config)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod.");
			IsModEnabled.OnSettingChanged<bool>(PanelUtils.TogglePanels);
			HoverPiecePanelPosition = config.BindInOrder<Vector2>("HoverPiece.Panel", "hoverPiecePanelPosition", new Vector2(0f, 150f), "Position of the HoverPiece properties panel.");
			HoverPiecePanelPosition.OnSettingChanged((Action<Vector2>)HoverPiecePanel.SetPosition);
			HoverPiecePanelEnabledRows = config.BindInOrder("HoverPiece.Panel", "hoverPiecePanelEnabledRows", HoverPiecePanelRow.Name | HoverPiecePanelRow.Health | HoverPiecePanelRow.Stability, "Which rows to display on the HoverPiece properties panel.");
			HoverPiecePanelFontSize = config.BindInOrder("HoverPiece.Panel", "hoverPiecePanelFontSize", 18, "Font size for the HoverPiece properties panel.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(6, 32));
			HoverPiecePanelFontSize.OnSettingChanged<int>(HoverPiecePanel.SetFontSize);
			ShowHoverPieceHealthBar = config.BindInOrder("HoverPiece.HealthBar", "showHoverPieceHealthBar", defaultValue: true, "Show the vanilla hover piece HealthBar.");
			PlacementGhostPanelPosition = config.BindInOrder<Vector2>("PlacementGhost.Panel", "placementGhostPanelPosition", new Vector2(150f, 0f), "Position of the PlacementGhost properties panel.");
			PlacementGhostPanelPosition.OnSettingChanged((Action<Vector2>)PlacementGhostPanel.SetPosition);
			PlacementGhostPanelEnabledRows = config.BindInOrder("PlacementGhost.Panel", "placementGhostPanelEnabledRows", PlacementGhostPanelRow.Name | PlacementGhostPanelRow.Euler | PlacementGhostPanelRow.Quaternion, "Which rows to display on the PlacementGhost properties panel.");
			PlacementGhostPanelFontSize = config.BindInOrder("PlacementGhost.Panel", "placementGhostPanelFontSize", 18, "Font size for the PlacementGhost properties panel.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(6, 32));
			PlacementGhostPanelFontSize.OnSettingChanged<int>(PlacementGhostPanel.SetFontSize);
		}
	}
	[HarmonyPatch(typeof(Hud))]
	internal static class HudPatch
	{
		private static GameObject _pieceHealthRoot;

		private static GuiBar _pieceHealthBar;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void AwakePostfix(ref Hud __instance)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PanelUtils.CreatePanels(__instance);
			}
			_pieceHealthRoot = ((Component)__instance.m_pieceHealthRoot).gameObject;
			_pieceHealthBar = __instance.m_pieceHealthBar;
			((MonoBehaviour)__instance).StartCoroutine(PanelUtils.UpdatePropertiesCoroutine());
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateCrosshair")]
		private static void UpdateCrosshairPostfix(Hud __instance)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (PluginConfig.IsModEnabled.Value && _pieceHealthRoot.activeSelf)
			{
				if (PluginConfig.ShowHoverPieceHealthBar.Value)
				{
					_pieceHealthBar.SetColor(PanelUtils.HealthPercentGradient.Evaluate(_pieceHealthBar.m_value));
				}
				else
				{
					_pieceHealthRoot.SetActive(false);
				}
			}
		}
	}
	public static class HoverPiecePanel
	{
		private static TwoColumnPanel _hoverPiecePanel;

		private static TMP_Text _pieceNameTextLabel;

		private static TMP_Text _pieceNameTextValue;

		private static TMP_Text _pieceHealthTextLabel;

		private static TMP_Text _pieceHealthTextValue;

		private static TMP_Text _pieceStabilityTextLabel;

		private static TMP_Text _pieceStabilityTextValue;

		private static TMP_Text _pieceEulerTextLabel;

		private static TMP_Text _pieceEulerTextValue;

		private static TMP_Text _pieceQuaternionTextLabel;

		private static TMP_Text _pieceQuaternionTextValue;

		public static void CreatePanel(Hud hud)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			_hoverPiecePanel = new TwoColumnPanel(((Component)hud.m_crosshair).transform).AddPanelRow(out _pieceNameTextLabel, out _pieceNameTextValue).AddPanelRow(out _pieceHealthTextLabel, out _pieceHealthTextValue).AddPanelRow(out _pieceStabilityTextLabel, out _pieceStabilityTextValue)
				.AddPanelRow(out _pieceEulerTextLabel, out _pieceEulerTextValue)
				.AddPanelRow(out _pieceQuaternionTextLabel, out _pieceQuaternionTextValue)
				.SetPosition(PluginConfig.HoverPiecePanelPosition.Value)
				.SetAnchors(new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f))
				.SetFontSize(PluginConfig.HoverPiecePanelFontSize.Value);
			_pieceNameTextLabel.text = "Piece ◈";
			_pieceHealthTextLabel.text = "Health ♡";
			_pieceStabilityTextLabel.text = "Stability ☖";
			_pieceEulerTextLabel.text = "Euler ⦿";
			_pieceQuaternionTextLabel.text = "Quaternion ⌘";
		}

		public static void DestroyPanel()
		{
			_hoverPiecePanel?.DestroyPanel();
		}

		public static void SetPosition(Vector2 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			_hoverPiecePanel?.SetPosition(position);
		}

		public static void SetFontSize(int fontSize)
		{
			_hoverPiecePanel?.SetFontSize(fontSize);
		}

		public static void UpdateProperties(Piece piece, PluginConfig.HoverPiecePanelRow enabledRows)
		{
			if (Object.op_Implicit((Object)(object)_hoverPiecePanel?.Panel))
			{
				WearNTear wearNTear = default(WearNTear);
				if (!Object.op_Implicit((Object)(object)piece) || !Object.op_Implicit((Object)(object)piece.m_nview) || !piece.m_nview.IsValid() || !((Component)piece).TryGetComponent<WearNTear>(ref wearNTear))
				{
					_hoverPiecePanel?.SetActive(active: false);
					return;
				}
				_hoverPiecePanel.SetActive(active: true);
				UpdateHoverPieceNameRow(piece, enabledRows.HasFlag(PluginConfig.HoverPiecePanelRow.Name), enabledRows.HasFlag(PluginConfig.HoverPiecePanelRow.PieceName));
				UpdateHoverPieceHealthRow(wearNTear, enabledRows.HasFlag(PluginConfig.HoverPiecePanelRow.Health));
				UpdateHoverPieceStabilityRow(wearNTear, enabledRows.HasFlag(PluginConfig.HoverPiecePanelRow.Stability));
				UpdateHoverPieceEulerRow(wearNTear, enabledRows.HasFlag(PluginConfig.HoverPiecePanelRow.Euler));
				UpdateHoverPieceQuaternionRow(wearNTear, enabledRows.HasFlag(PluginConfig.HoverPiecePanelRow.Quaternion));
			}
		}

		private static void UpdateHoverPieceNameRow(Piece piece, bool isRowEnabled, bool isPieceNameEnabled)
		{
			((Component)_pieceNameTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_pieceNameTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				_pieceNameTextValue.text = "<color=#FFCA28>" + Localization.instance.Localize(piece.m_name) + "</color>";
				if (isPieceNameEnabled)
				{
					TMP_Text pieceNameTextValue = _pieceNameTextValue;
					pieceNameTextValue.text = pieceNameTextValue.text + " (<color=#FFCA28>" + Utils.GetPrefabName(((Component)piece).gameObject) + "</color>)";
				}
			}
		}

		private static void UpdateHoverPieceHealthRow(WearNTear wearNTear, bool isRowEnabled)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			((Component)_pieceHealthTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_pieceHealthTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				float @float = wearNTear.m_nview.m_zdo.GetFloat(ZDOVars.s_health, wearNTear.m_health);
				float num = Mathf.Clamp01(@float / wearNTear.m_health);
				_pieceHealthTextValue.text = string.Format("<color=#{0}>{1}</color> /<color={2}>{3}</color> (<color=#{0}>{4:0%}</color>)", ColorUtility.ToHtmlStringRGB(PanelUtils.HealthPercentGradient.Evaluate(num)), ((double)Mathf.Abs(@float) > 1000000000.0) ? @float.ToString("G5") : @float.ToString("N0"), "#FAFAFA", wearNTear.m_health, num);
			}
		}

		private static void UpdateHoverPieceStabilityRow(WearNTear wearNTear, bool isRowEnabled)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			((Component)_pieceStabilityTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_pieceStabilityTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				float support = wearNTear.GetSupport();
				float maxSupport = wearNTear.GetMaxSupport();
				float num = Mathf.Clamp01(support / maxSupport);
				_pieceStabilityTextValue.text = string.Format("<color=#{0}>{1:N0}</color> /<color={2}>{3}</color> (<color=#{0}>{4:0%}</color>)", ColorUtility.ToHtmlStringRGB(PanelUtils.StabilityPercentGradient.Evaluate(num)), support, "#FAFAFA", maxSupport, num);
			}
		}

		private static void UpdateHoverPieceEulerRow(WearNTear wearNTear, bool isRowEnabled)
		{
			//IL_0033: 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)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			((Component)_pieceEulerTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_pieceEulerTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				TMP_Text pieceEulerTextValue = _pieceEulerTextValue;
				Quaternion rotation = ((Component)wearNTear).transform.rotation;
				pieceEulerTextValue.text = $"<color=#CFD8DC>{((Quaternion)(ref rotation)).eulerAngles}</color>";
			}
		}

		private static void UpdateHoverPieceQuaternionRow(WearNTear wearNTear, bool isRowEnabled)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			((Component)_pieceQuaternionTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_pieceQuaternionTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				_pieceQuaternionTextValue.text = $"<color=#D7CCC8>{((Component)wearNTear).transform.rotation:N2}</color>";
			}
		}
	}
	public static class PlacementGhostPanel
	{
		private static TwoColumnPanel _placementGhostPanel;

		private static TMP_Text _placementGhostNameTextLabel;

		private static TMP_Text _placementGhostNameTextValue;

		private static TMP_Text _placementGhostEulerTextLabel;

		private static TMP_Text _placementGhostEulerTextValue;

		private static TMP_Text _placementGhostQuaternionTextLabel;

		private static TMP_Text _placementGhostQuaternionTextValue;

		public static void CreatePanel(Hud hud)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			_placementGhostPanel = new TwoColumnPanel(((Component)hud.m_crosshair).transform).AddPanelRow(out _placementGhostNameTextLabel, out _placementGhostNameTextValue).AddPanelRow(out _placementGhostEulerTextLabel, out _placementGhostEulerTextValue).AddPanelRow(out _placementGhostQuaternionTextLabel, out _placementGhostQuaternionTextValue)
				.SetPosition(PluginConfig.PlacementGhostPanelPosition.Value)
				.SetAnchors(new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f))
				.SetFontSize(PluginConfig.PlacementGhostPanelFontSize.Value);
			_placementGhostNameTextLabel.text = "Placing ▥";
			_placementGhostEulerTextLabel.text = "Euler ⦿";
			_placementGhostQuaternionTextLabel.text = "Quaternion ⌘";
		}

		public static void DestroyPanel()
		{
			_placementGhostPanel?.DestroyPanel();
		}

		public static void SetPosition(Vector2 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			_placementGhostPanel?.SetPosition(position);
		}

		public static void SetFontSize(int fontSize)
		{
			_placementGhostPanel?.SetFontSize(fontSize);
		}

		public static void UpdateProperties(GameObject placementGhost, PluginConfig.PlacementGhostPanelRow enabledRows)
		{
			if (Object.op_Implicit((Object)(object)_placementGhostPanel?.Panel))
			{
				Piece piece = default(Piece);
				if (!Object.op_Implicit((Object)(object)placementGhost) || enabledRows == PluginConfig.PlacementGhostPanelRow.None || !placementGhost.TryGetComponent<Piece>(ref piece))
				{
					_placementGhostPanel?.SetActive(active: false);
					return;
				}
				_placementGhostPanel.SetActive(active: true);
				UpdatePlacementGhostNameRow(piece, enabledRows.HasFlag(PluginConfig.PlacementGhostPanelRow.Name), enabledRows.HasFlag(PluginConfig.PlacementGhostPanelRow.PieceName));
				UpdatePlacementGhostEulerRow(placementGhost, enabledRows.HasFlag(PluginConfig.PlacementGhostPanelRow.Euler));
				UpdatePlacementGhostQuaternionRow(placementGhost, enabledRows.HasFlag(PluginConfig.PlacementGhostPanelRow.Quaternion));
			}
		}

		private static void UpdatePlacementGhostNameRow(Piece piece, bool isRowEnabled, bool isPieceNameEnabled)
		{
			((Component)_placementGhostNameTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_placementGhostNameTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				_placementGhostNameTextValue.text = "<color=#FFCA28>" + Localization.instance.Localize(piece.m_name) + "</color>";
				if (isPieceNameEnabled)
				{
					TMP_Text placementGhostNameTextValue = _placementGhostNameTextValue;
					placementGhostNameTextValue.text = placementGhostNameTextValue.text + " (<color=#FFCA28>" + Utils.GetPrefabName(((Component)piece).gameObject) + "</color>)";
				}
			}
		}

		private static void UpdatePlacementGhostEulerRow(GameObject placementGhost, bool isRowEnabled)
		{
			//IL_0033: 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)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			((Component)_placementGhostEulerTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_placementGhostEulerTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				TMP_Text placementGhostEulerTextValue = _placementGhostEulerTextValue;
				Quaternion rotation = placementGhost.transform.rotation;
				placementGhostEulerTextValue.text = $"<color=#CFD8DC>{((Quaternion)(ref rotation)).eulerAngles}</color>";
			}
		}

		private static void UpdatePlacementGhostQuaternionRow(GameObject placementGhost, bool isRowEnabled)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			((Component)_placementGhostQuaternionTextLabel).gameObject.SetActive(isRowEnabled);
			((Component)_placementGhostQuaternionTextValue).gameObject.SetActive(isRowEnabled);
			if (isRowEnabled)
			{
				_placementGhostQuaternionTextValue.text = $"<color=#D7CCC8>{placementGhost.transform.rotation:N2}</color>";
			}
		}
	}
	public class TwoColumnPanel
	{
		private int _textFontSize = 18;

		private GameObject _leftColumn;

		private GameObject _rightColumn;

		public GameObject Panel { get; private set; }

		internal TwoColumnPanel(Transform parent)
		{
			CreatePanel(parent);
		}

		internal void DestroyPanel()
		{
			Object.Destroy((Object)(object)Panel);
		}

		internal void SetActive(bool active)
		{
			if (Object.op_Implicit((Object)(object)Panel) && Panel.activeSelf != active)
			{
				Panel.SetActive(active);
			}
		}

		internal TwoColumnPanel SetPosition(Vector2 position)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Panel.GetComponent<RectTransform>().anchoredPosition = position;
			return this;
		}

		internal TwoColumnPanel SetAnchors(Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
		{
			//IL_000c: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = Panel.GetComponent<RectTransform>();
			component.anchorMin = anchorMin;
			component.anchorMax = anchorMax;
			component.pivot = pivot;
			return this;
		}

		public TwoColumnPanel SetFontSize(int fontSize)
		{
			_textFontSize = fontSize;
			TMP_Text[] componentsInChildren = Panel.GetComponentsInChildren<TMP_Text>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				SetFontSize(componentsInChildren[i], fontSize);
			}
			return this;
		}

		private static void SetFontSize(TMP_Text label, int fontSize)
		{
			//IL_0014: 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)
			label.fontSize = fontSize;
			label.rectTransform.sizeDelta = label.GetPreferredValues("123") + new Vector2(0f, 4f);
		}

		private void CreatePanel(Transform parent)
		{
			//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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			Panel = new GameObject("TwoColumnPanel", new Type[1] { typeof(RectTransform) });
			Panel.transform.SetParent(parent, false);
			Panel.GetComponent<RectTransform>().SetSizeDelta(Vector2.zero);
			Panel.AddComponent<HorizontalLayoutGroup>().SetSpacing<HorizontalLayoutGroup>(6f).SetChildAlignment<HorizontalLayoutGroup>((TextAnchor)1);
			Panel.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2);
			_leftColumn = new GameObject("LeftColumn", new Type[1] { typeof(RectTransform) });
			_leftColumn.transform.SetParent(Panel.transform, false);
			_leftColumn.GetComponent<RectTransform>().SetSizeDelta(Vector2.zero);
			_leftColumn.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)false).SetChildForceExpand<VerticalLayoutGroup>((bool?)true, (bool?)false)
				.SetChildAlignment<VerticalLayoutGroup>((TextAnchor)3)
				.SetSpacing<VerticalLayoutGroup>(6f);
			_leftColumn.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2);
			_rightColumn = new GameObject("RightColumn", new Type[1] { typeof(RectTransform) });
			_rightColumn.transform.SetParent(Panel.transform, false);
			_rightColumn.GetComponent<RectTransform>().SetSizeDelta(Vector2.zero);
			_rightColumn.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)false).SetChildForceExpand<VerticalLayoutGroup>((bool?)true, (bool?)false)
				.SetChildAlignment<VerticalLayoutGroup>((TextAnchor)3)
				.SetSpacing<VerticalLayoutGroup>(6f);
			_rightColumn.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2);
		}

		public TwoColumnPanel AddPanelRow(out TMP_Text leftText, out TMP_Text rightText)
		{
			leftText = (TMP_Text)(object)UIBuilder.CreateTMPLabel(_leftColumn.transform);
			((Object)leftText).name = "LeftText";
			leftText.alignment = (TextAlignmentOptions)516;
			SetFontSize(leftText, _textFontSize);
			rightText = (TMP_Text)(object)UIBuilder.CreateTMPLabel(_rightColumn.transform);
			((Object)rightText).name = "RightText";
			rightText.alignment = (TextAlignmentOptions)513;
			SetFontSize(rightText, _textFontSize);
			return this;
		}
	}
}