Decompiled source of UIManager v1.0.0

plugins/UIManager.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UIManager.Menus;
using UIManager.Properties;
using UIManager.Snapping;
using UIManager.UI;
using UIManager.UI.ContextPanels;
using UIManager.UI.ContextPanels.ListPanels;
using UIManager.UI.ContextPanels.Properties;
using UIManager.UI.ContextPanels.SimplePanels;
using UIManager.UI.Layouts;
using UIManager.UI.Layouts.Controls;
using UIManager.UI.Utils;
using UIManager.Utils;
using UIManager.Utils.Configs;
using UnboundLib;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UIManager
{
	public class UIFocusHandler : MonoBehaviour
	{
		private GraphicRaycaster raycaster;

		private EventSystem eventSystem;

		private int selectedUIElementID = -1;

		public static UIFocusHandler Instance { get; private set; }

		private void Start()
		{
			Instance = this;
			raycaster = ((Component)this).GetComponent<GraphicRaycaster>();
			eventSystem = EventSystem.current;
		}

		private void Update()
		{
			//IL_001f: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_006e: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)323) || Input.GetKeyDown((KeyCode)324))
			{
				ClickForFocus(new PointerEventData(eventSystem)
				{
					position = Vector2.op_Implicit(Input.mousePosition)
				}, Input.GetKeyDown((KeyCode)324));
			}
			if (!InputManager.IsSetup)
			{
				return;
			}
			for (int i = 0; i < InputManager.ActiveDevices.Count; i++)
			{
				InputDevice val = InputManager.ActiveDevices[i];
				if ((val.AnyButtonWasPressed || Mathf.Abs(val.LeftStick.Value.y) > 0.1f) && !EventSystem.current.currentSelectedGameObject.activeInHierarchy)
				{
					if (UIRegistry.Instance.UIElements.Count > 0)
					{
						int num = ((val.LeftStick.Value.y > 0.1f) ? 1 : ((val.LeftStick.Value.y < -0.1f) ? (-1) : 0));
						selectedUIElementID = (selectedUIElementID + num + UIRegistry.Instance.LayoutPanels.Count) % UIRegistry.Instance.LayoutPanels.Count;
						UILayoutPanel uILayoutPanel = UIRegistry.Instance.LayoutPanels.Values.ToArray()[selectedUIElementID];
						UIRegistry.Instance.FocusUIElement = uILayoutPanel.Info;
						LoggerUtils.LogInfo("Focused UI Element: " + (UIRegistry.Instance.FocusUIElement?.PanelID ?? "None"));
					}
					else
					{
						UIRegistry.Instance.FocusUIElement = null;
						selectedUIElementID = -1;
						LoggerUtils.LogInfo("Focused UI Element: None");
					}
				}
			}
		}

		private void ClickForFocus(PointerEventData pointerData, bool openContextMenu)
		{
			//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)
			List<RaycastResult> list = new List<RaycastResult>();
			((BaseRaycaster)raycaster).Raycast(pointerData, list);
			UILayoutPanel uILayoutPanel = null;
			foreach (RaycastResult item in list)
			{
				RaycastResult current = item;
				UILayoutPanel componentInParent = ((RaycastResult)(ref current)).gameObject.GetComponentInParent<UILayoutPanel>();
				ContextPanel componentInParent2 = ((RaycastResult)(ref current)).gameObject.GetComponentInParent<ContextPanel>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					uILayoutPanel = componentInParent;
					break;
				}
				if ((Object)(object)componentInParent2 != (Object)null)
				{
					List<ContextPanel> connectingContextPanels = componentInParent2.GetConnectingContextPanels();
					connectingContextPanels.Add(componentInParent2);
					ContextPanel[] array = ContextPanelManager.Instance.ActiveContextPanels.Except(connectingContextPanels).ToArray();
					foreach (ContextPanel contextPanel in array)
					{
						ContextPanelManager.Instance.Hide(contextPanel);
					}
					uILayoutPanel = componentInParent2.ParentRootPanel;
					break;
				}
			}
			if ((Object)(object)uILayoutPanel == (Object)null)
			{
				ContextPanelManager.Instance.HideAll();
			}
			else if (openContextMenu && uILayoutPanel.Info.DisplayMode == DisplayMode.Layout)
			{
				ContextListPanel contextPanel2 = ContextListPanelFactory.Instance.ContextListPanels[uILayoutPanel.Info.PanelID];
				ContextPanelManager.Instance.SpawnFor(uILayoutPanel, contextPanel2);
			}
			UIRegistry.Instance.FocusUIElement = uILayoutPanel?.Info;
			LoggerUtils.LogInfo("Focused UI Element: " + (UIRegistry.Instance.FocusUIElement?.PanelID ?? "None"));
		}
	}
	public class UILayoutHandler : MonoBehaviour
	{
		[Header("Layout Panel Creation")]
		public GameObject UILayoutPanelPrefab;

		public float UILayoutPanelPadding = 5f;

		[Header("Snapping")]
		public float PanelSnapDistance = 10f;

		public int ScreenSnappingRectAmount = 3;

		public float ScreenSnappingRectSpacing = 10f;

		public int PanelSnappingRectAmount = 3;

		public float PanelSnappingRectSpacing = 10f;

		[Header("References")]
		public RectTransform UIHolder;

		private Queue<UILayoutPanel> LoadLayoutQueue = new Queue<UILayoutPanel>();

		public static UILayoutHandler Instance { get; private set; }

		public UISnappingController SnappingController { get; private set; }

		private void Awake()
		{
			Instance = this;
			SnappingController = new UISnappingController(UIHolder, new UISnappingController.SnappingOption(PanelSnapDistance, ScreenSnappingRectAmount, ScreenSnappingRectSpacing, PanelSnappingRectAmount, PanelSnappingRectSpacing));
		}

		private void Start()
		{
			UIRegistry.Instance.ClearLayoutPanels();
			foreach (UIPanelInfo uIPanelPrefab in UIRegistry.Instance.UIPanelPrefabs)
			{
				UILayoutPanel uILayoutPanel = CreateUILayoutPanel(uIPanelPrefab);
				UIRegistry.Instance.AddLayoutPanel(uILayoutPanel);
				UIRegistry.Instance.PrefabToInstanceMap.Add(uIPanelPrefab, uILayoutPanel.Info);
			}
			if (Application.isEditor)
			{
				LoggerUtils.LogInfo("UILayoutController initialized in Editor mode. DisplayMode of all panels set to Layout.");
				{
					foreach (UILayoutPanel value in UIRegistry.Instance.LayoutPanels.Values)
					{
						value.Info.DisplayMode = DisplayMode.Layout;
					}
					return;
				}
			}
			LoggerUtils.LogInfo("UILayoutController initialized in Play mode.");
		}

		private void Update()
		{
			while (LoadLayoutQueue.Count > 0)
			{
				LoadLayoutQueue.Dequeue().LoadUILayout();
			}
		}

		public UILayoutPanel CreateUILayoutPanel(UIPanelInfo info)
		{
			//IL_0042: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005e: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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)
			GameObject val = Object.Instantiate<GameObject>(UILayoutPanelPrefab, ((Component)UIHolder).transform);
			GameObject obj = Object.Instantiate<GameObject>(((Component)info).gameObject, val.transform);
			obj.transform.SetAsFirstSibling();
			RectTransform component = val.GetComponent<RectTransform>();
			RectTransform component2 = obj.GetComponent<RectTransform>();
			Rect rect = component2.rect;
			Vector2 size = ((Rect)(ref rect)).size;
			component.sizeDelta = size + Vector2.one * UILayoutPanelPadding * 2f;
			if (info.ResizeMode != ResizeMode.ResizeWithContent)
			{
				component2.anchorMin = Vector2.zero;
				component2.anchorMax = Vector2.one;
				component2.offsetMin = new Vector2(UILayoutPanelPadding, UILayoutPanelPadding);
				component2.offsetMax = new Vector2(0f - UILayoutPanelPadding, 0f - UILayoutPanelPadding);
				((Transform)component2).localScale = Vector3.one;
			}
			else
			{
				component2.anchorMin = new Vector2(0.5f, 0.5f);
				component2.anchorMax = new Vector2(0.5f, 0.5f);
			}
			component2.anchoredPosition = Vector2.zero;
			component2.pivot = new Vector2(0.5f, 0.5f);
			RectTransform component3 = ((Component)info).GetComponent<RectTransform>();
			component.anchorMin = component3.anchorMin;
			component.anchorMax = component3.anchorMax;
			component.anchoredPosition = component3.anchoredPosition;
			UILayoutPanel component4 = val.GetComponent<UILayoutPanel>();
			UIPanelInfo component5 = obj.GetComponent<UIPanelInfo>();
			component4.MainContent = component2;
			component4.Initialize(component5);
			val.SetActive(false);
			LoggerUtils.LogInfo("Created UILayoutPanel for " + info.PanelID);
			LoadLayoutQueue.Enqueue(component4);
			return component4;
		}

		private Rect GetInsetRect(Rect rect, float insertSize)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			((Rect)(ref rect)).xMin = ((Rect)(ref rect)).xMin + insertSize;
			((Rect)(ref rect)).xMax = ((Rect)(ref rect)).xMax - insertSize;
			((Rect)(ref rect)).yMin = ((Rect)(ref rect)).yMin + insertSize;
			((Rect)(ref rect)).yMax = ((Rect)(ref rect)).yMax - insertSize;
			return rect;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("net.aalund13.rounds.uimanager", "UI Manager", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class Main : BaseUnityPlugin
	{
		internal const string ModId = "net.aalund13.rounds.uimanager";

		internal const string ModName = "UI Manager";

		internal const string Version = "1.0.0";

		public const bool DEBUG = false;

		public static ManualLogSource ModLogger { get; private set; }

		public static AssetBundle Assets { get; private set; }

		public static Main Instance { get; private set; }

		public static bool InGame { get; private set; }

		public static bool MyPlayerSpawned { get; set; }

		private void Awake()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			ModLogger = ((BaseUnityPlugin)this).Logger;
			((Component)this).gameObject.AddComponent<UIRegistry>();
			Assets = AssetUtils.LoadAssetBundleFromResources("ui_manager_assets", typeof(Main).Assembly);
			new Harmony("net.aalund13.rounds.uimanager").PatchAll();
			SceneManager.sceneLoaded += CreateCanvas;
			Unbound.RegisterClientSideMod("net.aalund13.rounds.uimanager");
		}

		private void CreateCanvas(Scene scene, LoadSceneMode mode)
		{
			if (!((Object)(object)UILayoutHandler.Instance != (Object)null))
			{
				GameObject obj = Object.Instantiate<GameObject>(Assets.LoadAsset<GameObject>("UI Manager Canvas"), GameObject.Find("Game/UI/UI_Game/Canvas").transform);
				obj.GetComponent<Canvas>().overrideSorting = true;
				obj.GetComponent<Canvas>().sortingLayerName = "MostFront";
				LoggerUtils.LogInfo("Created UI Manager Canvas.");
			}
		}
	}
	[DefaultExecutionOrder(100)]
	public class UIPanelRegistrar : MonoBehaviour
	{
		public List<UIPanelInfo> UIPanelsPrefabs = new List<UIPanelInfo>();

		private void Awake()
		{
			if (Application.isEditor)
			{
				Register();
			}
		}

		public void Register()
		{
			foreach (UIPanelInfo uIPanelsPrefab in UIPanelsPrefabs)
			{
				if (!((Object)(object)uIPanelsPrefab == (Object)null))
				{
					UIRegistry.Instance.RegsiterUIElement(uIPanelsPrefab);
					UIRegistry.Instance.PrefabPanelsShownInLayoutMenu.Add(uIPanelsPrefab);
					LoggerUtils.LogInfo("Registered UI Panel: " + uIPanelsPrefab.PanelID);
				}
			}
		}

		public UILayoutPanel GetLayoutPanel(string panelID)
		{
			return UIRegistry.Instance.GetLayoutPanel(panelID);
		}

		public UIPanelInfo GetPanelInfo(string panelID)
		{
			return UIPanelsPrefabs.Find((UIPanelInfo p) => p.PanelID == panelID);
		}
	}
	public class UIRegistry : MonoBehaviour
	{
		public List<UIPanelInfo> UIPanelPrefabs = new List<UIPanelInfo>();

		public List<UIPanelInfo> PrefabPanelsShownInLayoutMenu = new List<UIPanelInfo>();

		public Dictionary<UIPanelInfo, UIPanelInfo> PrefabToInstanceMap = new Dictionary<UIPanelInfo, UIPanelInfo>();

		public Dictionary<UIPanelInfo, RectTransform> UIElements = new Dictionary<UIPanelInfo, RectTransform>();

		public Dictionary<UIPanelInfo, UILayoutPanel> LayoutPanels = new Dictionary<UIPanelInfo, UILayoutPanel>();

		private UIPanelInfo focusUIElement;

		public static UIRegistry Instance { get; private set; }

		public UIPanelInfo FocusUIElement
		{
			get
			{
				return focusUIElement;
			}
			set
			{
				if (!((Object)(object)focusUIElement == (Object)(object)value))
				{
					if ((Object)(object)focusUIElement != (Object)null)
					{
						focusUIElement.OnUnfocus?.Invoke();
					}
					focusUIElement = value;
					if ((Object)(object)focusUIElement != (Object)null)
					{
						focusUIElement.OnFocus?.Invoke();
					}
				}
			}
		}

		private void Awake()
		{
			Instance = this;
		}

		internal void AddLayoutPanel(UILayoutPanel handler)
		{
			RectTransform component = ((Component)handler).GetComponent<RectTransform>();
			if (UIElements.ContainsKey(handler.Info))
			{
				UIElements[handler.Info] = component;
			}
			else
			{
				UIElements.Add(handler.Info, component);
			}
			if (LayoutPanels.ContainsKey(handler.Info))
			{
				LayoutPanels[handler.Info] = handler;
			}
			else
			{
				LayoutPanels.Add(handler.Info, handler);
			}
		}

		internal void ClearLayoutPanels()
		{
			UIElements.Clear();
			LayoutPanels.Clear();
			PrefabToInstanceMap.Clear();
		}

		public void RegsiterUIElement(UIPanelInfo handler)
		{
			UIPanelPrefabs.Add(handler);
		}

		public List<UILayoutPanel> GetCurrentMenuPanels()
		{
			return LayoutPanels.Values.Where((UILayoutPanel x) => x.Info.DisplayMode != DisplayMode.Hidden).ToList();
		}

		public UIPanelInfo GetUIElement(string parentPanelID)
		{
			return UIElements.Keys.Where((UIPanelInfo x) => x.PanelID == parentPanelID).FirstOrDefault();
		}

		public UILayoutPanel GetLayoutPanel(string parentPanelID)
		{
			return (from x in LayoutPanels.Keys
				where x.PanelID == parentPanelID
				select LayoutPanels[x]).FirstOrDefault();
		}

		public UIPanelInfo GetPanelPrefeb(UIPanelInfo instance)
		{
			if (PrefabToInstanceMap.Any((KeyValuePair<UIPanelInfo, UIPanelInfo> prefeb) => (Object)(object)prefeb.Value == (Object)(object)instance))
			{
				return PrefabToInstanceMap.FirstOrDefault((KeyValuePair<UIPanelInfo, UIPanelInfo> prefeb) => (Object)(object)prefeb.Value == (Object)(object)instance).Key;
			}
			return null;
		}

		public UIPanelInfo GetPanelInstance(UIPanelInfo prefab)
		{
			if (PrefabToInstanceMap.TryGetValue(prefab, out var value))
			{
				return value;
			}
			return null;
		}
	}
}
namespace UIManager.Utils
{
	public enum Axis
	{
		Horizontal,
		Vertical
	}
	public static class AxisUtils
	{
		public static Axis GetOrthogonalAxis(Axis axis)
		{
			if (axis != 0)
			{
				return Axis.Horizontal;
			}
			return Axis.Vertical;
		}

		public static Axis GetAxisFromDirection(Direction direction)
		{
			if (DirectionUtils.IsHorizontal(direction))
			{
				return Axis.Horizontal;
			}
			return Axis.Vertical;
		}
	}
	public enum Direction
	{
		Left,
		Right,
		Top,
		Bottom,
		TopLeft,
		TopRight,
		BottomLeft,
		BottomRight
	}
	public static class DirectionUtils
	{
		public static Direction GetOppositeDirection(Direction direction)
		{
			return direction switch
			{
				Direction.Left => Direction.Right, 
				Direction.Right => Direction.Left, 
				Direction.Top => Direction.Bottom, 
				Direction.Bottom => Direction.Top, 
				Direction.TopLeft => Direction.BottomRight, 
				Direction.TopRight => Direction.BottomLeft, 
				Direction.BottomLeft => Direction.TopRight, 
				Direction.BottomRight => Direction.TopLeft, 
				_ => throw new ArgumentOutOfRangeException("direction", direction, null), 
			};
		}

		public static bool IsLeftEdge(Direction dir)
		{
			if (dir != 0 && dir != Direction.TopLeft)
			{
				return dir == Direction.BottomLeft;
			}
			return true;
		}

		public static bool IsRightEdge(Direction dir)
		{
			if (dir != Direction.Right && dir != Direction.TopRight)
			{
				return dir == Direction.BottomRight;
			}
			return true;
		}

		public static bool IsTopEdge(Direction dir)
		{
			if (dir != Direction.Top && dir != Direction.TopLeft)
			{
				return dir == Direction.TopRight;
			}
			return true;
		}

		public static bool IsBottomEdge(Direction dir)
		{
			if (dir != Direction.Bottom && dir != Direction.BottomLeft)
			{
				return dir == Direction.BottomRight;
			}
			return true;
		}

		public static bool IsHorizontal(Direction direction)
		{
			if (direction != 0 && direction != Direction.Right && direction != Direction.TopLeft && direction != Direction.TopRight && direction != Direction.BottomLeft)
			{
				return direction == Direction.BottomRight;
			}
			return true;
		}

		public static bool IsVertical(Direction direction)
		{
			if (direction != Direction.Top && direction != Direction.Bottom && direction != Direction.TopLeft && direction != Direction.TopRight && direction != Direction.BottomLeft)
			{
				return direction == Direction.BottomRight;
			}
			return true;
		}

		public static bool IsCorner(Direction direction)
		{
			if (direction != Direction.TopLeft && direction != Direction.TopRight && direction != Direction.BottomLeft)
			{
				return direction == Direction.BottomRight;
			}
			return true;
		}
	}
	internal static class HashCode
	{
		public static int Combine(params object[] values)
		{
			int num = 17;
			foreach (object obj in values)
			{
				num = num * 31 + obj.GetHashCode();
			}
			return num;
		}
	}
	internal static class LoggerUtils
	{
		public static void LogInfo(string message)
		{
		}

		public static void LogWarning(string message)
		{
			string name = new StackFrame(1).GetMethod().DeclaringType.Name;
			if (Main.ModLogger != null)
			{
				Main.ModLogger.LogWarning((object)("[" + name + "] " + message));
			}
			else
			{
				Debug.LogWarning((object)("[" + name + "] " + message));
			}
		}

		public static void LogError(string message)
		{
			string name = new StackFrame(1).GetMethod().DeclaringType.Name;
			if (Main.ModLogger != null)
			{
				Main.ModLogger.LogError((object)("[" + name + "] " + message));
			}
			else
			{
				Debug.LogError((object)("[" + name + "] " + message));
			}
		}
	}
	[Flags]
	public enum AnchorPoint
	{
		Middle = 0,
		Left = 1,
		Right = 2,
		Top = 4,
		Bottom = 8
	}
	public static class RectTranformUtils
	{
		public static (Vector2 min, Vector2 max) GetAnchorValue(AnchorPoint anchorPoint)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0010: 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 invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			Vector2 item = Vector2.one / 2f;
			Vector2 item2 = Vector2.one / 2f;
			if (anchorPoint.HasFlag(AnchorPoint.Left))
			{
				item.x = 0f;
				item2.x = 0f;
			}
			else if (anchorPoint.HasFlag(AnchorPoint.Right))
			{
				item.x = 1f;
				item2.x = 1f;
			}
			if (anchorPoint.HasFlag(AnchorPoint.Top))
			{
				item.y = 1f;
				item2.y = 1f;
			}
			else if (anchorPoint.HasFlag(AnchorPoint.Bottom))
			{
				item.y = 0f;
				item2.y = 0f;
			}
			return (item, item2);
		}

		public static AnchorPoint GetAnchorPoint(RectTransform rect)
		{
			//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_0008: 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_000e: 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_0024: 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)
			//IL_0050: 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)
			Vector2 anchorMin = rect.anchorMin;
			Vector2 anchorMax = rect.anchorMax;
			if (anchorMin != anchorMax)
			{
				throw new ArgumentException("RectTransform has stretched anchors; cannot determine a single anchor point.");
			}
			AnchorPoint anchorPoint = AnchorPoint.Middle;
			if (anchorMin.y == 1f)
			{
				anchorPoint |= AnchorPoint.Top;
				anchorPoint &= (AnchorPoint)(-1);
			}
			else if (anchorMin.y == 0f)
			{
				anchorPoint |= AnchorPoint.Bottom;
				anchorPoint &= (AnchorPoint)(-1);
			}
			if (anchorMin.x == 1f)
			{
				anchorPoint |= AnchorPoint.Right;
				anchorPoint &= (AnchorPoint)(-1);
			}
			else if (anchorMin.x == 0f)
			{
				anchorPoint |= AnchorPoint.Left;
				anchorPoint &= (AnchorPoint)(-1);
			}
			return anchorPoint;
		}

		public static Direction DirectionFromAnchor(AnchorPoint anchorPoint)
		{
			bool flag = anchorPoint.HasFlag(AnchorPoint.Left);
			bool flag2 = anchorPoint.HasFlag(AnchorPoint.Right);
			bool flag3 = anchorPoint.HasFlag(AnchorPoint.Top);
			bool flag4 = anchorPoint.HasFlag(AnchorPoint.Bottom);
			if (flag && flag3)
			{
				return Direction.TopLeft;
			}
			if (flag2 && flag3)
			{
				return Direction.TopRight;
			}
			if (flag && flag4)
			{
				return Direction.BottomLeft;
			}
			if (flag2 && flag4)
			{
				return Direction.BottomRight;
			}
			if (flag)
			{
				return Direction.Left;
			}
			if (flag2)
			{
				return Direction.Right;
			}
			if (flag3)
			{
				return Direction.Top;
			}
			if (flag4)
			{
				return Direction.Bottom;
			}
			throw new ArgumentException("Invalid AnchorPoint combination.");
		}

		public static AnchorPoint CombineAnchors(AnchorPoint first, AnchorPoint second)
		{
			AnchorPoint anchorPoint = AnchorPoint.Middle;
			if (first.HasFlag(AnchorPoint.Left) || second.HasFlag(AnchorPoint.Left))
			{
				anchorPoint |= AnchorPoint.Left;
				anchorPoint &= (AnchorPoint)(-1);
			}
			else if (first.HasFlag(AnchorPoint.Right) || second.HasFlag(AnchorPoint.Right))
			{
				anchorPoint |= AnchorPoint.Right;
				anchorPoint &= (AnchorPoint)(-1);
			}
			if (first.HasFlag(AnchorPoint.Top) || second.HasFlag(AnchorPoint.Top))
			{
				anchorPoint |= AnchorPoint.Top;
				anchorPoint &= (AnchorPoint)(-1);
			}
			else if (first.HasFlag(AnchorPoint.Bottom) || second.HasFlag(AnchorPoint.Bottom))
			{
				anchorPoint |= AnchorPoint.Bottom;
				anchorPoint &= (AnchorPoint)(-1);
			}
			return anchorPoint;
		}

		public static Rect GetWorldRect(RectTransform rectTransform)
		{
			//IL_0010: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			rectTransform.GetWorldCorners(array);
			Vector3 val = array[0];
			Vector3 val2 = array[2];
			return new Rect(val.x, val.y, val2.x - val.x, val2.y - val.y);
		}

		public static Rect GetScreenRect(RectTransform rectTransform, Camera cam)
		{
			//IL_0011: 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_001b: 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_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_002a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			rectTransform.GetWorldCorners(array);
			Vector2 val = RectTransformUtility.WorldToScreenPoint(cam, array[0]);
			Vector2 val2 = RectTransformUtility.WorldToScreenPoint(cam, array[2]);
			return new Rect(val, val2 - val);
		}

		public static (float DistanceToLeft, float DistanceToRight, float DistanceToTop, float DistanceToBottom) GetRectDistancesAbs(Rect firstRect, Rect secondRect)
		{
			float num = ((Rect)(ref firstRect)).xMin - ((Rect)(ref secondRect)).xMin;
			float num2 = ((Rect)(ref secondRect)).xMax - ((Rect)(ref firstRect)).xMax;
			float num3 = ((Rect)(ref firstRect)).yMin - ((Rect)(ref secondRect)).yMin;
			return new ValueTuple<float, float, float, float>(item3: Mathf.Abs(((Rect)(ref secondRect)).yMax - ((Rect)(ref firstRect)).yMax), item1: Mathf.Abs(num), item2: Mathf.Abs(num2), item4: Mathf.Abs(num3));
		}

		public static (float DistanceToLeft, float DistanceToRight, float DistanceToTop, float DistanceToBottom) GetRectDistances(Rect firstRect, Rect secondRect)
		{
			float item = ((Rect)(ref firstRect)).xMin - ((Rect)(ref secondRect)).xMin;
			float item2 = ((Rect)(ref secondRect)).xMax - ((Rect)(ref firstRect)).xMax;
			float item3 = ((Rect)(ref firstRect)).yMin - ((Rect)(ref secondRect)).yMin;
			float item4 = ((Rect)(ref secondRect)).yMax - ((Rect)(ref firstRect)).yMax;
			return (item, item2, item4, item3);
		}

		public static void SetSizeWithDirection(this RectTransform rectTransform, Vector2 size, Direction direction)
		{
			//IL_0000: 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_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_0017: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = size - rectTransform.sizeDelta;
			if (DirectionUtils.IsLeftEdge(direction))
			{
				val.x = size.x - rectTransform.sizeDelta.x;
			}
			else if (DirectionUtils.IsRightEdge(direction))
			{
				val.x = 0f - (size.x - rectTransform.sizeDelta.x);
			}
			else
			{
				val.x = 0f;
			}
			if (DirectionUtils.IsBottomEdge(direction))
			{
				val.y = size.y - rectTransform.sizeDelta.y;
			}
			else if (DirectionUtils.IsTopEdge(direction))
			{
				val.y = 0f - (size.y - rectTransform.sizeDelta.y);
			}
			else
			{
				val.y = 0f;
			}
			rectTransform.sizeDelta = size;
			rectTransform.anchoredPosition += new Vector2(val.x * 0.5f, val.y * 0.5f);
		}

		public static Rect GetRectInCanvasSpace(Camera camera, RectTransform canvas, RectTransform target)
		{
			//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_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_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_001f: 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_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)
			//IL_0036: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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: 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)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_005a: 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_0066: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = target.rect;
			Vector2 val = Vector2.op_Implicit(((Transform)target).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).center)));
			Vector2 val2 = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas, RectTransformUtility.WorldToScreenPoint(camera, Vector2.op_Implicit(val)), camera, ref val2);
			Vector2 val3 = val2;
			rect = target.rect;
			Vector2 val4 = ((Rect)(ref rect)).size * Vector2.op_Implicit(((Transform)target).localScale);
			Vector2 val5 = Vector2.Scale(val4, target.pivot);
			return new Rect(val3 - val5, val4);
		}

		public static Rect LocalRectToCanvasSpace(RectTransform parentRect, Rect localRect, RectTransform canvas)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4]
			{
				((Transform)parentRect).TransformPoint(new Vector3(((Rect)(ref localRect)).xMin, ((Rect)(ref localRect)).yMin)),
				((Transform)parentRect).TransformPoint(new Vector3(((Rect)(ref localRect)).xMin, ((Rect)(ref localRect)).yMax)),
				((Transform)parentRect).TransformPoint(new Vector3(((Rect)(ref localRect)).xMax, ((Rect)(ref localRect)).yMax)),
				((Transform)parentRect).TransformPoint(new Vector3(((Rect)(ref localRect)).xMax, ((Rect)(ref localRect)).yMin))
			};
			RectTransform component = ((Component)canvas).GetComponent<RectTransform>();
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(float.MaxValue, float.MaxValue);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(float.MinValue, float.MinValue);
			for (int i = 0; i < 4; i++)
			{
				Vector2 val3 = Vector2.op_Implicit(((Transform)component).InverseTransformPoint(array[i]));
				val = Vector2.Min(val, val3);
				val2 = Vector2.Max(val2, val3);
			}
			return new Rect(val, val2 - val);
		}
	}
}
namespace UIManager.Utils.Configs
{
	public abstract class GlobalConfig<T>
	{
		public readonly string Name;

		public readonly T DefaultValue;

		public Action<T> ValueChanged;

		private T _value;

		private bool _cache;

		public T Value
		{
			get
			{
				if (_cache)
				{
					return _value;
				}
				_value = Load();
				_cache = true;
				return _value;
			}
			set
			{
				_cache = true;
				_value = value;
				Save(value);
				ValueChanged?.Invoke(value);
			}
		}

		protected GlobalConfig(string name, T defaultValue)
		{
			Name = "net.aalund13.rounds.uimanager_" + name;
			DefaultValue = defaultValue;
		}

		protected abstract T Load();

		protected abstract void Save(T value);
	}
	public class ColorGlobleConfig : GlobalConfig<Color>
	{
		public ColorGlobleConfig(string name, Color defaultValue)
			: base(name, defaultValue)
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)


		protected override Color Load()
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			float @float = PlayerPrefs.GetFloat(Name + "_r", DefaultValue.r);
			float float2 = PlayerPrefs.GetFloat(Name + "_g", DefaultValue.g);
			float float3 = PlayerPrefs.GetFloat(Name + "_b", DefaultValue.b);
			float float4 = PlayerPrefs.GetFloat(Name + "_a", DefaultValue.a);
			return new Color(@float, float2, float3, float4);
		}

		protected override void Save(Color value)
		{
			//IL_0010: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			PlayerPrefs.SetFloat(Name + "_r", value.r);
			PlayerPrefs.SetFloat(Name + "_g", value.g);
			PlayerPrefs.SetFloat(Name + "_b", value.b);
			PlayerPrefs.SetFloat(Name + "_a", value.a);
		}
	}
	public class BoolGlobleConfig : GlobalConfig<bool>
	{
		public BoolGlobleConfig(string name, bool defaultValue)
			: base(name, defaultValue)
		{
		}

		protected override bool Load()
		{
			return PlayerPrefs.GetInt(Name, DefaultValue ? 1 : 0) == 1;
		}

		protected override void Save(bool value)
		{
			PlayerPrefs.SetInt(Name, value ? 1 : 0);
		}
	}
	public class IntGlobleConfig : GlobalConfig<int>
	{
		public IntGlobleConfig(string name, int defaultValue)
			: base(name, defaultValue)
		{
		}

		protected override int Load()
		{
			return PlayerPrefs.GetInt(Name, DefaultValue);
		}

		protected override void Save(int value)
		{
			PlayerPrefs.SetInt(Name, value);
		}
	}
	public class FloatGlobleConfig : GlobalConfig<float>
	{
		public FloatGlobleConfig(string name, float defaultValue)
			: base(name, defaultValue)
		{
		}

		protected override float Load()
		{
			return PlayerPrefs.GetFloat(Name, DefaultValue);
		}

		protected override void Save(float value)
		{
			PlayerPrefs.SetFloat(Name, value);
		}
	}
	public class EnumGlobleConfig<T> : GlobalConfig<T> where T : Enum
	{
		public EnumGlobleConfig(string name, T defaultValue)
			: base(name, defaultValue)
		{
		}

		protected override T Load()
		{
			if (!PlayerPrefs.HasKey(Name))
			{
				return DefaultValue;
			}
			int @int = PlayerPrefs.GetInt(Name);
			if (Enum.IsDefined(typeof(T), @int))
			{
				return (T)Enum.ToObject(typeof(T), @int);
			}
			return DefaultValue;
		}

		protected override void Save(T value)
		{
			PlayerPrefs.SetInt(Name, Convert.ToInt32(value));
		}
	}
}
namespace UIManager.UI
{
	public class OptionHolder : MonoBehaviour
	{
		public Transform Holder;
	}
	public enum DisplayMode
	{
		Hidden,
		Normal,
		Layout
	}
	public enum ResizeMode
	{
		None,
		Free,
		AspectRatio,
		ResizeWithContent
	}
	public struct UIPanelOptions
	{
		public string PanelID;

		public bool Draggable;

		public bool LockXAxis;

		public bool LockYAxis;

		public ResizeMode ResizeMode;

		public Vector2 MinSize;

		public Vector2 MaxSize;

		public UIPanelOptions(string panelID)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			PanelID = panelID;
			Draggable = true;
			LockXAxis = false;
			LockYAxis = false;
			ResizeMode = ResizeMode.Free;
			MinSize = new Vector2(100f, 100f);
			MaxSize = new Vector2(500f, 500f);
		}

		public static UIPanelOptions WithSizeLimits(string panelID, Vector2 minSize, Vector2 maxSize)
		{
			//IL_001a: 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_0022: 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)
			UIPanelOptions result = new UIPanelOptions(panelID);
			result.Draggable = true;
			result.ResizeMode = ResizeMode.Free;
			result.MinSize = minSize;
			result.MaxSize = maxSize;
			return result;
		}
	}
	[DisallowMultipleComponent]
	public class UIPanelInfo : MonoBehaviour
	{
		[Header("Panel Info")]
		[SerializeField]
		private string panelID;

		[Header("Drag Option")]
		[SerializeField]
		private bool draggable = true;

		[SerializeField]
		private bool lockXAxis;

		[SerializeField]
		private bool lockYAxis;

		[Header("Resize Option")]
		[SerializeField]
		private ResizeMode resizeMode = ResizeMode.Free;

		[SerializeField]
		private Vector2 minSize = new Vector2(100f, 100f);

		[SerializeField]
		private Vector2 maxSize = new Vector2(500f, 500f);

		public Action<DisplayMode> OnDisplayModeChnaged;

		public Action OnFocus;

		public Action OnUnfocus;

		internal bool isRegisteredInUIRegistry;

		private DisplayMode displayMode;

		public string PanelID => panelID;

		public bool Draggable => draggable;

		public bool LockXAxis => lockXAxis;

		public bool LockYAxis => lockYAxis;

		public ResizeMode ResizeMode => resizeMode;

		public Vector2 MinSize => minSize;

		public Vector2 MaxSize => maxSize;

		public bool Focus
		{
			get
			{
				return (Object)(object)UIRegistry.Instance.FocusUIElement == (Object)(object)this;
			}
			set
			{
				UIRegistry.Instance.FocusUIElement = (value ? this : null);
			}
		}

		public bool IsRegisteredInUIRegistry => isRegisteredInUIRegistry;

		public DisplayMode DisplayMode
		{
			get
			{
				return displayMode;
			}
			set
			{
				displayMode = value;
				OnDisplayModeChnaged?.Invoke(displayMode);
			}
		}

		public bool IsPrefeb => UIRegistry.Instance.UIPanelPrefabs.Contains(this);

		private void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0034: 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_004b: 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_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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (ResizeMode == ResizeMode.AspectRatio)
			{
				RectTransform component = ((Component)this).GetComponent<RectTransform>();
				Rect rect = component.rect;
				float width = ((Rect)(ref rect)).width;
				rect = component.rect;
				float num = width / ((Rect)(ref rect)).height;
				float x = MinSize.x;
				float x2 = MaxSize.x;
				float y = MinSize.y;
				float y2 = MaxSize.y;
				float num2 = y * num;
				float num3 = y2 * num;
				float num4 = Mathf.Max(x, num2);
				float num5 = Mathf.Min(x2, num3);
				minSize = new Vector2(num4, num4 / num);
				maxSize = new Vector2(num5, num5 / num);
			}
		}

		public static UIPanelInfo CreatePanelInfo(GameObject panelPrefab, UIPanelOptions options)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)panelPrefab.GetComponent<UIPanelInfo>() != (Object)null)
			{
				LoggerUtils.LogError("Panel prefab " + ((Object)panelPrefab).name + " already has a UIPanelInfo component.");
				return null;
			}
			UIPanelInfo uIPanelInfo = panelPrefab.AddComponent<UIPanelInfo>();
			uIPanelInfo.panelID = options.PanelID;
			uIPanelInfo.draggable = options.Draggable;
			uIPanelInfo.lockXAxis = options.LockXAxis;
			uIPanelInfo.lockYAxis = options.LockYAxis;
			uIPanelInfo.resizeMode = options.ResizeMode;
			uIPanelInfo.minSize = options.MinSize;
			uIPanelInfo.maxSize = options.MaxSize;
			return uIPanelInfo;
		}
	}
}
namespace UIManager.UI.Utils
{
	public class ColorPicker : MonoBehaviour
	{
		[SerializeField]
		private RawImage hueImage;

		[SerializeField]
		private RawImage saturationImage;

		[SerializeField]
		private RawImage valueImage;

		[SerializeField]
		private RawImage alphaImage;

		[SerializeField]
		private Image outputImage;

		[SerializeField]
		private Slider hueSlider;

		[SerializeField]
		private Slider saturationSlider;

		[SerializeField]
		private Slider valueSlider;

		[SerializeField]
		private Slider alphaSlider;

		[SerializeField]
		private TMP_InputField hexInputField;

		[SerializeField]
		private Color StartingColor = Color.white;

		public Action<Color> ColorChanged;

		private float CurrentHue;

		private float CurrentSaturation;

		private float CurrentValue;

		private float CurrentAlpha;

		private Texture2D hueTexture;

		private Texture2D saturationTexture;

		private Texture2D valueTexture;

		private Texture2D alphaTexture;

		public Color color
		{
			get
			{
				//IL_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
				Color result = Color.HSVToRGB(CurrentHue, CurrentSaturation, CurrentValue);
				result.a = CurrentAlpha;
				return result;
			}
			set
			{
				//IL_0000: 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)
				Color.RGBToHSV(value, ref CurrentHue, ref CurrentSaturation, ref CurrentValue);
				CurrentAlpha = value.a;
				UpdateColor();
				UpdateSaturationTexture();
				UpdateValueTexture();
				UpdateAlphaTexture();
				hueSlider.value = CurrentHue;
				saturationSlider.value = CurrentSaturation;
				valueSlider.value = CurrentValue;
				alphaSlider.value = CurrentAlpha;
			}
		}

		private void Awake()
		{
			hueSlider.value = CurrentHue;
			saturationSlider.value = CurrentSaturation;
			valueSlider.value = CurrentValue;
			alphaSlider.value = CurrentAlpha;
			CreateHueTexture();
			CreateSaturationTexture();
			CreateValueTexture();
			CreateAlphaTexture();
			((UnityEvent<float>)(object)hueSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float hue)
			{
				CurrentHue = hue;
				UpdateSaturationTexture();
				UpdateValueTexture();
				UpdateAlphaTexture();
				UpdateColor();
			});
			((UnityEvent<float>)(object)saturationSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float saturation)
			{
				CurrentSaturation = saturation;
				UpdateSaturationTexture();
				UpdateValueTexture();
				UpdateAlphaTexture();
				UpdateColor();
			});
			((UnityEvent<float>)(object)valueSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
			{
				CurrentValue = value;
				UpdateValueTexture();
				UpdateAlphaTexture();
				UpdateColor();
			});
			((UnityEvent<float>)(object)alphaSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float alpha)
			{
				CurrentAlpha = alpha;
				UpdateAlphaTexture();
				UpdateColor();
			});
			((UnityEvent<string>)(object)hexInputField.onValueChanged).AddListener((UnityAction<string>)delegate(string hex)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (!string.IsNullOrWhiteSpace(hex))
				{
					if (!hex.StartsWith("#"))
					{
						hex = "#" + hex;
					}
					Color val = default(Color);
					if (ColorUtility.TryParseHtmlString(hex, ref val))
					{
						color = val;
						hexInputField.SetTextWithoutNotify(hex);
					}
				}
			});
			UpdateColor();
		}

		private void CreateHueTexture()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			hueTexture = new Texture2D(16, 1);
			((Texture)hueTexture).wrapMode = (TextureWrapMode)1;
			((Object)hueTexture).name = "HueTexture";
			for (int i = 0; i < ((Texture)hueTexture).width; i++)
			{
				hueTexture.SetPixel(i, 0, Color.HSVToRGB((float)i / (float)((Texture)hueTexture).width, 1f, 1f));
			}
			hueTexture.Apply();
			hueImage.texture = (Texture)(object)hueTexture;
		}

		private void CreateSaturationTexture()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			saturationTexture = new Texture2D(16, 1);
			((Texture)saturationTexture).wrapMode = (TextureWrapMode)1;
			((Object)saturationTexture).name = "SaturationTexture";
			UpdateSaturationTexture();
			saturationImage.texture = (Texture)(object)saturationTexture;
		}

		private void CreateValueTexture()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			valueTexture = new Texture2D(16, 1);
			((Texture)valueTexture).wrapMode = (TextureWrapMode)1;
			((Object)valueTexture).name = "ValueTexture";
			UpdateValueTexture();
			valueImage.texture = (Texture)(object)valueTexture;
		}

		private void CreateAlphaTexture()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			alphaTexture = new Texture2D(16, 1);
			((Texture)alphaTexture).wrapMode = (TextureWrapMode)1;
			((Object)alphaTexture).name = "AlphaTexture";
			UpdateAlphaTexture();
			alphaImage.texture = (Texture)(object)alphaTexture;
		}

		public void UpdateSaturationTexture()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < ((Texture)saturationTexture).width; i++)
			{
				saturationTexture.SetPixel(i, 0, Color.HSVToRGB(CurrentHue, (float)i / (float)((Texture)saturationTexture).width, 1f));
			}
			saturationTexture.Apply();
		}

		public void UpdateValueTexture()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < ((Texture)valueTexture).width; i++)
			{
				valueTexture.SetPixel(i, 0, Color.HSVToRGB(CurrentHue, CurrentSaturation, (float)i / (float)((Texture)valueTexture).width));
			}
			valueTexture.Apply();
		}

		public void UpdateAlphaTexture()
		{
			//IL_0016: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < ((Texture)alphaTexture).width; i++)
			{
				Color val = Color.HSVToRGB(CurrentHue, CurrentSaturation, CurrentValue);
				val.a = (float)i / (float)((Texture)alphaTexture).width;
				alphaTexture.SetPixel(i, 0, val);
			}
			alphaTexture.Apply();
		}

		public void UpdateColor()
		{
			//IL_0012: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.HSVToRGB(CurrentHue, CurrentSaturation, CurrentValue);
			val.a = CurrentAlpha;
			hexInputField.SetTextWithoutNotify("#" + ColorUtility.ToHtmlStringRGBA(val));
			((Graphic)outputImage).color = val;
			ColorChanged?.Invoke(val);
		}
	}
	[RequireComponent(typeof(RectTransform))]
	[DisallowMultipleComponent]
	internal class DraggableWindow : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler
	{
		public RectTransform handler;

		private RectTransform panel;

		private Vector2 offset;

		private bool canDrag;

		private void Start()
		{
			panel = ((Component)this).GetComponent<RectTransform>();
			if ((Object)(object)handler == (Object)null)
			{
				handler = panel;
			}
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			canDrag = CanDrag(eventData);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(handler, eventData.position, eventData.pressEventCamera, ref offset);
		}

		private bool CanDrag(PointerEventData eventData)
		{
			//IL_0007: 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)
			if (RectTransformUtility.RectangleContainsScreenPoint(handler, eventData.position, eventData.pressEventCamera) && (int)eventData.button == 0)
			{
				return (Object)(object)eventData.pointerEnter == (Object)(object)((Component)handler).gameObject;
			}
			return false;
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0007: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0072: 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)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			if (RectTransformUtility.ScreenPointToLocalPointInRectangle(handler, eventData.position, eventData.pressEventCamera, ref val) && canDrag)
			{
				Vector2 val2 = val - offset;
				RectTransform obj = panel;
				obj.anchoredPosition += val2;
				Camera main = Camera.main;
				Transform transform = ((Component)((Component)this).GetComponentInParent<Canvas>()).transform;
				Rect rectInCanvasSpace = RectTranformUtils.GetRectInCanvasSpace(main, (RectTransform)(object)((transform is RectTransform) ? transform : null), panel);
				UISnappingController.ScreenSnappingInfo screenSnapping = UILayoutHandler.Instance.SnappingController.GetScreenSnapping(rectInCanvasSpace);
				((Transform)panel).localPosition = Vector2.op_Implicit(screenSnapping.Position);
			}
		}
	}
}
namespace UIManager.UI.Layouts
{
	internal class SetSizeParentOnContent : MonoBehaviour
	{
		public UILayoutPanel UILayoutPanel;

		private Vector2 lastSize;

		private void Awake()
		{
			//IL_0033: 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)
			//IL_0058: 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)
			UILayoutPanel = ((Component)this).GetComponentInParent<UILayoutPanel>();
			if ((Object)(object)UILayoutPanel == (Object)null)
			{
				LoggerUtils.LogError("SetSizeParentOnContent must be a child of a UILayoutPanel.");
				((Behaviour)this).enabled = false;
			}
			RectTransform component = ((Component)this).GetComponent<RectTransform>();
			if (component.anchorMin != component.anchorMax)
			{
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(0.5f, 0.5f);
				component.anchorMax = val;
				component.anchorMin = val;
			}
		}

		private void LateUpdate()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)UILayoutPanel == (Object)null) || !((Object)(object)UILayoutPanel.ResizableModule != (Object)null))
			{
				Transform transform = ((Component)this).transform;
				RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
				LayoutRebuilder.ForceRebuildLayoutImmediate(val);
				Rect rect = val.rect;
				Vector2 val2 = ((Rect)(ref rect)).size * Vector2.op_Implicit(((Transform)val).localScale);
				UILayoutPanel.ResizableModule.SetSizeBasedOnAnchor(new Vector2(val2.x + UILayoutHandler.Instance.UILayoutPanelPadding * 2f, val2.y + UILayoutHandler.Instance.UILayoutPanelPadding * 2f));
			}
		}
	}
	[RequireComponent(typeof(UILayoutPanel))]
	[DisallowMultipleComponent]
	public class UILayoutGizmo : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		[Header("Gizmo Objects")]
		public GameObject GizmoHolder;

		public GameObject ResizeGizmoHolder;

		public GameObject AnchorGizmoHolder;

		public GameObject ParentGizmoHolder;

		public Image[] OutlineGizmo;

		[Header("Gizmo Object Anchor")]
		public Image AnchorGizmoLeft;

		public Image AnchorGizmoRight;

		public Image AnchorGizmoTop;

		public Image AnchorGizmoBottom;

		[Header("Parent Object Anchor")]
		public Image ParentGizmoLeft;

		public Image ParentGizmoRight;

		public Image ParentGizmoTop;

		public Image ParentGizmoBottom;

		[Header("Gizmo Object Resize")]
		public UILayoutResizeControl[] ResizeGizmos;

		[Header("Color")]
		public Color OutlineUnfocusColor = new Color(0.9f, 0.9f, 0.9f);

		public Color OutlineFocusColor = new Color(0f, 0.4350232f, 97f / 106f);

		private UILayoutPanel handler;

		private void Start()
		{
			handler = ((Component)this).GetComponent<UILayoutPanel>();
			HideGizmo();
			UIPanelInfo info = handler.Info;
			info.OnDisplayModeChnaged = (Action<DisplayMode>)Delegate.Combine(info.OnDisplayModeChnaged, (Action<DisplayMode>)delegate(DisplayMode display)
			{
				if (display != DisplayMode.Layout)
				{
					HideGizmo();
				}
			});
			UIPanelInfo info2 = handler.Info;
			info2.OnFocus = (Action)Delegate.Combine(info2.OnFocus, (Action)delegate
			{
				ShowFocus();
			});
			UIPanelInfo info3 = handler.Info;
			info3.OnUnfocus = (Action)Delegate.Combine(info3.OnUnfocus, (Action)delegate
			{
				HideGizmo();
			});
		}

		private void Update()
		{
			((Behaviour)AnchorGizmoLeft).enabled = false;
			((Behaviour)AnchorGizmoRight).enabled = false;
			((Behaviour)AnchorGizmoTop).enabled = false;
			((Behaviour)AnchorGizmoBottom).enabled = false;
			((Behaviour)ParentGizmoLeft).enabled = false;
			((Behaviour)ParentGizmoRight).enabled = false;
			((Behaviour)ParentGizmoTop).enabled = false;
			((Behaviour)ParentGizmoBottom).enabled = false;
			if (handler.UIAnchorPoint.HasFlag(AnchorPoint.Left))
			{
				((Behaviour)AnchorGizmoLeft).enabled = true;
			}
			if (handler.UIAnchorPoint.HasFlag(AnchorPoint.Right))
			{
				((Behaviour)AnchorGizmoRight).enabled = true;
			}
			if (handler.UIAnchorPoint.HasFlag(AnchorPoint.Top))
			{
				((Behaviour)AnchorGizmoTop).enabled = true;
			}
			if (handler.UIAnchorPoint.HasFlag(AnchorPoint.Bottom))
			{
				((Behaviour)AnchorGizmoBottom).enabled = true;
			}
			if (handler.ParentPanel != null)
			{
				if (DirectionUtils.IsLeftEdge(handler.ParentPanel.AnchorDirection))
				{
					((Behaviour)ParentGizmoLeft).enabled = true;
				}
				if (DirectionUtils.IsRightEdge(handler.ParentPanel.AnchorDirection))
				{
					((Behaviour)ParentGizmoRight).enabled = true;
				}
				if (DirectionUtils.IsTopEdge(handler.ParentPanel.AnchorDirection))
				{
					((Behaviour)ParentGizmoTop).enabled = true;
				}
				if (DirectionUtils.IsBottomEdge(handler.ParentPanel.AnchorDirection))
				{
					((Behaviour)ParentGizmoBottom).enabled = true;
				}
			}
		}

		public void HideGizmo()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			Image[] outlineGizmo = OutlineGizmo;
			for (int i = 0; i < outlineGizmo.Length; i++)
			{
				((Graphic)outlineGizmo[i]).color = OutlineUnfocusColor;
			}
			ResizeGizmoHolder.SetActive(false);
			AnchorGizmoHolder.SetActive(false);
			ParentGizmoHolder.SetActive(false);
			GizmoHolder.SetActive(false);
		}

		public void ShowUnfocus()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			GizmoHolder.SetActive(true);
			ResizeGizmoHolder.SetActive(false);
			AnchorGizmoHolder.SetActive(false);
			ParentGizmoHolder.SetActive(false);
			Image[] outlineGizmo = OutlineGizmo;
			for (int i = 0; i < outlineGizmo.Length; i++)
			{
				((Graphic)outlineGizmo[i]).color = OutlineUnfocusColor;
			}
		}

		public void ShowFocus()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (handler.Info.DisplayMode != DisplayMode.Layout)
			{
				return;
			}
			GizmoHolder.SetActive(true);
			AnchorGizmoHolder.SetActive(true);
			ParentGizmoHolder.SetActive(true);
			if (handler.Info.ResizeMode != 0 && handler.Info.ResizeMode != ResizeMode.ResizeWithContent)
			{
				ResizeGizmoHolder.SetActive(true);
			}
			UILayoutResizeControl[] resizeGizmos = ResizeGizmos;
			foreach (UILayoutResizeControl uILayoutResizeControl in resizeGizmos)
			{
				if (handler.Info.ResizeMode == ResizeMode.AspectRatio && !DirectionUtils.IsCorner(uILayoutResizeControl.direction))
				{
					((Component)uILayoutResizeControl).gameObject.SetActive(false);
				}
			}
			Image[] outlineGizmo = OutlineGizmo;
			for (int i = 0; i < outlineGizmo.Length; i++)
			{
				((Graphic)outlineGizmo[i]).color = OutlineFocusColor;
			}
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			if (handler.Info.DisplayMode == DisplayMode.Layout && !handler.Info.Focus)
			{
				ShowUnfocus();
			}
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			if (handler.Info.DisplayMode == DisplayMode.Layout && !handler.Info.Focus)
			{
				HideGizmo();
			}
		}
	}
	public class ParentPanelInfo
	{
		public UILayoutPanel LayoutPanel;

		public Direction AnchorDirection;

		public ParentPanelInfo(UILayoutPanel panelInfo, Direction anchorDirection)
		{
			LayoutPanel = panelInfo;
			AnchorDirection = anchorDirection;
			LoggerUtils.LogInfo($"Set parent panel of {LayoutPanel.Info.PanelID} to {panelInfo.Info.PanelID} with anchor direction {anchorDirection}");
		}
	}
	[RequireComponent(typeof(RectTransform))]
	[DisallowMultipleComponent]
	public class UILayoutPanel : MonoBehaviour
	{
		public struct UIDefaultValues
		{
			public Vector2 AnchoredPosition;

			public Vector2 SizeDelta;

			public AnchorPoint DefaultAnchorPoint;

			public UIDefaultValues(Vector2 pos, Vector2 size, AnchorPoint anchor)
			{
				//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_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)
				AnchoredPosition = pos;
				SizeDelta = size;
				DefaultAnchorPoint = anchor;
			}
		}

		public RectTransform MainContent;

		private List<ParentPanelInfo> childPanels = new List<ParentPanelInfo>();

		private bool initialized;

		public UILayoutResizable ResizableModule { get; private set; }

		public AnchorPoint UIAnchorPoint { get; private set; }

		public RectTransform RectTransform { get; private set; }

		public UIDefaultValues DefaultValues { get; private set; }

		public UIPanelInfo Info { get; private set; }

		public float XToYAspectRatio
		{
			get
			{
				//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_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)
				Rect rect = MainContent.rect;
				float width = ((Rect)(ref rect)).width;
				rect = MainContent.rect;
				return width / ((Rect)(ref rect)).height;
			}
		}

		public float YToXAspectRatio
		{
			get
			{
				//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_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)
				Rect rect = MainContent.rect;
				float height = ((Rect)(ref rect)).height;
				rect = MainContent.rect;
				return height / ((Rect)(ref rect)).width;
			}
		}

		public ParentPanelInfo ParentPanel { get; private set; }

		public IReadOnlyList<ParentPanelInfo> ChildPanels => childPanels.AsReadOnly();

		private void Awake()
		{
			RectTransform = ((Component)this).GetComponent<RectTransform>();
			ResizableModule = ((Component)this).GetComponent<UILayoutResizable>();
		}

		internal void Initialize(UIPanelInfo panelInfo)
		{
			//IL_0050: 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)
			if (!initialized)
			{
				Info = panelInfo;
				UIPanelInfo info = Info;
				info.OnDisplayModeChnaged = (Action<DisplayMode>)Delegate.Combine(info.OnDisplayModeChnaged, (Action<DisplayMode>)delegate(DisplayMode displayMode)
				{
					((Component)this).gameObject.SetActive(displayMode != DisplayMode.Hidden);
				});
				SetAnchorPoint(RectTranformUtils.GetAnchorPoint(RectTransform));
				DefaultValues = new UIDefaultValues(RectTransform.anchoredPosition, RectTransform.sizeDelta, UIAnchorPoint);
				if (Info.ResizeMode == ResizeMode.ResizeWithContent)
				{
					((Component)MainContent).gameObject.AddComponent<SetSizeParentOnContent>();
				}
				initialized = true;
			}
		}

		public void SetParentPanel(ParentPanelInfo parentPanel)
		{
			if (ParentPanel != null)
			{
				ParentPanel.LayoutPanel.childPanels.RemoveAll((ParentPanelInfo p) => (Object)(object)p.LayoutPanel == (Object)(object)this);
			}
			if (parentPanel == null)
			{
				ParentPanel = null;
				return;
			}
			UILayoutPanel layoutPanel = parentPanel.LayoutPanel;
			if (!((Object)(object)layoutPanel == (Object)(object)this) && !IsDescendantOf(layoutPanel) && !layoutPanel.childPanels.Exists((ParentPanelInfo p) => (Object)(object)p.LayoutPanel == (Object)(object)this))
			{
				layoutPanel.childPanels.Add(new ParentPanelInfo(this, parentPanel.AnchorDirection));
				ParentPanel = parentPanel;
			}
		}

		public bool IsDescendantOf(UILayoutPanel potentialParent)
		{
			UILayoutPanel uILayoutPanel = potentialParent;
			while ((Object)(object)uILayoutPanel != (Object)null)
			{
				if ((Object)(object)uILayoutPanel == (Object)(object)this)
				{
					return true;
				}
				uILayoutPanel = uILayoutPanel.ParentPanel?.LayoutPanel;
			}
			return false;
		}

		public void SetAnchorPoint(AnchorPoint anchorPoint, bool preserveWorldPosition = true)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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)
			//IL_0039: 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_004c: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			var (anchorMin, anchorMax) = RectTranformUtils.GetAnchorValue(anchorPoint);
			_ = RectTransform.anchoredPosition;
			Vector2 sizeDelta = RectTransform.sizeDelta;
			if (preserveWorldPosition)
			{
				Vector3 position = ((Transform)RectTransform).position;
				RectTransform.anchorMin = anchorMin;
				RectTransform.anchorMax = anchorMax;
				((Transform)RectTransform).position = position;
			}
			else
			{
				RectTransform.anchorMin = anchorMin;
				RectTransform.anchorMax = anchorMax;
			}
			RectTransform.sizeDelta = sizeDelta;
			UIAnchorPoint = anchorPoint;
			LoggerUtils.LogInfo($"Set anchor point of panel {Info.PanelID} to {anchorPoint}");
		}

		public void ResetToDefault()
		{
			//IL_001e: 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)
			SetAnchorPoint(DefaultValues.DefaultAnchorPoint, preserveWorldPosition: false);
			RectTransform.anchoredPosition = DefaultValues.AnchoredPosition;
			RectTransform.sizeDelta = DefaultValues.SizeDelta;
			if (ParentPanel != null)
			{
				ParentPanel.LayoutPanel.childPanels.Remove(ParentPanel);
				ParentPanel = null;
			}
			SaveUILayout();
		}

		public void SaveUILayout()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(Info.PanelID))
			{
				throw new ArgumentException("UIPanelInfo.PanelID cannot be null or whitespace.", "PanelID");
			}
			PlayerPrefs.SetFloat("ui_layout." + Info.PanelID + ".width", RectTransform.sizeDelta.x);
			PlayerPrefs.SetFloat("ui_layout." + Info.PanelID + ".height", RectTransform.sizeDelta.y);
			PlayerPrefs.SetFloat("ui_layout." + Info.PanelID + ".pos_x", RectTransform.anchoredPosition.x);
			PlayerPrefs.SetFloat("ui_layout." + Info.PanelID + ".pos_y", RectTransform.anchoredPosition.y);
			PlayerPrefs.SetInt("ui_layout." + Info.PanelID + ".anchor", (int)RectTranformUtils.GetAnchorPoint(RectTransform));
			if (ParentPanel != null)
			{
				PlayerPrefs.SetString("ui_layout." + Info.PanelID + ".parent_id", ParentPanel.LayoutPanel.Info.PanelID);
				PlayerPrefs.SetInt("ui_layout." + Info.PanelID + ".parent_anchor_dir", (int)ParentPanel.AnchorDirection);
			}
			else
			{
				PlayerPrefs.DeleteKey("ui_layout." + Info.PanelID + ".parent_id");
				PlayerPrefs.DeleteKey("ui_layout." + Info.PanelID + ".parent_anchor_dir");
			}
			PlayerPrefs.Save();
			LoggerUtils.LogInfo("Saved UI layout for panel " + Info.PanelID);
		}

		public void LoadUILayout()
		{
			//IL_0075: 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_00d5: 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)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(Info.PanelID))
			{
				throw new ArgumentException("UIPanelInfo.PanelID cannot be null or whitespace.", "PanelID");
			}
			AnchorPoint @int = (AnchorPoint)PlayerPrefs.GetInt("ui_layout." + Info.PanelID + ".anchor", (int)RectTranformUtils.GetAnchorPoint(RectTransform));
			SetAnchorPoint(@int, preserveWorldPosition: false);
			float @float = PlayerPrefs.GetFloat("ui_layout." + Info.PanelID + ".pos_x", RectTransform.anchoredPosition.x);
			float float2 = PlayerPrefs.GetFloat("ui_layout." + Info.PanelID + ".pos_y", RectTransform.anchoredPosition.y);
			float float3 = PlayerPrefs.GetFloat("ui_layout." + Info.PanelID + ".width", RectTransform.sizeDelta.x);
			float float4 = PlayerPrefs.GetFloat("ui_layout." + Info.PanelID + ".height", RectTransform.sizeDelta.y);
			string @string = PlayerPrefs.GetString("ui_layout." + Info.PanelID + ".parent_id", (string)null);
			if (!string.IsNullOrWhiteSpace(@string))
			{
				UILayoutPanel layoutPanel = UIRegistry.Instance.GetLayoutPanel(@string);
				if ((Object)(object)layoutPanel != (Object)null)
				{
					Direction int2 = (Direction)PlayerPrefs.GetInt("ui_layout." + Info.PanelID + ".parent_anchor_dir");
					SetParentPanel(new ParentPanelInfo(layoutPanel, int2));
				}
			}
			RectTransform.anchoredPosition = new Vector2(@float, float2);
			RectTransform.sizeDelta = new Vector2(float3, float4);
			LoggerUtils.LogInfo("Loaded UI layout for panel " + Info.PanelID);
		}
	}
	public class UILayoutResizable : MonoBehaviour
	{
		private UILayoutPanel handler;

		private RectTransform rect;

		private void Start()
		{
			rect = ((Component)this).GetComponent<RectTransform>();
			handler = ((Component)this).GetComponent<UILayoutPanel>();
		}

		public void SetSizeBasedOnAnchor(Vector2 size)
		{
			//IL_0000: 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_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_0013: Unknown result type (might be due to invalid IL or missing references)
			Vector2 delta = size - rect.sizeDelta;
			ResizeBasedOnAnchor(delta);
		}

		public void ResizeBasedOnAnchor(Vector2 delta)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0043: 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)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			Vector2 zero = Vector2.zero;
			Vector2 val = (rect.anchorMin + rect.anchorMax) * 0.5f;
			zero.x = ((val.x > 0.5f) ? (0f - delta.x) : delta.x);
			zero.y = ((val.y > 0.5f) ? (0f - delta.y) : delta.y);
			Resize(zero);
		}

		public void SetSize(Vector2 size)
		{
			//IL_0000: 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_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_0013: Unknown result type (might be due to invalid IL or missing references)
			Vector2 delta = size - rect.sizeDelta;
			Resize(delta);
		}

		public void Resize(Vector2 delta)
		{
			//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)
			//IL_0055: 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_0061: 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_006e: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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)
			//IL_00ff: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			if (handler.Info.LockXAxis)
			{
				delta.x = 0f;
			}
			if (handler.Info.LockYAxis)
			{
				delta.y = 0f;
			}
			Transform parent = ((Transform)rect).parent;
			Rect val = ((RectTransform)((parent is RectTransform) ? parent : null)).rect;
			Vector2 size = ((Rect)(ref val)).size;
			new Vector2(delta.x / size.x, delta.y / size.y);
			float num = rect.sizeDelta.x + delta.x;
			float num2 = rect.sizeDelta.y + delta.y;
			float num3 = num - rect.sizeDelta.x;
			float num4 = num2 - rect.sizeDelta.y;
			rect.sizeDelta = new Vector2(num, num2);
			RectTransform obj = rect;
			obj.anchoredPosition += new Vector2(num3 * 0.5f, num4 * 0.5f);
			List<UILayoutPanel> list = new List<UILayoutPanel>();
			foreach (ParentPanelInfo childPanel in handler.ChildPanels)
			{
				if (!list.Contains(childPanel.LayoutPanel))
				{
					RectTransform rectTransform = childPanel.LayoutPanel.RectTransform;
					Vector2 anchoredPosition = rectTransform.anchoredPosition;
					list.Add(childPanel.LayoutPanel);
					if (DirectionUtils.IsLeftEdge(childPanel.AnchorDirection))
					{
						anchoredPosition.x += num3;
					}
					else if (DirectionUtils.IsRightEdge(childPanel.AnchorDirection))
					{
						anchoredPosition.x -= num3;
					}
					if (DirectionUtils.IsBottomEdge(childPanel.AnchorDirection))
					{
						anchoredPosition.y += num4;
					}
					else if (DirectionUtils.IsTopEdge(childPanel.AnchorDirection))
					{
						anchoredPosition.y -= num4;
					}
					rectTransform.anchoredPosition = anchoredPosition;
				}
			}
		}
	}
}
namespace UIManager.UI.Layouts.Controls
{
	[RequireComponent(typeof(UILayoutPanel))]
	[DisallowMultipleComponent]
	public class UILayoutDraggingControl : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
	{
		private UILayoutPanel handler;

		private RectTransform rect;

		private Vector2 offset;

		private bool canDrag;

		private void Start()
		{
			handler = ((Component)this).GetComponent<UILayoutPanel>();
			rect = handler.RectTransform;
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			canDrag = CanDrag(eventData);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, eventData.position, eventData.pressEventCamera, ref offset);
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0007: 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_002b: 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_008d: 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)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, eventData.position, eventData.pressEventCamera, ref val) || !canDrag)
			{
				return;
			}
			if (val != offset)
			{
				foreach (ParentPanelInfo childPanel in handler.ChildPanels)
				{
					childPanel.LayoutPanel.SetParentPanel(null);
				}
			}
			Transform parent = ((Transform)rect).parent;
			Rect val2 = ((RectTransform)((parent is RectTransform) ? parent : null)).rect;
			Vector2 size = ((Rect)(ref val2)).size;
			Vector2 val3 = val - offset;
			if (handler.Info.LockXAxis)
			{
				val3.x = 0f;
			}
			if (handler.Info.LockYAxis)
			{
				val3.y = 0f;
			}
			if (rect.anchorMin == rect.anchorMax)
			{
				RectTransform obj = rect;
				obj.anchoredPosition += val3;
			}
			else
			{
				Vector2 val4 = default(Vector2);
				((Vector2)(ref val4))..ctor(val3.x / size.x, val3.y / size.y);
				RectTransform obj2 = rect;
				obj2.anchorMin += val4;
				RectTransform obj3 = rect;
				obj3.anchorMax += val4;
			}
			RectTransform uIHolder = UILayoutHandler.Instance.UIHolder;
			RectTransform mainContent = handler.MainContent;
			Rect rectInCanvasSpace = RectTranformUtils.GetRectInCanvasSpace(Camera.main, uIHolder, mainContent);
			UISnappingController.PanelSnappingInfo snapping = UILayoutHandler.Instance.SnappingController.GetSnapping(handler, rectInCanvasSpace);
			((Transform)rect).localPosition = Vector2.op_Implicit(snapping.Position);
			handler.SetAnchorPoint(snapping.Anchor);
			handler.SetParentPanel(snapping.ParentPanel);
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			if (handler.Info.DisplayMode == DisplayMode.Layout)
			{
				handler.SaveUILayout();
			}
		}

		private bool CanDrag(PointerEventData eventData)
		{
			//IL_0007: 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)
			if (RectTransformUtility.RectangleContainsScreenPoint(rect, eventData.position, eventData.pressEventCamera) && (int)eventData.button == 0 && handler.Info.Draggable)
			{
				return handler.Info.DisplayMode == DisplayMode.Layout;
			}
			return false;
		}
	}
	[DisallowMultipleComponent]
	public class UILayoutResizeControl : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
	{
		private const float DRAG_THRESHOLD = 0.5f;

		[Header("Color")]
		public Color ActiveColor = new Color(1f, 1f, 1f, 1f);

		public Color InActiveColor = new Color(0.6f, 0.6f, 0.6f, 1f);

		public Image TintImage;

		[Header("Other")]
		public Direction direction;

		private UILayoutPanel handler;

		private UILayoutResizable resizable;

		private RectTransform handlerRect;

		private RectTransform mainContentRect;

		private RectTransform rect;

		private Vector2 startMouseLocal;

		private Vector2 startBottomLeft;

		private Vector2 startTopRight;

		private float startAspect;

		private bool canResize;

		private bool enabledForAnchor;

		private Vector2 startHandlerBottomLeft;

		private Vector2 startHandlerTopRight;

		private Vector2 anchorReference;

		private void Start()
		{
			handler = ((Component)this).GetComponentInParent<UILayoutPanel>();
			resizable = ((Component)handler).GetComponent<UILayoutResizable>();
			handlerRect = handler.RectTransform;
			mainContentRect = handler.MainContent;
			rect = ((Component)this).GetComponent<RectTransform>();
		}

		private void Update()
		{
			//IL_002f: 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)
			enabledForAnchor = IsHandleValidForAnchor(direction, handlerRect);
			((Graphic)TintImage).color = (enabledForAnchor ? ActiveColor : InActiveColor);
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			canResize = CanResize(eventData) && enabledForAnchor;
			if (canResize)
			{
				Transform parent = ((Transform)handlerRect).parent;
				RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null);
				if (!((Object)(object)val == (Object)null))
				{
					RectTransformUtility.ScreenPointToLocalPointInRectangle(val, eventData.position, eventData.pressEventCamera, ref startMouseLocal);
					Vector3[] array = (Vector3[])(object)new Vector3[4];
					handlerRect.GetWorldCorners(array);
					startHandlerBottomLeft = Vector2.op_Implicit(((Transform)val).InverseTransformPoint(array[0]));
					startHandlerTopRight = Vector2.op_Implicit(((Transform)val).InverseTransformPoint(array[2]));
					startAspect = handler.XToYAspectRatio;
					Rect val2 = val.rect;
					Vector2 min = ((Rect)(ref val2)).min;
					val2 = val.rect;
					anchorReference = min + Vector2.Scale(((Rect)(ref val2)).size, handlerRect.anchorMin);
				}
			}
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_009a: 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_00bd: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: 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_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: 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_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: 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_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: 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_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			if (!canResize || !enabledForAnchor)
			{
				return;
			}
			Transform parent = ((Transform)handlerRect).parent;
			RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Vector2 val2 = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(val, eventData.position, eventData.pressEventCamera, ref val2);
			Vector2 val3 = val2 - startMouseLocal;
			if (IsResizingFromAspectRatio())
			{
				float num = startAspect;
				switch (direction)
				{
				case Direction.TopLeft:
					val3.y = (0f - val3.x) / num;
					val3.x = (0f - val3.y) * num;
					break;
				case Direction.TopRight:
					val3.y = val3.x / num;
					val3.x = val3.y * num;
					break;
				case Direction.BottomLeft:
					val3.y = val3.x / num;
					val3.x = val3.y * num;
					break;
				case Direction.BottomRight:
					val3.y = (0f - val3.x) / num;
					val3.x = (0f - val3.y) * num;
					break;
				}
			}
			if (!(((Vector2)(ref val3)).sqrMagnitude < 0.25f))
			{
				float x = startHandlerBottomLeft.x;
				float y = startHandlerBottomLeft.y;
				float x2 = startHandlerTopRight.x;
				float y2 = startHandlerTopRight.y;
				float num2 = x + mainContentRect.offsetMin.x;
				float num3 = y + mainContentRect.offsetMin.y;
				float num4 = x2 + mainContentRect.offsetMax.x;
				float num5 = y2 + mainContentRect.offsetMax.y;
				switch (direction)
				{
				case Direction.Left:
					num2 += val3.x;
					break;
				case Direction.Right:
					num4 += val3.x;
					break;
				case Direction.Top:
					num5 += val3.y;
					break;
				case Direction.Bottom:
					num3 += val3.y;
					break;
				case Direction.TopLeft:
					num2 += val3.x;
					num5 += val3.y;
					break;
				case Direction.TopRight:
					num4 += val3.x;
					num5 += val3.y;
					break;
				case Direction.BottomLeft:
					num2 += val3.x;
					num3 += val3.y;
					break;
				case Direction.BottomRight:
					num4 += val3.x;
					num3 += val3.y;
					break;
				}
				float num6 = num4 - num2;
				float num7 = num5 - num3;
				Rect localRect = default(Rect);
				((Rect)(ref localRect))..ctor(num2, num3, num6, num7);
				Rect val4 = RectTranformUtils.LocalRectToCanvasSpace(val, localRect, UILayoutHandler.Instance.UIHolder);
				UISnappingController.PanelSnappingInfo snappingWithOffset = UILayoutHandler.Instance.SnappingController.GetSnappingWithOffset(handler, val4);
				num6 += snappingWithOffset.Position.x * (float)((!DirectionUtils.IsLeftEdge(direction)) ? 1 : (-1));
				num7 += snappingWithOffset.Position.y * (float)((!DirectionUtils.IsBottomEdge(direction)) ? 1 : (-1));
				if (IsResizingFromAspectRatio())
				{
					float num8 = startAspect;
					float x3 = handler.Info.MinSize.x;
					float x4 = handler.Info.MaxSize.x;
					float y3 = handler.Info.MinSize.y;
					float y4 = handler.Info.MaxSize.y;
					float num9 = y3 * num8;
					float num10 = y4 * num8;
					float num11 = Mathf.Max(x3, num9);
					float num12 = Mathf.Min(x4, num10);
					num6 = Mathf.Clamp(num6, num11, num12);
					num7 = num6 / num8;
				}
				else
				{
					num6 = Mathf.Clamp(num6, handler.Info.MinSize.x, handler.Info.MaxSize.x);
					num7 = Mathf.Clamp(num7, handler.Info.MinSize.y, handler.Info.MaxSize.y);
				}
				if (DirectionUtils.IsLeftEdge(direction))
				{
					num2 = num4 - num6;
				}
				else if (DirectionUtils.IsRightEdge(direction))
				{
					num4 = num2 + num6;
				}